From 45d566a50d42a3519c742795720ef6171a21bf64 Mon Sep 17 00:00:00 2001 From: InsanityAutomation Date: Mon, 8 Apr 2019 11:11:39 -0400 Subject: [PATCH] Bump to head with BLTouch V3 --- Marlin/Configuration.h | 109 +- Marlin/Configuration_adv.h | 134 +- Marlin/src/HAL/HAL_AVR/HAL.h | 25 +- Marlin/src/HAL/HAL_AVR/SanityCheck.h | 11 +- Marlin/src/HAL/HAL_AVR/fast_pwm.cpp | 250 ++ Marlin/src/HAL/HAL_AVR/fastio_1280.h | 9 +- Marlin/src/HAL/HAL_AVR/fastio_AVR.cpp | 238 ++ Marlin/src/HAL/HAL_AVR/fastio_AVR.h | 119 +- .../HAL/HAL_AVR/persistent_store_eeprom.cpp | 2 +- .../src/HAL/HAL_AVR/pinsDebug_Teensyduino.h | 4 +- Marlin/src/HAL/HAL_AVR/servo_AVR.cpp | 4 +- .../src/HAL/HAL_DUE/EepromEmulation_Due.cpp | 4 +- Marlin/src/HAL/HAL_DUE/HAL_timers_Due.cpp | 4 +- Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h | 8 +- Marlin/src/HAL/HAL_DUE/SanityCheck.h | 4 + Marlin/src/HAL/HAL_DUE/Servo_Due.cpp | 4 +- Marlin/src/HAL/HAL_DUE/Tone.cpp | 6 +- Marlin/src/HAL/HAL_DUE/fastio_Due.h | 33 +- .../HAL/HAL_DUE/persistent_store_eeprom.cpp | 4 +- Marlin/src/HAL/HAL_DUE/pinsDebug.h | 2 +- .../HAL/HAL_ESP32/FlushableHardwareSerial.cpp | 33 + .../HAL/HAL_ESP32/FlushableHardwareSerial.h | 36 + Marlin/src/HAL/HAL_ESP32/HAL.cpp | 26 +- Marlin/src/HAL/HAL_ESP32/HAL.h | 15 +- Marlin/src/HAL/HAL_ESP32/HAL_spi_ESP32.cpp | 26 +- Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.h | 4 +- Marlin/src/HAL/HAL_ESP32/SanityCheck.h | 4 + Marlin/src/HAL/HAL_ESP32/WebSocketSerial.cpp | 234 ++ Marlin/src/HAL/HAL_ESP32/WebSocketSerial.h | 99 + Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h | 32 +- Marlin/src/HAL/HAL_ESP32/ota.cpp | 13 +- .../HAL/HAL_ESP32/persistent_store_spiffs.cpp | 93 + Marlin/src/HAL/HAL_ESP32/spiffs.cpp | 44 + Marlin/src/HAL/HAL_ESP32/spiffs.h | 26 + Marlin/src/HAL/HAL_ESP32/web.cpp | 42 + Marlin/src/HAL/HAL_ESP32/web.h | 21 + Marlin/src/HAL/HAL_ESP32/wifi.cpp | 55 + Marlin/src/HAL/HAL_ESP32/wifi.h | 27 + Marlin/src/HAL/HAL_LINUX/HAL_timers.cpp | 4 +- Marlin/src/HAL/HAL_LINUX/HAL_timers.h | 6 +- Marlin/src/HAL/HAL_LINUX/SanityCheck.h | 4 + Marlin/src/HAL/HAL_LINUX/fastio.h | 74 +- .../src/HAL/HAL_LINUX/hardware/LinearAxis.cpp | 2 +- Marlin/src/HAL/HAL_LINUX/spi_pins.h | 2 +- Marlin/src/HAL/HAL_LPC1768/HAL.cpp | 10 +- Marlin/src/HAL/HAL_LPC1768/HAL.h | 16 + Marlin/src/HAL/HAL_LPC1768/HAL_timers.h | 4 +- Marlin/src/HAL/HAL_LPC1768/fast_pwm.cpp | 40 + Marlin/src/HAL/HAL_LPC1768/fastio.h | 73 +- Marlin/src/HAL/HAL_LPC1768/main.cpp | 2 +- .../HAL_LPC1768/persistent_store_flash.cpp | 3 +- Marlin/src/HAL/HAL_LPC1768/pinsDebug.h | 8 +- .../u8g/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp | 2 - Marlin/src/HAL/HAL_STM32/HAL.cpp | 4 +- Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.h | 4 +- Marlin/src/HAL/HAL_STM32/SanityCheck.h | 4 + Marlin/src/HAL/HAL_STM32/fastio_STM32.h | 19 +- .../HAL/HAL_STM32/persistent_store_impl.cpp | 14 +- Marlin/src/HAL/HAL_STM32F1/HAL.cpp | 36 +- Marlin/src/HAL/HAL_STM32F1/HAL.h | 61 +- .../src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.cpp | 18 +- .../src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.h | 5 +- Marlin/src/HAL/HAL_STM32F1/SanityCheck.h | 4 + Marlin/src/HAL/HAL_STM32F1/binary.h | 1 - Marlin/src/HAL/HAL_STM32F1/fastio_Stm32f1.h | 20 +- .../HAL_STM32F1/persistent_store_flash.cpp | 9 +- .../HAL_STM32F1/persistent_store_sdcard.cpp | 2 +- .../HAL_STM32F1/u8g_com_stm32duino_fsmc.cpp | 117 +- Marlin/src/HAL/HAL_STM32F4/EmulatedEeprom.cpp | 4 +- .../src/HAL/HAL_STM32F4/HAL_timers_STM32F4.h | 8 +- Marlin/src/HAL/HAL_STM32F4/SanityCheck.h | 4 + Marlin/src/HAL/HAL_STM32F4/fastio_STM32F4.h | 15 +- .../src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h | 4 +- Marlin/src/HAL/HAL_STM32F7/SanityCheck.h | 4 + Marlin/src/HAL/HAL_STM32F7/TMC2660.cpp | 20 +- Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h | 15 +- .../HAL/HAL_TEENSY31_32/HAL_timers_Teensy.h | 4 +- Marlin/src/HAL/HAL_TEENSY31_32/SanityCheck.h | 4 + .../src/HAL/HAL_TEENSY31_32/fastio_Teensy.h | 18 +- Marlin/src/HAL/HAL_TEENSY35_36/HAL.h | 8 +- .../HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h | 4 +- Marlin/src/HAL/HAL_TEENSY35_36/SanityCheck.h | 4 + .../src/HAL/HAL_TEENSY35_36/fastio_Teensy.h | 18 +- Marlin/src/HAL/shared/HAL_spi_L6470.cpp | 4 +- .../src/HAL/shared/persistent_store_api.cpp | 2 +- Marlin/src/Marlin.cpp | 70 +- Marlin/src/Marlin.h | 8 +- .../WASP/PowerWASP/Configuration_adv.h | 2262 ---------------- Marlin/src/core/boards.h | 3 + Marlin/src/core/debug_out.h | 91 + Marlin/src/core/drivers.h | 2 +- Marlin/src/core/language.h | 2 + Marlin/src/core/macros.h | 66 +- Marlin/src/core/minmax.h | 28 +- Marlin/src/core/serial.cpp | 36 +- Marlin/src/core/serial.h | 115 +- Marlin/src/core/utility.cpp | 34 +- Marlin/src/core/utility.h | 19 +- Marlin/src/feature/I2CPositionEncoder.cpp | 77 +- Marlin/src/feature/I2CPositionEncoder.h | 21 +- Marlin/src/feature/babystep.cpp | 135 + Marlin/src/feature/babystep.h | 63 + Marlin/src/feature/bedlevel/abl/abl.cpp | 56 +- Marlin/src/feature/bedlevel/abl/abl.h | 4 +- Marlin/src/feature/bedlevel/bedlevel.cpp | 21 +- Marlin/src/feature/bedlevel/bedlevel.h | 63 +- .../bedlevel/mbl/mesh_bed_leveling.cpp | 5 + .../feature/bedlevel/mbl/mesh_bed_leveling.h | 5 +- Marlin/src/feature/bedlevel/ubl/ubl.cpp | 61 +- Marlin/src/feature/bedlevel/ubl/ubl.h | 81 +- Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp | 285 +- .../src/feature/bedlevel/ubl/ubl_motion.cpp | 25 - Marlin/src/feature/bltouch.cpp | 96 + Marlin/src/feature/bltouch.h | 62 + Marlin/src/feature/caselight.cpp | 2 +- Marlin/src/feature/controllerfan.cpp | 2 +- Marlin/src/feature/dac/stepper_dac.cpp | 15 +- .../src/feature/digipot/digipot_mcp4018.cpp | 2 +- Marlin/src/feature/emergency_parser.h | 3 +- Marlin/src/feature/fwretract.cpp | 26 +- Marlin/src/feature/fwretract.h | 6 +- Marlin/src/feature/host_actions.cpp | 6 +- Marlin/src/feature/leds/leds.cpp | 30 +- Marlin/src/feature/leds/leds.h | 4 +- Marlin/src/feature/mixing.cpp | 12 +- Marlin/src/feature/mixing.h | 21 +- Marlin/src/feature/pause.cpp | 66 +- Marlin/src/feature/pause.h | 50 +- Marlin/src/feature/power.cpp | 4 +- Marlin/src/feature/power_loss_recovery.cpp | 102 +- Marlin/src/feature/power_loss_recovery.h | 11 +- Marlin/src/feature/prusa_MMU2/mmu2.cpp | 122 +- Marlin/src/feature/runout.h | 27 +- Marlin/src/feature/solenoid.cpp | 4 +- Marlin/src/feature/tmc_util.cpp | 18 +- Marlin/src/feature/tmc_util.h | 2 +- Marlin/src/feature/twibus.cpp | 4 +- Marlin/src/gcode/bedlevel/G26.cpp | 144 +- Marlin/src/gcode/bedlevel/M420.cpp | 9 +- Marlin/src/gcode/bedlevel/abl/G29.cpp | 87 +- Marlin/src/gcode/bedlevel/abl/M421.cpp | 3 + Marlin/src/gcode/bedlevel/mbl/G29.cpp | 12 +- Marlin/src/gcode/bedlevel/ubl/M421.cpp | 10 +- Marlin/src/gcode/calibrate/G28.cpp | 98 +- Marlin/src/gcode/calibrate/G34_M422.cpp | 65 +- Marlin/src/gcode/calibrate/G425.cpp | 42 +- Marlin/src/gcode/calibrate/M425.cpp | 9 +- Marlin/src/gcode/calibrate/M666.cpp | 22 +- Marlin/src/gcode/config/M217.cpp | 4 - Marlin/src/gcode/config/M304.cpp | 12 +- Marlin/src/gcode/config/M43.cpp | 20 +- Marlin/src/gcode/control/M111.cpp | 4 +- Marlin/src/gcode/control/M17_M18_M84.cpp | 2 +- Marlin/src/gcode/control/M211.cpp | 12 +- Marlin/src/gcode/control/M226.cpp | 4 +- Marlin/src/gcode/control/M380_M381.cpp | 2 +- Marlin/src/gcode/control/M42.cpp | 2 +- Marlin/src/gcode/control/M605.cpp | 139 +- Marlin/src/gcode/control/T.cpp | 25 +- Marlin/src/gcode/eeprom/M500-M504.cpp | 4 - Marlin/src/gcode/feature/L6470/M906.cpp | 7 +- Marlin/src/gcode/feature/L6470/M916-918.cpp | 136 +- Marlin/src/gcode/feature/advance/M900.cpp | 118 +- Marlin/src/gcode/feature/camera/M240.cpp | 2 +- Marlin/src/gcode/feature/caselight/M355.cpp | 2 +- .../src/gcode/feature/digipot/M907-M910.cpp | 4 +- .../src/gcode/feature/fwretract/M207-M209.cpp | 8 +- Marlin/src/gcode/feature/pause/M125.cpp | 12 +- Marlin/src/gcode/feature/pause/M600.cpp | 10 +- Marlin/src/gcode/feature/pause/M701_M702.cpp | 14 +- Marlin/src/gcode/feature/powerloss/M1000.cpp | 26 +- Marlin/src/gcode/feature/powerloss/M413.cpp | 2 +- Marlin/src/gcode/gcode.cpp | 47 +- Marlin/src/gcode/gcode.h | 23 +- Marlin/src/gcode/host/M114.cpp | 6 +- Marlin/src/gcode/host/M115.cpp | 16 +- Marlin/src/gcode/lcd/M0_M1.cpp | 12 + Marlin/src/gcode/lcd/M145.cpp | 2 +- Marlin/src/gcode/lcd/M73.cpp | 4 +- Marlin/src/gcode/motion/G0_G1.cpp | 4 +- Marlin/src/gcode/motion/G2_G3.cpp | 16 +- Marlin/src/gcode/motion/M290.cpp | 5 +- Marlin/src/gcode/parser.cpp | 49 +- Marlin/src/gcode/parser.h | 3 +- Marlin/src/gcode/probe/G38.cpp | 70 +- Marlin/src/gcode/queue.cpp | 27 +- Marlin/src/gcode/queue.h | 2 +- Marlin/src/gcode/scara/M360-M364.cpp | 5 +- .../sdcard/M20-M30_M32-M34_M524_M928.cpp | 303 --- Marlin/src/gcode/sdcard/M20.cpp | 39 + Marlin/src/gcode/sdcard/M21_M22.cpp | 40 + Marlin/src/gcode/sdcard/M23.cpp | 42 + Marlin/src/gcode/sdcard/M24_M25.cpp | 106 + Marlin/src/gcode/sdcard/M26.cpp | 38 + Marlin/src/gcode/sdcard/M27.cpp | 50 + Marlin/src/gcode/sdcard/M28_M29.cpp | 77 + Marlin/src/gcode/sdcard/M30.cpp | 40 + Marlin/src/gcode/sdcard/M32.cpp | 59 + Marlin/src/gcode/sdcard/M33.cpp | 48 + Marlin/src/gcode/sdcard/M34.cpp | 42 + .../{bedlevel/ubl/M49.cpp => sdcard/M524.cpp} | 24 +- Marlin/src/gcode/sdcard/M928.cpp | 39 + Marlin/src/gcode/stats/M31.cpp | 4 - Marlin/src/gcode/temperature/M104_M109.cpp | 2 +- Marlin/src/gcode/temperature/M105.cpp | 4 - Marlin/src/gcode/temperature/M106_M107.cpp | 6 +- Marlin/src/gcode/temperature/M141_M191.cpp | 77 + Marlin/src/inc/Conditionals_LCD.h | 95 +- Marlin/src/inc/Conditionals_post.h | 135 +- Marlin/src/inc/SanityCheck.h | 154 +- Marlin/src/inc/Version.h | 4 +- Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp | 57 +- Marlin/src/lcd/dogm/HAL_LCD_com_defines.h | 2 +- Marlin/src/lcd/dogm/dogm_Bootscreen.h | 182 +- Marlin/src/lcd/dogm/dogm_Statusscreen.h | 2 - Marlin/src/lcd/dogm/status_screen_DOGM.cpp | 45 +- .../lcd/dogm/status_screen_lite_ST7920.cpp | 45 +- .../lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp | 2 +- .../lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp | 2 +- .../lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp | 68 +- Marlin/src/lcd/dogm/ultralcd_DOGM.cpp | 19 +- Marlin/src/lcd/extensible_ui/lib/example.cpp | 3 +- Marlin/src/lcd/extensible_ui/ui_api.cpp | 213 +- Marlin/src/lcd/extensible_ui/ui_api.h | 36 +- Marlin/src/lcd/language/language_de.h | 2 +- Marlin/src/lcd/language/language_en.h | 50 +- Marlin/src/lcd/language/language_it.h | 10 +- Marlin/src/lcd/language/language_ko_KR.h | 2 +- Marlin/src/lcd/language/language_pt-br.h | 2 +- Marlin/src/lcd/language/language_sk.h | 11 +- Marlin/src/lcd/language/language_tr.h | 2 +- Marlin/src/lcd/language/language_zh_CN.h | 4 +- Marlin/src/lcd/language/language_zh_TW.h | 4 +- Marlin/src/lcd/menu/game/brickout.cpp | 213 ++ Marlin/src/lcd/menu/game/game.cpp | 69 + Marlin/src/lcd/menu/game/game.h | 78 + Marlin/src/lcd/menu/game/invaders.cpp | 468 ++++ Marlin/src/lcd/menu/game/maze.cpp | 137 + Marlin/src/lcd/menu/game/snake.cpp | 334 +++ Marlin/src/lcd/menu/menu.cpp | 70 +- Marlin/src/lcd/menu/menu.h | 25 +- Marlin/src/lcd/menu/menu_advanced.cpp | 55 +- Marlin/src/lcd/menu/menu_backlash.cpp | 58 + Marlin/src/lcd/menu/menu_bed_corners.cpp | 41 +- Marlin/src/lcd/menu/menu_bed_leveling.cpp | 8 +- Marlin/src/lcd/menu/menu_configuration.cpp | 34 +- Marlin/src/lcd/menu/menu_delta_calibrate.cpp | 4 +- Marlin/src/lcd/menu/menu_filament.cpp | 164 +- Marlin/src/lcd/menu/menu_game.cpp | 48 + Marlin/src/lcd/menu/menu_info.cpp | 9 + Marlin/src/lcd/menu/menu_job_recovery.cpp | 2 +- Marlin/src/lcd/menu/menu_led.cpp | 2 +- Marlin/src/lcd/menu/menu_main.cpp | 139 +- Marlin/src/lcd/menu/menu_mixer.cpp | 4 +- Marlin/src/lcd/menu/menu_mmu2.cpp | 8 +- Marlin/src/lcd/menu/menu_motion.cpp | 18 +- Marlin/src/lcd/menu/menu_sdcard.cpp | 2 +- Marlin/src/lcd/menu/menu_temperature.cpp | 31 +- Marlin/src/lcd/menu/menu_tune.cpp | 56 +- Marlin/src/lcd/menu/menu_ubl.cpp | 60 +- Marlin/src/lcd/ultralcd.cpp | 84 +- Marlin/src/lcd/ultralcd.h | 44 +- Marlin/src/libs/L6470/L6470_Marlin.cpp | 45 +- Marlin/src/libs/L6470/L6470_Marlin.h | 20 - Marlin/src/libs/bresenham.h | 132 + Marlin/src/libs/hex_print_routines.cpp | 2 +- Marlin/src/libs/least_squares_fit.cpp | 2 +- Marlin/src/libs/nozzle.cpp | 4 +- Marlin/src/module/configuration_store.cpp | 557 ++-- Marlin/src/module/delta.cpp | 11 +- Marlin/src/module/endstops.cpp | 23 +- Marlin/src/module/motion.cpp | 469 ++-- Marlin/src/module/motion.h | 69 +- Marlin/src/module/planner.cpp | 42 +- Marlin/src/module/planner.h | 6 +- Marlin/src/module/planner_bezier.cpp | 2 +- Marlin/src/module/printcounter.cpp | 41 +- Marlin/src/module/printcounter.h | 4 +- Marlin/src/module/probe.cpp | 151 +- Marlin/src/module/probe.h | 10 - Marlin/src/module/scara.cpp | 33 +- Marlin/src/module/servo.h | 13 +- Marlin/src/module/stepper.cpp | 71 +- Marlin/src/module/stepper.h | 4 +- Marlin/src/module/stepper_indirection.h | 99 +- Marlin/src/module/temperature.cpp | 1446 +++++----- Marlin/src/module/temperature.h | 445 ++-- Marlin/src/module/thermistor/thermistor_20.h | 4 + Marlin/src/module/thermistor/thermistors.h | 21 +- Marlin/src/module/tool_change.cpp | 333 +-- Marlin/src/pins/pins.h | 12 +- Marlin/src/pins/pinsDebug.h | 11 +- Marlin/src/pins/pinsDebug_list.h | 3 + Marlin/src/pins/pins_3DRAG.h | 4 +- Marlin/src/pins/pins_ANET_10.h | 2 +- Marlin/src/pins/pins_AZTEEG_X3.h | 4 +- Marlin/src/pins/pins_AZTEEG_X3_PRO.h | 6 +- Marlin/src/pins/pins_AZTEEG_X5_GT.h | 2 +- Marlin/src/pins/pins_AZTEEG_X5_MINI_WIFI.h | 3 +- Marlin/src/pins/pins_BEAST.h | 5 +- Marlin/src/pins/pins_BIGTREE_SKR_V1.3.h | 59 +- Marlin/src/pins/pins_BLACK_STM32F407VE.h | 131 + Marlin/src/pins/pins_CHITU3D.h | 5 +- Marlin/src/pins/pins_EINSTART-S.h | 2 +- Marlin/src/pins/pins_EINSY_RETRO.h | 4 +- Marlin/src/pins/pins_ESP32.h | 22 +- Marlin/src/pins/pins_FELIX2.h | 2 +- Marlin/src/pins/pins_FORMBOT_RAPTOR.h | 2 +- Marlin/src/pins/pins_FORMBOT_RAPTOR2.h | 4 +- Marlin/src/pins/pins_FORMBOT_TREX2PLUS.h | 2 +- Marlin/src/pins/pins_FYSETC_F6_13.h | 4 + Marlin/src/pins/pins_MEGACONTROLLER.h | 1 - Marlin/src/pins/pins_MEGATRONICS.h | 2 +- Marlin/src/pins/pins_MIGHTYBOARD_REVE.h | 4 +- Marlin/src/pins/pins_MKS_GEN_13.h | 2 +- Marlin/src/pins/pins_MKS_SBASE.h | 2 +- Marlin/src/pins/pins_PRINTRBOARD.h | 4 +- Marlin/src/pins/pins_PRINTRBOARD_REVF.h | 2 +- Marlin/src/pins/pins_RAMBO.h | 2 +- Marlin/src/pins/pins_RAMPS.h | 40 +- Marlin/src/pins/pins_RAMPS_DUO.h | 2 +- Marlin/src/pins/pins_RAMPS_ENDER_4.h | 15 +- Marlin/src/pins/pins_RAMPS_FD_V1.h | 2 +- Marlin/src/pins/pins_RAMPS_LINUX.h | 16 +- Marlin/src/pins/pins_RAMPS_PLUS.h | 2 +- Marlin/src/pins/pins_RAMPS_RE_ARM.h | 15 +- Marlin/src/pins/pins_RUMBA.h | 2 +- Marlin/src/pins/pins_RURAMPS4D_11.h | 4 +- Marlin/src/pins/pins_RURAMPS4D_13.h | 4 +- Marlin/src/pins/pins_SANGUINOLOLU_11.h | 5 +- Marlin/src/pins/pins_SAV_MKI.h | 2 +- Marlin/src/pins/pins_SCOOVO_X9H.h | 2 +- Marlin/src/pins/pins_SMOOTHIEBOARD.h | 2 +- Marlin/src/pins/pins_STM32F1R.h | 5 +- Marlin/src/pins/pins_STM3R_MINI.h | 5 +- Marlin/src/pins/pins_TEENSYLU.h | 2 +- Marlin/src/pins/pins_TRIGORILLA_14.h | 4 +- Marlin/src/pins/pins_TRONXY_V3_1_0.h | 278 ++ Marlin/src/pins/pins_ULTIMAKER_OLD.h | 5 +- Marlin/src/pins/sensitive_pins.h | 4 +- Marlin/src/sd/Sd2Card.cpp | 10 +- Marlin/src/sd/cardreader.cpp | 55 +- Marlin/src/sd/cardreader.h | 4 +- .../sd/usb_flashdrive/Sd2Card_FlashDrive.cpp | 4 +- .../config => config}/default/Configuration.h | 92 +- .../default/Configuration_adv.h | 142 +- .../examples/3DFabXYZ/Migbot/Configuration.h | 84 +- .../3DFabXYZ/Migbot/Configuration_adv.h | 142 +- .../examples/3DFabXYZ/Migbot/Readme.md | 0 .../AlephObjects/TAZ4/Configuration.h | 94 +- .../AlephObjects/TAZ4/Configuration_adv.h | 143 +- .../AliExpress/CL-260/Configuration.h | 94 +- .../examples/AliExpress/CL-260/README.txt | 0 .../AliExpress/UM2pExt/Configuration.h | 92 +- .../AliExpress/UM2pExt/Configuration_adv.h | 141 +- .../examples/Anet/A2/Configuration.h | 94 +- .../examples/Anet/A2}/Configuration_adv.h | 143 +- .../examples/Anet/A2plus/Configuration.h | 94 +- .../examples/Anet/A2plus}/Configuration_adv.h | 143 +- .../examples/Anet/A6/Configuration.h | 94 +- .../examples/Anet/A6/Configuration_adv.h | 144 +- .../examples/Anet/A8/Configuration.h | 94 +- .../examples/Anet/A8/Configuration_adv.h | 143 +- .../examples/AnimationExample/_Bootscreen.h | 0 .../examples/AnyCubic/i3/Configuration.h | 92 +- .../examples/AnyCubic/i3/Configuration_adv.h | 143 +- .../examples/ArmEd/Configuration.h | 94 +- config/examples/ArmEd/Configuration_adv.h | 2336 +++++++++++++++++ .../examples/Azteeg/X5GT/Configuration.h | 98 +- .../BIBO/TouchX/cyclops/Configuration.h | 98 +- .../BIBO/TouchX/cyclops/Configuration_adv.h | 144 +- .../BIBO/TouchX/default/Configuration.h | 98 +- .../BIBO/TouchX/default/Configuration_adv.h | 143 +- .../examples/BQ/Hephestos/Configuration.h | 94 +- .../examples/BQ/Hephestos/Configuration_adv.h | 138 +- .../examples/BQ/Hephestos_2/Configuration.h | 92 +- .../BQ/Hephestos_2/Configuration_adv.h | 138 +- .../examples/BQ/Hephestos_2/README.md | 0 .../examples/BQ/Hephestos_2/_Bootscreen.h | 0 .../examples/BQ/WITBOX/Configuration.h | 94 +- .../examples/BQ/WITBOX/Configuration_adv.h | 138 +- .../examples/Cartesio/Configuration.h | 94 +- .../examples/Cartesio/Configuration_adv.h | 143 +- .../examples/Cartesio/_Bootscreen.h | 0 .../examples/Creality/CR-10/Configuration.h | 96 +- .../Creality/CR-10/Configuration_adv.h | 143 +- .../examples/Creality/CR-10/_Bootscreen.h | 0 .../examples/Creality/CR-10/_Statusscreen.h | 0 .../examples/Creality/CR-10S/Configuration.h | 96 +- .../Creality/CR-10S/Configuration_adv.h | 143 +- .../examples/Creality/CR-10S/_Bootscreen.h | 0 .../examples/Creality/CR-10S/_Statusscreen.h | 0 .../Creality/CR-10_5S/Configuration.h | 96 +- .../Creality/CR-10_5S/Configuration_adv.h | 141 +- .../examples/Creality/CR-10_5S/_Bootscreen.h | 0 .../Creality/CR-10mini/Configuration.h | 96 +- .../Creality/CR-10mini/Configuration_adv.h | 143 +- .../examples/Creality/CR-10mini/_Bootscreen.h | 0 .../Creality/CR-10mini/_Statusscreen.h | 0 .../examples/Creality/CR-8/Configuration.h | 96 +- .../Creality/CR-8/Configuration_adv.h | 143 +- .../examples/Creality/Ender-2/Configuration.h | 96 +- .../Creality/Ender-2/Configuration_adv.h | 138 +- .../examples/Creality/Ender-2/README.md | 0 .../examples/Creality/Ender-2/_Bootscreen.h | 0 .../examples/Creality/Ender-2/_Statusscreen.h | 0 .../examples/Creality/Ender-3/Configuration.h | 94 +- .../Creality/Ender-3/Configuration_adv.h | 140 +- .../examples/Creality/Ender-3/README.md | 0 .../examples/Creality/Ender-3/_Bootscreen.h | 0 .../examples/Creality/Ender-3/_Statusscreen.h | 0 .../examples/Creality/Ender-4/Configuration.h | 96 +- .../Creality/Ender-4/Configuration_adv.h | 145 +- .../examples/Einstart-S/Configuration.h | 94 +- .../examples/Einstart-S/Configuration_adv.h | 143 +- .../examples/Einstart-S/readme.md | 0 .../examples/Felix/Configuration.h | 94 +- .../examples/Felix/Configuration_adv.h | 143 +- .../examples/Felix/DUAL/Configuration.h | 94 +- .../examples/Felix/README.md | 0 .../FlashForge/CreatorPro/Configuration.h | 91 +- .../FlashForge/CreatorPro/Configuration_adv.h | 138 +- .../FolgerTech/i3-2020/Configuration.h | 94 +- .../FolgerTech/i3-2020/Configuration_adv.h | 143 +- .../examples/Formbot/Raptor/Configuration.h | 98 +- .../Formbot/Raptor/Configuration_adv.h | 143 +- .../examples/Formbot/Raptor/_Bootscreen.h | 0 .../examples/Formbot/Raptor/_Statusscreen.h | 0 .../examples/Formbot/T_Rex_2+/Configuration.h | 94 +- .../Formbot/T_Rex_2+/Configuration_adv.h | 146 +- .../examples/Formbot/T_Rex_2+/_Bootscreen.h | 0 .../examples/Formbot/T_Rex_2+/_Statusscreen.h | 0 .../examples/Formbot/T_Rex_3/Configuration.h | 94 +- .../Formbot/T_Rex_3/Configuration_adv.h | 142 +- .../examples/Formbot/T_Rex_3/_Bootscreen.h | 0 .../examples/Formbot/T_Rex_3/_Statusscreen.h | 0 .../examples/Geeetech/A10M/Configuration.h | 92 +- .../Geeetech/A10M/Configuration_adv.h | 143 +- .../examples/Geeetech/A20M/Configuration.h | 92 +- .../Geeetech/A20M/Configuration_adv.h | 143 +- .../examples/Geeetech/GT2560/Configuration.h | 96 +- .../Geeetech/I3_Pro_X-GT2560/Configuration.h | 83 +- .../Geeetech/MeCreator2/Configuration.h | 94 +- .../Geeetech/MeCreator2/Configuration_adv.h | 137 +- .../Geeetech/Prusa i3 Pro B/README.md | 0 .../Prusa i3 Pro B/bltouch/Configuration.h | 94 +- .../Prusa i3 Pro B/noprobe/Configuration.h | 94 +- .../Geeetech/Prusa i3 Pro C/Configuration.h | 94 +- .../Prusa i3 Pro C}/Configuration_adv.h | 143 +- .../Geeetech/Prusa i3 Pro W/Configuration.h | 94 +- .../Prusa i3 Pro W}/Configuration_adv.h | 143 +- .../examples/Infitary/i3-M508/Configuration.h | 94 +- .../Infitary/i3-M508/Configuration_adv.h | 143 +- .../examples/JGAurora/A5/Configuration.h | 98 +- .../examples/JGAurora/A5/Configuration_adv.h | 138 +- .../examples/JGAurora/A5/README.md | 0 .../examples/MakerParts/Configuration.h | 94 +- .../examples/MakerParts/Configuration_adv.h | 143 +- .../examples/MakerParts/_Bootscreen.h | 0 .../examples/Malyan/M150/Configuration.h | 94 +- .../examples/Malyan/M150/Configuration_adv.h | 143 +- .../examples/Malyan/M150/README.md | 2 +- .../examples/Malyan/M150/_Bootscreen.h | 0 .../examples/Malyan/M200/Configuration.h | 94 +- .../examples/Malyan/M200/Configuration_adv.h | 143 +- .../examples/Micromake/C1/README.md | 0 .../Micromake/C1/basic/Configuration.h | 94 +- .../Micromake/C1/enhanced/Configuration.h | 94 +- .../Micromake/C1/enhanced/Configuration_adv.h | 143 +- .../examples/Mks/Robin/Configuration.h | 92 +- .../examples/Mks/Robin/Configuration_adv.h | 142 +- ...Discount_Full_Graphic_Smart_Controller.txt | 0 .../examples/Mks/Sbase/Configuration.h | 94 +- .../examples/Mks/Sbase/Configuration_adv.h | 150 +- .../Printrbot/PrintrboardG2/Configuration.h | 92 +- .../examples/RapideLite/RL200/Configuration.h | 92 +- .../RapideLite/RL200/Configuration_adv.h | 142 +- .../examples/RepRapPro/Huxley/Configuration.h | 94 +- .../RepRapWorld/Megatronics/Configuration.h | 94 +- .../examples/RigidBot/Configuration.h | 94 +- .../examples/RigidBot/Configuration_adv.h | 143 +- .../examples/SCARA/Configuration.h | 96 +- .../examples/SCARA/Configuration_adv.h | 138 +- .../STM32/Black_STM32F407VET6/Configuration.h | 2108 +++++++++++++++ .../Black_STM32F407VET6}/Configuration_adv.h | 145 +- .../examples/STM32}/STM32F10/Configuration.h | 94 +- .../examples/STM32}/STM32F4/Configuration.h | 94 +- .../STM32}/stm32f103ret6/Configuration.h | 94 +- .../examples/Sanguinololu/Configuration.h | 86 +- .../examples/Sanguinololu/Configuration_adv.h | 143 +- .../examples/TheBorg/Configuration.h | 94 +- .../examples/TheBorg/Configuration_adv.h | 143 +- .../examples/TinyBoy2/Configuration.h | 94 +- .../examples/TinyBoy2/Configuration_adv.h | 143 +- .../examples/Tronxy/X1/Configuration.h | 98 +- .../examples/Tronxy/X3A/Configuration.h | 94 +- .../examples/Tronxy/X3A/Configuration_adv.h | 143 +- config/examples/Tronxy/X5S-2E/Configuration.h | 2129 +++++++++++++++ .../Tronxy/X5S-2E/Configuration_adv.h | 2332 ++++++++++++++++ .../examples/Tronxy/X5S/Configuration.h | 94 +- .../examples/Tronxy/XY100/Configuration.h | 94 +- .../UltiMachine/Archim1/Configuration.h | 94 +- .../UltiMachine/Archim1/Configuration_adv.h | 142 +- .../UltiMachine/Archim2/Configuration.h | 94 +- .../UltiMachine/Archim2/Configuration_adv.h | 143 +- .../examples/VORONDesign/Configuration.h | 92 +- .../examples/VORONDesign/Configuration_adv.h | 142 +- .../examples/VORONDesign/_Bootscreen.h | 0 .../examples/Velleman/K8200/Configuration.h | 94 +- .../Velleman/K8200/Configuration_adv.h | 143 +- .../examples/Velleman/K8200/README.md | 0 .../examples/Velleman/K8400/Configuration.h | 86 +- .../Velleman/K8400/Configuration_adv.h | 143 +- .../Velleman/K8400/Dual-head/Configuration.h | 86 +- .../examples/Velleman/K8400/README.md | 0 .../examples/WASP/PowerWASP/Configuration.h | 92 +- .../WASP/PowerWASP/Configuration_adv.h | 2332 ++++++++++++++++ .../examples/WASP/PowerWASP/README.md | 0 .../Wanhao/Duplicator 6/Configuration.h | 98 +- .../Wanhao/Duplicator 6/Configuration_adv.h | 138 +- .../examples/adafruit/ST7565/Configuration.h | 94 +- .../delta/Anycubic/Kossel/Configuration.h | 96 +- .../delta/Anycubic/Kossel/Configuration_adv.h | 138 +- .../examples/delta/Anycubic/Kossel/README.md | 0 .../Anycubic/Kossel/images/Version1Probe.jpg | Bin .../Anycubic/Kossel/images/Version2Probe.jpg | Bin .../FLSUN/auto_calibrate/Configuration.h | 96 +- .../FLSUN/auto_calibrate/Configuration_adv.h | 138 +- .../delta/FLSUN/kossel/Configuration.h | 100 +- .../delta/FLSUN/kossel/Configuration_adv.h | 138 +- .../delta/FLSUN/kossel_mini/Configuration.h | 96 +- .../FLSUN/kossel_mini}/Configuration_adv.h | 138 +- .../Geeetech/Rostock 301/Configuration.h | 96 +- .../Geeetech/Rostock 301}/Configuration_adv.h | 138 +- .../delta/Hatchbox_Alpha/Configuration.h | 96 +- .../examples/delta/MKS/SBASE/Configuration.h | 94 +- .../delta/MKS/SBASE/Configuration_adv.h | 138 +- .../RRD Full Graphic Smart Controller.md | 0 .../delta/Tevo Little Monster/Configuration.h | 85 +- .../Tevo Little Monster/Configuration_adv.h | 138 +- .../examples/delta/generic/Configuration.h | 96 +- .../delta/generic}/Configuration_adv.h | 139 +- .../delta/kossel_mini/Configuration.h | 96 +- .../delta/kossel_mini}/Configuration_adv.h | 138 +- .../examples/delta/kossel_pro/Configuration.h | 96 +- .../examples/delta/kossel_pro/README.md | 0 .../examples/delta/kossel_xl/Configuration.h | 96 +- .../delta/kossel_xl/Configuration_adv.h | 138 +- .../examples/delta/kossel_xl/README.md | 0 .../examples/gCreate/gMax1.5+/Configuration.h | 83 +- .../gCreate/gMax1.5+/Configuration_adv.h | 143 +- .../examples/gCreate/gMax1.5+/_Bootscreen.h | 0 .../examples/makibox/Configuration.h | 94 +- .../examples/makibox/Configuration_adv.h | 143 +- .../examples/tvrrug/Round2/Configuration.h | 94 +- .../tvrrug/Round2/Configuration_adv.h | 143 +- .../examples/wt150/Configuration.h | 94 +- .../examples/wt150/Configuration_adv.h | 143 +- 558 files changed, 33798 insertions(+), 13745 deletions(-) create mode 100644 Marlin/src/HAL/HAL_AVR/fast_pwm.cpp create mode 100644 Marlin/src/HAL/HAL_AVR/fastio_AVR.cpp create mode 100644 Marlin/src/HAL/HAL_ESP32/FlushableHardwareSerial.cpp create mode 100644 Marlin/src/HAL/HAL_ESP32/FlushableHardwareSerial.h create mode 100644 Marlin/src/HAL/HAL_ESP32/WebSocketSerial.cpp create mode 100644 Marlin/src/HAL/HAL_ESP32/WebSocketSerial.h create mode 100644 Marlin/src/HAL/HAL_ESP32/persistent_store_spiffs.cpp create mode 100644 Marlin/src/HAL/HAL_ESP32/spiffs.cpp create mode 100644 Marlin/src/HAL/HAL_ESP32/spiffs.h create mode 100644 Marlin/src/HAL/HAL_ESP32/web.cpp create mode 100644 Marlin/src/HAL/HAL_ESP32/web.h create mode 100644 Marlin/src/HAL/HAL_ESP32/wifi.cpp create mode 100644 Marlin/src/HAL/HAL_ESP32/wifi.h create mode 100644 Marlin/src/HAL/HAL_LPC1768/fast_pwm.cpp delete mode 100644 Marlin/src/HAL/HAL_STM32F1/binary.h delete mode 100644 Marlin/src/config/examples/WASP/PowerWASP/Configuration_adv.h create mode 100644 Marlin/src/core/debug_out.h create mode 100644 Marlin/src/feature/babystep.cpp create mode 100644 Marlin/src/feature/babystep.h create mode 100644 Marlin/src/feature/bltouch.cpp create mode 100644 Marlin/src/feature/bltouch.h delete mode 100644 Marlin/src/gcode/sdcard/M20-M30_M32-M34_M524_M928.cpp create mode 100644 Marlin/src/gcode/sdcard/M20.cpp create mode 100644 Marlin/src/gcode/sdcard/M21_M22.cpp create mode 100644 Marlin/src/gcode/sdcard/M23.cpp create mode 100644 Marlin/src/gcode/sdcard/M24_M25.cpp create mode 100644 Marlin/src/gcode/sdcard/M26.cpp create mode 100644 Marlin/src/gcode/sdcard/M27.cpp create mode 100644 Marlin/src/gcode/sdcard/M28_M29.cpp create mode 100644 Marlin/src/gcode/sdcard/M30.cpp create mode 100644 Marlin/src/gcode/sdcard/M32.cpp create mode 100644 Marlin/src/gcode/sdcard/M33.cpp create mode 100644 Marlin/src/gcode/sdcard/M34.cpp rename Marlin/src/gcode/{bedlevel/ubl/M49.cpp => sdcard/M524.cpp} (70%) create mode 100644 Marlin/src/gcode/sdcard/M928.cpp create mode 100644 Marlin/src/gcode/temperature/M141_M191.cpp create mode 100644 Marlin/src/lcd/menu/game/brickout.cpp create mode 100644 Marlin/src/lcd/menu/game/game.cpp create mode 100644 Marlin/src/lcd/menu/game/game.h create mode 100644 Marlin/src/lcd/menu/game/invaders.cpp create mode 100644 Marlin/src/lcd/menu/game/maze.cpp create mode 100644 Marlin/src/lcd/menu/game/snake.cpp create mode 100644 Marlin/src/lcd/menu/menu_backlash.cpp create mode 100644 Marlin/src/lcd/menu/menu_game.cpp create mode 100644 Marlin/src/libs/bresenham.h create mode 100644 Marlin/src/pins/pins_BLACK_STM32F407VE.h create mode 100644 Marlin/src/pins/pins_TRONXY_V3_1_0.h rename {Marlin/src/config => config}/default/Configuration.h (96%) rename {Marlin/src/config => config}/default/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/3DFabXYZ/Migbot/Configuration.h (96%) rename {Marlin/src/config => config}/examples/3DFabXYZ/Migbot/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/3DFabXYZ/Migbot/Readme.md (100%) rename {Marlin/src/config => config}/examples/AlephObjects/TAZ4/Configuration.h (96%) rename {Marlin/src/config => config}/examples/AlephObjects/TAZ4/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/AliExpress/CL-260/Configuration.h (96%) rename {Marlin/src/config => config}/examples/AliExpress/CL-260/README.txt (100%) rename {Marlin/src/config => config}/examples/AliExpress/UM2pExt/Configuration.h (96%) rename {Marlin/src/config => config}/examples/AliExpress/UM2pExt/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/Anet/A2/Configuration.h (96%) rename {Marlin/src/config/examples/Anet/A2plus => config/examples/Anet/A2}/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/Anet/A2plus/Configuration.h (96%) rename {Marlin/src/config/examples/Anet/A2 => config/examples/Anet/A2plus}/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/Anet/A6/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Anet/A6/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/Anet/A8/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Anet/A8/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/AnimationExample/_Bootscreen.h (100%) rename {Marlin/src/config => config}/examples/AnyCubic/i3/Configuration.h (96%) rename {Marlin/src/config => config}/examples/AnyCubic/i3/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/ArmEd/Configuration.h (96%) create mode 100644 config/examples/ArmEd/Configuration_adv.h rename {Marlin/src/config => config}/examples/Azteeg/X5GT/Configuration.h (95%) rename {Marlin/src/config => config}/examples/BIBO/TouchX/cyclops/Configuration.h (95%) rename {Marlin/src/config => config}/examples/BIBO/TouchX/cyclops/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/BIBO/TouchX/default/Configuration.h (95%) rename {Marlin/src/config => config}/examples/BIBO/TouchX/default/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/BQ/Hephestos/Configuration.h (96%) rename {Marlin/src/config => config}/examples/BQ/Hephestos/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/BQ/Hephestos_2/Configuration.h (96%) rename {Marlin/src/config => config}/examples/BQ/Hephestos_2/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/BQ/Hephestos_2/README.md (100%) rename {Marlin/src/config => config}/examples/BQ/Hephestos_2/_Bootscreen.h (100%) rename {Marlin/src/config => config}/examples/BQ/WITBOX/Configuration.h (96%) rename {Marlin/src/config => config}/examples/BQ/WITBOX/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/Cartesio/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Cartesio/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/Cartesio/_Bootscreen.h (100%) rename {Marlin/src/config => config}/examples/Creality/CR-10/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Creality/CR-10/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/Creality/CR-10/_Bootscreen.h (100%) rename {Marlin/src/config => config}/examples/Creality/CR-10/_Statusscreen.h (100%) rename {Marlin/src/config => config}/examples/Creality/CR-10S/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Creality/CR-10S/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/Creality/CR-10S/_Bootscreen.h (100%) rename {Marlin/src/config => config}/examples/Creality/CR-10S/_Statusscreen.h (100%) rename {Marlin/src/config => config}/examples/Creality/CR-10_5S/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Creality/CR-10_5S/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/Creality/CR-10_5S/_Bootscreen.h (100%) rename {Marlin/src/config => config}/examples/Creality/CR-10mini/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Creality/CR-10mini/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/Creality/CR-10mini/_Bootscreen.h (100%) rename {Marlin/src/config => config}/examples/Creality/CR-10mini/_Statusscreen.h (100%) rename {Marlin/src/config => config}/examples/Creality/CR-8/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Creality/CR-8/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/Creality/Ender-2/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Creality/Ender-2/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/Creality/Ender-2/README.md (100%) rename {Marlin/src/config => config}/examples/Creality/Ender-2/_Bootscreen.h (100%) rename {Marlin/src/config => config}/examples/Creality/Ender-2/_Statusscreen.h (100%) rename {Marlin/src/config => config}/examples/Creality/Ender-3/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Creality/Ender-3/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/Creality/Ender-3/README.md (100%) rename {Marlin/src/config => config}/examples/Creality/Ender-3/_Bootscreen.h (100%) rename {Marlin/src/config => config}/examples/Creality/Ender-3/_Statusscreen.h (100%) rename {Marlin/src/config => config}/examples/Creality/Ender-4/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Creality/Ender-4/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/Einstart-S/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Einstart-S/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/Einstart-S/readme.md (100%) rename {Marlin/src/config => config}/examples/Felix/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Felix/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/Felix/DUAL/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Felix/README.md (100%) rename {Marlin/src/config => config}/examples/FlashForge/CreatorPro/Configuration.h (96%) rename {Marlin/src/config => config}/examples/FlashForge/CreatorPro/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/FolgerTech/i3-2020/Configuration.h (96%) rename {Marlin/src/config => config}/examples/FolgerTech/i3-2020/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/Formbot/Raptor/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Formbot/Raptor/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/Formbot/Raptor/_Bootscreen.h (100%) rename {Marlin/src/config => config}/examples/Formbot/Raptor/_Statusscreen.h (100%) rename {Marlin/src/config => config}/examples/Formbot/T_Rex_2+/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Formbot/T_Rex_2+/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/Formbot/T_Rex_2+/_Bootscreen.h (100%) rename {Marlin/src/config => config}/examples/Formbot/T_Rex_2+/_Statusscreen.h (100%) rename {Marlin/src/config => config}/examples/Formbot/T_Rex_3/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Formbot/T_Rex_3/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/Formbot/T_Rex_3/_Bootscreen.h (100%) rename {Marlin/src/config => config}/examples/Formbot/T_Rex_3/_Statusscreen.h (100%) rename {Marlin/src/config => config}/examples/Geeetech/A10M/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Geeetech/A10M/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/Geeetech/A20M/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Geeetech/A20M/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/Geeetech/GT2560/Configuration.h (95%) rename {Marlin/src/config => config}/examples/Geeetech/I3_Pro_X-GT2560/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Geeetech/MeCreator2/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Geeetech/MeCreator2/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/Geeetech/Prusa i3 Pro B/README.md (100%) rename {Marlin/src/config => config}/examples/Geeetech/Prusa i3 Pro B/bltouch/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Geeetech/Prusa i3 Pro B/noprobe/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Geeetech/Prusa i3 Pro C/Configuration.h (96%) rename {Marlin/src/config/examples/Geeetech/Prusa i3 Pro W => config/examples/Geeetech/Prusa i3 Pro C}/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/Geeetech/Prusa i3 Pro W/Configuration.h (96%) rename {Marlin/src/config/examples/Geeetech/Prusa i3 Pro C => config/examples/Geeetech/Prusa i3 Pro W}/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/Infitary/i3-M508/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Infitary/i3-M508/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/JGAurora/A5/Configuration.h (95%) rename {Marlin/src/config => config}/examples/JGAurora/A5/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/JGAurora/A5/README.md (100%) rename {Marlin/src/config => config}/examples/MakerParts/Configuration.h (96%) rename {Marlin/src/config => config}/examples/MakerParts/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/MakerParts/_Bootscreen.h (100%) rename {Marlin/src/config => config}/examples/Malyan/M150/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Malyan/M150/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/Malyan/M150/README.md (97%) rename {Marlin/src/config => config}/examples/Malyan/M150/_Bootscreen.h (100%) rename {Marlin/src/config => config}/examples/Malyan/M200/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Malyan/M200/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/Micromake/C1/README.md (100%) rename {Marlin/src/config => config}/examples/Micromake/C1/basic/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Micromake/C1/enhanced/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Micromake/C1/enhanced/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/Mks/Robin/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Mks/Robin/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/Mks/Sbase/000-README_RepRap_Discount_Full_Graphic_Smart_Controller.txt (100%) rename {Marlin/src/config => config}/examples/Mks/Sbase/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Mks/Sbase/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/Printrbot/PrintrboardG2/Configuration.h (96%) rename {Marlin/src/config => config}/examples/RapideLite/RL200/Configuration.h (96%) rename {Marlin/src/config => config}/examples/RapideLite/RL200/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/RepRapPro/Huxley/Configuration.h (96%) rename {Marlin/src/config => config}/examples/RepRapWorld/Megatronics/Configuration.h (96%) rename {Marlin/src/config => config}/examples/RigidBot/Configuration.h (96%) rename {Marlin/src/config => config}/examples/RigidBot/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/SCARA/Configuration.h (96%) rename {Marlin/src/config => config}/examples/SCARA/Configuration_adv.h (93%) create mode 100644 config/examples/STM32/Black_STM32F407VET6/Configuration.h rename {Marlin/src/config/examples/ArmEd => config/examples/STM32/Black_STM32F407VET6}/Configuration_adv.h (93%) rename {Marlin/src/config/examples => config/examples/STM32}/STM32F10/Configuration.h (96%) rename {Marlin/src/config/examples => config/examples/STM32}/STM32F4/Configuration.h (96%) rename {Marlin/src/config/examples => config/examples/STM32}/stm32f103ret6/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Sanguinololu/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Sanguinololu/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/TheBorg/Configuration.h (96%) rename {Marlin/src/config => config}/examples/TheBorg/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/TinyBoy2/Configuration.h (96%) rename {Marlin/src/config => config}/examples/TinyBoy2/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/Tronxy/X1/Configuration.h (95%) rename {Marlin/src/config => config}/examples/Tronxy/X3A/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Tronxy/X3A/Configuration_adv.h (93%) create mode 100644 config/examples/Tronxy/X5S-2E/Configuration.h create mode 100644 config/examples/Tronxy/X5S-2E/Configuration_adv.h rename {Marlin/src/config => config}/examples/Tronxy/X5S/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Tronxy/XY100/Configuration.h (96%) rename {Marlin/src/config => config}/examples/UltiMachine/Archim1/Configuration.h (96%) rename {Marlin/src/config => config}/examples/UltiMachine/Archim1/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/UltiMachine/Archim2/Configuration.h (96%) rename {Marlin/src/config => config}/examples/UltiMachine/Archim2/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/VORONDesign/Configuration.h (96%) rename {Marlin/src/config => config}/examples/VORONDesign/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/VORONDesign/_Bootscreen.h (100%) rename {Marlin/src/config => config}/examples/Velleman/K8200/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Velleman/K8200/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/Velleman/K8200/README.md (100%) rename {Marlin/src/config => config}/examples/Velleman/K8400/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Velleman/K8400/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/Velleman/K8400/Dual-head/Configuration.h (96%) rename {Marlin/src/config => config}/examples/Velleman/K8400/README.md (100%) rename {Marlin/src/config => config}/examples/WASP/PowerWASP/Configuration.h (96%) create mode 100644 config/examples/WASP/PowerWASP/Configuration_adv.h rename {Marlin/src/config => config}/examples/WASP/PowerWASP/README.md (100%) rename {Marlin/src/config => config}/examples/Wanhao/Duplicator 6/Configuration.h (95%) rename {Marlin/src/config => config}/examples/Wanhao/Duplicator 6/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/adafruit/ST7565/Configuration.h (96%) rename {Marlin/src/config => config}/examples/delta/Anycubic/Kossel/Configuration.h (96%) rename {Marlin/src/config => config}/examples/delta/Anycubic/Kossel/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/delta/Anycubic/Kossel/README.md (100%) rename {Marlin/src/config => config}/examples/delta/Anycubic/Kossel/images/Version1Probe.jpg (100%) rename {Marlin/src/config => config}/examples/delta/Anycubic/Kossel/images/Version2Probe.jpg (100%) rename {Marlin/src/config => config}/examples/delta/FLSUN/auto_calibrate/Configuration.h (96%) rename {Marlin/src/config => config}/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/delta/FLSUN/kossel/Configuration.h (95%) rename {Marlin/src/config => config}/examples/delta/FLSUN/kossel/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/delta/FLSUN/kossel_mini/Configuration.h (96%) rename {Marlin/src/config/examples/delta/generic => config/examples/delta/FLSUN/kossel_mini}/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/delta/Geeetech/Rostock 301/Configuration.h (96%) rename {Marlin/src/config/examples/delta/FLSUN/kossel_mini => config/examples/delta/Geeetech/Rostock 301}/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/delta/Hatchbox_Alpha/Configuration.h (96%) rename {Marlin/src/config => config}/examples/delta/MKS/SBASE/Configuration.h (96%) rename {Marlin/src/config => config}/examples/delta/MKS/SBASE/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/delta/MKS/SBASE/RRD Full Graphic Smart Controller.md (100%) rename {Marlin/src/config => config}/examples/delta/Tevo Little Monster/Configuration.h (96%) rename {Marlin/src/config => config}/examples/delta/Tevo Little Monster/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/delta/generic/Configuration.h (96%) rename {Marlin/src/config/examples/delta/kossel_mini => config/examples/delta/generic}/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/delta/kossel_mini/Configuration.h (96%) rename {Marlin/src/config/examples/delta/Geeetech/Rostock 301 => config/examples/delta/kossel_mini}/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/delta/kossel_pro/Configuration.h (96%) rename {Marlin/src/config => config}/examples/delta/kossel_pro/README.md (100%) rename {Marlin/src/config => config}/examples/delta/kossel_xl/Configuration.h (96%) rename {Marlin/src/config => config}/examples/delta/kossel_xl/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/delta/kossel_xl/README.md (100%) rename {Marlin/src/config => config}/examples/gCreate/gMax1.5+/Configuration.h (96%) rename {Marlin/src/config => config}/examples/gCreate/gMax1.5+/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/gCreate/gMax1.5+/_Bootscreen.h (100%) rename {Marlin/src/config => config}/examples/makibox/Configuration.h (96%) rename {Marlin/src/config => config}/examples/makibox/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/tvrrug/Round2/Configuration.h (96%) rename {Marlin/src/config => config}/examples/tvrrug/Round2/Configuration_adv.h (93%) rename {Marlin/src/config => config}/examples/wt150/Configuration.h (96%) rename {Marlin/src/config => config}/examples/wt150/Configuration_adv.h (93%) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 161872eed4..6f93ed837e 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -6,7 +6,7 @@ // Enable this is you have a raptor 2. // Selects pin file, runout sensor and stock TMC Drivers automatically -//#define RAPTOR2 +#define RAPTOR2 /** * Enable if you replace the stepper drivers with TMC 2208. Be sure to remove MS3 jumper @@ -15,14 +15,14 @@ * you require Linear Advance with a TMC2208 on the extruder! * If you have used a UART connection to program the driver to SpreadCycle mode, pease seect that as well */ -#define X_2208 +//#define X_2208 //#define X_SpreadCycle -#define Y_2208 -#define Y_SpreadCycle // Highly recommended as large prints with high mass can cause layer shifts with stealthchop at high speed +//#define Y_2208 +//#define Y_SpreadCycle // Highly recommended as large prints with high mass can cause layer shifts with stealthchop at high speed //#define Y_4988 // Some machines shipped with 4988 drivers across the board. Set this if you arent sure what you have and all the drivers look identical //#define Z_2208 // NOT Recommended! Dual stepper current draw is above the recommended limit for this driver //#define Z_SpreadCycle -#define Z_4988 // Some machines shipped with 4988 drivers across the board. Set this if you arent sure what you have and all the drivers look identical +//#define Z_4988 // Some machines shipped with 4988 drivers across the board. Set this if you arent sure what you have and all the drivers look identical //#define E_2208 // Not Recommended! Stealthchop mode faults with linear advance //#define E_SpreadCycle @@ -283,7 +283,7 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder @@ -445,6 +445,7 @@ #define TEMP_SENSOR_BED 1 #endif #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -455,40 +456,42 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 290 +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (Use MINTEMP for thermistor short/failure protection.) +#define HEATER_0_MAXTEMP 305 #define HEATER_1_MAXTEMP 275 #define HEATER_2_MAXTEMP 275 #define HEATER_3_MAXTEMP 275 #define HEATER_4_MAXTEMP 275 -#if(ENABLED(BED_AC)) +#define HEATER_5_MAXTEMP 275 + #if(ENABLED(BED_AC)) #define BED_MAXTEMP 150 #else -#define BED_MAXTEMP 100 + #define BED_MAXTEMP 100 #endif +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -627,6 +630,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -956,6 +960,17 @@ #define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + #define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + #define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -998,6 +1013,8 @@ #define X_PROBE_OFFSET_FROM_EXTRUDER -22 // X offset: -left +right [of the nozzle] #define Y_PROBE_OFFSET_FROM_EXTRUDER 0 // Y offset: -front +behind [the nozzle] #define Z_PROBE_OFFSET_FROM_EXTRUDER -1.5 // Z offset: -below +above [the nozzle] + +// Certain types of probes need to stay away from edges #define MIN_PROBE_EDGE 3 // X and Y axis travel speed (mm/m) between probes @@ -1174,7 +1191,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) #define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1258,9 +1275,9 @@ //#define AUTO_BED_LEVELING_3POINT //#define AUTO_BED_LEVELING_LINEAR #if(ENABLED(UBL)) -#define AUTO_BED_LEVELING_UBL + #define AUTO_BED_LEVELING_UBL #else -#define AUTO_BED_LEVELING_BILINEAR + #define AUTO_BED_LEVELING_BILINEAR #endif //#define MESH_BED_LEVELING @@ -1278,7 +1295,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1297,13 +1314,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 11 @@ -1399,6 +1417,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1432,8 +1451,8 @@ #define Z_SAFE_HOMING #if ENABLED(Z_SAFE_HOMING) - #define Z_SAFE_HOMING_X_POINT 50 // X point for Z homing when homing all axis (G28). - #define Z_SAFE_HOMING_Y_POINT 50 // Y point for Z homing when homing all axis (G28). + #define Z_SAFE_HOMING_X_POINT 50 // X point for Z homing when homing all axes (G28). + #define Z_SAFE_HOMING_Y_POINT 50 // Y point for Z homing when homing all axes (G28). #endif // Homing speeds (mm/m) @@ -2206,11 +2225,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2235,7 +2254,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 163dc96907..ebb77eab91 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -271,7 +312,7 @@ */ #define CASE_LIGHT_ENABLE #if ENABLED(CASE_LIGHT_ENABLE) - #define CASE_LIGHT_PIN 5 + #define CASE_LIGHT_PIN 5 // 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 255 // Set default power-up brightness (0-255, requires PWM pin) @@ -367,31 +408,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -442,8 +492,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -467,8 +517,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -724,8 +777,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -914,6 +968,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -956,6 +1015,7 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 #define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) @@ -1045,7 +1105,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1053,11 +1114,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1624,7 +1691,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1639,8 +1706,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2214,6 +2280,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/HAL/HAL_AVR/HAL.h b/Marlin/src/HAL/HAL_AVR/HAL.h index a4c1355b52..b5b63dc5d1 100644 --- a/Marlin/src/HAL/HAL_AVR/HAL.h +++ b/Marlin/src/HAL/HAL_AVR/HAL.h @@ -182,7 +182,7 @@ FORCE_INLINE void HAL_timer_start(const uint8_t timer_num, const uint32_t freque #define TIMER_OCR_0 OCR0A #define TIMER_COUNTER_0 TCNT0 -#define _CAT(a, ...) a ## __VA_ARGS__ +#define _CAT(a,V...) a##V #define HAL_timer_set_compare(timer, compare) (_CAT(TIMER_OCR_, timer) = compare) #define HAL_timer_get_compare(timer) _CAT(TIMER_OCR_, timer) #define HAL_timer_get_count(timer) _CAT(TIMER_COUNTER_, timer) @@ -197,7 +197,7 @@ FORCE_INLINE void HAL_timer_start(const uint8_t timer_num, const uint32_t freque #define HAL_timer_isr_epilogue(TIMER_NUM) /* 18 cycles maximum latency */ -#define HAL_STEP_TIMER_ISR \ +#define HAL_STEP_TIMER_ISR() \ extern "C" void TIMER1_COMPA_vect (void) __attribute__ ((signal, naked, used, externally_visible)); \ extern "C" void TIMER1_COMPA_vect_bottom (void) asm ("TIMER1_COMPA_vect_bottom") __attribute__ ((used, externally_visible, noinline)); \ void TIMER1_COMPA_vect (void) { \ @@ -270,7 +270,7 @@ void TIMER1_COMPA_vect (void) { \ void TIMER1_COMPA_vect_bottom(void) /* 14 cycles maximum latency */ -#define HAL_TEMP_TIMER_ISR \ +#define HAL_TEMP_TIMER_ISR() \ extern "C" void TIMER0_COMPB_vect (void) __attribute__ ((signal, naked, used, externally_visible)); \ extern "C" void TIMER0_COMPB_vect_bottom(void) asm ("TIMER0_COMPB_vect_bottom") __attribute__ ((used, externally_visible, noinline)); \ void TIMER0_COMPB_vect (void) { \ @@ -372,3 +372,22 @@ inline void HAL_adc_init(void) { // AVR compatibility #define strtof strtod + +/** + * set_pwm_frequency + * Sets the frequency of the timer corresponding to the provided pin + * as close as possible to the provided desired frequency. Internally + * calculates the required waveform generation mode, prescaler and + * resolution values required and sets the timer registers accordingly. + * NOTE that the frequency is applied to all pins on the timer (Ex OC3A, OC3B and OC3B) + * NOTE that there are limitations, particularly if using TIMER2. (see Configuration_adv.h -> FAST FAN PWM Settings) + */ +void set_pwm_frequency(const pin_t pin, int f_desired); + +/** + * set_pwm_duty + * Sets the PWM duty cycle of the provided pin to the provided value + * Optionally allows inverting the duty cycle [default = false] + * Optionally allows changing the maximum size of the provided value to enable finer PWM duty control [default = 255] + */ +void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size=255, const bool invert=false); diff --git a/Marlin/src/HAL/HAL_AVR/SanityCheck.h b/Marlin/src/HAL/HAL_AVR/SanityCheck.h index 5eb5098bae..5da811c9ce 100644 --- a/Marlin/src/HAL/HAL_AVR/SanityCheck.h +++ b/Marlin/src/HAL/HAL_AVR/SanityCheck.h @@ -35,13 +35,18 @@ #endif #endif +/** + * Checks for FAST PWM + */ +#if ENABLED(FAST_PWM_FAN) && (ENABLED(USE_OCR2A_AS_TOP) && defined(TCCR2)) + #error "USE_OCR2A_AS_TOP does not apply to devices with a single output TIMER2" +#endif + /** * Sanity checks for Spindle / Laser */ #if ENABLED(SPINDLE_LASER_ENABLE) - #if !PIN_EXISTS(SPINDLE_LASER_ENABLE) - #error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENABLE_PIN." - #elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR) + #if SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR) #error "SPINDLE_DIR_PIN not defined." #elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM) #if !(WITHIN(SPINDLE_LASER_PWM_PIN, 2, 13) || WITHIN(SPINDLE_LASER_PWM_PIN, 44, 46)) diff --git a/Marlin/src/HAL/HAL_AVR/fast_pwm.cpp b/Marlin/src/HAL/HAL_AVR/fast_pwm.cpp new file mode 100644 index 0000000000..b38a4acea2 --- /dev/null +++ b/Marlin/src/HAL/HAL_AVR/fast_pwm.cpp @@ -0,0 +1,250 @@ +#ifdef __AVR__ + +#include "../../inc/MarlinConfigPre.h" +/** + * get_pwm_timer + * Grabs timer information and registers of the provided pin + * returns Timer struct containing this information + * Used by set_pwm_frequency, set_pwm_duty + * + */ + +#if ENABLED(FAST_PWM_FAN) +#include "HAL.h" + + struct Timer { + volatile uint8_t* TCCRnQ[3]; // max 3 TCCR registers per timer + volatile uint16_t* OCRnQ[3]; // max 3 OCR registers per timer + volatile uint16_t* ICRn; // max 1 ICR register per timer + uint8_t n; // the timer number [0->5] + uint8_t q; // the timer output [0->2] (A->C) + }; + + Timer get_pwm_timer(pin_t pin) { + uint8_t q = 0; + switch (digitalPinToTimer(pin)) { + // Protect reserved timers (TIMER0 & TIMER1) + #ifdef TCCR0A + #if !AVR_AT90USB1286_FAMILY + case TIMER0A: + #endif + case TIMER0B: + #endif + #ifdef TCCR1A + case TIMER1A: case TIMER1B: + #endif + break; + #if defined(TCCR2) || defined(TCCR2A) + #ifdef TCCR2 + case TIMER2: { + Timer timer = { + /*TCCRnQ*/ { &TCCR2, NULL, NULL}, + /*OCRnQ*/ { (uint16_t*)&OCR2, NULL, NULL}, + /*ICRn*/ NULL, + /*n, q*/ 2, 0 + }; + } + #elif defined TCCR2A + #if ENABLED(USE_OCR2A_AS_TOP) + case TIMER2A: break; // protect TIMER2A + case TIMER2B: { + Timer timer = { + /*TCCRnQ*/ { &TCCR2A, &TCCR2B, NULL}, + /*OCRnQ*/ { (uint16_t*)&OCR2A, (uint16_t*)&OCR2B, NULL}, + /*ICRn*/ NULL, + /*n, q*/ 2, 1 + }; + return timer; + } + #else + case TIMER2B: ++q; + case TIMER2A: { + Timer timer = { + /*TCCRnQ*/ { &TCCR2A, &TCCR2B, NULL}, + /*OCRnQ*/ { (uint16_t*)&OCR2A, (uint16_t*)&OCR2B, NULL}, + /*ICRn*/ NULL, + 2, q + }; + return timer; + } + #endif + #endif + #endif + #ifdef TCCR3A + case TIMER3C: ++q; + case TIMER3B: ++q; + case TIMER3A: { + Timer timer = { + /*TCCRnQ*/ { &TCCR3A, &TCCR3B, &TCCR3C}, + /*OCRnQ*/ { &OCR3A, &OCR3B, &OCR3C}, + /*ICRn*/ &ICR3, + /*n, q*/ 3, q + }; + return timer; + } + #endif + #ifdef TCCR4A + case TIMER4C: ++q; + case TIMER4B: ++q; + case TIMER4A: { + Timer timer = { + /*TCCRnQ*/ { &TCCR4A, &TCCR4B, &TCCR4C}, + /*OCRnQ*/ { &OCR4A, &OCR4B, &OCR4C}, + /*ICRn*/ &ICR4, + /*n, q*/ 4, q + }; + return timer; + } + #endif + #ifdef TCCR5A + case TIMER5C: ++q; + case TIMER5B: ++q; + case TIMER5A: { + Timer timer = { + /*TCCRnQ*/ { &TCCR5A, &TCCR5B, &TCCR5C}, + /*OCRnQ*/ { &OCR5A, &OCR5B, &OCR5C }, + /*ICRn*/ &ICR5, + /*n, q*/ 5, q + }; + return timer; + } + #endif + } + Timer timer = { + /*TCCRnQ*/ { NULL, NULL, NULL}, + /*OCRnQ*/ { NULL, NULL, NULL}, + /*ICRn*/ NULL, + 0, 0 + }; + return timer; + } + + void set_pwm_frequency(const pin_t pin, int f_desired) { + Timer timer = get_pwm_timer(pin); + if (timer.n == 0) return; // Don't proceed if protected timer or not recognised + uint16_t size; + if (timer.n == 2) size = 255; else size = 65535; + + uint16_t res = 255; // resolution (TOP value) + uint8_t j = 0; // prescaler index + uint8_t wgm = 1; // waveform generation mode + + // Calculating the prescaler and resolution to use to achieve closest frequency + if (f_desired != 0) { + int f = (F_CPU) / (2 * 1024 * size) + 1; // Initialize frequency as lowest (non-zero) achievable + uint16_t prescaler[] = { 0, 1, 8, /*TIMER2 ONLY*/32, 64, /*TIMER2 ONLY*/128, 256, 1024 }; + + // loop over prescaler values + for (uint8_t i = 1; i < 8; i++) { + uint16_t res_temp_fast = 255, res_temp_phase_correct = 255; + if (timer.n == 2) { + // No resolution calculation for TIMER2 unless enabled USE_OCR2A_AS_TOP + #if ENABLED(USE_OCR2A_AS_TOP) + const uint16_t rtf = (F_CPU) / (prescaler[i] * f_desired); + res_temp_fast = rtf - 1; + res_temp_phase_correct = rtf / 2; + #endif + } + else { + // Skip TIMER2 specific prescalers when not TIMER2 + if (i == 3 || i == 5) continue; + const uint16_t rtf = (F_CPU) / (prescaler[i] * f_desired); + res_temp_fast = rtf - 1; + res_temp_phase_correct = rtf / 2; + } + + LIMIT(res_temp_fast, 1u, size); + LIMIT(res_temp_phase_correct, 1u, size); + // Calculate frequencies of test prescaler and resolution values + const int f_temp_fast = (F_CPU) / (prescaler[i] * (1 + res_temp_fast)), + f_temp_phase_correct = (F_CPU) / (2 * prescaler[i] * res_temp_phase_correct), + f_diff = ABS(f - f_desired), + f_fast_diff = ABS(f_temp_fast - f_desired), + f_phase_diff = ABS(f_temp_phase_correct - f_desired); + + // If FAST values are closest to desired f + if (f_fast_diff < f_diff && f_fast_diff <= f_phase_diff) { + // Remember this combination + f = f_temp_fast; + res = res_temp_fast; + j = i; + // Set the Wave Generation Mode to FAST PWM + if (timer.n == 2) { + wgm = ( + #if ENABLED(USE_OCR2A_AS_TOP) + WGM2_FAST_PWM_OCR2A + #else + WGM2_FAST_PWM + #endif + ); + } + else wgm = WGM_FAST_PWM_ICRn; + } + // If PHASE CORRECT values are closes to desired f + else if (f_phase_diff < f_diff) { + f = f_temp_phase_correct; + res = res_temp_phase_correct; + j = i; + // Set the Wave Generation Mode to PWM PHASE CORRECT + if (timer.n == 2) { + wgm = ( + #if ENABLED(USE_OCR2A_AS_TOP) + WGM2_PWM_PC_OCR2A + #else + WGM2_PWM_PC + #endif + ); + } + else wgm = WGM_PWM_PC_ICRn; + } + } + } + _SET_WGMnQ(timer.TCCRnQ, wgm); + _SET_CSn(timer.TCCRnQ, j); + + if (timer.n == 2) { + #if ENABLED(USE_OCR2A_AS_TOP) + _SET_OCRnQ(timer.OCRnQ, 0, res); // Set OCR2A value (TOP) = res + #endif + } + else + _SET_ICRn(timer.ICRn, res); // Set ICRn value (TOP) = res + } + + void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255*/, const bool invert/*=false*/) { + // If v is 0 or v_size (max), digitalWrite to LOW or HIGH. + // Note that digitalWrite also disables pwm output for us (sets COM bit to 0) + if (v == 0) + digitalWrite(pin, invert); + else if (v == v_size) + digitalWrite(pin, !invert); + else { + Timer timer = get_pwm_timer(pin); + if (timer.n == 0) return; // Don't proceed if protected timer or not recognised + // Set compare output mode to CLEAR -> SET or SET -> CLEAR (if inverted) + _SET_COMnQ(timer.TCCRnQ, (timer.q + #ifdef TCCR2 + + (timer.q == 2) // COM20 is on bit 4 of TCCR2, thus requires q + 1 in the macro + #endif + ), COM_CLEAR_SET + invert + ); + + uint16_t top; + if (timer.n == 2) { // if TIMER2 + top = ( + #if ENABLED(USE_OCR2A_AS_TOP) + *timer.OCRnQ[0] // top = OCR2A + #else + 255 // top = 0xFF (max) + #endif + ); + } + else + top = *timer.ICRn; // top = ICRn + + _SET_OCRnQ(timer.OCRnQ, timer.q, v * float(top / v_size)); // Scale 8/16-bit v to top value + } + } + +#endif // FAST_PWM_FAN +#endif // __AVR__ diff --git a/Marlin/src/HAL/HAL_AVR/fastio_1280.h b/Marlin/src/HAL/HAL_AVR/fastio_1280.h index 38408d7b60..1e3c44a4f5 100644 --- a/Marlin/src/HAL/HAL_AVR/fastio_1280.h +++ b/Marlin/src/HAL/HAL_AVR/fastio_1280.h @@ -24,9 +24,9 @@ /** * Pin mapping for the 1280 and 2560 * - * Hardware Pin : 02 03 06 07 01 05 15 16 17 18 23 24 25 26 64 63 13 12 46 45 44 43 78 77 76 75 74 73 72 71 60 59 58 57 56 55 54 53 50 70 52 51 42 41 40 39 38 37 36 35 22 21 20 19 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 04 08 09 10 11 14 27 28 29 30 31 32 33 34 47 48 49 61 62 65 66 67 68 69 79 80 81 98 99 100 - * Port : E0 E1 E4 E5 G5 E3 H3 H4 H5 H6 B4 B5 B6 B7 J1 J0 H1 H0 D3 D2 D1 D0 A0 A1 A2 A3 A4 A5 A6 A7 C7 C6 C5 C4 C3 C2 C1 C0 D7 G2 G1 G0 L7 L6 L5 L4 L3 L2 L1 L0 B3 B2 B1 B0 F0 F1 F2 F3 F4 F5 F6 F7 K0 K1 K2 K3 K4 K5 K6 K7 E2 E6 E7 xx xx H2 H7 G3 G4 xx xx xx xx xx D4 D5 D6 xx xx J2 J3 J4 J5 J6 J7 xx xx xx xx xx - * 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 + * Hardware Pin : 02 03 06 07 01 05 15 16 17 18 23 24 25 26 64 63 13 12 46 45 44 43 78 77 76 75 74 73 72 71 60 59 58 57 56 55 54 53 50 70 52 51 42 41 40 39 38 37 36 35 22 21 20 19 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 | 04 08 09 10 11 14 27 28 29 30 31 32 33 34 47 48 49 61 62 65 66 67 68 69 79 80 81 98 99 100 + * Port : E0 E1 E4 E5 G5 E3 H3 H4 H5 H6 B4 B5 B6 B7 J1 J0 H1 H0 D3 D2 D1 D0 A0 A1 A2 A3 A4 A5 A6 A7 C7 C6 C5 C4 C3 C2 C1 C0 D7 G2 G1 G0 L7 L6 L5 L4 L3 L2 L1 L0 B3 B2 B1 B0 F0 F1 F2 F3 F4 F5 F6 F7 K0 K1 K2 K3 K4 K5 K6 K7 | E2 E6 E7 xx xx H2 H7 G3 G4 xx xx xx xx xx D4 D5 D6 xx xx J2 J3 J4 J5 J6 J7 xx xx xx xx xx + * 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 | 78 79 80 xx xx 84 85 71 70 xx xx xx xx xx 81 82 83 xx xx 72 72 75 76 77 74 xx xx xx xx xx */ #include "fastio_AVR.h" @@ -487,6 +487,9 @@ #define DIO69_DDR DDRK #define DIO69_PWM NULL +//#define FASTIO_EXT_START 70 +//#define FASTIO_EXT_END 85 + #define DIO70_PIN PING4 #define DIO70_RPORT PING #define DIO70_WPORT PORTG diff --git a/Marlin/src/HAL/HAL_AVR/fastio_AVR.cpp b/Marlin/src/HAL/HAL_AVR/fastio_AVR.cpp new file mode 100644 index 0000000000..63fbe4d969 --- /dev/null +++ b/Marlin/src/HAL/HAL_AVR/fastio_AVR.cpp @@ -0,0 +1,238 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * Fast I/O for extended pins + */ + +#ifdef __AVR__ + +#include "fastio_AVR.h" + +#ifdef FASTIO_EXT_START + +#include + +#define _IS_EXT(P) WITHIN(P, FASTIO_EXT_START, FASTIO_EXT_END) + +void extDigitalWrite(const int8_t pin, const uint8_t state) { + #define _WCASE(N) case N: WRITE(N, state); break + switch (pin) { + default: digitalWrite(pin, state); + #if _IS_EXT(70) + _WCASE(70); + #endif + #if _IS_EXT(71) + _WCASE(71); + #endif + #if _IS_EXT(72) + _WCASE(72); + #endif + #if _IS_EXT(73) + _WCASE(73); + #endif + #if _IS_EXT(74) + _WCASE(74); + #endif + #if _IS_EXT(75) + _WCASE(75); + #endif + #if _IS_EXT(76) + _WCASE(76); + #endif + #if _IS_EXT(77) + _WCASE(77); + #endif + #if _IS_EXT(78) + _WCASE(78); + #endif + #if _IS_EXT(79) + _WCASE(79); + #endif + #if _IS_EXT(80) + _WCASE(80); + #endif + #if _IS_EXT(81) + _WCASE(81); + #endif + #if _IS_EXT(82) + _WCASE(82); + #endif + #if _IS_EXT(83) + _WCASE(83); + #endif + #if _IS_EXT(84) + _WCASE(84); + #endif + #if _IS_EXT(85) + _WCASE(85); + #endif + #if _IS_EXT(86) + _WCASE(86); + #endif + #if _IS_EXT(87) + _WCASE(87); + #endif + #if _IS_EXT(88) + _WCASE(88); + #endif + #if _IS_EXT(89) + _WCASE(89); + #endif + #if _IS_EXT(90) + _WCASE(90); + #endif + #if _IS_EXT(91) + _WCASE(91); + #endif + #if _IS_EXT(92) + _WCASE(92); + #endif + #if _IS_EXT(93) + _WCASE(93); + #endif + #if _IS_EXT(94) + _WCASE(94); + #endif + #if _IS_EXT(95) + _WCASE(95); + #endif + #if _IS_EXT(96) + _WCASE(96); + #endif + #if _IS_EXT(97) + _WCASE(97); + #endif + #if _IS_EXT(98) + _WCASE(98); + #endif + #if _IS_EXT(99) + _WCASE(99); + #endif + #if _IS_EXT(100) + _WCASE(100); + #endif + } +} + +uint8_t extDigitalRead(const int8_t pin) { + #define _RCASE(N) case N: return READ(N) + switch (pin) { + default: return digitalRead(pin); + #if _IS_EXT(70) + _RCASE(70); + #endif + #if _IS_EXT(71) + _RCASE(71); + #endif + #if _IS_EXT(72) + _RCASE(72); + #endif + #if _IS_EXT(73) + _RCASE(73); + #endif + #if _IS_EXT(74) + _RCASE(74); + #endif + #if _IS_EXT(75) + _RCASE(75); + #endif + #if _IS_EXT(76) + _RCASE(76); + #endif + #if _IS_EXT(77) + _RCASE(77); + #endif + #if _IS_EXT(78) + _RCASE(78); + #endif + #if _IS_EXT(79) + _RCASE(79); + #endif + #if _IS_EXT(80) + _RCASE(80); + #endif + #if _IS_EXT(81) + _RCASE(81); + #endif + #if _IS_EXT(82) + _RCASE(82); + #endif + #if _IS_EXT(83) + _RCASE(83); + #endif + #if _IS_EXT(84) + _RCASE(84); + #endif + #if _IS_EXT(85) + _RCASE(85); + #endif + #if _IS_EXT(86) + _RCASE(86); + #endif + #if _IS_EXT(87) + _RCASE(87); + #endif + #if _IS_EXT(88) + _RCASE(88); + #endif + #if _IS_EXT(89) + _RCASE(89); + #endif + #if _IS_EXT(90) + _RCASE(90); + #endif + #if _IS_EXT(91) + _RCASE(91); + #endif + #if _IS_EXT(92) + _RCASE(92); + #endif + #if _IS_EXT(93) + _RCASE(93); + #endif + #if _IS_EXT(94) + _RCASE(94); + #endif + #if _IS_EXT(95) + _RCASE(95); + #endif + #if _IS_EXT(96) + _RCASE(96); + #endif + #if _IS_EXT(97) + _RCASE(97); + #endif + #if _IS_EXT(98) + _RCASE(98); + #endif + #if _IS_EXT(99) + _RCASE(99); + #endif + #if _IS_EXT(100) + _RCASE(100); + #endif + } +} + +#endif // FASTIO_EXT_START +#endif // __AVR__ diff --git a/Marlin/src/HAL/HAL_AVR/fastio_AVR.h b/Marlin/src/HAL/HAL_AVR/fastio_AVR.h index 1e1e4108fa..a843f1ae75 100644 --- a/Marlin/src/HAL/HAL_AVR/fastio_AVR.h +++ b/Marlin/src/HAL/HAL_AVR/fastio_AVR.h @@ -30,7 +30,7 @@ #include #include "../../core/macros.h" -#define AVR_AT90USB1286_FAMILY (defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1286P__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB646P__) || defined(__AVR_AT90USB647__)) +#define AVR_AT90USB1286_FAMILY (defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1286P__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB646P__) || defined(__AVR_AT90USB647__)) #define AVR_ATmega1284_FAMILY (defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__) || defined(__AVR_ATmega1284P__)) #define AVR_ATmega2560_FAMILY (defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)) #define AVR_ATmega2561_FAMILY (defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)) @@ -81,9 +81,18 @@ #define _SET_INPUT(IO) CBI(DIO ## IO ## _DDR, DIO ## IO ## _PIN) #define _SET_OUTPUT(IO) SBI(DIO ## IO ## _DDR, DIO ## IO ## _PIN) -#define _GET_INPUT(IO) !TEST(DIO ## IO ## _DDR, DIO ## IO ## _PIN) -#define _GET_OUTPUT(IO) TEST(DIO ## IO ## _DDR, DIO ## IO ## _PIN) -#define _GET_TIMER(IO) DIO ## IO ## _PWM +#define _IS_INPUT(IO) !TEST(DIO ## IO ## _DDR, DIO ## IO ## _PIN) +#define _IS_OUTPUT(IO) TEST(DIO ## IO ## _DDR, DIO ## IO ## _PIN) +#define _HAS_TIMER(IO) DIO ## IO ## _PWM + +// digitalRead/Write wrappers +#ifdef FASTIO_EXT_START + void extDigitalWrite(const int8_t pin, const uint8_t state); + uint8_t extDigitalRead(const int8_t pin); +#else + #define extDigitalWrite(IO,V) digitalWrite(IO,V) + #define extDigitalRead(IO) digitalRead(IO) +#endif #define READ(IO) _READ(IO) #define WRITE(IO,V) _WRITE(IO,V) @@ -93,9 +102,11 @@ #define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _WRITE(IO, HIGH); }while(0) #define SET_OUTPUT(IO) _SET_OUTPUT(IO) -#define GET_INPUT(IO) _GET_INPUT(IO) -#define GET_OUTPUT(IO) _GET_OUTPUT(IO) -#define GET_TIMER(IO) _GET_TIMER(IO) +#define SET_PWM(IO) SET_OUTPUT(IO) + +#define IS_INPUT(IO) _IS_INPUT(IO) +#define IS_OUTPUT(IO) _IS_OUTPUT(IO) +#define HAS_TIMER(IO) _HAS_TIMER(IO) #define OUT_WRITE(IO,V) do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0) @@ -123,6 +134,18 @@ enum WaveGenMode : char { WGM_FAST_PWM_OCRnA // 15 COM OCnA }; +// Wavefore Generation Modes (Timer 2 only) +enum WaveGenMode2 : char { + WGM2_NORMAL, // 0 + WGM2_PWM_PC, // 1 + WGM2_CTC_OCR2A, // 2 + WGM2_FAST_PWM, // 3 + WGM2_reserved_1, // 4 + WGM2_PWM_PC_OCR2A, // 5 + WGM2_reserved_2, // 6 + WGM2_FAST_PWM_OCR2A, // 7 +}; + // Compare Modes enum CompareMode : char { COM_NORMAL, // 0 @@ -177,6 +200,11 @@ enum ClockSource2 : char { TCCR##T##B = (TCCR##T##B & ~(0x3 << WGM##T##2)) | (((int(V) >> 2) & 0x3) << WGM##T##2); \ }while(0) #define SET_WGM(T,V) _SET_WGM(T,WGM_##V) +// Runtime (see set_pwm_frequency): +#define _SET_WGMnQ(TCCRnQ, V) do{ \ + *(TCCRnQ)[0] = (*(TCCRnQ)[0] & ~(0x3 << 0)) | (( int(V) & 0x3) << 0); \ + *(TCCRnQ)[1] = (*(TCCRnQ)[1] & ~(0x3 << 3)) | (((int(V) >> 2) & 0x3) << 3); \ + }while(0) // Set Clock Select bits // Ex: SET_CS3(PRESCALER_64); @@ -202,6 +230,10 @@ enum ClockSource2 : char { #define SET_CS4(V) _SET_CS4(CS_##V) #define SET_CS5(V) _SET_CS5(CS_##V) #define SET_CS(T,V) SET_CS##T(V) +// Runtime (see set_pwm_frequency) +#define _SET_CSn(TCCRnQ, V) do{ \ + (*(TCCRnQ)[1] = (*(TCCRnQ[1]) & ~(0x7 << 0)) | ((int(V) & 0x7) << 0)); \ + }while(0) // Set Compare Mode bits // Ex: SET_COMS(4,CLEAR_SET,CLEAR_SET,CLEAR_SET); @@ -211,6 +243,22 @@ enum ClockSource2 : char { #define SET_COMB(T,V) SET_COM(T,B,V) #define SET_COMC(T,V) SET_COM(T,C,V) #define SET_COMS(T,V1,V2,V3) do{ SET_COMA(T,V1); SET_COMB(T,V2); SET_COMC(T,V3); }while(0) +// Runtime (see set_pwm_duty) +#define _SET_COMnQ(TCCRnQ, Q, V) do{ \ + (*(TCCRnQ)[0] = (*(TCCRnQ)[0] & ~(0x3 << (6-2*(Q)))) | (int(V) << (6-2*(Q)))); \ + }while(0) + +// Set OCRnQ register +// Runtime (see set_pwm_duty): +#define _SET_OCRnQ(OCRnQ, Q, V) do{ \ + (*(OCRnQ)[(Q)] = (0x0000) | (int(V) & 0xFFFF)); \ + }while(0) + +// Set ICRn register (one per timer) +// Runtime (see set_pwm_frequency) +#define _SET_ICRn(ICRn, V) do{ \ + (*(ICRn) = (0x0000) | (int(V) & 0xFFFF)); \ + }while(0) // Set Noise Canceler bit // Ex: SET_ICNC(2,1) @@ -227,86 +275,83 @@ enum ClockSource2 : char { #define SET_FOCB(T,V) SET_FOC(T,B,V) #define SET_FOCC(T,V) SET_FOC(T,C,V) - /** * PWM availability macros */ // Determine which harware PWMs are already in use #if PIN_EXISTS(CONTROLLER_FAN) - #define PWM_CHK_FAN_B(p) (p == CONTROLLER_FAN_PIN || p == E0_AUTO_FAN_PIN || p == E1_AUTO_FAN_PIN || p == E2_AUTO_FAN_PIN || p == E3_AUTO_FAN_PIN || p == E4_AUTO_FAN_PIN || p == CHAMBER_AUTO_FAN_PIN) + #define PWM_CHK_FAN_B(P) (P == CONTROLLER_FAN_PIN || P == E0_AUTO_FAN_PIN || P == E1_AUTO_FAN_PIN || P == E2_AUTO_FAN_PIN || P == E3_AUTO_FAN_PIN || P == E4_AUTO_FAN_PIN || P == E5_AUTO_FAN_PIN || P == CHAMBER_AUTO_FAN_PIN) #else - #define PWM_CHK_FAN_B(p) (p == E0_AUTO_FAN_PIN || p == E1_AUTO_FAN_PIN || p == E2_AUTO_FAN_PIN || p == E3_AUTO_FAN_PIN || p == E4_AUTO_FAN_PIN || p == CHAMBER_AUTO_FAN_PIN) + #define PWM_CHK_FAN_B(P) (P == E0_AUTO_FAN_PIN || P == E1_AUTO_FAN_PIN || P == E2_AUTO_FAN_PIN || P == E3_AUTO_FAN_PIN || P == E4_AUTO_FAN_PIN || P == E5_AUTO_FAN_PIN || P == CHAMBER_AUTO_FAN_PIN) #endif -#if PIN_EXISTS(FAN) || PIN_EXISTS(FAN1) || PIN_EXISTS(FAN2) +#if ANY_PIN(FAN, FAN1, FAN2) #if PIN_EXISTS(FAN2) - #define PWM_CHK_FAN_A(p) (p == FAN_PIN || p == FAN1_PIN || p == FAN2_PIN) + #define PWM_CHK_FAN_A(P) (P == FAN_PIN || P == FAN1_PIN || P == FAN2_PIN) #elif PIN_EXISTS(FAN1) - #define PWM_CHK_FAN_A(p) (p == FAN_PIN || p == FAN1_PIN) + #define PWM_CHK_FAN_A(P) (P == FAN_PIN || P == FAN1_PIN) #else - #define PWM_CHK_FAN_A(p) (p == FAN_PIN) + #define PWM_CHK_FAN_A(P) (P == FAN_PIN) #endif #else - #define PWM_CHK_FAN_A(p) false + #define PWM_CHK_FAN_A(P) false #endif #if HAS_MOTOR_CURRENT_PWM #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) - #define PWM_CHK_MOTOR_CURRENT(p) (p == MOTOR_CURRENT_PWM_E || p == MOTOR_CURRENT_PWM_Z || p == MOTOR_CURRENT_PWM_XY) + #define PWM_CHK_MOTOR_CURRENT(P) (P == MOTOR_CURRENT_PWM_E || P == MOTOR_CURRENT_PWM_Z || P == MOTOR_CURRENT_PWM_XY) #elif PIN_EXISTS(MOTOR_CURRENT_PWM_Z) - #define PWM_CHK_MOTOR_CURRENT(p) (p == MOTOR_CURRENT_PWM_E || p == MOTOR_CURRENT_PWM_Z) + #define PWM_CHK_MOTOR_CURRENT(P) (P == MOTOR_CURRENT_PWM_E || P == MOTOR_CURRENT_PWM_Z) #else - #define PWM_CHK_MOTOR_CURRENT(p) (p == MOTOR_CURRENT_PWM_E) + #define PWM_CHK_MOTOR_CURRENT(P) (P == MOTOR_CURRENT_PWM_E) #endif #else - #define PWM_CHK_MOTOR_CURRENT(p) false + #define PWM_CHK_MOTOR_CURRENT(P) false #endif #ifdef NUM_SERVOS #if AVR_ATmega2560_FAMILY - #define PWM_CHK_SERVO(p) (p == 5 || (NUM_SERVOS > 12 && p == 6) || (NUM_SERVOS > 24 && p == 46)) // PWMS 3A, 4A & 5A + #define PWM_CHK_SERVO(P) (P == 5 || (NUM_SERVOS > 12 && P == 6) || (NUM_SERVOS > 24 && P == 46)) // PWMS 3A, 4A & 5A #elif AVR_ATmega2561_FAMILY - #define PWM_CHK_SERVO(p) (p == 5) // PWM3A + #define PWM_CHK_SERVO(P) (P == 5) // PWM3A #elif AVR_ATmega1284_FAMILY - #define PWM_CHK_SERVO(p) false + #define PWM_CHK_SERVO(P) false #elif AVR_AT90USB1286_FAMILY - #define PWM_CHK_SERVO(p) (p == 16) // PWM3A + #define PWM_CHK_SERVO(P) (P == 16) // PWM3A #elif AVR_ATmega328_FAMILY - #define PWM_CHK_SERVO(p) false + #define PWM_CHK_SERVO(P) false #endif #else - #define PWM_CHK_SERVO(p) false + #define PWM_CHK_SERVO(P) false #endif #if ENABLED(BARICUDA) #if HAS_HEATER_1 && HAS_HEATER_2 - #define PWM_CHK_HEATER(p) (p == HEATER_1_PIN || p == HEATER_2_PIN) + #define PWM_CHK_HEATER(P) (P == HEATER_1_PIN || P == HEATER_2_PIN) #elif HAS_HEATER_1 - #define PWM_CHK_HEATER(p) (p == HEATER_1_PIN) + #define PWM_CHK_HEATER(P) (P == HEATER_1_PIN) #endif #else - #define PWM_CHK_HEATER(p) false + #define PWM_CHK_HEATER(P) false #endif -#define PWM_CHK(p) (PWM_CHK_HEATER(p) || PWM_CHK_SERVO(p) || PWM_CHK_MOTOR_CURRENT(p)\ - || PWM_CHK_FAN_A(p) || PWM_CHK_FAN_B(p)) +#define PWM_CHK(P) (PWM_CHK_HEATER(P) || PWM_CHK_SERVO(P) || PWM_CHK_MOTOR_CURRENT(P) || PWM_CHK_FAN_A(P) || PWM_CHK_FAN_B(P)) // define which hardware PWMs are available for the current CPU // all timer 1 PWMS deleted from this list because they are never available #if AVR_ATmega2560_FAMILY - #define PWM_PINS(p) ((p >= 2 && p <= 10) || p == 13 || p == 44 || p == 45 || p == 46) + #define PWM_PIN(P) ((P >= 2 && P <= 10) || P == 13 || P == 44 || P == 45 || P == 46) #elif AVR_ATmega2561_FAMILY - #define PWM_PINS(p) ((p >= 2 && p <= 6) || p == 9) + #define PWM_PIN(P) ((P >= 2 && P <= 6) || P == 9) #elif AVR_ATmega1284_FAMILY - #define PWM_PINS(p) (p == 3 || p == 4 || p == 14 || p == 15) + #define PWM_PIN(P) (P == 3 || P == 4 || P == 14 || P == 15) #elif AVR_AT90USB1286_FAMILY - #define PWM_PINS(p) (p == 0 || p == 1 || p == 14 || p == 15 || p == 16 || p == 24) + #define PWM_PIN(P) (P == 0 || P == 1 || P == 14 || P == 15 || P == 16 || P == 24) #elif AVR_ATmega328_FAMILY - #define PWM_PINS(p) (p == 3 || p == 5 || p == 6 || p == 11) + #define PWM_PIN(P) (P == 3 || P == 5 || P == 6 || P == 11) #else #error "unknown CPU" #endif -// 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)) +#define USEABLE_HARDWARE_PWM(P) (PWM_PIN(P) && !PWM_CHK(P)) diff --git a/Marlin/src/HAL/HAL_AVR/persistent_store_eeprom.cpp b/Marlin/src/HAL/HAL_AVR/persistent_store_eeprom.cpp index 25feab3124..4c2f9ea4f1 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) || ENABLED(SD_FIRMWARE_UPDATE) +#if EITHER(EEPROM_SETTINGS, SD_FIRMWARE_UPDATE) #include "../shared/persistent_store_api.h" diff --git a/Marlin/src/HAL/HAL_AVR/pinsDebug_Teensyduino.h b/Marlin/src/HAL/HAL_AVR/pinsDebug_Teensyduino.h index 3aedaffddd..e97d694bb0 100644 --- a/Marlin/src/HAL/HAL_AVR/pinsDebug_Teensyduino.h +++ b/Marlin/src/HAL/HAL_AVR/pinsDebug_Teensyduino.h @@ -105,7 +105,7 @@ const uint8_t PROGMEM digital_pin_to_port_PGM[] = { // digitalPinToBitMask(pin) is OK -#define digitalRead_mod(p) digitalRead(p) // Teensyduino's version of digitalRead doesn't - // disable the PWMs so we can use it as is +#define digitalRead_mod(p) extDigitalRead(p) // Teensyduino's version of digitalRead doesn't + // disable the PWMs so we can use it as is // portModeRegister(pin) is OK diff --git a/Marlin/src/HAL/HAL_AVR/servo_AVR.cpp b/Marlin/src/HAL/HAL_AVR/servo_AVR.cpp index 96ccf013f9..e3d2194bf7 100644 --- a/Marlin/src/HAL/HAL_AVR/servo_AVR.cpp +++ b/Marlin/src/HAL/HAL_AVR/servo_AVR.cpp @@ -73,14 +73,14 @@ static inline void handle_interrupts(timer16_Sequence_t timer, volatile uint16_t *TCNTn = 0; // 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 + extDigitalWrite(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) { *OCRnA = *TCNTn + SERVO(timer, Channel[timer]).ticks; if (SERVO(timer, Channel[timer]).Pin.isActive) // check if activated - digitalWrite(SERVO(timer, Channel[timer]).Pin.nbr, HIGH); // it's an active channel so pulse it high + extDigitalWrite(SERVO(timer, Channel[timer]).Pin.nbr, HIGH); // it's 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/EepromEmulation_Due.cpp b/Marlin/src/HAL/HAL_DUE/EepromEmulation_Due.cpp index e560570148..21f1a8c9d4 100644 --- a/Marlin/src/HAL/HAL_DUE/EepromEmulation_Due.cpp +++ b/Marlin/src/HAL/HAL_DUE/EepromEmulation_Due.cpp @@ -34,7 +34,7 @@ #include "../shared/persistent_store_api.h" #include "../../inc/MarlinConfig.h" -#if ENABLED(EEPROM_SETTINGS) && DISABLED(I2C_EEPROM) && DISABLED(SPI_EEPROM) +#if ENABLED(EEPROM_SETTINGS) && DISABLED(I2C_EEPROM, SPI_EEPROM) #include @@ -997,5 +997,5 @@ void eeprom_flush(void) { ee_Flush(); } -#endif // ENABLED(EEPROM_SETTINGS) && DISABLED(I2C_EEPROM) && DISABLED(SPI_EEPROM) +#endif // EEPROM_SETTINGS && (!I2C_EEPROM && !SPI_EEPROM) #endif // ARDUINO_ARCH_AVR diff --git a/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.cpp b/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.cpp index aba3b3270a..9d2233d914 100644 --- a/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.cpp +++ b/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.cpp @@ -63,8 +63,8 @@ const tTimerConfig TimerConfig [NUM_HARDWARE_TIMERS] = { { TC0, 0, TC0_IRQn, 3}, // 0 - [servo timer5] { TC0, 1, TC1_IRQn, 0}, // 1 - { TC0, 2, TC2_IRQn, 0}, // 2 - { TC1, 0, TC3_IRQn, 2}, // 3 - stepper + { TC0, 2, TC2_IRQn, 2}, // 2 - stepper + { TC1, 0, TC3_IRQn, 0}, // 3 { TC1, 1, TC4_IRQn, 15}, // 4 - temperature { TC1, 2, TC5_IRQn, 3}, // 5 - [servo timer3] { TC2, 0, TC6_IRQn, 14}, // 6 - tone diff --git a/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h b/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h index 7e88835500..a2676e0875 100644 --- a/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h +++ b/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h @@ -43,7 +43,7 @@ typedef uint32_t hal_timer_t; #define HAL_TIMER_RATE ((F_CPU) / 2) // frequency of timers peripherals -#define STEP_TIMER_NUM 3 // index of timer to use for stepper +#define STEP_TIMER_NUM 2 // index of timer to use for stepper #define TEMP_TIMER_NUM 4 // index of timer to use for temperature #define PULSE_TIMER_NUM STEP_TIMER_NUM #define TONE_TIMER_NUM 6 // index of timer to use for beeper tones @@ -65,9 +65,9 @@ typedef uint32_t hal_timer_t; #define ENABLE_TEMPERATURE_INTERRUPT() HAL_timer_enable_interrupt(TEMP_TIMER_NUM) #define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM) -#define HAL_STEP_TIMER_ISR void TC3_Handler() -#define HAL_TEMP_TIMER_ISR void TC4_Handler() -#define HAL_TONE_TIMER_ISR void TC6_Handler() +#define HAL_STEP_TIMER_ISR() void TC2_Handler() +#define HAL_TEMP_TIMER_ISR() void TC4_Handler() +#define HAL_TONE_TIMER_ISR() void TC6_Handler() // -------------------------------------------------------------------------- // Types diff --git a/Marlin/src/HAL/HAL_DUE/SanityCheck.h b/Marlin/src/HAL/HAL_DUE/SanityCheck.h index a399bbf13d..30a5d72b25 100644 --- a/Marlin/src/HAL/HAL_DUE/SanityCheck.h +++ b/Marlin/src/HAL/HAL_DUE/SanityCheck.h @@ -50,3 +50,7 @@ #error "DUE software SPI is required but is incompatible with TMC2130 hardware SPI. Enable TMC_USE_SW_SPI to fix." #endif #endif + +#if ENABLED(FAST_PWM_FAN) + #error "FAST_PWM_FAN is not yet implemented for this platform." +#endif diff --git a/Marlin/src/HAL/HAL_DUE/Servo_Due.cpp b/Marlin/src/HAL/HAL_DUE/Servo_Due.cpp index 13a858a429..848d263b70 100644 --- a/Marlin/src/HAL/HAL_DUE/Servo_Due.cpp +++ b/Marlin/src/HAL/HAL_DUE/Servo_Due.cpp @@ -77,13 +77,13 @@ void Servo_Handler(timer16_Sequence_t timer, Tc *tc, uint8_t channel) { 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 + extDigitalWrite(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 + extDigitalWrite(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 aa4d7a0126..292be1401f 100644 --- a/Marlin/src/HAL/HAL_DUE/Tone.cpp +++ b/Marlin/src/HAL/HAL_DUE/Tone.cpp @@ -42,16 +42,16 @@ void tone(const pin_t _pin, const unsigned int frequency, const unsigned long du void noTone(const pin_t _pin) { HAL_timer_disable_interrupt(TONE_TIMER_NUM); - digitalWrite(_pin, LOW); + extDigitalWrite(_pin, LOW); } -HAL_TONE_TIMER_ISR { +HAL_TONE_TIMER_ISR() { static uint8_t pin_state = 0; HAL_timer_isr_prologue(TONE_TIMER_NUM); if (toggles) { toggles--; - digitalWrite(tone_pin, (pin_state ^= 1)); + extDigitalWrite(tone_pin, (pin_state ^= 1)); } else noTone(tone_pin); // turn off interrupt } diff --git a/Marlin/src/HAL/HAL_DUE/fastio_Due.h b/Marlin/src/HAL/HAL_DUE/fastio_Due.h index 02c1a1c5d6..542469f65e 100644 --- a/Marlin/src/HAL/HAL_DUE/fastio_Due.h +++ b/Marlin/src/HAL/HAL_DUE/fastio_Due.h @@ -45,7 +45,8 @@ // 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) WITHIN(p, 2, 13) +#define PWM_PIN(P) WITHIN(P, 2, 13) +#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P) #ifndef MASK #define MASK(PIN) (1 << PIN) @@ -81,8 +82,6 @@ // Toggle a pin #define _TOGGLE(IO) _WRITE(IO, !READ(IO)) -#include - #if MB(PRINTRBOARD_G2) #include "G2_pins.h" @@ -156,34 +155,40 @@ #endif // Set pin as input with pullup mode -#define _PULLUP(IO,V) pinMode(IO, (V) ? INPUT_PULLUP : INPUT) +#define _PULLUP(IO,V) pinMode(IO, (V) ? INPUT_PULLUP : INPUT) // Read a pin (wrapper) -#define READ(IO) _READ(IO) +#define READ(IO) _READ(IO) // Write to a pin (wrapper) -#define WRITE_VAR(IO,V) _WRITE_VAR(IO,V) -#define WRITE(IO,V) _WRITE(IO,V) +#define WRITE_VAR(IO,V) _WRITE_VAR(IO,V) +#define WRITE(IO,V) _WRITE(IO,V) // Toggle a pin (wrapper) -#define TOGGLE(IO) _TOGGLE(IO) +#define TOGGLE(IO) _TOGGLE(IO) // Set pin as input (wrapper) -#define SET_INPUT(IO) _SET_INPUT(IO) +#define SET_INPUT(IO) _SET_INPUT(IO) // Set pin as input with pullup (wrapper) #define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0) // Set pin as output (wrapper) - reads the pin and sets the output to that value -#define SET_OUTPUT(IO) _SET_OUTPUT(IO) +#define SET_OUTPUT(IO) _SET_OUTPUT(IO) +// Set pin as PWM +#define SET_PWM(IO) SET_OUTPUT(IO) // Check if pin is an input -#define GET_INPUT(IO) !(digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) +#define IS_INPUT(IO) ((digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) == 0) // Check if pin is an output -#define GET_OUTPUT(IO) !!(digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) +#define IS_OUTPUT(IO) ((digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) != 0) // Check if pin is a timer - Must be a constexpr -#define GET_TIMER(IO) ((IO) >= 2 && (IO) <= 13) +#define HAS_TIMER(IO) ((IO) >= 2 && (IO) <= 13) // Shorthand -#define OUT_WRITE(IO,V) { SET_OUTPUT(IO); WRITE(IO,V); } +#define OUT_WRITE(IO,V) { SET_OUTPUT(IO); WRITE(IO,V); } + +// digitalRead/Write wrappers +#define extDigitalRead(IO) digitalRead(IO) +#define extDigitalWrite(IO,V) digitalWrite(IO,V) /** * Ports and functions diff --git a/Marlin/src/HAL/HAL_DUE/persistent_store_eeprom.cpp b/Marlin/src/HAL/HAL_DUE/persistent_store_eeprom.cpp index 648f6304ec..4d788acae6 100644 --- a/Marlin/src/HAL/HAL_DUE/persistent_store_eeprom.cpp +++ b/Marlin/src/HAL/HAL_DUE/persistent_store_eeprom.cpp @@ -29,7 +29,7 @@ #include "../../inc/MarlinConfig.h" #include "../shared/persistent_store_api.h" -#if DISABLED(I2C_EEPROM) && DISABLED(SPI_EEPROM) +#if DISABLED(I2C_EEPROM, SPI_EEPROM) #define E2END 0xFFF // Default to Flash emulated EEPROM size (EepromEmulation_Due.cpp) #endif @@ -38,7 +38,7 @@ extern void eeprom_flush(void); bool PersistentStore::access_start() { return true; } bool PersistentStore::access_finish() { - #if DISABLED(I2C_EEPROM) && DISABLED(SPI_EEPROM) + #if DISABLED(I2C_EEPROM, SPI_EEPROM) eeprom_flush(); #endif return true; diff --git a/Marlin/src/HAL/HAL_DUE/pinsDebug.h b/Marlin/src/HAL/HAL_DUE/pinsDebug.h index c1832d9ac5..9d86577052 100644 --- a/Marlin/src/HAL/HAL_DUE/pinsDebug.h +++ b/Marlin/src/HAL/HAL_DUE/pinsDebug.h @@ -63,7 +63,7 @@ #define NUMBER_PINS_TOTAL PINS_COUNT -#define digitalRead_mod(p) digitalRead(p) // AVR digitalRead disabled PWM before it read the pin +#define digitalRead_mod(p) extDigitalRead(p) // AVR digitalRead disabled PWM before it read the pin #define PRINT_PORT(p) #define NAME_FORMAT(p) PSTR("%-##p##s") #define PRINT_ARRAY_NAME(x) do {sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer);} while (0) diff --git a/Marlin/src/HAL/HAL_ESP32/FlushableHardwareSerial.cpp b/Marlin/src/HAL/HAL_ESP32/FlushableHardwareSerial.cpp new file mode 100644 index 0000000000..2d99792d21 --- /dev/null +++ b/Marlin/src/HAL/HAL_ESP32/FlushableHardwareSerial.cpp @@ -0,0 +1,33 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "FlushableHardwareSerial.h" + +#ifdef ARDUINO_ARCH_ESP32 + +FlushableHardwareSerial::FlushableHardwareSerial(int uart_nr) + : HardwareSerial(uart_nr) +{} + +FlushableHardwareSerial flushableSerial(0); + +#endif // ARDUINO_ARCH_ESP32 diff --git a/Marlin/src/HAL/HAL_ESP32/FlushableHardwareSerial.h b/Marlin/src/HAL/HAL_ESP32/FlushableHardwareSerial.h new file mode 100644 index 0000000000..082fa7df04 --- /dev/null +++ b/Marlin/src/HAL/HAL_ESP32/FlushableHardwareSerial.h @@ -0,0 +1,36 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#ifdef ARDUINO_ARCH_ESP32 + +#include + +class FlushableHardwareSerial : public HardwareSerial { +public: + FlushableHardwareSerial(int uart_nr); + + inline void flushTX(void) { /* No need to flush the hardware serial, but defined here for compatibility. */ } +}; + +extern FlushableHardwareSerial flushableSerial; + +#endif // ARDUINO_ARCH_ESP32 diff --git a/Marlin/src/HAL/HAL_ESP32/HAL.cpp b/Marlin/src/HAL/HAL_ESP32/HAL.cpp index 1ef2798553..5e281f2ef3 100644 --- a/Marlin/src/HAL/HAL_ESP32/HAL.cpp +++ b/Marlin/src/HAL/HAL_ESP32/HAL.cpp @@ -34,7 +34,17 @@ #include "../../inc/MarlinConfigPre.h" #if ENABLED(WIFISUPPORT) - #include "ota.h" + #include + #include "wifi.h" + #if ENABLED(OTASUPPORT) + #include "ota.h" + #endif + #if ENABLED(WEBSUPPORT) + #include "web.h" + #include "spiffs.h" + #endif +#elif ENABLED(EEPROM_SETTINGS) + #include "spiffs.h" #endif // -------------------------------------------------------------------------- @@ -83,14 +93,24 @@ esp_adc_cal_characteristics_t characteristics; void HAL_init(void) { #if ENABLED(WIFISUPPORT) - OTA_init(); + wifi_init(); + #if ENABLED(OTASUPPORT) + OTA_init(); + #endif + #if ENABLED(WEBSUPPORT) + spiffs_init(); + web_init(); + #endif + server.begin(); + #elif ENABLED(EEPROM_SETTINGS) + spiffs_init(); #endif i2s_init(); } void HAL_idletask(void) { - #if ENABLED(WIFISUPPORT) + #if ENABLED(OTASUPPORT) OTA_handle(); #endif } diff --git a/Marlin/src/HAL/HAL_ESP32/HAL.h b/Marlin/src/HAL/HAL_ESP32/HAL.h index e1249c71ee..a291458b33 100644 --- a/Marlin/src/HAL/HAL_ESP32/HAL.h +++ b/Marlin/src/HAL/HAL_ESP32/HAL.h @@ -36,7 +36,7 @@ #include #undef DISABLED -#define DISABLED(b) (!_CAT(SWITCH_ENABLED_, b)) +#define DISABLED(V...) DO(DIS,&&,V) #include "../shared/math_32bit.h" #include "../shared/HAL_SPI.h" @@ -47,14 +47,23 @@ #include "HAL_timers_ESP32.h" +#include "WebSocketSerial.h" +#include "FlushableHardwareSerial.h" + // -------------------------------------------------------------------------- // Defines // -------------------------------------------------------------------------- extern portMUX_TYPE spinlock; -#define NUM_SERIAL 1 -#define MYSERIAL0 Serial +#define MYSERIAL0 flushableSerial + +#if ENABLED(WIFISUPPORT) + #define NUM_SERIAL 2 + #define MYSERIAL1 webSocketSerial +#else + #define NUM_SERIAL 1 +#endif #define CRITICAL_SECTION_START portENTER_CRITICAL(&spinlock) #define CRITICAL_SECTION_END portEXIT_CRITICAL(&spinlock) diff --git a/Marlin/src/HAL/HAL_ESP32/HAL_spi_ESP32.cpp b/Marlin/src/HAL/HAL_ESP32/HAL_spi_ESP32.cpp index 7beb9b4991..d48b14d610 100644 --- a/Marlin/src/HAL/HAL_ESP32/HAL_spi_ESP32.cpp +++ b/Marlin/src/HAL/HAL_ESP32/HAL_spi_ESP32.cpp @@ -44,6 +44,15 @@ static SPISettings spiConfig; // Public functions // -------------------------------------------------------------------------- +#if ENABLED(SOFTWARE_SPI) + + // -------------------------------------------------------------------------- + // Software SPI + // -------------------------------------------------------------------------- + #error "Software SPI not supported for ESP32. Use Hardware SPI." + +#else + // -------------------------------------------------------------------------- // Hardware SPI // -------------------------------------------------------------------------- @@ -61,13 +70,14 @@ void spiInit(uint8_t spiRate) { uint32_t clock; switch (spiRate) { - case SPI_FULL_SPEED: clock = SPI_CLOCK_DIV2; break; - case SPI_HALF_SPEED: clock = SPI_CLOCK_DIV4; break; - case SPI_QUARTER_SPEED: clock = SPI_CLOCK_DIV8; break; - case SPI_EIGHTH_SPEED: clock = SPI_CLOCK_DIV16; break; - case SPI_SPEED_5: clock = SPI_CLOCK_DIV32; break; - case SPI_SPEED_6: clock = SPI_CLOCK_DIV64; break; - default: clock = SPI_CLOCK_DIV2; // Default from the SPI library + case SPI_FULL_SPEED: clock = 16000000; break; + case SPI_HALF_SPEED: clock = 8000000; break; + case SPI_QUARTER_SPEED: clock = 4000000; break; + case SPI_EIGHTH_SPEED: clock = 2000000; break; + case SPI_SIXTEENTH_SPEED: clock = 1000000; break; + case SPI_SPEED_5: clock = 500000; break; + case SPI_SPEED_6: clock = 250000; break; + default: clock = 1000000; // Default from the SPI library } spiConfig = SPISettings(clock, MSBFIRST, SPI_MODE0); @@ -106,4 +116,6 @@ void spiBeginTransaction(uint32_t spiClock, uint8_t bitOrder, uint8_t dataMode) SPI.beginTransaction(spiConfig); } +#endif // !SOFTWARE_SPI + #endif // ARDUINO_ARCH_ESP32 diff --git a/Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.h b/Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.h index 60b6dcfa84..7fbaa5222d 100644 --- a/Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.h +++ b/Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.h @@ -69,8 +69,8 @@ typedef uint64_t hal_timer_t; #define ENABLE_TEMPERATURE_INTERRUPT() HAL_timer_enable_interrupt(TEMP_TIMER_NUM) #define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM) -#define HAL_TEMP_TIMER_ISR extern "C" void tempTC_Handler(void) -#define HAL_STEP_TIMER_ISR extern "C" void stepTC_Handler(void) +#define HAL_TEMP_TIMER_ISR() extern "C" void tempTC_Handler(void) +#define HAL_STEP_TIMER_ISR() extern "C" void stepTC_Handler(void) extern "C" void tempTC_Handler(void); extern "C" void stepTC_Handler(void); diff --git a/Marlin/src/HAL/HAL_ESP32/SanityCheck.h b/Marlin/src/HAL/HAL_ESP32/SanityCheck.h index 23b3fbe026..f911d84ce0 100644 --- a/Marlin/src/HAL/HAL_ESP32/SanityCheck.h +++ b/Marlin/src/HAL/HAL_ESP32/SanityCheck.h @@ -23,3 +23,7 @@ #if ENABLED(EMERGENCY_PARSER) #error "EMERGENCY_PARSER is not yet implemented for ESP32. Disable EMERGENCY_PARSER to continue." #endif + +#if ENABLED(FAST_PWM_FAN) + #error "FAST_PWM_FAN is not yet implemented for this platform." +#endif diff --git a/Marlin/src/HAL/HAL_ESP32/WebSocketSerial.cpp b/Marlin/src/HAL/HAL_ESP32/WebSocketSerial.cpp new file mode 100644 index 0000000000..4858ba4c3e --- /dev/null +++ b/Marlin/src/HAL/HAL_ESP32/WebSocketSerial.cpp @@ -0,0 +1,234 @@ +/** + * 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_ESP32 + +#include "../../inc/MarlinConfig.h" + +#if ENABLED(WIFISUPPORT) + +#include "WebSocketSerial.h" + +extern WebSocketSerial webSocketSerial; + +#include "wifi.h" +#include +#include + +struct ring_buffer_r { + unsigned char buffer[RX_BUFFER_SIZE]; + volatile ring_buffer_pos_t head, tail; +}; + +struct ring_buffer_t { + unsigned char buffer[256]; + volatile uint8_t head, tail; +}; + +ring_buffer_r rx_buffer = { { 0 }, 0, 0 }; +ring_buffer_t tx_buffer = { { 0 }, 0, 0 }; + +static bool _written; + +#if ENABLED(EMERGENCY_PARSER) + static EmergencyParser::State emergency_state; // = EP_RESET +#endif + +AsyncWebSocket ws("/ws"); // access at ws://[esp ip]/ws + +FORCE_INLINE int next_rx_index(const int i) { return (ring_buffer_pos_t)(i + 1) & (ring_buffer_pos_t)(RX_BUFFER_SIZE - 1); } +FORCE_INLINE int next_tx_index(const int i) { return (ring_buffer_pos_t)(i + 1) & (ring_buffer_pos_t)(TX_BUFFER_SIZE - 1); } + +static void addToBuffer(uint8_t * const data, const size_t len) { + for (size_t i = 0; i < len; i++) { + ring_buffer_pos_t h = rx_buffer.head; + const ring_buffer_pos_t t = rx_buffer.tail, n = next_rx_index(h); + + if (n != t) { rx_buffer.buffer[h] = data[i]; h = n; } + + // TODO: buffer is full, handle? + + rx_buffer.head = h; + } +} + +// Handle WebSocket event +static void onEvent(AsyncWebSocket * server, AsyncWebSocketClient * client, AwsEventType type, void * arg, uint8_t *data, size_t len) { + switch (type) { + case WS_EVT_CONNECT: client->ping(); break; // client connected + case WS_EVT_DISCONNECT: // client disconnected + case WS_EVT_ERROR: // error was received from the other end + case WS_EVT_PONG: break; // pong message was received (in response to a ping request maybe) + case WS_EVT_DATA: { // data packet + AwsFrameInfo * info = (AwsFrameInfo*)arg; + if (info->opcode == WS_TEXT || info->message_opcode == WS_TEXT) + addToBuffer(data, len); + } + } +} + +// Public Methods +void WebSocketSerial::begin(const long baud_setting) { + ws.onEvent(onEvent); + server.addHandler(&ws); // attach AsyncWebSocket +} + +void WebSocketSerial::end() { } + +int WebSocketSerial::peek(void) { + const int v = rx_buffer.head == rx_buffer.tail ? -1 : rx_buffer.buffer[rx_buffer.tail]; + return v; +} + +int WebSocketSerial::read(void) { + const ring_buffer_pos_t h = rx_buffer.head, t = rx_buffer.tail; + if (h == t) return -1; // Nothing to read? Return now + + const int v = rx_buffer.buffer[t]; + + rx_buffer.tail = (ring_buffer_pos_t)(t + 1) & (RX_BUFFER_SIZE - 1); // Advance tail + + return v; +} + +bool WebSocketSerial::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); +} + +void WebSocketSerial::flush(void) { + ws.textAll("flush"); + rx_buffer.tail = rx_buffer.head; +} + +#if TX_BUFFER_SIZE + + void WebSocketSerial::write(const uint8_t c) { + _written = true; + + const uint8_t i = (tx_buffer.head + 1) & (TX_BUFFER_SIZE - 1); + + // Store new char. head is always safe to move + tx_buffer.buffer[tx_buffer.head] = c; + tx_buffer.head = i; + + if (c == '\n') { + ws.textAll(tx_buffer.buffer, tx_buffer.head); + tx_buffer.head = 0; + } + } + + void WebSocketSerial::flushTx(void) { + ws.textAll("flushTx"); + if (!_written) return; + } + +#else + + //void WebSocketSerial::write(const uint8_t c) { _written = true; } + //void WebSocketSerial::flushTx(void) { if (!_written) return; } + +#endif + +/** + * Imports from print.h + */ + +void WebSocketSerial::print(char c, int base) { print((long)c, base); } +void WebSocketSerial::print(unsigned char b, int base) { print((unsigned long)b, base); } +void WebSocketSerial::print(int n, int base) { print((long)n, base); } +void WebSocketSerial::print(unsigned int n, int base) { print((unsigned long)n, base); } +void WebSocketSerial::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 WebSocketSerial::print(unsigned long n, int base) { + if (base == 0) write(n); else printNumber(n, base); +} + +void WebSocketSerial::print(double n, int digits) { printFloat(n, digits); } + +void WebSocketSerial::println(void) { print('\r'); print('\n'); } +void WebSocketSerial::println(const String& s) { print(s); println(); } +void WebSocketSerial::println(const char c[]) { print(c); println(); } +void WebSocketSerial::println(char c, int base) { print(c, base); println(); } +void WebSocketSerial::println(unsigned char b, int base) { print(b, base); println(); } +void WebSocketSerial::println(int n, int base) { print(n, base); println(); } +void WebSocketSerial::println(unsigned int n, int base) { print(n, base); println(); } +void WebSocketSerial::println(long n, int base) { print(n, base); println(); } +void WebSocketSerial::println(unsigned long n, int base) { print(n, base); println(); } +void WebSocketSerial::println(double n, int digits) { print(n, digits); println(); } + +// Private Methods + +void WebSocketSerial::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 WebSocketSerial::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" + // Use a lookup table for performance + constexpr double rounds[] = { 0.5, 0.05, 0.005, 0.0005, 0.00005, 0.000005, 0.0000005, 0.00000005 }; + number += rounds[digits]; + + //number += pow(10, -(digits + 1)); // slower single-line equivalent + + // Extract the integer part of the number and print it + unsigned long int_part = (unsigned long)number; + print(int_part); + + // Print the decimal point, but only if there are digits beyond + double remainder = number - (double)int_part; + if (digits) { + print('.'); + // Extract digits from the remainder one at a time + while (digits--) { + remainder *= 10.0; + const int toPrint = int(remainder); + print(toPrint); + remainder -= toPrint; + } + } +} + +#endif // WIFISUPPORT +#endif // ARDUINO_ARCH_ESP32 diff --git a/Marlin/src/HAL/HAL_ESP32/WebSocketSerial.h b/Marlin/src/HAL/HAL_ESP32/WebSocketSerial.h new file mode 100644 index 0000000000..43c8044107 --- /dev/null +++ b/Marlin/src/HAL/HAL_ESP32/WebSocketSerial.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 + +#include "../../inc/MarlinConfig.h" + +#include + +#define DEC 10 +#define HEX 16 +#define OCT 8 +#define BIN 2 + +#ifndef RX_BUFFER_SIZE + #define RX_BUFFER_SIZE 128 +#endif +#ifndef TX_BUFFER_SIZE + #define TX_BUFFER_SIZE 32 +#endif +#if TX_BUFFER_SIZE <= 0 + #error "TX_BUFFER_SIZE is required for the WebSocket." +#endif + +#if RX_BUFFER_SIZE > 256 + typedef uint16_t ring_buffer_pos_t; +#else + typedef uint8_t ring_buffer_pos_t; +#endif + +class WebSocketSerial { +public: + WebSocketSerial() {}; + static void begin(const long); + static void end(); + static int peek(void); + static int read(void); + static void flush(void); + static void flushTx(void); + static bool available(void); + static void write(const uint8_t c); + + #if ENABLED(SERIAL_STATS_DROPPED_RX) + FORCE_INLINE static uint32_t dropped() { return 0; } + #endif + + #if ENABLED(SERIAL_STATS_MAX_RX_QUEUED) + FORCE_INLINE static int rxMaxEnqueued() { return 0; } + #endif + + 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++); } + FORCE_INLINE static void print(const String& s) { for (int i = 0; i < (int)s.length(); i++) write(s[i]); } + FORCE_INLINE static void print(const char* str) { write(str); } + + static void print(char, int = 0); + static void print(unsigned char, int = 0); + static void print(int, int = DEC); + static void print(unsigned int, int = DEC); + static void print(long, int = DEC); + static void print(unsigned long, int = DEC); + static void print(double, int = 2); + + static void println(const String& s); + static void println(const char[]); + static void println(char, int = 0); + static void println(unsigned char, int = 0); + static void println(int, int = DEC); + static void println(unsigned int, int = DEC); + static void println(long, int = DEC); + static void println(unsigned long, int = DEC); + static void println(double, int = 2); + static void println(void); + operator bool() { return true; } + +private: + static void printNumber(unsigned long, const uint8_t); + static void printFloat(double, uint8_t); +}; + +extern WebSocketSerial webSocketSerial; diff --git a/Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h b/Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h index abf7ba5f9b..dc2cd708de 100644 --- a/Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h +++ b/Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h @@ -28,30 +28,44 @@ */ // Set pin as input -#define _SET_INPUT(IO) pinMode(IO, INPUT) +#define _SET_INPUT(IO) pinMode(IO, INPUT) // Set pin as output -#define _SET_OUTPUT(IO) pinMode(IO, OUTPUT) +#define _SET_OUTPUT(IO) pinMode(IO, OUTPUT) // Set pin as input with pullup mode -#define _PULLUP(IO, v) pinMode(IO, v ? INPUT_PULLUP : INPUT) +#define _PULLUP(IO, v) pinMode(IO, v ? INPUT_PULLUP : INPUT) // Read a pin wrapper -#define READ(IO) digitalRead(IO) +#define READ(IO) digitalRead(IO) // Write to a pin wrapper -#define WRITE(IO, v) (TEST(IO, 7) ? i2s_write(IO & 0x7F, v) : digitalWrite(IO, v)) +#define WRITE(IO, v) (TEST(IO, 7) ? i2s_write(IO & 0x7F, v) : digitalWrite(IO, v)) // Set pin as input wrapper -#define SET_INPUT(IO) _SET_INPUT(IO) +#define SET_INPUT(IO) _SET_INPUT(IO) // Set pin as input with pullup wrapper -#define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0) +#define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0) // Set pin as output wrapper -#define SET_OUTPUT(IO) do{ _SET_OUTPUT(IO); WRITE(IO, LOW); }while(0) +#define SET_OUTPUT(IO) do{ _SET_OUTPUT(IO); }while(0) -#define OUT_WRITE(IO,V) do{ _SET_OUTPUT(IO); WRITE(IO,V); }while(0) +// Set pin as PWM +#define SET_PWM(IO) SET_OUTPUT(IO) + +// Set pin as output and init +#define OUT_WRITE(IO,V) do{ _SET_OUTPUT(IO); WRITE(IO,V); }while(0) + +// digitalRead/Write wrappers +#define extDigitalRead(IO) digitalRead(IO) +#define extDigitalWrite(IO,V) digitalWrite(IO,V) + +#define PWM_PIN(P) true +#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P) + +// Toggle pin value +#define TOGGLE(IO) WRITE(IO, !READ(IO)) // // Ports and functions diff --git a/Marlin/src/HAL/HAL_ESP32/ota.cpp b/Marlin/src/HAL/HAL_ESP32/ota.cpp index 52129ac92b..40ec1ab875 100644 --- a/Marlin/src/HAL/HAL_ESP32/ota.cpp +++ b/Marlin/src/HAL/HAL_ESP32/ota.cpp @@ -21,7 +21,7 @@ #include "../../inc/MarlinConfigPre.h" -#if ENABLED(WIFISUPPORT) +#if ENABLED(OTASUPPORT) #include #include @@ -30,15 +30,6 @@ #include "driver/timer.h" void OTA_init() { - WiFi.mode(WIFI_STA); - WiFi.begin(WIFI_SSID, WIFI_PWD); - - while (WiFi.waitForConnectResult() != WL_CONNECTED) { - Serial.println("Connection Failed! Rebooting..."); - delay(5000); - ESP.restart(); - } - ArduinoOTA .onStart([]() { timer_pause(TIMER_GROUP_0, TIMER_0); @@ -76,6 +67,6 @@ void OTA_handle() { ArduinoOTA.handle(); } -#endif // WIFISUPPORT +#endif // OTASUPPORT #endif // ARDUINO_ARCH_ESP32 diff --git a/Marlin/src/HAL/HAL_ESP32/persistent_store_spiffs.cpp b/Marlin/src/HAL/HAL_ESP32/persistent_store_spiffs.cpp new file mode 100644 index 0000000000..795edf6781 --- /dev/null +++ b/Marlin/src/HAL/HAL_ESP32/persistent_store_spiffs.cpp @@ -0,0 +1,93 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#ifdef ARDUINO_ARCH_ESP32 + +#include "../../inc/MarlinConfig.h" + +#if ENABLED(EEPROM_SETTINGS) && DISABLED(FLASH_EEPROM_EMULATION) + +#include "../shared/persistent_store_api.h" + +#include "SPIFFS.h" +#include "FS.h" +#include "spiffs.h" + +#define HAL_ESP32_EEPROM_SIZE 4096 + +File eeprom_file; + +bool PersistentStore::access_start() { + if (spiffs_initialized) { + eeprom_file = SPIFFS.open("/eeprom.dat", "r+"); + + size_t file_size = eeprom_file.size(); + if (file_size < HAL_ESP32_EEPROM_SIZE) { + bool write_ok = eeprom_file.seek(file_size); + + while (write_ok && file_size < HAL_ESP32_EEPROM_SIZE) { + write_ok = eeprom_file.write(0xFF) == 1; + file_size++; + } + } + return true; + } + return false; +} + +bool PersistentStore::access_finish() { + eeprom_file.close(); + return true; +} + +bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { + if (!eeprom_file.seek(pos)) return true; // return true for any error + if (eeprom_file.write(value, size) != size) return true; + + crc16(crc, value, size); + pos += size; + + return false; +} + +bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) { + if (!eeprom_file.seek(pos)) return true; // return true for any error + + if (writing) { + if (eeprom_file.read(value, size) != size) return true; + crc16(crc, value, size); + } + else { + uint8_t tmp[size]; + if (eeprom_file.read(tmp, size) != size) return true; + crc16(crc, tmp, size); + } + + pos += size; + + return false; +} + +size_t PersistentStore::capacity() { return HAL_ESP32_EEPROM_SIZE; } + +#endif // EEPROM_SETTINGS +#endif // ARDUINO_ARCH_ESP32 diff --git a/Marlin/src/HAL/HAL_ESP32/spiffs.cpp b/Marlin/src/HAL/HAL_ESP32/spiffs.cpp new file mode 100644 index 0000000000..c960f386d4 --- /dev/null +++ b/Marlin/src/HAL/HAL_ESP32/spiffs.cpp @@ -0,0 +1,44 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#ifdef ARDUINO_ARCH_ESP32 + +#include "../../inc/MarlinConfigPre.h" + +#if EITHER(WEBSUPPORT, EEPROM_SETTINGS) + +#include "../../core/serial.h" + +#include "FS.h" +#include "SPIFFS.h" + +bool spiffs_initialized; + +void spiffs_init() { + if (SPIFFS.begin()) + spiffs_initialized = true; + else + SERIAL_ECHO_MSG("SPIFFS mount failed"); +} + +#endif // WEBSUPPORT +#endif // ARDUINO_ARCH_ESP32 diff --git a/Marlin/src/HAL/HAL_ESP32/spiffs.h b/Marlin/src/HAL/HAL_ESP32/spiffs.h new file mode 100644 index 0000000000..e1573340cd --- /dev/null +++ b/Marlin/src/HAL/HAL_ESP32/spiffs.h @@ -0,0 +1,26 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +extern bool spiffs_initialized; + +void spiffs_init(); diff --git a/Marlin/src/HAL/HAL_ESP32/web.cpp b/Marlin/src/HAL/HAL_ESP32/web.cpp new file mode 100644 index 0000000000..6bbc0d13aa --- /dev/null +++ b/Marlin/src/HAL/HAL_ESP32/web.cpp @@ -0,0 +1,42 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.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_ESP32 + +#include "../../inc/MarlinConfigPre.h" + +#if ENABLED(WEBSUPPORT) + +#include "SPIFFS.h" +#include "wifi.h" + +AsyncEventSource events("/events"); // event source (Server-Sent events) + +void onNotFound(AsyncWebServerRequest *request){ + request->send(404); +} + +void web_init() { + server.addHandler(&events); // attach AsyncEventSource + server.serveStatic("/", SPIFFS, "/www").setDefaultFile("index.html"); + server.onNotFound(onNotFound); +} + +#endif // WEBSUPPORT +#endif // ARDUINO_ARCH_ESP32 diff --git a/Marlin/src/HAL/HAL_ESP32/web.h b/Marlin/src/HAL/HAL_ESP32/web.h new file mode 100644 index 0000000000..7f8796e7d4 --- /dev/null +++ b/Marlin/src/HAL/HAL_ESP32/web.h @@ -0,0 +1,21 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.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 + +void web_init(); diff --git a/Marlin/src/HAL/HAL_ESP32/wifi.cpp b/Marlin/src/HAL/HAL_ESP32/wifi.cpp new file mode 100644 index 0000000000..7afc7a87a8 --- /dev/null +++ b/Marlin/src/HAL/HAL_ESP32/wifi.cpp @@ -0,0 +1,55 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.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_ESP32 + +#include "../../inc/MarlinConfigPre.h" + +#if ENABLED(WIFISUPPORT) + +#include +#include +#include +#include "wifi.h" + +AsyncWebServer server(80); + +#ifndef WIFI_HOSTNAME + #define WIFI_HOSTNAME DEFAULT_WIFI_HOSTNAME +#endif + +void wifi_init() { + WiFi.mode(WIFI_STA); + WiFi.begin(WIFI_SSID, WIFI_PWD); + + while (WiFi.waitForConnectResult() != WL_CONNECTED) { + delay(5000); + ESP.restart(); + } + + delay(10); + + // Loop forever (watchdog kill) on failure + if (!MDNS.begin(WIFI_HOSTNAME)) for(;;) delay(5000); + + MDNS.addService("http", "tcp", 80); +} + +#endif // WIFISUPPORT +#endif // ARDUINO_ARCH_ESP32 diff --git a/Marlin/src/HAL/HAL_ESP32/wifi.h b/Marlin/src/HAL/HAL_ESP32/wifi.h new file mode 100644 index 0000000000..ef35cf14ca --- /dev/null +++ b/Marlin/src/HAL/HAL_ESP32/wifi.h @@ -0,0 +1,27 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.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 + +#include + +extern AsyncWebServer server; + +#define DEFAULT_WIFI_HOSTNAME "marlin" + +void wifi_init(); diff --git a/Marlin/src/HAL/HAL_LINUX/HAL_timers.cpp b/Marlin/src/HAL/HAL_LINUX/HAL_timers.cpp index 5a59165f50..f7b46725af 100644 --- a/Marlin/src/HAL/HAL_LINUX/HAL_timers.cpp +++ b/Marlin/src/HAL/HAL_LINUX/HAL_timers.cpp @@ -32,8 +32,8 @@ * This has many limitations and is not fit for the purpose */ -HAL_STEP_TIMER_ISR; -HAL_TEMP_TIMER_ISR; +HAL_STEP_TIMER_ISR(); +HAL_TEMP_TIMER_ISR(); Timer timers[2]; diff --git a/Marlin/src/HAL/HAL_LINUX/HAL_timers.h b/Marlin/src/HAL/HAL_LINUX/HAL_timers.h index 75ec68b0a8..9505fc568a 100644 --- a/Marlin/src/HAL/HAL_LINUX/HAL_timers.h +++ b/Marlin/src/HAL/HAL_LINUX/HAL_timers.h @@ -63,12 +63,12 @@ typedef uint32_t hal_timer_t; #define ENABLE_TEMPERATURE_INTERRUPT() HAL_timer_enable_interrupt(TEMP_TIMER_NUM) #define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM) -#define HAL_STEP_TIMER_ISR extern "C" void TIMER0_IRQHandler(void) -#define HAL_TEMP_TIMER_ISR extern "C" void TIMER1_IRQHandler(void) +#define HAL_STEP_TIMER_ISR() extern "C" void TIMER0_IRQHandler(void) +#define HAL_TEMP_TIMER_ISR() extern "C" void TIMER1_IRQHandler(void) // PWM timer #define HAL_PWM_TIMER -#define HAL_PWM_TIMER_ISR extern "C" void TIMER3_IRQHandler(void) +#define HAL_PWM_TIMER_ISR() extern "C" void TIMER3_IRQHandler(void) #define HAL_PWM_TIMER_IRQn diff --git a/Marlin/src/HAL/HAL_LINUX/SanityCheck.h b/Marlin/src/HAL/HAL_LINUX/SanityCheck.h index b9ed279fe7..fd4c53241a 100644 --- a/Marlin/src/HAL/HAL_LINUX/SanityCheck.h +++ b/Marlin/src/HAL/HAL_LINUX/SanityCheck.h @@ -65,3 +65,7 @@ #endif #endif #endif // SPINDLE_LASER_ENABLE + +#if ENABLED(FAST_PWM_FAN) + #error "FAST_PWM_FAN is not yet implemented for this platform." +#endif diff --git a/Marlin/src/HAL/HAL_LINUX/fastio.h b/Marlin/src/HAL/HAL_LINUX/fastio.h index db43b93fcf..8eae771a4f 100644 --- a/Marlin/src/HAL/HAL_LINUX/fastio.h +++ b/Marlin/src/HAL/HAL_LINUX/fastio.h @@ -28,18 +28,16 @@ #include #include -#define USEABLE_HARDWARE_PWM(pin) false +#define SET_DIR_INPUT(IO) Gpio::setDir(IO, 1) +#define SET_DIR_OUTPUT(IO) Gpio::setDir(IO, 0) -#define SET_DIR_INPUT(IO) Gpio::setDir(IO, 1) -#define SET_DIR_OUTPUT(IO) Gpio::setDir(IO, 0) +#define SET_MODE(IO, mode) Gpio::setMode(IO, mode) -#define SET_MODE(IO, mode) Gpio::setMode(IO, mode) +#define WRITE_PIN_SET(IO) Gpio::set(IO) +#define WRITE_PIN_CLR(IO) Gpio::clear(IO) -#define WRITE_PIN_SET(IO) Gpio::set(IO) -#define WRITE_PIN_CLR(IO) Gpio::clear(IO) - -#define READ_PIN(IO) Gpio::get(IO) -#define WRITE_PIN(IO,V) Gpio::set(IO, V) +#define READ_PIN(IO) Gpio::get(IO) +#define WRITE_PIN(IO,V) Gpio::set(IO, V) /** * Magic I/O routines @@ -50,74 +48,82 @@ */ /// Read a pin -#define _READ(IO) READ_PIN(IO) +#define _READ(IO) READ_PIN(IO) /// Write to a pin -#define _WRITE_VAR(IO,V) digitalWrite(IO,V) +#define _WRITE_VAR(IO,V) digitalWrite(IO,V) -#define _WRITE(IO,V) WRITE_PIN(IO,V) +#define _WRITE(IO,V) WRITE_PIN(IO,V) /// toggle a pin -#define _TOGGLE(IO) _WRITE(IO, !READ(IO)) +#define _TOGGLE(IO) _WRITE(IO, !READ(IO)) /// set pin as input -#define _SET_INPUT(IO) SET_DIR_INPUT(IO) +#define _SET_INPUT(IO) SET_DIR_INPUT(IO) /// set pin as output -#define _SET_OUTPUT(IO) SET_DIR_OUTPUT(IO) +#define _SET_OUTPUT(IO) SET_DIR_OUTPUT(IO) /// set pin as input with pullup mode -#define _PULLUP(IO,V) pinMode(IO, (V) ? INPUT_PULLUP : INPUT) +#define _PULLUP(IO,V) pinMode(IO, (V) ? INPUT_PULLUP : INPUT) /// set pin as input with pulldown mode -#define _PULLDOWN(IO,V) pinMode(IO, (V) ? INPUT_PULLDOWN : INPUT) +#define _PULLDOWN(IO,V) pinMode(IO, (V) ? INPUT_PULLDOWN : INPUT) // hg42: all pins can be input or output (I hope) // hg42: undefined pins create compile error (IO, is no pin) // hg42: currently not used, but was used by pinsDebug /// check if pin is an input -#define _GET_INPUT(IO) (LPC1768_PIN_PIN(IO) >= 0) +#define _IS_INPUT(IO) (LPC1768_PIN_PIN(IO) >= 0) /// check if pin is an output -#define _GET_OUTPUT(IO) (LPC1768_PIN_PIN(IO) >= 0) +#define _IS_OUTPUT(IO) (LPC1768_PIN_PIN(IO) >= 0) -// hg42: GET_TIMER is used only to check if it's a PWM pin +// hg42: HAS_TIMER is used only to check if it's a PWM pin // hg42: we cannot use USEABLE_HARDWARE_PWM because it uses a function that cannot be used statically // hg42: instead use PWM bit from the #define /// check if pin is a timer -#define _GET_TIMER(IO) TRUE // could be LPC1768_PIN_PWM(IO), but there +#define _HAS_TIMER(IO) true // could be LPC1768_PIN_PWM(IO), but there // hg42: could be this: -// #define _GET_TIMER(IO) LPC1768_PIN_PWM(IO) +// #define _HAS_TIMER(IO) LPC1768_PIN_PWM(IO) // but this is an incomplete check (12 pins are PWMable, but only 6 can be used at the same time) /// Read a pin wrapper -#define READ(IO) _READ(IO) +#define READ(IO) _READ(IO) /// Write to a pin wrapper -#define WRITE_VAR(IO,V) _WRITE_VAR(IO,V) -#define WRITE(IO,V) _WRITE(IO,V) +#define WRITE_VAR(IO,V) _WRITE_VAR(IO,V) +#define WRITE(IO,V) _WRITE(IO,V) /// toggle a pin wrapper -#define TOGGLE(IO) _TOGGLE(IO) +#define TOGGLE(IO) _TOGGLE(IO) /// set pin as input wrapper -#define SET_INPUT(IO) _SET_INPUT(IO) +#define SET_INPUT(IO) _SET_INPUT(IO) /// set pin as input with pullup wrapper -#define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0) +#define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0) /// set pin as input with pulldown wrapper -#define SET_INPUT_PULLDOWN(IO) do{ _SET_INPUT(IO); _PULLDOWN(IO, HIGH); }while(0) +#define SET_INPUT_PULLDOWN(IO) do{ _SET_INPUT(IO); _PULLDOWN(IO, HIGH); }while(0) /// set pin as output wrapper - reads the pin and sets the output to that value -#define SET_OUTPUT(IO) do{ _WRITE(IO, _READ(IO)); _SET_OUTPUT(IO); }while(0) +#define SET_OUTPUT(IO) do{ _WRITE(IO, _READ(IO)); _SET_OUTPUT(IO); }while(0) +// set pin as PWM +#define SET_PWM(IO) SET_OUTPUT(IO) /// check if pin is an input wrapper -#define GET_INPUT(IO) _GET_INPUT(IO) +#define IS_INPUT(IO) _IS_INPUT(IO) /// check if pin is an output wrapper -#define GET_OUTPUT(IO) _GET_OUTPUT(IO) +#define IS_OUTPUT(IO) _IS_OUTPUT(IO) /// check if pin is a timer (wrapper) -#define GET_TIMER(IO) _GET_TIMER(IO) +#define HAS_TIMER(IO) _HAS_TIMER(IO) // Shorthand -#define OUT_WRITE(IO,V) do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0) +#define OUT_WRITE(IO,V) do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0) + +// digitalRead/Write wrappers +#define extDigitalRead(IO) digitalRead(IO) +#define extDigitalWrite(IO,V) digitalWrite(IO,V) + +#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P) diff --git a/Marlin/src/HAL/HAL_LINUX/hardware/LinearAxis.cpp b/Marlin/src/HAL/HAL_LINUX/hardware/LinearAxis.cpp index 2682f8be0c..c50390d736 100644 --- a/Marlin/src/HAL/HAL_LINUX/hardware/LinearAxis.cpp +++ b/Marlin/src/HAL/HAL_LINUX/hardware/LinearAxis.cpp @@ -58,7 +58,7 @@ void LinearAxis::interrupt(GpioEvent ev) { position += -1 + 2 * Gpio::pin_map[dir_pin].value; Gpio::pin_map[min_pin].value = (position < min_position); //Gpio::pin_map[max_pin].value = (position > max_position); - //if(position < min_position) printf("axis(%d) endstop : pos: %d, mm: %f, min: %d\n", step_pin, position, position / 80.0, Gpio::pin_map[min_pin].value); + //if (position < min_position) printf("axis(%d) endstop : pos: %d, mm: %f, min: %d\n", step_pin, position, position / 80.0, Gpio::pin_map[min_pin].value); } } } diff --git a/Marlin/src/HAL/HAL_LINUX/spi_pins.h b/Marlin/src/HAL/HAL_LINUX/spi_pins.h index b24968b2ee..fe510ddcff 100644 --- a/Marlin/src/HAL/HAL_LINUX/spi_pins.h +++ b/Marlin/src/HAL/HAL_LINUX/spi_pins.h @@ -23,7 +23,7 @@ #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 BOTH(SDSUPPORT, DOGLCD) && (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 diff --git a/Marlin/src/HAL/HAL_LPC1768/HAL.cpp b/Marlin/src/HAL/HAL_LPC1768/HAL.cpp index fedca7a1ff..ac242ca4ab 100644 --- a/Marlin/src/HAL/HAL_LPC1768/HAL.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/HAL.cpp @@ -52,11 +52,13 @@ int freeMemory() { return result; } +// scan command line for code +// return index into pin map array if found and the pin is valid. +// return dval if not found or not a valid pin. int16_t PARSED_PIN_INDEX(const char code, const int16_t dval) { - const uint16_t val = (uint16_t)parser.intval(code), port = val / 100, pin = val % 100; - const int16_t ind = (port < (NUM_DIGITAL_PINS >> 5) && (pin < 32)) - ? GET_PIN_MAP_INDEX(port << 5 | pin) : -2; - return ind > -2 ? ind : dval; + const uint16_t val = (uint16_t)parser.intval(code, -1), port = val / 100, pin = val % 100; + const int16_t ind = (port < ((NUM_DIGITAL_PINS) >> 5) && pin < 32) ? GET_PIN_MAP_INDEX((port << 5) | pin) : -2; + return ind > -1 ? ind : dval; } void flashFirmware(int16_t value) { diff --git a/Marlin/src/HAL/HAL_LPC1768/HAL.h b/Marlin/src/HAL/HAL_LPC1768/HAL.h index 9593f473d1..0ac6db167e 100644 --- a/Marlin/src/HAL/HAL_LPC1768/HAL.h +++ b/Marlin/src/HAL/HAL_LPC1768/HAL.h @@ -157,3 +157,19 @@ void HAL_idletask(void); #define PLATFORM_M997_SUPPORT void flashFirmware(int16_t value); + +/** + * set_pwm_frequency + * Set the frequency of the timer corresponding to the provided pin + * All Hardware PWM pins run at the same frequency and all + * Software PWM pins run at the same frequency + */ +void set_pwm_frequency(const pin_t pin, int f_desired); + +/** + * set_pwm_duty + * Set the PWM duty cycle of the provided pin to the provided value + * Optionally allows inverting the duty cycle [default = false] + * Optionally allows changing the maximum size of the provided value to enable finer PWM duty control [default = 255] + */ +void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size=255, const bool invert=false); diff --git a/Marlin/src/HAL/HAL_LPC1768/HAL_timers.h b/Marlin/src/HAL/HAL_LPC1768/HAL_timers.h index 8f2ee4bc16..e90cdf2488 100644 --- a/Marlin/src/HAL/HAL_LPC1768/HAL_timers.h +++ b/Marlin/src/HAL/HAL_LPC1768/HAL_timers.h @@ -88,8 +88,8 @@ typedef uint32_t hal_timer_t; #define ENABLE_TEMPERATURE_INTERRUPT() HAL_timer_enable_interrupt(TEMP_TIMER_NUM) #define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM) -#define HAL_STEP_TIMER_ISR _HAL_TIMER_ISR(STEP_TIMER_NUM) -#define HAL_TEMP_TIMER_ISR _HAL_TIMER_ISR(TEMP_TIMER_NUM) +#define HAL_STEP_TIMER_ISR() _HAL_TIMER_ISR(STEP_TIMER_NUM) +#define HAL_TEMP_TIMER_ISR() _HAL_TIMER_ISR(TEMP_TIMER_NUM) // Timer references by index #define STEP_TIMER _HAL_TIMER(STEP_TIMER_NUM) diff --git a/Marlin/src/HAL/HAL_LPC1768/fast_pwm.cpp b/Marlin/src/HAL/HAL_LPC1768/fast_pwm.cpp new file mode 100644 index 0000000000..5e3c2ae6cb --- /dev/null +++ b/Marlin/src/HAL/HAL_LPC1768/fast_pwm.cpp @@ -0,0 +1,40 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#ifdef TARGET_LPC1768 + +#include "../../inc/MarlinConfigPre.h" + +#if ENABLED(FAST_PWM_FAN) + +#include + +void set_pwm_frequency(const pin_t pin, int f_desired) { + pwm_set_frequency(pin, f_desired); +} + +void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255*/, const bool invert/*=false*/) { + pwm_write_ratio(pin, invert ? 1.0f - (float)v / v_size : (float)v / v_size); +} + +#endif // FAST_PWM_FAN +#endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/HAL_LPC1768/fastio.h b/Marlin/src/HAL/HAL_LPC1768/fastio.h index e291a703fa..49f8ec13c3 100644 --- a/Marlin/src/HAL/HAL_LPC1768/fastio.h +++ b/Marlin/src/HAL/HAL_LPC1768/fastio.h @@ -35,21 +35,22 @@ #include -#define USEABLE_HARDWARE_PWM(pin) TRUE // all pins are PWM capable +#define PWM_PIN(P) true // all pins are PWM capable +#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P) -#define LPC_PIN(pin) gpio_pin(pin) -#define LPC_GPIO(port) gpio_port(port) +#define LPC_PIN(pin) gpio_pin(pin) +#define LPC_GPIO(port) gpio_port(port) -#define SET_DIR_INPUT(IO) gpio_set_input(IO) -#define SET_DIR_OUTPUT(IO) gpio_set_output(IO) +#define SET_DIR_INPUT(IO) gpio_set_input(IO) +#define SET_DIR_OUTPUT(IO) gpio_set_output(IO) -#define SET_MODE(IO, mode) pinMode(IO, mode) +#define SET_MODE(IO, mode) pinMode(IO, mode) -#define WRITE_PIN_SET(IO) gpio_set(IO) -#define WRITE_PIN_CLR(IO) gpio_clear(IO) +#define WRITE_PIN_SET(IO) gpio_set(IO) +#define WRITE_PIN_CLR(IO) gpio_clear(IO) -#define READ_PIN(IO) gpio_get(IO) -#define WRITE_PIN(IO,V) gpio_set(IO, V) +#define READ_PIN(IO) gpio_get(IO) +#define WRITE_PIN(IO,V) gpio_set(IO, V) /** * Magic I/O routines @@ -60,64 +61,70 @@ */ /// Read a pin -#define _READ(IO) READ_PIN(IO) +#define _READ(IO) READ_PIN(IO) /// Write to a pin -#define _WRITE_VAR(IO,V) digitalWrite(IO,V) +#define _WRITE_VAR(IO,V) digitalWrite(IO,V) -#define _WRITE(IO,V) WRITE_PIN(IO,V) +#define _WRITE(IO,V) WRITE_PIN(IO,V) /// toggle a pin -#define _TOGGLE(IO) _WRITE(IO, !READ(IO)) +#define _TOGGLE(IO) _WRITE(IO, !READ(IO)) /// set pin as input -#define _SET_INPUT(IO) SET_DIR_INPUT(IO) +#define _SET_INPUT(IO) SET_DIR_INPUT(IO) /// set pin as output -#define _SET_OUTPUT(IO) SET_DIR_OUTPUT(IO) +#define _SET_OUTPUT(IO) SET_DIR_OUTPUT(IO) /// set pin as input with pullup mode -#define _PULLUP(IO,V) pinMode(IO, (V) ? INPUT_PULLUP : INPUT) +#define _PULLUP(IO,V) pinMode(IO, (V) ? INPUT_PULLUP : INPUT) /// set pin as input with pulldown mode -#define _PULLDOWN(IO,V) pinMode(IO, (V) ? INPUT_PULLDOWN : INPUT) +#define _PULLDOWN(IO,V) pinMode(IO, (V) ? INPUT_PULLDOWN : INPUT) /// check if pin is an input -#define _GET_INPUT(IO) (!gpio_get_dir(IO)) +#define _IS_INPUT(IO) (!gpio_get_dir(IO)) /// check if pin is an output -#define _GET_OUTPUT(IO) (gpio_get_dir(IO)) +#define _IS_OUTPUT(IO) (gpio_get_dir(IO)) /// check if pin is a timer /// all gpio pins are pwm capable, either interrupt or hardware pwm controlled -#define _GET_TIMER(IO) TRUE +#define _HAS_TIMER(IO) true /// Read a pin wrapper -#define READ(IO) _READ(IO) +#define READ(IO) _READ(IO) /// Write to a pin wrapper -#define WRITE_VAR(IO,V) _WRITE_VAR(IO,V) -#define WRITE(IO,V) _WRITE(IO,V) +#define WRITE_VAR(IO,V) _WRITE_VAR(IO,V) +#define WRITE(IO,V) _WRITE(IO,V) /// toggle a pin wrapper -#define TOGGLE(IO) _TOGGLE(IO) +#define TOGGLE(IO) _TOGGLE(IO) /// set pin as input wrapper -#define SET_INPUT(IO) _SET_INPUT(IO) +#define SET_INPUT(IO) _SET_INPUT(IO) /// set pin as input with pullup wrapper -#define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0) +#define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0) /// set pin as input with pulldown wrapper -#define SET_INPUT_PULLDOWN(IO) do{ _SET_INPUT(IO); _PULLDOWN(IO, HIGH); }while(0) +#define SET_INPUT_PULLDOWN(IO) do{ _SET_INPUT(IO); _PULLDOWN(IO, HIGH); }while(0) /// set pin as output wrapper - reads the pin and sets the output to that value -#define SET_OUTPUT(IO) do{ _WRITE(IO, _READ(IO)); _SET_OUTPUT(IO); }while(0) +#define SET_OUTPUT(IO) do{ _WRITE(IO, _READ(IO)); _SET_OUTPUT(IO); }while(0) +// set pin as PWM +#define SET_PWM(IO) SET_OUTPUT(IO) /// check if pin is an input wrapper -#define GET_INPUT(IO) _GET_INPUT(IO) +#define IS_INPUT(IO) _IS_INPUT(IO) /// check if pin is an output wrapper -#define GET_OUTPUT(IO) _GET_OUTPUT(IO) +#define IS_OUTPUT(IO) _IS_OUTPUT(IO) /// check if pin is a timer (wrapper) -#define GET_TIMER(IO) _GET_TIMER(IO) +#define HAS_TIMER(IO) _HAS_TIMER(IO) // Shorthand -#define OUT_WRITE(IO,V) do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0) +#define OUT_WRITE(IO,V) do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0) + +// digitalRead/Write wrappers +#define extDigitalRead(IO) digitalRead(IO) +#define extDigitalWrite(IO,V) digitalWrite(IO,V) diff --git a/Marlin/src/HAL/HAL_LPC1768/main.cpp b/Marlin/src/HAL/HAL_LPC1768/main.cpp index c56b029d1c..609c0c7e66 100644 --- a/Marlin/src/HAL/HAL_LPC1768/main.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/main.cpp @@ -98,7 +98,7 @@ void HAL_init() { // HAL idle task void HAL_idletask(void) { - #if ENABLED(SDSUPPORT) && ENABLED(SHARED_SD_CARD) + #if BOTH(SDSUPPORT, 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 diff --git a/Marlin/src/HAL/HAL_LPC1768/persistent_store_flash.cpp b/Marlin/src/HAL/HAL_LPC1768/persistent_store_flash.cpp index df7cc76b03..4b02544e1b 100644 --- a/Marlin/src/HAL/HAL_LPC1768/persistent_store_flash.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/persistent_store_flash.cpp @@ -74,7 +74,8 @@ bool PersistentStore::access_start() { // sector is blank so nothing stored yet 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; uint8_t *eeprom_data = SLOT_ADDRESS(EEPROM_SECTOR, current_slot); diff --git a/Marlin/src/HAL/HAL_LPC1768/pinsDebug.h b/Marlin/src/HAL/HAL_LPC1768/pinsDebug.h index 6230faa054..af3d7c92e7 100644 --- a/Marlin/src/HAL/HAL_LPC1768/pinsDebug.h +++ b/Marlin/src/HAL/HAL_LPC1768/pinsDebug.h @@ -32,7 +32,7 @@ #define pwm_details(pin) pin = pin // do nothing // print PWM details #define pwm_status(pin) false //Print a pin's PWM status. Return true if it's currently a PWM pin. #define IS_ANALOG(P) (DIGITAL_PIN_TO_ANALOG_PIN(P) >= 0 ? 1 : 0) -#define digitalRead_mod(p) digitalRead(p) +#define digitalRead_mod(p) extDigitalRead(p) #define PRINT_PORT(p) #define GET_ARRAY_PIN(p) pin_array[p].pin #define NAME_FORMAT(p) PSTR("%-##p##s") @@ -40,6 +40,12 @@ #define PRINT_PIN(p) do {sprintf_P(buffer, PSTR("%d.%02d"), LPC1768_PIN_PORT(p), LPC1768_PIN_PIN(p)); SERIAL_ECHO(buffer);} while (0) #define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin +// pins that will cause hang/reset/disconnect in M43 Toggle and Watch utilities +// uses pin index +#ifndef M43_NEVER_TOUCH + #define M43_NEVER_TOUCH(Q) ((Q) == 29 || (Q) == 30 || (Q) == 73) // USB pins +#endif + // active ADC function/mode/code values for PINSEL registers constexpr int8_t ADC_pin_mode(pin_t pin) { return (LPC1768_PIN_PORT(pin) == 0 && LPC1768_PIN_PIN(pin) == 2 ? 2 : diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp index 4495e7f7e6..aad3603ad2 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp @@ -26,8 +26,6 @@ * COM interface for Arduino (AND ATmega) and the SSDxxxx chip (SOLOMON) variant * I2C protocol * - * ToDo: Rename this to u8g_com_avr_ssd_i2c.c - * * Universal 8bit Graphics Library * * Copyright (c) 2011, olikraus@gmail.com diff --git a/Marlin/src/HAL/HAL_STM32/HAL.cpp b/Marlin/src/HAL/HAL_STM32/HAL.cpp index ab61e57bfd..0eaee0711b 100644 --- a/Marlin/src/HAL/HAL_STM32/HAL.cpp +++ b/Marlin/src/HAL/HAL_STM32/HAL.cpp @@ -36,8 +36,10 @@ #if ENABLED(EEPROM_EMULATED_WITH_SRAM) #if STM32F7xx #include "stm32f7xx_ll_pwr.h" + #elif STM32F4xx + #include "stm32f4xx_ll_pwr.h" #else - #error "EEPROM_EMULATED_WITH_SRAM is currently only supported for STM32F7xx" + #error "EEPROM_EMULATED_WITH_SRAM is currently only supported for STM32F4xx and STM32F7xx" #endif #endif // EEPROM_EMULATED_WITH_SRAM diff --git a/Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.h b/Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.h index 72b80ccce9..e92da9a5c8 100644 --- a/Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.h +++ b/Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.h @@ -137,8 +137,8 @@ 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) +#define HAL_STEP_TIMER_ISR() void Step_Handler(stimer_t *htim) +#define HAL_TEMP_TIMER_ISR() void Temp_Handler(stimer_t *htim) // -------------------------------------------------------------------------- // Types diff --git a/Marlin/src/HAL/HAL_STM32/SanityCheck.h b/Marlin/src/HAL/HAL_STM32/SanityCheck.h index 49671e3454..9a65f9bfa8 100644 --- a/Marlin/src/HAL/HAL_STM32/SanityCheck.h +++ b/Marlin/src/HAL/HAL_STM32/SanityCheck.h @@ -69,3 +69,7 @@ #if ENABLED(EMERGENCY_PARSER) #error "EMERGENCY_PARSER is not yet implemented for STM32. Disable EMERGENCY_PARSER to continue." #endif + +#if ENABLED(FAST_PWM_FAN) + #error "FAST_PWM_FAN is not yet implemented for this platform." +#endif diff --git a/Marlin/src/HAL/HAL_STM32/fastio_STM32.h b/Marlin/src/HAL/HAL_STM32/fastio_STM32.h index 8b43744684..bd2edb4495 100644 --- a/Marlin/src/HAL/HAL_STM32/fastio_STM32.h +++ b/Marlin/src/HAL/HAL_STM32/fastio_STM32.h @@ -45,6 +45,10 @@ void FastIO_init(); // Must be called before using fast io macros #define _BV32(b) (1UL << (b)) +#if !defined(PWM) + #define PWM OUTPUT +#endif + #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])) ; \ @@ -72,10 +76,15 @@ void FastIO_init(); // Must be called before using fast io macros #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 SET_PWM(IO) _SET_MODE(IO, PWM) -#define GET_INPUT(IO) -#define GET_OUTPUT(IO) -#define GET_TIMER(IO) +#define IS_INPUT(IO) +#define IS_OUTPUT(IO) +#define HAS_TIMER(IO) digitalPinHasPWM(IO) -#define PWM_PIN(p) digitalPinHasPWM(p) -#define USEABLE_HARDWARE_PWM(p) PWM_PIN(p) +#define PWM_PIN(P) HAS_TIMER(P) +#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P) + +// digitalRead/Write wrappers +#define extDigitalRead(IO) digitalRead(IO) +#define extDigitalWrite(IO,V) digitalWrite(IO,V) diff --git a/Marlin/src/HAL/HAL_STM32/persistent_store_impl.cpp b/Marlin/src/HAL/HAL_STM32/persistent_store_impl.cpp index 34df9bf591..a6c50f0f7d 100644 --- a/Marlin/src/HAL/HAL_STM32/persistent_store_impl.cpp +++ b/Marlin/src/HAL/HAL_STM32/persistent_store_impl.cpp @@ -28,20 +28,20 @@ #include "../shared/persistent_store_api.h" -#if DISABLED(EEPROM_EMULATED_WITH_SRAM) && DISABLED(SPI_EEPROM) && DISABLED(I2C_EEPROM) +#if DISABLED(EEPROM_EMULATED_WITH_SRAM, SPI_EEPROM, 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) + #if DISABLED(EEPROM_EMULATED_WITH_SRAM, SPI_EEPROM, 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 DISABLED(EEPROM_EMULATED_WITH_SRAM, SPI_EEPROM, I2C_EEPROM) if (eeprom_data_written) { eeprom_buffer_flush(); eeprom_data_written = false; @@ -55,7 +55,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui uint8_t v = *value; // Save to either external EEPROM, program flash or Backup SRAM - #if ENABLED(SPI_EEPROM) || ENABLED(I2C_EEPROM) + #if EITHER(SPI_EEPROM, I2C_EEPROM) // EEPROM has only ~100,000 write cycles, // so only write bytes that have changed! uint8_t * const p = (uint8_t * const)pos; @@ -76,7 +76,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui pos++; value++; }; - #if DISABLED(EEPROM_EMULATED_WITH_SRAM) && DISABLED(SPI_EEPROM) && DISABLED(I2C_EEPROM) + #if DISABLED(EEPROM_EMULATED_WITH_SRAM, SPI_EEPROM, I2C_EEPROM) eeprom_data_written = true; #endif @@ -87,7 +87,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t do { // Read from either external EEPROM, program flash or Backup SRAM const uint8_t c = ( - #if ENABLED(SPI_EEPROM) || ENABLED(I2C_EEPROM) + #if EITHER(SPI_EEPROM, I2C_EEPROM) eeprom_read_byte((uint8_t*)pos) #elif DISABLED(EEPROM_EMULATED_WITH_SRAM) eeprom_buffered_read_byte(pos) @@ -105,7 +105,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t } size_t PersistentStore::capacity() { - #if ENABLED(SPI_EEPROM) || ENABLED(I2C_EEPROM) + #if EITHER(SPI_EEPROM, I2C_EEPROM) return E2END + 1; #elif DISABLED(EEPROM_EMULATED_WITH_SRAM) return E2END + 1; diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL.cpp b/Marlin/src/HAL/HAL_STM32F1/HAL.cpp index ce9eb92b14..1534a35756 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL.cpp +++ b/Marlin/src/HAL/HAL_STM32F1/HAL.cpp @@ -33,6 +33,7 @@ #include "HAL.h" #include +#include "../../inc/MarlinConfig.h" // -------------------------------------------------------------------------- // Externals @@ -91,7 +92,9 @@ // -------------------------------------------------------------------------- // Public Variables // -------------------------------------------------------------------------- -USBSerial SerialUSB; +#ifdef SERIAL_USB + USBSerial SerialUSB; +#endif uint16_t HAL_adc_result; @@ -104,6 +107,12 @@ uint8_t adc_pins[] = { #if HAS_TEMP_ADC_0 TEMP_0_PIN, #endif + #if HAS_HEATED_BED + TEMP_BED_PIN, + #endif + #if HAS_HEATED_CHAMBER + TEMP_CHAMBER_PIN, + #endif #if HAS_TEMP_ADC_1 TEMP_1_PIN, #endif @@ -116,8 +125,8 @@ uint8_t adc_pins[] = { #if HAS_TEMP_ADC_4 TEMP_4_PIN, #endif - #if HAS_HEATED_BED - TEMP_BED_PIN, + #if HAS_TEMP_ADC_5 + TEMP_5_PIN, #endif #if ENABLED(FILAMENT_WIDTH_SENSOR) FILWIDTH_PIN, @@ -128,6 +137,12 @@ enum TEMP_PINS : char { #if HAS_TEMP_ADC_0 TEMP_0, #endif + #if HAS_HEATED_BED + TEMP_BED, + #endif + #if HAS_HEATED_CHAMBER + TEMP_CHAMBER, + #endif #if HAS_TEMP_ADC_1 TEMP_1, #endif @@ -140,8 +155,8 @@ enum TEMP_PINS : char { #if HAS_TEMP_ADC_4 TEMP_4, #endif - #if HAS_HEATED_BED - TEMP_BED, + #if HAS_TEMP_ADC_5 + TEMP_5, #endif #if ENABLED(FILAMENT_WIDTH_SENSOR) FILWIDTH, @@ -192,7 +207,6 @@ static void NVIC_SetPriorityGrouping(uint32_t PriorityGroup) { } } #endif - void HAL_init(void) { NVIC_SetPriorityGrouping(0x3); } @@ -268,6 +282,12 @@ void HAL_adc_start_conversion(const uint8_t adc_pin) { #if HAS_TEMP_ADC_0 case TEMP_0_PIN: pin_index = TEMP_0; break; #endif + #if HAS_HEATED_BED + case TEMP_BED_PIN: pin_index = TEMP_BED; break; + #endif + #if HAS_HEATED_CHAMBER + case TEMP_CHAMBER_PIN: pin_index = TEMP_CHAMBER; break; + #endif #if HAS_TEMP_ADC_1 case TEMP_1_PIN: pin_index = TEMP_1; break; #endif @@ -280,8 +300,8 @@ void HAL_adc_start_conversion(const uint8_t adc_pin) { #if HAS_TEMP_ADC_4 case TEMP_4_PIN: pin_index = TEMP_4; break; #endif - #if HAS_HEATED_BED - case TEMP_BED_PIN: pin_index = TEMP_BED; break; + #if HAS_TEMP_ADC_5 + case TEMP_5_PIN: pin_index = TEMP_5; break; #endif #if ENABLED(FILAMENT_WIDTH_SENSOR) case FILWIDTH_PIN: pin_index = FILWIDTH; break; diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL.h b/Marlin/src/HAL/HAL_STM32F1/HAL.h index 941f485f54..66c4cba59e 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL.h +++ b/Marlin/src/HAL/HAL_STM32F1/HAL.h @@ -51,46 +51,69 @@ #include "watchdog_STM32F1.h" #include "HAL_timers_STM32F1.h" - +#include "../../inc/MarlinConfigPre.h" // -------------------------------------------------------------------------- // Defines // -------------------------------------------------------------------------- -#if !WITHIN(SERIAL_PORT, -1, 3) - #error "SERIAL_PORT must be from -1 to 3" +#ifdef SERIAL_USB + #define UsbSerial Serial + #define MSerial1 Serial1 + #define MSerial2 Serial2 + #define MSerial3 Serial3 + #define MSerial4 Serial4 + #define MSerial5 Serial5 +#else + extern USBSerial SerialUSB; + #define UsbSerial SerialUSB + #define MSerial1 Serial + #define MSerial2 Serial1 + #define MSerial3 Serial2 + #define MSerial4 Serial3 + #define MSerial5 Serial4 +#endif + +#if !WITHIN(SERIAL_PORT, -1, 5) + #error "SERIAL_PORT must be from -1 to 5" #endif #if SERIAL_PORT == -1 - extern USBSerial SerialUSB; - #define MYSERIAL0 SerialUSB + #define MYSERIAL0 UsbSerial #elif SERIAL_PORT == 0 - #define MYSERIAL0 Serial + #error "Serial port 0 does not exist" #elif SERIAL_PORT == 1 - #define MYSERIAL0 Serial1 + #define MYSERIAL0 MSerial1 #elif SERIAL_PORT == 2 - #define MYSERIAL0 Serial2 + #define MYSERIAL0 MSerial2 #elif SERIAL_PORT == 3 - #define MYSERIAL0 Serial3 + #define MYSERIAL0 MSerial3 +#elif SERIAL_PORT == 4 + #define MYSERIAL0 MSerial4 +#elif SERIAL_PORT == 5 + #define MYSERIAL0 MSerial5 #endif #ifdef SERIAL_PORT_2 - #if !WITHIN(SERIAL_PORT_2, -1, 3) - #error "SERIAL_PORT_2 must be from -1 to 3" + #if !WITHIN(SERIAL_PORT_2, -1, 5) + #error "SERIAL_PORT_2 must be from -1 to 5" #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 - extern USBSerial SerialUSB; - #define MYSERIAL1 SerialUSB + #define MYSERIAL1 UsbSerial #elif SERIAL_PORT_2 == 0 - #define MYSERIAL1 Serial + #error "Serial port 0 does not exist" #elif SERIAL_PORT_2 == 1 - #define MYSERIAL1 Serial1 + #define MYSERIAL1 MSerial1 #elif SERIAL_PORT_2 == 2 - #define MYSERIAL1 Serial2 + #define MYSERIAL1 MSerial2 #elif SERIAL_PORT_2 == 3 - #define MYSERIAL1 Serial3 + #define MYSERIAL1 MSerial3 + #elif SERIAL_PORT_2 == 4 + #define MYSERIAL1 MSerial4 + #elif SERIAL_PORT_2 == 5 + #define MYSERIAL1 MSerial5 #endif #else #define NUM_SERIAL 1 @@ -107,6 +130,10 @@ void HAL_init(); #define analogInputToDigitalPin(p) (p) #endif +#ifndef digitalPinHasPWM + #define digitalPinHasPWM(P) (PIN_MAP[P].timer_device != NULL) +#endif + #define CRITICAL_SECTION_START uint32_t primask = __get_primask(); (void)__iCliRetVal() #define CRITICAL_SECTION_END if (!primask) (void)__iSeiRetVal() #define ISRS_ENABLED() (!__get_primask()) diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.cpp b/Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.cpp index 30674eab88..d7aa3ccd20 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.cpp +++ b/Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.cpp @@ -21,7 +21,7 @@ * */ -#ifdef __STM32F1__ +#if defined(ARDUINO_ARCH_STM32F1) && (defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY)) #include "HAL_sdio_STM32F1.h" @@ -76,7 +76,7 @@ bool SDIO_Init(void) { return true; } -bool SDIO_ReadBlock(uint32_t blockAddress, uint8_t *data) { +bool SDIO_ReadBlock_DMA(uint32_t blockAddress, uint8_t *data) { if (SDIO_GetCardState() != SDIO_CARD_TRANSFER) return false; if (blockAddress >= SdCard.LogBlockNbr) return false; if ((0x03 & (uint32_t)data)) return false; // misaligned data @@ -100,6 +100,12 @@ bool SDIO_ReadBlock(uint32_t blockAddress, uint8_t *data) { dma_disable(SDIO_DMA_DEV, SDIO_DMA_CHANNEL); + if (SDIO->STA & SDIO_STA_RXDAVL) { + while (SDIO->STA & SDIO_STA_RXDAVL) (void) SDIO->FIFO; + SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS | SDIO_ICR_DATA_FLAGS); + return false; + } + if (SDIO_GET_FLAG(SDIO_STA_TRX_ERROR_FLAGS)) { SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS | SDIO_ICR_DATA_FLAGS); return false; @@ -108,6 +114,12 @@ bool SDIO_ReadBlock(uint32_t blockAddress, uint8_t *data) { return true; } +bool SDIO_ReadBlock(uint32_t blockAddress, uint8_t *data) { + uint32_t retries = 3; + while (retries--) if (SDIO_ReadBlock_DMA(blockAddress, data)) return true; + return false; +} + bool SDIO_WriteBlock(uint32_t blockAddress, const uint8_t *data) { if (SDIO_GetCardState() != SDIO_CARD_TRANSFER) return false; if (blockAddress >= SdCard.LogBlockNbr) return false; @@ -264,4 +276,4 @@ bool SDIO_GetCmdResp7(void) { return true; } -#endif // __STM32F1__ +#endif // ARDUINO_ARCH_STM32F1 && (STM32_HIGH_DENSITY || STM32_XL_DENSITY) diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.h b/Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.h index 28e0693718..b17d8a44d3 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.h +++ b/Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.h @@ -85,9 +85,8 @@ timer_dev* get_timer_dev(int number); // TODO change this - -#define HAL_TEMP_TIMER_ISR extern "C" void tempTC_Handler(void) -#define HAL_STEP_TIMER_ISR extern "C" void stepTC_Handler(void) +#define HAL_TEMP_TIMER_ISR() extern "C" void tempTC_Handler(void) +#define HAL_STEP_TIMER_ISR() extern "C" void stepTC_Handler(void) extern "C" void tempTC_Handler(void); extern "C" void stepTC_Handler(void); diff --git a/Marlin/src/HAL/HAL_STM32F1/SanityCheck.h b/Marlin/src/HAL/HAL_STM32F1/SanityCheck.h index d0515f7c54..82a0789eeb 100644 --- a/Marlin/src/HAL/HAL_STM32F1/SanityCheck.h +++ b/Marlin/src/HAL/HAL_STM32F1/SanityCheck.h @@ -74,3 +74,7 @@ #if ENABLED(SDIO_SUPPORT) && DISABLED(SDSUPPORT) #error "SDIO_SUPPORT requires SDSUPPORT. Enable SDSUPPORT to continue." #endif + +#if ENABLED(FAST_PWM_FAN) + #error "FAST_PWM_FAN is not yet implemented for this platform." +#endif diff --git a/Marlin/src/HAL/HAL_STM32F1/binary.h b/Marlin/src/HAL/HAL_STM32F1/binary.h deleted file mode 100644 index 70d5ead723..0000000000 --- a/Marlin/src/HAL/HAL_STM32F1/binary.h +++ /dev/null @@ -1 +0,0 @@ -#include "bit_constants.h" diff --git a/Marlin/src/HAL/HAL_STM32F1/fastio_Stm32f1.h b/Marlin/src/HAL/HAL_STM32F1/fastio_Stm32f1.h index e206c6bbd3..3994b3268a 100644 --- a/Marlin/src/HAL/HAL_STM32F1/fastio_Stm32f1.h +++ b/Marlin/src/HAL/HAL_STM32F1/fastio_Stm32f1.h @@ -30,7 +30,7 @@ #include #define READ(IO) (PIN_MAP[IO].gpio_device->regs->IDR & (1U << PIN_MAP[IO].gpio_bit) ? HIGH : LOW) -#define WRITE(IO,V) (PIN_MAP[IO].gpio_device->regs->BSRR = (1U << PIN_MAP[IO].gpio_bit) << (16 * !(bool)V)) +#define WRITE(IO,V) (PIN_MAP[IO].gpio_device->regs->BSRR = (1U << PIN_MAP[IO].gpio_bit) << (16 * !((bool)V))) #define TOGGLE(IO) (PIN_MAP[IO].gpio_device->regs->ODR = PIN_MAP[IO].gpio_device->regs->ODR ^ (1U << PIN_MAP[IO].gpio_bit)) #define WRITE_VAR(IO,V) WRITE(IO,V) @@ -42,11 +42,17 @@ #define SET_INPUT(IO) _SET_MODE(IO, GPIO_INPUT_FLOATING) #define SET_INPUT_PULLUP(IO) _SET_MODE(IO, GPIO_INPUT_PU) -#define SET_OUTPUT(IO) OUT_WRITE(IO,LOW) +#define SET_OUTPUT(IO) OUT_WRITE(IO, LOW) +#define SET_PWM(IO) pinMode(IO, PWM) // do{ gpio_set_mode(PIN_MAP[pin].gpio_device, PIN_MAP[pin].gpio_bit, GPIO_AF_OUTPUT_PP); timer_set_mode(PIN_MAP[pin].timer_device, PIN_MAP[pin].timer_channel, TIMER_PWM); }while(0) -#define GET_INPUT(IO) (_GET_MODE(IO) == GPIO_INPUT_FLOATING || _GET_MODE(IO) == GPIO_INPUT_ANALOG || _GET_MODE(IO) == GPIO_INPUT_PU || _GET_MODE(IO) == GPIO_INPUT_PD) -#define GET_OUTPUT(IO) (_GET_MODE(IO) == GPIO_OUTPUT_PP) -#define GET_TIMER(IO) (PIN_MAP[IO].timer_device != NULL) +#define IS_INPUT(IO) (_GET_MODE(IO) == GPIO_INPUT_FLOATING || _GET_MODE(IO) == GPIO_INPUT_ANALOG || _GET_MODE(IO) == GPIO_INPUT_PU || _GET_MODE(IO) == GPIO_INPUT_PD) +#define IS_OUTPUT(IO) (_GET_MODE(IO) == GPIO_OUTPUT_PP) +#define HAS_TIMER(IO) (PIN_MAP[IO].timer_device != NULL) + +#define PWM_PIN(P) HAS_TIMER(P) +#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P) + +// digitalRead/Write wrappers +#define extDigitalRead(IO) digitalRead(IO) +#define extDigitalWrite(IO,V) digitalWrite(IO,V) -#define PWM_PIN(p) true -#define USEABLE_HARDWARE_PWM(p) PWM_PIN(p) diff --git a/Marlin/src/HAL/HAL_STM32F1/persistent_store_flash.cpp b/Marlin/src/HAL/HAL_STM32F1/persistent_store_flash.cpp index 133402bb8c..aa03474d2b 100644 --- a/Marlin/src/HAL/HAL_STM32F1/persistent_store_flash.cpp +++ b/Marlin/src/HAL/HAL_STM32F1/persistent_store_flash.cpp @@ -32,7 +32,7 @@ #include "../../inc/MarlinConfig.h" // This is for EEPROM emulation in flash -#if ENABLED(EEPROM_SETTINGS) && ENABLED(FLASH_EEPROM_EMULATION) +#if BOTH(EEPROM_SETTINGS, FLASH_EEPROM_EMULATION) #include "../shared/persistent_store_api.h" @@ -79,14 +79,15 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, const size_t si } // Now, write any remaining single byte - if (size & 1) { + const uint16_t odd = size & 1; + if (odd) { uint16_t temp = value[size - 1]; status = FLASH_ProgramHalfWord(pageBase + pos + i, temp); if (status != FLASH_COMPLETE) return true; } crc16(crc, value, size); - pos += ((size + 1) & ~1); + pos += size + odd; return false; } @@ -97,7 +98,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uin if (writing) value[i] = c; crc16(crc, &c, 1); } - pos += ((size + 1) & ~1); + pos += ((size + 1) & ~1); // i.e., size+(size&1), round up odd values return false; } diff --git a/Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp b/Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp index e7a1336edd..2b184cdc4c 100644 --- a/Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp +++ b/Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp @@ -55,7 +55,7 @@ bool PersistentStore::access_start() { bool PersistentStore::access_finish() { if (!card.isDetected()) return false; - card.openFile(eeprom_filename, true); + card.openFile(eeprom_filename, false); int16_t bytes_written = card.write(HAL_STM32F1_eeprom_content, HAL_STM32F1_EEPROM_SIZE); card.closefile(); return (bytes_written == HAL_STM32F1_EEPROM_SIZE); diff --git a/Marlin/src/HAL/HAL_STM32F1/u8g_com_stm32duino_fsmc.cpp b/Marlin/src/HAL/HAL_STM32F1/u8g_com_stm32duino_fsmc.cpp index 18cd7c10f2..1d2153d208 100644 --- a/Marlin/src/HAL/HAL_STM32F1/u8g_com_stm32duino_fsmc.cpp +++ b/Marlin/src/HAL/HAL_STM32F1/u8g_com_stm32duino_fsmc.cpp @@ -26,7 +26,7 @@ * Communication interface for FSMC */ -#if defined(STM32F1) || defined(STM32F1xx) +#if defined(ARDUINO_ARCH_STM32F1) && (defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY)) #include "../../inc/MarlinConfig.h" @@ -108,36 +108,43 @@ __attribute__((always_inline)) __STATIC_INLINE void __DSB(void) { } #define FSMC_CS_NE1 PD7 -#define FSMC_CS_NE2 PG9 -#define FSMC_CS_NE3 PG10 -#define FSMC_CS_NE4 PG12 -#define FSMC_RS_A0 PF0 -#define FSMC_RS_A1 PF1 -#define FSMC_RS_A2 PF2 -#define FSMC_RS_A3 PF3 -#define FSMC_RS_A4 PF4 -#define FSMC_RS_A5 PF5 -#define FSMC_RS_A6 PF12 -#define FSMC_RS_A7 PF13 -#define FSMC_RS_A8 PF14 -#define FSMC_RS_A9 PF15 -#define FSMC_RS_A10 PG0 -#define FSMC_RS_A11 PG1 -#define FSMC_RS_A12 PG2 -#define FSMC_RS_A13 PG3 -#define FSMC_RS_A14 PG4 -#define FSMC_RS_A15 PG5 -#define FSMC_RS_A16 PD11 -#define FSMC_RS_A17 PD12 -#define FSMC_RS_A18 PD13 -#define FSMC_RS_A19 PE3 -#define FSMC_RS_A20 PE4 -#define FSMC_RS_A21 PE5 -#define FSMC_RS_A22 PE6 -#define FSMC_RS_A23 PE2 -#define FSMC_RS_A24 PG13 -#define FSMC_RS_A25 PG14 +#ifdef STM32_XL_DENSITY + #define FSMC_CS_NE2 PG9 + #define FSMC_CS_NE3 PG10 + #define FSMC_CS_NE4 PG12 + + #define FSMC_RS_A0 PF0 + #define FSMC_RS_A1 PF1 + #define FSMC_RS_A2 PF2 + #define FSMC_RS_A3 PF3 + #define FSMC_RS_A4 PF4 + #define FSMC_RS_A5 PF5 + #define FSMC_RS_A6 PF12 + #define FSMC_RS_A7 PF13 + #define FSMC_RS_A8 PF14 + #define FSMC_RS_A9 PF15 + #define FSMC_RS_A10 PG0 + #define FSMC_RS_A11 PG1 + #define FSMC_RS_A12 PG2 + #define FSMC_RS_A13 PG3 + #define FSMC_RS_A14 PG4 + #define FSMC_RS_A15 PG5 +#endif + +#define FSMC_RS_A16 PD11 +#define FSMC_RS_A17 PD12 +#define FSMC_RS_A18 PD13 +#define FSMC_RS_A19 PE3 +#define FSMC_RS_A20 PE4 +#define FSMC_RS_A21 PE5 +#define FSMC_RS_A22 PE6 +#define FSMC_RS_A23 PE2 + +#ifdef STM32_XL_DENSITY + #define FSMC_RS_A24 PG13 + #define FSMC_RS_A25 PG14 +#endif static uint8_t fsmcInit = 0; @@ -156,31 +163,35 @@ void LCD_IO_Init(uint8_t cs, uint8_t rs) { switch (cs) { case FSMC_CS_NE1: controllerAddress = (uint32_t)FSMC_NOR_PSRAM_REGION1; break; - case FSMC_CS_NE2: controllerAddress = (uint32_t)FSMC_NOR_PSRAM_REGION2; break; - case FSMC_CS_NE3: controllerAddress = (uint32_t)FSMC_NOR_PSRAM_REGION3; break; - case FSMC_CS_NE4: controllerAddress = (uint32_t)FSMC_NOR_PSRAM_REGION4; break; + #ifdef STM32_XL_DENSITY + case FSMC_CS_NE2: controllerAddress = (uint32_t)FSMC_NOR_PSRAM_REGION2; break; + case FSMC_CS_NE3: controllerAddress = (uint32_t)FSMC_NOR_PSRAM_REGION3; break; + case FSMC_CS_NE4: controllerAddress = (uint32_t)FSMC_NOR_PSRAM_REGION4; break; + #endif default: return; } #define _ORADDR(N) controllerAddress |= (_BV32(N) - 2) switch (rs) { - case FSMC_RS_A0: _ORADDR( 1); break; - case FSMC_RS_A1: _ORADDR( 2); break; - case FSMC_RS_A2: _ORADDR( 3); break; - case FSMC_RS_A3: _ORADDR( 4); break; - case FSMC_RS_A4: _ORADDR( 5); break; - case FSMC_RS_A5: _ORADDR( 6); break; - case FSMC_RS_A6: _ORADDR( 7); break; - case FSMC_RS_A7: _ORADDR( 8); break; - case FSMC_RS_A8: _ORADDR( 9); break; - case FSMC_RS_A9: _ORADDR(10); break; - case FSMC_RS_A10: _ORADDR(11); break; - case FSMC_RS_A11: _ORADDR(12); break; - case FSMC_RS_A12: _ORADDR(13); break; - case FSMC_RS_A13: _ORADDR(14); break; - case FSMC_RS_A14: _ORADDR(15); break; - case FSMC_RS_A15: _ORADDR(16); break; + #ifdef STM32_XL_DENSITY + case FSMC_RS_A0: _ORADDR( 1); break; + case FSMC_RS_A1: _ORADDR( 2); break; + case FSMC_RS_A2: _ORADDR( 3); break; + case FSMC_RS_A3: _ORADDR( 4); break; + case FSMC_RS_A4: _ORADDR( 5); break; + case FSMC_RS_A5: _ORADDR( 6); break; + case FSMC_RS_A6: _ORADDR( 7); break; + case FSMC_RS_A7: _ORADDR( 8); break; + case FSMC_RS_A8: _ORADDR( 9); break; + case FSMC_RS_A9: _ORADDR(10); break; + case FSMC_RS_A10: _ORADDR(11); break; + case FSMC_RS_A11: _ORADDR(12); break; + case FSMC_RS_A12: _ORADDR(13); break; + case FSMC_RS_A13: _ORADDR(14); break; + case FSMC_RS_A14: _ORADDR(15); break; + case FSMC_RS_A15: _ORADDR(16); break; + #endif case FSMC_RS_A16: _ORADDR(17); break; case FSMC_RS_A17: _ORADDR(18); break; case FSMC_RS_A18: _ORADDR(19); break; @@ -189,8 +200,10 @@ void LCD_IO_Init(uint8_t cs, uint8_t rs) { case FSMC_RS_A21: _ORADDR(22); break; case FSMC_RS_A22: _ORADDR(23); break; case FSMC_RS_A23: _ORADDR(24); break; - case FSMC_RS_A24: _ORADDR(25); break; - case FSMC_RS_A25: _ORADDR(26); break; + #ifdef STM32_XL_DENSITY + case FSMC_RS_A24: _ORADDR(25); break; + case FSMC_RS_A25: _ORADDR(26); break; + #endif default: return; } @@ -254,4 +267,4 @@ uint32_t LCD_IO_ReadData(uint16_t RegValue, uint8_t ReadSize) { #endif // HAS_GRAPHICAL_LCD -#endif // STM32F1 || STM32F1xx +#endif // ARDUINO_ARCH_STM32F1 && (STM32_HIGH_DENSITY || STM32_XL_DENSITY) diff --git a/Marlin/src/HAL/HAL_STM32F4/EmulatedEeprom.cpp b/Marlin/src/HAL/HAL_STM32F4/EmulatedEeprom.cpp index 5329ddfbdc..1f3d753448 100644 --- a/Marlin/src/HAL/HAL_STM32F4/EmulatedEeprom.cpp +++ b/Marlin/src/HAL/HAL_STM32F4/EmulatedEeprom.cpp @@ -26,7 +26,7 @@ #include "../../inc/MarlinConfig.h" -#if ENABLED(EEPROM_SETTINGS) && DISABLED(I2C_EEPROM) && DISABLED(SPI_EEPROM) +#if ENABLED(EEPROM_SETTINGS) && DISABLED(I2C_EEPROM, SPI_EEPROM) // -------------------------------------------------------------------------- // Includes @@ -138,5 +138,5 @@ void eeprom_update_block(const void *__src, void *__dst, size_t __n) { } -#endif // ENABLED(EEPROM_SETTINGS) && DISABLED(I2C_EEPROM) && DISABLED(SPI_EEPROM) +#endif // EEPROM_SETTINGS && (!I2C_EEPROM && !SPI_EEPROM) #endif // STM32GENERIC && STM32F4 diff --git a/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.h b/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.h index cbf93fba50..a4c2ba6f44 100644 --- a/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.h +++ b/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.h @@ -65,13 +65,13 @@ #ifdef STM32GENERIC extern void TC5_Handler(); extern void TC7_Handler(); - #define HAL_STEP_TIMER_ISR void TC5_Handler() - #define HAL_TEMP_TIMER_ISR void TC7_Handler() + #define HAL_STEP_TIMER_ISR() void TC5_Handler() + #define HAL_TEMP_TIMER_ISR() void TC7_Handler() #else extern void TC5_Handler(stimer_t *htim); extern void TC7_Handler(stimer_t *htim); - #define HAL_STEP_TIMER_ISR void TC5_Handler(stimer_t *htim) - #define HAL_TEMP_TIMER_ISR void TC7_Handler(stimer_t *htim) + #define HAL_STEP_TIMER_ISR() void TC5_Handler(stimer_t *htim) + #define HAL_TEMP_TIMER_ISR() void TC7_Handler(stimer_t *htim) #endif diff --git a/Marlin/src/HAL/HAL_STM32F4/SanityCheck.h b/Marlin/src/HAL/HAL_STM32F4/SanityCheck.h index 7e88dbbd82..31e7ce6248 100644 --- a/Marlin/src/HAL/HAL_STM32F4/SanityCheck.h +++ b/Marlin/src/HAL/HAL_STM32F4/SanityCheck.h @@ -68,3 +68,7 @@ #if ENABLED(EMERGENCY_PARSER) #error "EMERGENCY_PARSER is not yet implemented for STM32F4. Disable EMERGENCY_PARSER to continue." #endif + +#if ENABLED(FAST_PWM_FAN) + #error "FAST_PWM_FAN is not yet implemented for this platform." +#endif diff --git a/Marlin/src/HAL/HAL_STM32F4/fastio_STM32F4.h b/Marlin/src/HAL/HAL_STM32F4/fastio_STM32F4.h index 5e80ec7fec..bac5bdabca 100644 --- a/Marlin/src/HAL/HAL_STM32F4/fastio_STM32F4.h +++ b/Marlin/src/HAL/HAL_STM32F4/fastio_STM32F4.h @@ -44,15 +44,20 @@ #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 SET_PWM(IO) pinMode(IO, PWM) #define TOGGLE(IO) OUT_WRITE(IO, !READ(IO)) -#define GET_INPUT(IO) -#define GET_OUTPUT(IO) -#define GET_TIMER(IO) +#define IS_INPUT(IO) +#define IS_OUTPUT(IO) +#define HAS_TIMER(IO) true -#define PWM_PIN(p) true -#define USEABLE_HARDWARE_PWM(p) PWM_PIN(p) +#define PWM_PIN(P) HAS_TIMER(P) +#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P) + +// digitalRead/Write wrappers +#define extDigitalRead(IO) digitalRead(IO) +#define extDigitalWrite(IO,V) digitalWrite(IO,V) // // Pins Definitions diff --git a/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h b/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h index b856edb3e8..34e56a2059 100644 --- a/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h +++ b/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h @@ -66,8 +66,8 @@ extern void TC5_Handler(); extern void TC7_Handler(); -#define HAL_STEP_TIMER_ISR void TC5_Handler() -#define HAL_TEMP_TIMER_ISR void TC7_Handler() +#define HAL_STEP_TIMER_ISR() void TC5_Handler() +#define HAL_TEMP_TIMER_ISR() void TC7_Handler() // -------------------------------------------------------------------------- // Types diff --git a/Marlin/src/HAL/HAL_STM32F7/SanityCheck.h b/Marlin/src/HAL/HAL_STM32F7/SanityCheck.h index 870fa36fd5..2192d6ffcf 100644 --- a/Marlin/src/HAL/HAL_STM32F7/SanityCheck.h +++ b/Marlin/src/HAL/HAL_STM32F7/SanityCheck.h @@ -70,3 +70,7 @@ #if ENABLED(EMERGENCY_PARSER) #error "EMERGENCY_PARSER is not yet implemented for STM32F7. Disable EMERGENCY_PARSER to continue." #endif + +#if ENABLED(FAST_PWM_FAN) + #error "FAST_PWM_FAN is not yet implemented for this platform." +#endif diff --git a/Marlin/src/HAL/HAL_STM32F7/TMC2660.cpp b/Marlin/src/HAL/HAL_STM32F7/TMC2660.cpp index b54e7d0bda..33418bb981 100644 --- a/Marlin/src/HAL/HAL_STM32F7/TMC2660.cpp +++ b/Marlin/src/HAL/HAL_STM32F7/TMC2660.cpp @@ -191,9 +191,9 @@ void TMC26XStepper::start() { pinMode(dir_pin, OUTPUT); pinMode(cs_pin, OUTPUT); //SET_OUTPUT(STEPPER_ENABLE_PIN); - digitalWrite(step_pin, LOW); - digitalWrite(dir_pin, LOW); - digitalWrite(cs_pin, HIGH); + extDigitalWrite(step_pin, LOW); + extDigitalWrite(dir_pin, LOW); + extDigitalWrite(cs_pin, HIGH); STEPPER_SPI.begin(); STEPPER_SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE3)); @@ -261,10 +261,10 @@ char TMC26XStepper::move(void) { // increment or decrement the step number, // depending on direction: if (this->direction == 1) - digitalWrite(step_pin, HIGH); + extDigitalWrite(step_pin, HIGH); else { - digitalWrite(dir_pin, HIGH); - digitalWrite(step_pin, HIGH); + extDigitalWrite(dir_pin, HIGH); + extDigitalWrite(step_pin, HIGH); } // get the timeStamp of when you stepped: this->last_step_time = time; @@ -272,8 +272,8 @@ char TMC26XStepper::move(void) { // decrement the steps left: steps_left--; //disable the step & dir pins - digitalWrite(step_pin, LOW); - digitalWrite(dir_pin, LOW); + extDigitalWrite(step_pin, LOW); + extDigitalWrite(dir_pin, LOW); } return -1; } @@ -864,7 +864,7 @@ inline void TMC26XStepper::send262(uint32_t datagram) { //} //select the TMC driver - digitalWrite(cs_pin, LOW); + extDigitalWrite(cs_pin, LOW); //ensure that only valid bist are set (0-19) //datagram &=REGISTER_BIT_PATTERN; @@ -893,7 +893,7 @@ inline void TMC26XStepper::send262(uint32_t datagram) { #endif //deselect the TMC chip - digitalWrite(cs_pin, HIGH); + extDigitalWrite(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/fastio_STM32F7.h b/Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h index 8aaba0c298..50b071ff30 100644 --- a/Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h +++ b/Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h @@ -43,15 +43,20 @@ #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 SET_PWM(IO) _SET_MODE(IO, PWM) #define TOGGLE(IO) OUT_WRITE(IO, !READ(IO)) -#define GET_INPUT(IO) -#define GET_OUTPUT(IO) -#define GET_TIMER(IO) +#define IS_INPUT(IO) +#define IS_OUTPUT(IO) +#define HAS_TIMER(IO) true -#define PWM_PIN(p) true -#define USEABLE_HARDWARE_PWM(p) PWM_PIN(p) +#define PWM_PIN(P) HAS_TIMER(P) +#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P) + +// digitalRead/Write wrappers +#define extDigitalRead(IO) digitalRead(IO) +#define extDigitalWrite(IO,V) digitalWrite(IO,V) // // Pins Definitions diff --git a/Marlin/src/HAL/HAL_TEENSY31_32/HAL_timers_Teensy.h b/Marlin/src/HAL/HAL_TEENSY31_32/HAL_timers_Teensy.h index b733d1625f..79a854126e 100644 --- a/Marlin/src/HAL/HAL_TEENSY31_32/HAL_timers_Teensy.h +++ b/Marlin/src/HAL/HAL_TEENSY31_32/HAL_timers_Teensy.h @@ -72,8 +72,8 @@ typedef uint32_t hal_timer_t; #define ENABLE_TEMPERATURE_INTERRUPT() HAL_timer_enable_interrupt(TEMP_TIMER_NUM) #define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM) -#define HAL_STEP_TIMER_ISR extern "C" void ftm0_isr(void) //void TC3_Handler() -#define HAL_TEMP_TIMER_ISR extern "C" void ftm1_isr(void) //void TC4_Handler() +#define HAL_STEP_TIMER_ISR() extern "C" void ftm0_isr(void) //void TC3_Handler() +#define HAL_TEMP_TIMER_ISR() extern "C" void ftm1_isr(void) //void TC4_Handler() void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency); diff --git a/Marlin/src/HAL/HAL_TEENSY31_32/SanityCheck.h b/Marlin/src/HAL/HAL_TEENSY31_32/SanityCheck.h index e1e2a8e0a6..9ecf5e35f5 100644 --- a/Marlin/src/HAL/HAL_TEENSY31_32/SanityCheck.h +++ b/Marlin/src/HAL/HAL_TEENSY31_32/SanityCheck.h @@ -27,3 +27,7 @@ #if ENABLED(EMERGENCY_PARSER) #error "EMERGENCY_PARSER is not yet implemented for Teensy 3.1/3.2. Disable EMERGENCY_PARSER to continue." #endif + +#if ENABLED(FAST_PWM_FAN) + #error "FAST_PWM_FAN is not yet implemented for this platform." +#endif diff --git a/Marlin/src/HAL/HAL_TEENSY31_32/fastio_Teensy.h b/Marlin/src/HAL/HAL_TEENSY31_32/fastio_Teensy.h index 5116979c9a..928cd758e7 100644 --- a/Marlin/src/HAL/HAL_TEENSY31_32/fastio_Teensy.h +++ b/Marlin/src/HAL/HAL_TEENSY31_32/fastio_Teensy.h @@ -43,7 +43,7 @@ * Why double up on these macros? see http://gcc.gnu.org/onlinedocs/cpp/Stringification.html */ -#define _READ(p) bool(CORE_PIN ## p ## _PINREG & CORE_PIN ## p ## _BITMASK) +#define _READ(P) bool(CORE_PIN ## P ## _PINREG & CORE_PIN ## P ## _BITMASK) #define _WRITE(P,V) do{ \ if (V) CORE_PIN ## P ## _PORTSET = CORE_PIN ## P ## _BITMASK; \ @@ -67,8 +67,8 @@ GPIO_BITBAND(CORE_PIN ## P ## _DDRREG , CORE_PIN ## P ## _BIT) = 0; \ }while(0) -#define _GET_INPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0) -#define _GET_OUTPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0) +#define _IS_INPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0) +#define _IS_OUTPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0) #define READ(IO) _READ(IO) @@ -79,12 +79,20 @@ #define SET_INPUT(IO) _SET_INPUT(IO) #define SET_INPUT_PULLUP(IO) _SET_INPUT_PULLUP(IO) #define SET_OUTPUT(IO) _SET_OUTPUT(IO) +#define SET_PWM(IO) SET_OUTPUT(IO) -#define GET_INPUT(IO) _GET_INPUT(IO) -#define GET_OUTPUT(IO) _GET_OUTPUT(IO) +#define IS_INPUT(IO) _IS_INPUT(IO) +#define IS_OUTPUT(IO) _IS_OUTPUT(IO) #define OUT_WRITE(IO,V) do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0) +// digitalRead/Write wrappers +#define extDigitalRead(IO) digitalRead(IO) +#define extDigitalWrite(IO,V) digitalWrite(IO,V) + +#define PWM_PIN(P) digitalPinHasPWM(P) +#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P) + /** * Ports, functions, and pins */ diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/HAL.h b/Marlin/src/HAL/HAL_TEENSY35_36/HAL.h index 03918c28f2..99fc31aff5 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/HAL.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/HAL.h @@ -49,6 +49,7 @@ #include "HAL_timers_Teensy.h" #include +#include #define ST7920_DELAY_1 DELAY_NS(600) #define ST7920_DELAY_2 DELAY_NS(750) @@ -58,9 +59,6 @@ // Defines // -------------------------------------------------------------------------- -#undef MOTHERBOARD -#define MOTHERBOARD BOARD_TEENSY35_36 - #define IS_32BIT_TEENSY (defined(__MK64FX512__) || defined(__MK66FX1M0__)) #define IS_TEENSY35 defined(__MK64FX512__) #define IS_TEENSY36 defined(__MK66FX1M0__) @@ -87,9 +85,9 @@ typedef int8_t pin_t; #define analogInputToDigitalPin(p) ((p < 12u) ? (p) + 54u : -1) #endif -#define CRITICAL_SECTION_START uint32_t primask = __get_PRIMASK(); __disable_irq() +#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 ISRS_ENABLED() (!__get_primask()) #define ENABLE_ISRS() __enable_irq() #define DISABLE_ISRS() __disable_irq() 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 bac4332ac1..fed256452a 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h @@ -71,8 +71,8 @@ typedef uint32_t hal_timer_t; #define ENABLE_TEMPERATURE_INTERRUPT() HAL_timer_enable_interrupt(TEMP_TIMER_NUM) #define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM) -#define HAL_STEP_TIMER_ISR extern "C" void ftm0_isr(void) //void TC3_Handler() -#define HAL_TEMP_TIMER_ISR extern "C" void ftm1_isr(void) //void TC4_Handler() +#define HAL_STEP_TIMER_ISR() extern "C" void ftm0_isr(void) //void TC3_Handler() +#define HAL_TEMP_TIMER_ISR() extern "C" void ftm1_isr(void) //void TC4_Handler() void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency); diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/SanityCheck.h b/Marlin/src/HAL/HAL_TEENSY35_36/SanityCheck.h index 630b5abcf8..597a3638da 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/SanityCheck.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/SanityCheck.h @@ -27,3 +27,7 @@ #if ENABLED(EMERGENCY_PARSER) #error "EMERGENCY_PARSER is not yet implemented for Teensy 3.5/3.6. Disable EMERGENCY_PARSER to continue." #endif + +#if ENABLED(FAST_PWM_FAN) + #error "FAST_PWM_FAN is not yet implemented for this platform." +#endif diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/fastio_Teensy.h b/Marlin/src/HAL/HAL_TEENSY35_36/fastio_Teensy.h index ccbeddd726..b9ddd957c1 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/fastio_Teensy.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/fastio_Teensy.h @@ -42,7 +42,7 @@ * Why double up on these macros? see http://gcc.gnu.org/onlinedocs/cpp/Stringification.html */ -#define _READ(p) bool(CORE_PIN ## p ## _PINREG & CORE_PIN ## p ## _BITMASK) +#define _READ(P) bool(CORE_PIN ## P ## _PINREG & CORE_PIN ## P ## _BITMASK) #define _WRITE(P,V) do{ \ if (V) CORE_PIN ## P ## _PORTSET = CORE_PIN ## P ## _BITMASK; \ @@ -66,8 +66,8 @@ GPIO_BITBAND(CORE_PIN ## P ## _DDRREG , CORE_PIN ## P ## _BIT) = 0; \ }while(0) -#define _GET_INPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0) -#define _GET_OUTPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0) +#define _IS_INPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0) +#define _IS_OUTPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0) #define READ(IO) _READ(IO) @@ -78,12 +78,20 @@ #define SET_INPUT(IO) _SET_INPUT(IO) #define SET_INPUT_PULLUP(IO) _SET_INPUT_PULLUP(IO) #define SET_OUTPUT(IO) _SET_OUTPUT(IO) +#define SET_PWM(IO) SET_OUTPUT(IO) -#define GET_INPUT(IO) _GET_INPUT(IO) -#define GET_OUTPUT(IO) _GET_OUTPUT(IO) +#define IS_INPUT(IO) _IS_INPUT(IO) +#define IS_OUTPUT(IO) _IS_OUTPUT(IO) #define OUT_WRITE(IO,V) do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0) +// digitalRead/Write wrappers +#define extDigitalRead(IO) digitalRead(IO) +#define extDigitalWrite(IO,V) digitalWrite(IO,V) + +#define PWM_PIN(P) digitalPinHasPWM(P) +#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P) + /** * Ports, functions, and pins */ diff --git a/Marlin/src/HAL/shared/HAL_spi_L6470.cpp b/Marlin/src/HAL/shared/HAL_spi_L6470.cpp index f3c5a31f60..ecd808fe46 100644 --- a/Marlin/src/HAL/shared/HAL_spi_L6470.cpp +++ b/Marlin/src/HAL/shared/HAL_spi_L6470.cpp @@ -83,7 +83,7 @@ uint8_t L6470_transfer(uint8_t data, int16_t ss_pin, const uint8_t chain_positio uint8_t data_out = 0; // first device in chain has data sent last - digitalWrite(ss_pin, LOW); + extDigitalWrite(ss_pin, LOW); for (uint8_t i = L6470::chain[0]; (i >= 1) && !spi_abort; i--) { // stop sending data if spi_abort is active DISABLE_ISRS(); // disable interrupts during SPI transfer (can't allow partial command to chips) @@ -92,7 +92,7 @@ uint8_t L6470_transfer(uint8_t data, int16_t ss_pin, const uint8_t chain_positio if (i == chain_position) data_out = temp; } - digitalWrite(ss_pin, HIGH); + extDigitalWrite(ss_pin, HIGH); return data_out; } diff --git a/Marlin/src/HAL/shared/persistent_store_api.cpp b/Marlin/src/HAL/shared/persistent_store_api.cpp index 5d7a6b7b57..e7bd107cbe 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) || ENABLED(SD_FIRMWARE_UPDATE) +#if EITHER(EEPROM_SETTINGS, SD_FIRMWARE_UPDATE) #include "persistent_store_api.h" PersistentStore persistentStore; diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp index a848265c12..e11db20bc5 100644 --- a/Marlin/src/Marlin.cpp +++ b/Marlin/src/Marlin.cpp @@ -30,6 +30,7 @@ #include "Marlin.h" +#include "core/utility.h" #include "lcd/ultralcd.h" #include "module/motion.h" #include "module/planner.h" @@ -84,6 +85,10 @@ #include "feature/leds/leds.h" #endif +#if ENABLED(BLTOUCH) + #include "feature/bltouch.h" +#endif + #if HAS_SERVOS #include "module/servo.h" #endif @@ -114,8 +119,8 @@ #endif #if ENABLED(G38_PROBE_TARGET) - bool G38_move = false, - G38_endstop_hit = false; + uint8_t G38_move; // = 0 + bool G38_did_trigger; // = false #endif #if ENABLED(DELTA) @@ -128,7 +133,7 @@ #include "feature/bedlevel/bedlevel.h" #endif -#if ENABLED(ADVANCED_PAUSE_FEATURE) && ENABLED(PAUSE_PARK_NO_STEPPER_TIMEOUT) +#if BOTH(ADVANCED_PAUSE_FEATURE, PAUSE_PARK_NO_STEPPER_TIMEOUT) #include "feature/pause.h" #endif @@ -152,7 +157,7 @@ #include "feature/fanmux.h" #endif -#if DO_SWITCH_EXTRUDER || ENABLED(SWITCHING_NOZZLE) || ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if DO_SWITCH_EXTRUDER || ANY(SWITCHING_NOZZLE, PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #include "module/tool_change.h" #endif @@ -179,11 +184,11 @@ bool Running = true; #endif // For M109 and M190, this flag may be cleared (by M108) to exit the wait loop -volatile bool wait_for_heatup = true; +bool wait_for_heatup = true; // For M0/M1, this flag may be cleared (by M108) to exit the wait-for-user loop #if HAS_RESUME_CONTINUE - volatile bool wait_for_user; // = false; + bool wait_for_user; // = false; #endif #if HAS_AUTO_REPORTING || ENABLED(HOST_KEEPALIVE_FEATURE) @@ -328,7 +333,7 @@ void disable_all_steppers() { ExtUI::onFilamentRunout(ExtUI::getActiveTool()); #endif - #if ENABLED(HOST_PROMPT_SUPPORT) || ENABLED(HOST_ACTION_COMMANDS) + #if EITHER(HOST_PROMPT_SUPPORT, HOST_ACTION_COMMANDS) const char tool = '0' #if NUM_RUNOUT_SENSORS > 1 + active_extruder @@ -443,7 +448,7 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) { } // Prevent steppers timing-out in the middle of M600 - #if ENABLED(ADVANCED_PAUSE_FEATURE) && ENABLED(PAUSE_PARK_NO_STEPPER_TIMEOUT) + #if BOTH(ADVANCED_PAUSE_FEATURE, PAUSE_PARK_NO_STEPPER_TIMEOUT) #define MOVE_AWAY_TEST !did_pause_print #else #define MOVE_AWAY_TEST true @@ -764,11 +769,34 @@ void minkill() { suicide(); #endif - while (1) { - #if ENABLED(USE_WATCHDOG) - watchdog_reset(); - #endif - } // Wait for reset + #if HAS_KILL + + // Wait for kill to be released + while (!READ(KILL_PIN)) { + #if ENABLED(USE_WATCHDOG) + watchdog_reset(); + #endif + } + + // Wait for kill to be pressed + while (READ(KILL_PIN)) { + #if ENABLED(USE_WATCHDOG) + watchdog_reset(); + #endif + } + + void(*resetFunc)(void) = 0; // Declare resetFunc() at address 0 + resetFunc(); // Jump to address 0 + + #else // !HAS_KILL + + for (;;) { + #if ENABLED(USE_WATCHDOG) + watchdog_reset(); + #endif + } // Wait for reset + + #endif // !HAS_KILL } /** @@ -910,8 +938,7 @@ void setup() { #endif SERIAL_ECHO_START(); - SERIAL_ECHOPAIR(MSG_FREE_MEMORY, freeMemory()); - SERIAL_ECHOLNPAIR(MSG_PLANNER_BUFFER_BYTES, (int)sizeof(block_t)*BLOCK_BUFFER_SIZE); + SERIAL_ECHOLNPAIR(MSG_FREE_MEMORY, freeMemory(), MSG_PLANNER_BUFFER_BYTES, (int)sizeof(block_t) * (BLOCK_BUFFER_SIZE)); queue_setup(); @@ -953,7 +980,7 @@ void setup() { OUT_WRITE(SPINDLE_DIR_PIN, SPINDLE_INVERT_DIR ? 255 : 0); // init rotation to clockwise (M3) #endif #if ENABLED(SPINDLE_LASER_PWM) && defined(SPINDLE_LASER_PWM_PIN) && SPINDLE_LASER_PWM_PIN >= 0 - SET_OUTPUT(SPINDLE_LASER_PWM_PIN); + SET_PWM(SPINDLE_LASER_PWM_PIN); analogWrite(SPINDLE_LASER_PWM_PIN, SPINDLE_LASER_PWM_INVERT ? 255 : 0); // set to lowest speed #endif #endif @@ -978,7 +1005,7 @@ void setup() { dac_init(); #endif - #if (ENABLED(Z_PROBE_SLED) || ENABLED(SOLENOID_PROBE)) && HAS_SOLENOID_1 + #if EITHER(Z_PROBE_SLED, SOLENOID_PROBE) && HAS_SOLENOID_1 OUT_WRITE(SOL1_PIN, LOW); // OFF #endif @@ -1000,7 +1027,7 @@ void setup() { #if HAS_CASE_LIGHT #if DISABLED(CASE_LIGHT_USE_NEOPIXEL) - SET_OUTPUT(CASE_LIGHT_PIN); + if (PWM_PIN(CASE_LIGHT_PIN)) SET_PWM(CASE_LIGHT_PIN); else SET_OUTPUT(CASE_LIGHT_PIN); #endif update_case_light(); #endif @@ -1018,7 +1045,7 @@ void setup() { ui.init(); ui.reset_status(); - #if ENABLED(SHOW_BOOTSCREEN) + #if HAS_SPI_LCD && ENABLED(SHOW_BOOTSCREEN) ui.show_bootscreen(); #endif @@ -1027,7 +1054,7 @@ void setup() { #endif #if ENABLED(BLTOUCH) - bltouch_init(); + bltouch.init(); #endif #if ENABLED(I2C_POSITION_ENCODERS) @@ -1116,6 +1143,9 @@ void loop() { #if ENABLED(POWER_LOSS_RECOVERY) card.removeJobRecoveryFile(); #endif + #ifdef EVENT_GCODE_SD_STOP + enqueue_and_echo_commands_P(PSTR(EVENT_GCODE_SD_STOP)); + #endif } #endif // SDSUPPORT diff --git a/Marlin/src/Marlin.h b/Marlin/src/Marlin.h index bea5c358c9..1252d7f574 100644 --- a/Marlin/src/Marlin.h +++ b/Marlin/src/Marlin.h @@ -309,8 +309,8 @@ void manage_inactivity(const bool ignore_stepper_queue=false); #endif #if ENABLED(G38_PROBE_TARGET) - extern bool G38_move, // flag to tell the interrupt handler that a G38 command is being run - G38_endstop_hit; // flag from the interrupt handler to indicate if the endstop went active + extern uint8_t G38_move; // Flag to tell the ISR that G38 is in progress, and the type + extern bool G38_did_trigger; // Flag from the ISR to indicate the endstop changed #endif /** @@ -330,10 +330,10 @@ extern bool Running; inline bool IsRunning() { return Running; } inline bool IsStopped() { return !Running; } -extern volatile bool wait_for_heatup; +extern bool wait_for_heatup; #if HAS_RESUME_CONTINUE - extern volatile bool wait_for_user; + extern bool wait_for_user; #endif #if HAS_AUTO_REPORTING || ENABLED(HOST_KEEPALIVE_FEATURE) diff --git a/Marlin/src/config/examples/WASP/PowerWASP/Configuration_adv.h b/Marlin/src/config/examples/WASP/PowerWASP/Configuration_adv.h deleted file mode 100644 index 03bbd1db4f..0000000000 --- a/Marlin/src/config/examples/WASP/PowerWASP/Configuration_adv.h +++ /dev/null @@ -1,2262 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -#pragma once - -/** - * 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 - - //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) - //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 - #endif - - /** - * 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 180 - #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) - -// -// Backlash Compensation -// Adds extra movement to axes on direction-changes to account for backlash. -// -//#define BACKLASH_COMPENSATION -#if ENABLED(BACKLASH_COMPENSATION) - // Define values for backlash distance and correction. - // If BACKLASH_GCODE is enabled these values are the defaults. - #define BACKLASH_DISTANCE_MM { 0, 0, 0 } // (mm) - #define BACKLASH_CORRECTION 0.0 // 0.0 = no correction; 1.0 = full correction - - // Set BACKLASH_SMOOTHING_MM to spread backlash correction over multiple segments - // to reduce print artifacts. (Enabling this is costly in memory and computation!) - //#define BACKLASH_SMOOTHING_MM 3 // (mm) - - // Add runtime configuration and tuning of backlash values (M425) - //#define BACKLASH_GCODE - - #if ENABLED(BACKLASH_GCODE) - // Measure the Z backlash when probing (G29) and set with "M425 Z" - #define MEASURE_BACKLASH_WHEN_PROBING - - #if ENABLED(MEASURE_BACKLASH_WHEN_PROBING) - // When measuring, the probe will move up to BACKLASH_MEASUREMENT_LIMIT - // mm away from point of contact in BACKLASH_MEASUREMENT_RESOLUTION - // increments while checking for the contact to be broken. - #define BACKLASH_MEASUREMENT_LIMIT 0.5 // (mm) - #define BACKLASH_MEASUREMENT_RESOLUTION 0.005 // (mm) - #define BACKLASH_MEASUREMENT_FEEDRATE Z_PROBE_SPEED_SLOW // (mm/m) - #endif - #endif -#endif - -/** - * Automatic backlash, position and hotend offset calibration - * - * Enable G425 to run automatic calibration using an electrically- - * conductive cube, bolt, or washer mounted on the bed. - * - * G425 uses the probe to touch the top and sides of the calibration object - * on the bed and measures and/or correct positional offsets, axis backlash - * and hotend offsets. - * - * Note: HOTEND_OFFSET and CALIBRATION_OBJECT_CENTER must be set to within - * ±5mm of true values for G425 to succeed. - */ -//#define CALIBRATION_GCODE -#if ENABLED(CALIBRATION_GCODE) - - #define CALIBRATION_MEASUREMENT_RESOLUTION 0.01 // mm - - #define CALIBRATION_FEEDRATE_SLOW 60 // mm/m - #define CALIBRATION_FEEDRATE_FAST 1200 // mm/m - #define CALIBRATION_FEEDRATE_TRAVEL 3000 // mm/m - - // The following parameters refer to the conical section of the nozzle tip. - #define CALIBRATION_NOZZLE_TIP_HEIGHT 1.0 // mm - #define CALIBRATION_NOZZLE_OUTER_DIAMETER 2.0 // mm - - // Uncomment to enable reporting (required for "G425 V", but consumes PROGMEM). - //#define CALIBRATION_REPORTING - - // The true location and dimension the cube/bolt/washer on the bed. - #define CALIBRATION_OBJECT_CENTER { 264.0, -22.0, -2.0} // mm - #define CALIBRATION_OBJECT_DIMENSIONS { 10.0, 10.0, 10.0} // mm - - // Comment out any sides which are unreachable by the probe. For best - // auto-calibration results, all sides must be reachable. - #define CALIBRATION_MEASURE_RIGHT - #define CALIBRATION_MEASURE_FRONT - #define CALIBRATION_MEASURE_LEFT - #define CALIBRATION_MEASURE_BACK - - // Probing at the exact top center only works if the center is flat. If - // probing on a screwhead or hollow washer, probe near the edges. - //#define CALIBRATION_MEASURE_AT_TOP_EDGES - - // Define pin which is read during calibration - #ifndef CALIBRATION_PIN - #define CALIBRATION_PIN -1 // Override in pins.h or set to -1 to use your Z endstop - #define CALIBRATION_PIN_INVERTING false // set to true to invert the pin - //#define CALIBRATION_PIN_PULLDOWN - #define CALIBRATION_PIN_PULLUP - #endif -#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 - -// Play a beep when the feedrate is changed from the Status Screen -//#define BEEP_ON_FEEDRATE_CHANGE -#if ENABLED(BEEP_ON_FEEDRATE_CHANGE) - #define FEEDRATE_CHANGE_BEEP_DURATION 10 - #define FEEDRATE_CHANGE_BEEP_FREQUENCY 440 -#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 - -/** - * 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 "G1 Y190 Z190\nM84 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 65 // Pin to detect power loss - #define POWER_LOSS_STATE LOW // 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 BINARY_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 - - /** - * 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. - */ - #if ENABLED(U8GLIB_ST7920) - //#define LIGHTWEIGHT_UI - #if ENABLED(LIGHTWEIGHT_UI) - #define STATUS_EXPIRE_SECONDS 20 - #endif - #endif - - /** - * Status (Info) Screen customizations - * These options may affect code size and screen render time. - * Custom status screens can forcibly override these settings. - */ - //#define STATUS_COMBINE_HEATERS // Use combined heater images instead of separate ones - //#define STATUS_HOTEND_NUMBERLESS // Use plain hotend icons instead of numbered ones (with 2+ hotends) - #define STATUS_HOTEND_INVERTED // Show solid nozzle bitmaps when heating (Requires STATUS_HOTEND_ANIM) - #define STATUS_HOTEND_ANIM // Use a second bitmap to indicate hotend heating - #define STATUS_BED_ANIM // Use a second bitmap to indicate bed heating - //#define STATUS_ALT_BED_BITMAP // Use the alternative bed bitmap - //#define STATUS_ALT_FAN_BITMAP // Use the alternative fan bitmap - //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames - //#define STATUS_HEAT_PERCENT // Show heating in a progress bar - -#endif // HAS_GRAPHICAL_LCD - -// @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_WITHOUT_HOMING - //#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. - //#define BABYSTEP_ALWAYS_AVAILABLE // Allow babystepping at all times (not just during movement). - //#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 - #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" - -#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 - -// Printrun may have trouble receiving long strings all at once. -// This option inserts short delays between lines of serial output. -#define SERIAL_OVERRUN_PROTECTION - -// @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_EXTRA_PRIME 2 // (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 20 // (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 400 // (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 20 // (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 400 // (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. - #define ADVANCED_PAUSE_RESUME_PRIME 0 // (mm) Extra distance to prime nozzle after returning from park. - - // 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 5 // 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) - - #if AXIS_DRIVER_TYPE_X(TMC26X) - #define X_MAX_CURRENT 1000 // (mA) - #define X_SENSE_RESISTOR 91 // (mOhms) - #define X_MICROSTEPS 16 // Number of microsteps - #endif - - #if AXIS_DRIVER_TYPE_X2(TMC26X) - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 - #endif - - #if AXIS_DRIVER_TYPE_Y(TMC26X) - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 - #endif - - #if AXIS_DRIVER_TYPE_Y2(TMC26X) - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 - #endif - - #if AXIS_DRIVER_TYPE_Z(TMC26X) - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 - #endif - - #if AXIS_DRIVER_TYPE_Z2(TMC26X) - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 - #endif - - #if AXIS_DRIVER_TYPE_Z3(TMC26X) - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 - #endif - - #if AXIS_DRIVER_TYPE_E0(TMC26X) - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 - #endif - - #if AXIS_DRIVER_TYPE_E1(TMC26X) - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 - #endif - - #if AXIS_DRIVER_TYPE_E2(TMC26X) - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 - #endif - - #if AXIS_DRIVER_TYPE_E3(TMC26X) - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 - #endif - - #if AXIS_DRIVER_TYPE_E4(TMC26X) - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 - #endif - - #if AXIS_DRIVER_TYPE_E5(TMC26X) - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 - #endif - -#endif // TMC26X - -// @section tmc_smart - -/** - * To use TMC2130, TMC2160, TMC2660, TMC5130, TMC5160 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. - * - * 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. - * - * TMCStepper library is required to use TMC stepper drivers. - * https://github.com/teemuatlut/TMCStepper - */ -#if HAS_TRINAMIC - - #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current - #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - - #if AXIS_IS_TMC(X) - #define X_CURRENT 800 // (mA) RMS current. Multiply by 1.414 for peak current. - #define X_MICROSTEPS 16 // 0..256 - #define X_RSENSE 0.11 - #endif - - #if AXIS_IS_TMC(X2) - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 - #define X2_RSENSE 0.11 - #endif - - #if AXIS_IS_TMC(Y) - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 - #define Y_RSENSE 0.11 - #endif - - #if AXIS_IS_TMC(Y2) - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 - #define Y2_RSENSE 0.11 - #endif - - #if AXIS_IS_TMC(Z) - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 - #define Z_RSENSE 0.11 - #endif - - #if AXIS_IS_TMC(Z2) - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 - #define Z2_RSENSE 0.11 - #endif - - #if AXIS_IS_TMC(Z3) - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 - #define Z3_RSENSE 0.11 - #endif - - #if AXIS_IS_TMC(E0) - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 - #define E0_RSENSE 0.11 - #endif - - #if AXIS_IS_TMC(E1) - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 - #define E1_RSENSE 0.11 - #endif - - #if AXIS_IS_TMC(E2) - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 - #define E2_RSENSE 0.11 - #endif - - #if AXIS_IS_TMC(E3) - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 - #define E3_RSENSE 0.11 - #endif - - #if AXIS_IS_TMC(E4) - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 - #define E4_RSENSE 0.11 - #endif - - #if AXIS_IS_TMC(E5) - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 - #define E5_RSENSE 0.11 - #endif - - /** - * Override default SPI pins for TMC2130, TMC2160, TMC2660, TMC5130 and TMC5160 drivers here. - * The default pins can be found in your board's pins file. - */ - //#define X_CS_PIN -1 - //#define Y_CS_PIN -1 - //#define Z_CS_PIN -1 - //#define X2_CS_PIN -1 - //#define Y2_CS_PIN -1 - //#define Z2_CS_PIN -1 - //#define Z3_CS_PIN -1 - //#define E0_CS_PIN -1 - //#define E1_CS_PIN -1 - //#define E2_CS_PIN -1 - //#define E3_CS_PIN -1 - //#define E4_CS_PIN -1 - //#define E5_CS_PIN -1 - - /** - * Use software SPI for TMC2130. - * Software option for SPI driven drivers (TMC2130, TMC2160, TMC2660, TMC5130 and TMC5160). - * 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 - - /** - * Software enable - * - * Use for drivers that do not use a dedicated enable pin, but rather handle the same - * function through a communication line such as SPI or UART. - */ - //#define SOFTWARE_DRIVER_ENABLE - - /** - * TMC2130, TMC2160, TMC2208, TMC5130 and TMC5160 only - * Use Trinamic's ultra quiet stepping mode. - * When disabled, Marlin will use spreadCycle stepping mode. - */ - #define STEALTHCHOP_XY - #define STEALTHCHOP_Z - #define STEALTHCHOP_E - - /** - * Optimize spreadCycle chopper parameters by using predefined parameter sets - * or with the help of an example included in the library. - * Provided parameter sets are - * CHOPPER_DEFAULT_12V - * CHOPPER_DEFAULT_19V - * CHOPPER_DEFAULT_24V - * CHOPPER_DEFAULT_36V - * CHOPPER_PRUSAMK3_24V // Imported parameters from the official Prusa firmware for MK3 (24V) - * CHOPPER_MARLIN_119 // Old defaults from Marlin v1.1.9 - * - * Define you own with - * { , , hysteresis_start[1..8] } - */ - #define CHOPPER_TIMING CHOPPER_DEFAULT_12V - - /** - * Monitor Trinamic 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 - 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 - - /** - * TMC2130, TMC2160, TMC2208, TMC5130 and TMC5160 only - * 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_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. - * 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 - - /** - * TMC2130, TMC2160, TMC2660, TMC5130, and TMC5160 only - * 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 - - /** - * 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 - * - * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver. - * https://github.com/ameyer/Arduino-L6470 - * - * Requires the following to be defined in your pins_YOUR_BOARD file - * L6470_CHAIN_SCK_PIN - * L6470_CHAIN_MISO_PIN - * L6470_CHAIN_MOSI_PIN - * L6470_CHAIN_SS_PIN - * L6470_RESET_CHAIN_PIN (optional) - */ -#if HAS_DRIVER(L6470) - - //#define L6470_CHITCHAT // Display additional status info - - #if AXIS_DRIVER_TYPE_X(L6470) - #define X_MICROSTEPS 128 // Number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128) - #define X_OVERCURRENT 2000 // (mA) Current where the driver detects an over current (VALID: 375 x (1 - 16) - 6A max - rounds down) - #define X_STALLCURRENT 1500 // (mA) Current where the driver detects a stall (VALID: 31.25 * (1-128) - 4A max - rounds down) - #define X_MAX_VOLTAGE 127 // 0-255, Maximum effective voltage seen by stepper - #define X_CHAIN_POS 0 // Position in SPI chain, 0=Not in chain, 1=Nearest MOSI - #endif - - #if AXIS_DRIVER_TYPE_X2(L6470) - #define X2_MICROSTEPS 128 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 - #define X2_MAX_VOLTAGE 127 - #define X2_CHAIN_POS 0 - #endif - - #if AXIS_DRIVER_TYPE_Y(L6470) - #define Y_MICROSTEPS 128 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 - #define Y_MAX_VOLTAGE 127 - #define Y_CHAIN_POS 0 - #endif - - #if AXIS_DRIVER_TYPE_Y2(L6470) - #define Y2_MICROSTEPS 128 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 - #define Y2_MAX_VOLTAGE 127 - #define Y2_CHAIN_POS 0 - #endif - - #if AXIS_DRIVER_TYPE_Z(L6470) - #define Z_MICROSTEPS 128 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 - #define Z_MAX_VOLTAGE 127 - #define Z_CHAIN_POS 0 - #endif - - #if AXIS_DRIVER_TYPE_Z2(L6470) - #define Z2_MICROSTEPS 128 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 - #define Z2_MAX_VOLTAGE 127 - #define Z2_CHAIN_POS 0 - #endif - - #if AXIS_DRIVER_TYPE_Z3(L6470) - #define Z3_MICROSTEPS 128 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 - #define Z3_MAX_VOLTAGE 127 - #define Z3_CHAIN_POS 0 - #endif - - #if AXIS_DRIVER_TYPE_E0(L6470) - #define E0_MICROSTEPS 128 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 - #define E0_MAX_VOLTAGE 127 - #define E0_CHAIN_POS 0 - #endif - - #if AXIS_DRIVER_TYPE_E1(L6470) - #define E1_MICROSTEPS 128 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 - #define E1_MAX_VOLTAGE 127 - #define E1_CHAIN_POS 0 - #endif - - #if AXIS_DRIVER_TYPE_E2(L6470) - #define E2_MICROSTEPS 128 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 - #define E2_MAX_VOLTAGE 127 - #define E2_CHAIN_POS 0 - #endif - - #if AXIS_DRIVER_TYPE_E3(L6470) - #define E3_MICROSTEPS 128 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 - #define E3_MAX_VOLTAGE 127 - #define E3_CHAIN_POS 0 - #endif - - #if AXIS_DRIVER_TYPE_E4(L6470) - #define E4_MICROSTEPS 128 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 - #define E4_MAX_VOLTAGE 127 - #define E4_CHAIN_POS 0 - #endif - - #if AXIS_DRIVER_TYPE_E5(L6470) - #define E5_MICROSTEPS 128 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 - #define E5_MAX_VOLTAGE 127 - #define E5_CHAIN_POS 0 - #endif - - /** - * Monitor L6470 drivers for error conditions like over temperature and over current. - * In the case of over temperature Marlin can decrease the drive until the error condition clears. - * Other detected conditions can be used to stop the current print. - * Relevant g-codes: - * M906 - I1/2/3/4/5 Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given. - * I not present or I0 or I1 - X, Y, Z or E0 - * I2 - X2, Y2, Z2 or E1 - * I3 - Z3 or E3 - * I4 - E4 - * I5 - E5 - * M916 - Increase drive level until get thermal warning - * M917 - Find minimum current thresholds - * M918 - Increase speed until max or error - * M122 S0/1 - Report driver parameters - */ - //#define MONITOR_L6470_DRIVER_STATUS - - #if ENABLED(MONITOR_L6470_DRIVER_STATUS) - #define KVAL_HOLD_STEP_DOWN 1 - //#define L6470_STOP_ON_ERROR - #endif - -#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 - -/** - * Photo G-code - * Add the M240 G-code to take a photo. - * The photo can be triggered by a digital pin or a physical movement. - */ -//#define PHOTO_GCODE -#if ENABLED(PHOTO_GCODE) - // A position to move to (and raise Z) before taking the photo - //#define PHOTO_POSITION { X_MAX_POS - 5, Y_MAX_POS, 0 } // { xpos, ypos, zraise } (M240 X Y Z) - //#define PHOTO_DELAY_MS 100 // (ms) Duration to pause before moving back (M240 P) - //#define PHOTO_RETRACT_MM 6.5 // (mm) E retract/recover for the photo move (M240 R S) - - // Canon RC-1 or homebrew digital camera trigger - // Data from: http://www.doc-diy.net/photo/rc-1_hacked/ - //#define PHOTOGRAPH_PIN 23 - - // Canon Hack Development Kit - // http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ - //#define CHDK_PIN 4 - - // Optional second move with delay to trigger the camera shutter - //#define PHOTO_SWITCH_POSITION { X_MAX_POS, Y_MAX_POS } // { xpos, ypos } (M240 I J) - - // Duration to hold the switch or keep CHDK_PIN high - //#define PHOTO_SWITCH_MS 50 // (ms) (M240 D) -#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 - -/** - * 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 - -/** - * Host Action Commands - * - * Define host streamer action commands in compliance with the standard. - * - * See https://reprap.org/wiki/G-code#Action_commands - * Common commands ........ poweroff, pause, paused, resume, resumed, cancel - * G29_RETRY_AND_RECOVER .. probe_rewipe, probe_failed - * - * Some features add reason codes to extend these commands. - * - * Host Prompt Support enables Marlin to use the host for user prompts so - * filament runout and other processes can be managed from the host side. - */ -//#define HOST_ACTION_COMMANDS -#if ENABLED(HOST_ACTION_COMMANDS) - //#define HOST_PROMPT_SUPPORT -#endif - -//=========================================================================== -//====================== 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/ - * - * Reliabuild 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 - -/** - * Prusa Multi-Material Unit v2 - * Enable in Configuration.h - */ -#if ENABLED(PRUSA_MMU2) - - // Serial port used for communication with MMU2. - // For AVR enable the UART port used for the MMU. (e.g., internalSerial) - // For 32-bit boards check your HAL for available serial ports. (e.g., Serial2) - #define INTERNAL_SERIAL_PORT 2 - #define MMU2_SERIAL internalSerial - - // Use hardware reset for MMU if a pin is defined for it - //#define MMU2_RST_PIN 23 - - // Enable if the MMU2 has 12V stepper motors (MMU2 Firmware 1.0.2 and up) - //#define MMU2_MODE_12V - - // G-code to execute when MMU2 F.I.N.D.A. probe detects filament runout - #define MMU2_FILAMENT_RUNOUT_SCRIPT "M600" - - // Add an LCD menu for MMU2 - //#define MMU2_MENUS - #if ENABLED(MMU2_MENUS) - // Settings for filament load / unload from the LCD menu. - // This is for Prusa MK3-style extruders. Customize for your hardware. - #define MMU2_FILAMENTCHANGE_EJECT_FEED 80.0 - #define MMU2_LOAD_TO_NOZZLE_SEQUENCE \ - { 7.2, 562 }, \ - { 14.4, 871 }, \ - { 36.0, 1393 }, \ - { 14.4, 871 }, \ - { 50.0, 198 } - - #define MMU2_RAMMING_SEQUENCE \ - { 1.0, 1000 }, \ - { 1.0, 1500 }, \ - { 2.0, 2000 }, \ - { 1.5, 3000 }, \ - { 2.5, 4000 }, \ - { -15.0, 5000 }, \ - { -14.0, 1200 }, \ - { -6.0, 600 }, \ - { 10.0, 700 }, \ - { -10.0, 400 }, \ - { -50.0, 2000 } - - #endif - - //#define MMU2_DEBUG // Write debug info to serial output - -#endif // PRUSA_MMU2 - -/** - * Advanced Print Counter settings - */ -#if ENABLED(PRINTCOUNTER) - #define SERVICE_WARNING_BUZZES 3 - // Activate up to 3 service interval watchdogs - //#define SERVICE_NAME_1 "Service S" - //#define SERVICE_INTERVAL_1 100 // print hours - //#define SERVICE_NAME_2 "Service L" - //#define SERVICE_INTERVAL_2 200 // print hours - //#define SERVICE_NAME_3 "Service 3" - //#define SERVICE_INTERVAL_3 1 // print hours -#endif - -// @section develop - -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - -// Enable Marlin dev mode which adds some special commands -//#define MARLIN_DEV_MODE diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index 845d32732d..cfebabe1bd 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -89,6 +89,7 @@ #define BOARD_FYSETC_F6_13 541 // Fysetc F6 #define BOARD_DUPLICATOR_I3_PLUS 31 // Wanhao Duplicator i3 Plus #define BOARD_VORON 441 // VORON Design +#define BOARD_TRONXY_V3_1_0 442 // Tronxy TRONXY-V3-1.0 // // Other ATmega1280, ATmega2560 @@ -252,6 +253,8 @@ #define BOARD_STM32F4 1804 // STM32 STM32GENERIC based STM32F4 controller #define BOARD_ARMED 1807 // Arm'ed STM32F4 based controller #define BOARD_RUMBA32 1809 // RUMBA32 STM32F4 based controller +#define BOARD_BLACK_STM32F407VE 1810 // BLACK_STM32F407VE +#define BOARD_BLACK_STM32F407ZE 1811 // BLACK_STM32F407ZE #define BOARD_STEVAL 1866 // STEVAL-3DP001V1 3D PRINTER BOARD // diff --git a/Marlin/src/core/debug_out.h b/Marlin/src/core/debug_out.h new file mode 100644 index 0000000000..e92c5c5416 --- /dev/null +++ b/Marlin/src/core/debug_out.h @@ -0,0 +1,91 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +// +// Serial aliases for debugging. +// Include this header after defining DEBUG_OUT +// (or not) in a given .cpp file +// + +#undef DEBUG_ECHO_START +#undef DEBUG_ERROR_START +#undef DEBUG_CHAR +#undef DEBUG_ECHO +#undef DEBUG_ECHO_F +#undef DEBUG_ECHOLN +#undef DEBUG_ECHOPGM +#undef DEBUG_ECHOLNPGM +#undef DEBUG_ECHOPAIR +#undef DEBUG_ECHOPAIR_F +#undef DEBUG_ECHOLNPAIR +#undef DEBUG_ECHOLNPAIR_F +#undef DEBUG_ECHO_MSG +#undef DEBUG_ERROR_MSG +#undef DEBUG_EOL +#undef DEBUG_POS +#undef DEBUG_XYZ +#undef DEBUG_DELAY + +#if DEBUG_OUT + #define DEBUG_PRINT_P(P) serialprintPGM(P) + #define DEBUG_ECHO_START SERIAL_ECHO_START + #define DEBUG_ERROR_START SERIAL_ERROR_START + #define DEBUG_CHAR SERIAL_CHAR + #define DEBUG_ECHO SERIAL_ECHO + #define DEBUG_ECHO_F SERIAL_ECHO_F + #define DEBUG_ECHOLN SERIAL_ECHOLN + #define DEBUG_ECHOPGM SERIAL_ECHOPGM + #define DEBUG_ECHOLNPGM SERIAL_ECHOLNPGM + #define DEBUG_ECHOPAIR SERIAL_ECHOPAIR + #define DEBUG_ECHOPAIR_F SERIAL_ECHOPAIR_F + #define DEBUG_ECHOLNPAIR SERIAL_ECHOLNPAIR + #define DEBUG_ECHOLNPAIR_F SERIAL_ECHOLNPAIR_F + #define DEBUG_ECHO_MSG SERIAL_ECHO_MSG + #define DEBUG_ERROR_MSG SERIAL_ERROR_MSG + #define DEBUG_EOL SERIAL_EOL + #define DEBUG_POS SERIAL_POS + #define DEBUG_XYZ SERIAL_XYZ + #define DEBUG_DELAY(ms) serial_delay(ms) +#else + #define DEBUG_PRINT_P(P) NOOP + #define DEBUG_ECHO_START() NOOP + #define DEBUG_ERROR_START() NOOP + #define DEBUG_CHAR(...) NOOP + #define DEBUG_ECHO(...) NOOP + #define DEBUG_ECHO_F(...) NOOP + #define DEBUG_ECHOLN(...) NOOP + #define DEBUG_ECHOPGM(...) NOOP + #define DEBUG_ECHOLNPGM(...) NOOP + #define DEBUG_ECHOPAIR(...) NOOP + #define DEBUG_ECHOPAIR_F(...) NOOP + #define DEBUG_ECHOLNPAIR(...) NOOP + #define DEBUG_ECHOLNPAIR_F(...) NOOP + #define DEBUG_ECHO_MSG(...) NOOP + #define DEBUG_ERROR_MSG(...) NOOP + #define DEBUG_EOL() NOOP + #define DEBUG_POS(...) NOOP + #define DEBUG_XYZ(...) NOOP + #define DEBUG_DELAY(...) NOOP +#endif + +#undef DEBUG_OUT diff --git a/Marlin/src/core/drivers.h b/Marlin/src/core/drivers.h index 25fe2245f6..a405bd3144 100644 --- a/Marlin/src/core/drivers.h +++ b/Marlin/src/core/drivers.h @@ -52,7 +52,7 @@ #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) (EITHER(X_DUAL_STEPPER_DRIVERS, 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)) diff --git a/Marlin/src/core/language.h b/Marlin/src/core/language.h index 149a7d3a0b..0dfd54b3af 100644 --- a/Marlin/src/core/language.h +++ b/Marlin/src/core/language.h @@ -285,6 +285,8 @@ #define MSG_INVALID_EXTRUDER_NUM " - Invalid extruder number !" #define MSG_HEATER_BED "bed" +#define MSG_HEATER_CHAMBER "chamber" + #define MSG_STOPPED_HEATER ", system stopped! Heater_ID: " #define MSG_REDUNDANCY "Heater switched off. Temperature difference between temp sensors is too high !" #define MSG_T_HEATING_FAILED "Heating failed" diff --git a/Marlin/src/core/macros.h b/Marlin/src/core/macros.h index b438db9201..3805c216fe 100644 --- a/Marlin/src/core/macros.h +++ b/Marlin/src/core/macros.h @@ -56,7 +56,7 @@ #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 @@ -133,8 +133,25 @@ #endif +// Macros to chain up to 12 conditions +#define _DO_1(W,C,A) (_##W##_1(A)) +#define _DO_2(W,C,A,B) (_##W##_1(A) C _##W##_1(B)) +#define _DO_3(W,C,A,V...) (_##W##_1(A) C _DO_2(W,C,V)) +#define _DO_4(W,C,A,V...) (_##W##_1(A) C _DO_3(W,C,V)) +#define _DO_5(W,C,A,V...) (_##W##_1(A) C _DO_4(W,C,V)) +#define _DO_6(W,C,A,V...) (_##W##_1(A) C _DO_5(W,C,V)) +#define _DO_7(W,C,A,V...) (_##W##_1(A) C _DO_6(W,C,V)) +#define _DO_8(W,C,A,V...) (_##W##_1(A) C _DO_7(W,C,V)) +#define _DO_9(W,C,A,V...) (_##W##_1(A) C _DO_8(W,C,V)) +#define _DO_10(W,C,A,V...) (_##W##_1(A) C _DO_9(W,C,V)) +#define _DO_11(W,C,A,V...) (_##W##_1(A) C _DO_10(W,C,V)) +#define _DO_12(W,C,A,V...) (_##W##_1(A) C _DO_11(W,C,V)) +#define __DO_N(W,C,N,V...) _DO_##N(W,C,V) +#define _DO_N(W,C,N,V...) __DO_N(W,C,N,V) +#define DO(W,C,V...) _DO_N(W,C,NUM_ARGS(V),V) + // Macros to support option testing -#define _CAT(a, ...) a ## __VA_ARGS__ +#define _CAT(a,V...) a##V #define SWITCH_ENABLED_false 0 #define SWITCH_ENABLED_true 1 #define SWITCH_ENABLED_0 0 @@ -142,16 +159,33 @@ #define SWITCH_ENABLED_0x0 0 #define SWITCH_ENABLED_0x1 1 #define SWITCH_ENABLED_ 1 -#define ENABLED(b) _CAT(SWITCH_ENABLED_, b) -#define DISABLED(b) !ENABLED(b) +#define _ENA_1(O) _CAT(SWITCH_ENABLED_, O) +#define _DIS_1(O) !_ENA_1(O) +#define ENABLED(V...) DO(ENA,&&,V) +#define DISABLED(V...) DO(DIS,&&,V) -#define WITHIN(V,L,H) ((V) >= (L) && (V) <= (H)) -#define NUMERIC(a) WITHIN(a, '0', '9') -#define DECIMAL(a) (NUMERIC(a) || a == '.') -#define NUMERIC_SIGNED(a) (NUMERIC(a) || (a) == '-' || (a) == '+') -#define DECIMAL_SIGNED(a) (DECIMAL(a) || (a) == '-' || (a) == '+') -#define COUNT(a) (sizeof(a)/sizeof(*a)) -#define ZERO(a) memset(a,0,sizeof(a)) +#define ANY(V...) !DISABLED(V) +#define NONE(V...) DISABLED(V) +#define ALL(V...) ENABLED(V) +#define BOTH(V1,V2) ALL(V1,V2) +#define EITHER(V1,V2) ANY(V1,V2) + +// Macros to support pins/buttons exist testing +#define _PINEX_1(PN) (defined(PN##_PIN) && PN##_PIN >= 0) +#define PIN_EXISTS(V...) DO(PINEX,&&,V) +#define ANY_PIN(V...) DO(PINEX,||,V) + +#define _BTNEX_1(BN) (defined(BTN_##BN) && BTN_##BN >= 0) +#define BUTTON_EXISTS(V...) DO(BTNEX,&&,V) +#define ANY_BUTTON(V...) DO(BTNEX,||,V) + +#define WITHIN(N,L,H) ((N) >= (L) && (N) <= (H)) +#define NUMERIC(a) WITHIN(a, '0', '9') +#define DECIMAL(a) (NUMERIC(a) || a == '.') +#define NUMERIC_SIGNED(a) (NUMERIC(a) || (a) == '-' || (a) == '+') +#define DECIMAL_SIGNED(a) (DECIMAL(a) || (a) == '-' || (a) == '+') +#define COUNT(a) (sizeof(a)/sizeof(*a)) +#define ZERO(a) memset(a,0,sizeof(a)) #define COPY(a,b) do{ \ static_assert(sizeof(a[0]) == sizeof(b[0]), "COPY: '" STRINGIFY(a) "' and '" STRINGIFY(b) "' types (sizes) don't match!"); \ memcpy(&a[0],&b[0],MIN(sizeof(a),sizeof(b))); \ @@ -165,8 +199,8 @@ #define ARRAY_2(v1, v2, ...) { v1, v2 } #define ARRAY_1(v1, ...) { v1 } -#define _ARRAY_N(N, ...) ARRAY_ ##N(__VA_ARGS__) -#define ARRAY_N(N, ...) _ARRAY_N(N, __VA_ARGS__) +#define _ARRAY_N(N,V...) ARRAY_##N(V) +#define ARRAY_N(N,V...) _ARRAY_N(N,V) // Macros for adding #define INC_0 1 @@ -178,7 +212,7 @@ #define INC_6 7 #define INC_7 8 #define INC_8 9 -#define INCREMENT_(n) INC_ ##n +#define INCREMENT_(n) INC_##n #define INCREMENT(n) INCREMENT_(n) // Macros for subtracting @@ -191,11 +225,9 @@ #define DEC_7 6 #define DEC_8 7 #define DEC_9 8 -#define DECREMENT_(n) DEC_ ##n +#define DECREMENT_(n) DEC_##n #define DECREMENT(n) DECREMENT_(n) -#define PIN_EXISTS(PN) (defined(PN ##_PIN) && PN ##_PIN >= 0) - #define MMM_TO_MMS(MM_M) ((MM_M)/60.0f) #define MMS_TO_MMM(MM_S) ((MM_S)*60.0f) diff --git a/Marlin/src/core/minmax.h b/Marlin/src/core/minmax.h index ddb2117dba..0f29443adc 100644 --- a/Marlin/src/core/minmax.h +++ b/Marlin/src/core/minmax.h @@ -23,6 +23,10 @@ #undef MIN #undef MAX +// Use NUM_ARGS(__VA_ARGS__) to get the number of variadic arguments +#define _NUM_ARGS(_0,_24_,_23,_22,_21,_20,_19,_18,_17,_16,_15,_14,_13,_12,_11,_10,_9,_8,_7,_6,_5,_4,_3,_2,_1,N,...) N +#define NUM_ARGS(V...) _NUM_ARGS(0,V,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0) + #ifdef __cplusplus #ifndef _MINMAX_H_ @@ -46,26 +50,30 @@ #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_2(a,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_7(a,...) MIN_2(a,MIN_6(__VA_ARGS__)) + #define MIN_8(a,...) MIN_2(a,MIN_7(__VA_ARGS__)) + #define MIN_9(a,...) MIN_2(a,MIN_8(__VA_ARGS__)) + #define MIN_10(a,...) MIN_2(a,MIN_9(__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_2(a,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_7(a,...) MAX_2(a,MAX_6(__VA_ARGS__)) + #define MAX_8(a,...) MAX_2(a,MAX_7(__VA_ARGS__)) + #define MAX_9(a,...) MAX_2(a,MAX_8(__VA_ARGS__)) + #define MAX_10(a,...) MAX_2(a,MAX_9(__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 eb39f389ac..aae0d63698 100644 --- a/Marlin/src/core/serial.cpp +++ b/Marlin/src/core/serial.cpp @@ -22,6 +22,7 @@ #include "serial.h" #include "language.h" +#include "enum.h" uint8_t marlin_debug_flags = MARLIN_DEBUG_NONE; @@ -49,8 +50,14 @@ void serial_echopair_PGM(PGM_P const s_P, unsigned long v) { serialprintPGM(s_P) void serial_spaces(uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) SERIAL_CHAR(' '); } +void serial_ternary(const bool onoff, PGM_P const pre, PGM_P const on, PGM_P const off, PGM_P const post/*=NULL*/) { + if (pre) serialprintPGM(pre); + serialprintPGM(onoff ? on : off); + if (post) serialprintPGM(post); +} void serialprint_onoff(const bool onoff) { serialprintPGM(onoff ? PSTR(MSG_ON) : PSTR(MSG_OFF)); } void serialprintln_onoff(const bool onoff) { serialprint_onoff(onoff); SERIAL_EOL(); } +void serialprint_truefalse(const bool tf) { serialprintPGM(tf ? PSTR("true") : PSTR("false")); } void print_bin(const uint16_t val) { uint16_t mask = 0x8000; @@ -61,22 +68,15 @@ void print_bin(const uint16_t val) { } } -#if ENABLED(DEBUG_LEVELING_FEATURE) +void print_xyz(PGM_P const prefix, PGM_P const suffix, const float x, const float y, const float z) { + serialprintPGM(prefix); + SERIAL_CHAR('('); + SERIAL_ECHO(x); + SERIAL_ECHOPAIR(", ", y, ", ", z); + SERIAL_CHAR(')'); + if (suffix) serialprintPGM(suffix); else SERIAL_EOL(); +} - #include "enum.h" - - void print_xyz(PGM_P const prefix, PGM_P const suffix, const float x, const float y, const float z) { - serialprintPGM(prefix); - SERIAL_CHAR('('); - SERIAL_ECHO(x); - SERIAL_ECHOPAIR(", ", y); - SERIAL_ECHOPAIR(", ", z); - SERIAL_CHAR(')'); - if (suffix) serialprintPGM(suffix); else SERIAL_EOL(); - } - - void print_xyz(PGM_P const prefix, PGM_P const suffix, const float xyz[]) { - print_xyz(prefix, suffix, xyz[X_AXIS], xyz[Y_AXIS], xyz[Z_AXIS]); - } - -#endif +void print_xyz(PGM_P const prefix, PGM_P const suffix, const float xyz[]) { + print_xyz(prefix, suffix, xyz[X_AXIS], xyz[Y_AXIS], xyz[Z_AXIS]); +} diff --git a/Marlin/src/core/serial.h b/Marlin/src/core/serial.h index b2d0f73b3d..f79856178c 100644 --- a/Marlin/src/core/serial.h +++ b/Marlin/src/core/serial.h @@ -22,6 +22,7 @@ #pragma once #include "../inc/MarlinConfigPre.h" +#include "../core/minmax.h" #include HAL_PATH(../HAL, HAL.h) /** @@ -34,27 +35,32 @@ enum MarlinDebugFlags : uint8_t { 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 + #if ENABLED(DEBUG_LEVELING_FEATURE) + MARLIN_DEBUG_LEVELING = _BV(5), ///< Print detailed output for homing and leveling + MARLIN_DEBUG_MESH_ADJUST = _BV(6), ///< UBL bed leveling + #else + MARLIN_DEBUG_LEVELING = 0, + MARLIN_DEBUG_MESH_ADJUST = 0, + #endif MARLIN_DEBUG_ALL = 0xFF }; extern uint8_t marlin_debug_flags; #define DEBUGGING(F) (marlin_debug_flags & (MARLIN_DEBUG_## F)) +#define SERIAL_BOTH 0x7F #if NUM_SERIAL > 1 extern int8_t serial_port_index; #define _PORT_REDIRECT(n,p) REMEMBER(n,serial_port_index,p) #define _PORT_RESTORE(n) RESTORE(n) - #define SERIAL_BOTH 0x7F #define SERIAL_OUT(WHAT, ...) do{ \ - if (!serial_port_index || serial_port_index == SERIAL_BOTH) MYSERIAL0.WHAT(__VA_ARGS__); \ - if ( serial_port_index) MYSERIAL1.WHAT(__VA_ARGS__); \ + if (!serial_port_index || serial_port_index == SERIAL_BOTH) (void)MYSERIAL0.WHAT(__VA_ARGS__); \ + if ( serial_port_index) (void)MYSERIAL1.WHAT(__VA_ARGS__); \ }while(0) #else #define _PORT_REDIRECT(n,p) NOOP #define _PORT_RESTORE(n) NOOP - #define SERIAL_OUT(WHAT, ...) MYSERIAL0.WHAT(__VA_ARGS__) + #define SERIAL_OUT(WHAT, ...) (void)MYSERIAL0.WHAT(__VA_ARGS__) #endif #define PORT_REDIRECT(p) _PORT_REDIRECT(1,p) @@ -62,11 +68,11 @@ extern uint8_t marlin_debug_flags; #define SERIAL_CHAR(x) SERIAL_OUT(write, x) #define SERIAL_ECHO(x) SERIAL_OUT(print, x) -#define SERIAL_ECHO_F(x,y) SERIAL_OUT(print, x, y) +#define SERIAL_ECHO_F(...) SERIAL_OUT(print, __VA_ARGS__) #define SERIAL_ECHOLN(x) SERIAL_OUT(println, x) #define SERIAL_PRINT(x,b) SERIAL_OUT(print, x, b) #define SERIAL_PRINTLN(x,b) SERIAL_OUT(println, x, b) -#define SERIAL_PRINTF(args...) SERIAL_OUT(printf, args) +#define SERIAL_PRINTF(...) SERIAL_OUT(printf, __VA_ARGS__) #define SERIAL_FLUSH() SERIAL_OUT(flush) #if TX_BUFFER_SIZE > 0 @@ -75,22 +81,80 @@ extern uint8_t marlin_debug_flags; #define SERIAL_FLUSHTX() #endif -#define SERIAL_ECHOPGM(x) (serialprintPGM(PSTR(x))) -#define SERIAL_ECHOLNPGM(x) (serialprintPGM(PSTR(x "\n"))) -#define SERIAL_ECHOPAIR(pre, value) (serial_echopair_PGM(PSTR(pre), value)) -#define SERIAL_ECHOLNPAIR(pre, value) do{ SERIAL_ECHOPAIR(pre, value); SERIAL_EOL(); }while(0) +// Print up to 12 pairs of values +#define __SEP_N(N,...) _SEP_##N(__VA_ARGS__) +#define _SEP_N(N,...) __SEP_N(N,__VA_ARGS__) +#define _SEP_1(PRE) SERIAL_ECHOPGM(PRE) +#define _SEP_2(PRE,V) serial_echopair_PGM(PSTR(PRE),V) +#define _SEP_3(a,b,c) do{ _SEP_2(a,b); SERIAL_ECHOPGM(c); }while(0) +#define _SEP_4(a,b,...) do{ _SEP_2(a,b); _SEP_2(__VA_ARGS__); }while(0) +#define _SEP_5(a,b,...) do{ _SEP_2(a,b); _SEP_3(__VA_ARGS__); }while(0) +#define _SEP_6(a,b,...) do{ _SEP_2(a,b); _SEP_4(__VA_ARGS__); }while(0) +#define _SEP_7(a,b,...) do{ _SEP_2(a,b); _SEP_5(__VA_ARGS__); }while(0) +#define _SEP_8(a,b,...) do{ _SEP_2(a,b); _SEP_6(__VA_ARGS__); }while(0) +#define _SEP_9(a,b,...) do{ _SEP_2(a,b); _SEP_7(__VA_ARGS__); }while(0) +#define _SEP_10(a,b,...) do{ _SEP_2(a,b); _SEP_8(__VA_ARGS__); }while(0) +#define _SEP_11(a,b,...) do{ _SEP_2(a,b); _SEP_9(__VA_ARGS__); }while(0) +#define _SEP_12(a,b,...) do{ _SEP_2(a,b); _SEP_10(__VA_ARGS__); }while(0) +#define _SEP_13(a,b,...) do{ _SEP_2(a,b); _SEP_11(__VA_ARGS__); }while(0) +#define _SEP_14(a,b,...) do{ _SEP_2(a,b); _SEP_12(__VA_ARGS__); }while(0) +#define _SEP_15(a,b,...) do{ _SEP_2(a,b); _SEP_13(__VA_ARGS__); }while(0) +#define _SEP_16(a,b,...) do{ _SEP_2(a,b); _SEP_14(__VA_ARGS__); }while(0) +#define _SEP_17(a,b,...) do{ _SEP_2(a,b); _SEP_15(__VA_ARGS__); }while(0) +#define _SEP_18(a,b,...) do{ _SEP_2(a,b); _SEP_16(__VA_ARGS__); }while(0) +#define _SEP_19(a,b,...) do{ _SEP_2(a,b); _SEP_17(__VA_ARGS__); }while(0) +#define _SEP_20(a,b,...) do{ _SEP_2(a,b); _SEP_18(__VA_ARGS__); }while(0) +#define _SEP_21(a,b,...) do{ _SEP_2(a,b); _SEP_19(__VA_ARGS__); }while(0) +#define _SEP_22(a,b,...) do{ _SEP_2(a,b); _SEP_20(__VA_ARGS__); }while(0) +#define _SEP_23(a,b,...) do{ _SEP_2(a,b); _SEP_21(__VA_ARGS__); }while(0) +#define _SEP_24(a,b,...) do{ _SEP_2(a,b); _SEP_22(__VA_ARGS__); }while(0) -#define SERIAL_ECHOPAIR_F(pre, value, y) do{ SERIAL_ECHO(pre); SERIAL_ECHO_F(value, y); }while(0) -#define SERIAL_ECHOLNPAIR_F(pre, value, y) do{ SERIAL_ECHOPAIR_F(pre, value, y); SERIAL_EOL(); }while(0) +#define SERIAL_ECHOPAIR(...) _SEP_N(NUM_ARGS(__VA_ARGS__),__VA_ARGS__) -#define SERIAL_ECHO_START() serial_echo_start() -#define SERIAL_ERROR_START() serial_error_start() -#define SERIAL_EOL() SERIAL_CHAR('\n') +// Print up to 12 pairs of values followed by newline +#define __SELP_N(N,...) _SELP_##N(__VA_ARGS__) +#define _SELP_N(N,...) __SELP_N(N,__VA_ARGS__) +#define _SELP_1(PRE) SERIAL_ECHOLNPGM(PRE) +#define _SELP_2(PRE,V) do{ serial_echopair_PGM(PSTR(PRE),V); SERIAL_EOL(); }while(0) +#define _SELP_3(a,b,c) do{ _SEP_2(a,b); SERIAL_ECHOLNPGM(c); }while(0) +#define _SELP_4(a,b,...) do{ _SEP_2(a,b); _SELP_2(__VA_ARGS__); }while(0) +#define _SELP_5(a,b,...) do{ _SEP_2(a,b); _SELP_3(__VA_ARGS__); }while(0) +#define _SELP_6(a,b,...) do{ _SEP_2(a,b); _SELP_4(__VA_ARGS__); }while(0) +#define _SELP_7(a,b,...) do{ _SEP_2(a,b); _SELP_5(__VA_ARGS__); }while(0) +#define _SELP_8(a,b,...) do{ _SEP_2(a,b); _SELP_6(__VA_ARGS__); }while(0) +#define _SELP_9(a,b,...) do{ _SEP_2(a,b); _SELP_7(__VA_ARGS__); }while(0) +#define _SELP_10(a,b,...) do{ _SEP_2(a,b); _SELP_8(__VA_ARGS__); }while(0) +#define _SELP_11(a,b,...) do{ _SEP_2(a,b); _SELP_9(__VA_ARGS__); }while(0) +#define _SELP_12(a,b,...) do{ _SEP_2(a,b); _SELP_10(__VA_ARGS__); }while(0) +#define _SELP_13(a,b,...) do{ _SEP_2(a,b); _SELP_11(__VA_ARGS__); }while(0) +#define _SELP_14(a,b,...) do{ _SEP_2(a,b); _SELP_12(__VA_ARGS__); }while(0) +#define _SELP_15(a,b,...) do{ _SEP_2(a,b); _SELP_13(__VA_ARGS__); }while(0) +#define _SELP_16(a,b,...) do{ _SEP_2(a,b); _SELP_14(__VA_ARGS__); }while(0) +#define _SELP_17(a,b,...) do{ _SEP_2(a,b); _SELP_15(__VA_ARGS__); }while(0) +#define _SELP_18(a,b,...) do{ _SEP_2(a,b); _SELP_16(__VA_ARGS__); }while(0) +#define _SELP_19(a,b,...) do{ _SEP_2(a,b); _SELP_17(__VA_ARGS__); }while(0) +#define _SELP_20(a,b,...) do{ _SEP_2(a,b); _SELP_18(__VA_ARGS__); }while(0) +#define _SELP_21(a,b,...) do{ _SEP_2(a,b); _SELP_19(__VA_ARGS__); }while(0) +#define _SELP_22(a,b,...) do{ _SEP_2(a,b); _SELP_20(__VA_ARGS__); }while(0) +#define _SELP_23(a,b,...) do{ _SEP_2(a,b); _SELP_21(__VA_ARGS__); }while(0) +#define _SELP_24(a,b,...) do{ _SEP_2(a,b); _SELP_22(__VA_ARGS__); }while(0) -#define SERIAL_ECHO_MSG(STR) do{ SERIAL_ECHO_START(); SERIAL_ECHOLNPGM(STR); }while(0) -#define SERIAL_ERROR_MSG(STR) do{ SERIAL_ERROR_START(); SERIAL_ECHOLNPGM(STR); }while(0) +#define SERIAL_ECHOLNPAIR(...) _SELP_N(NUM_ARGS(__VA_ARGS__),__VA_ARGS__) -#define SERIAL_ECHO_SP(C) serial_spaces(C) +#define SERIAL_ECHOPGM(S) (serialprintPGM(PSTR(S))) +#define SERIAL_ECHOLNPGM(S) (serialprintPGM(PSTR(S "\n"))) + +#define SERIAL_ECHOPAIR_F(pre, ...) do{ SERIAL_ECHO(pre); SERIAL_ECHO_F(__VA_ARGS__); }while(0) +#define SERIAL_ECHOLNPAIR_F(...) do{ SERIAL_ECHOPAIR_F(__VA_ARGS__); SERIAL_EOL(); }while(0) + +#define SERIAL_ECHO_START() serial_echo_start() +#define SERIAL_ERROR_START() serial_error_start() +#define SERIAL_EOL() SERIAL_CHAR('\n') + +#define SERIAL_ECHO_MSG(S) do{ SERIAL_ECHO_START(); SERIAL_ECHOLNPGM(S); }while(0) +#define SERIAL_ERROR_MSG(S) do{ SERIAL_ERROR_START(); SERIAL_ECHOLNPGM(S); }while(0) + +#define SERIAL_ECHO_SP(C) serial_spaces(C) // // Functions for serial printing from PROGMEM. (Saves loads of SRAM.) @@ -110,14 +174,15 @@ inline void serial_echopair_PGM(PGM_P const s_P, void *v) { serial_echopair_PG void serialprintPGM(PGM_P str); void serial_echo_start(); void serial_error_start(); +void serial_ternary(const bool onoff, PGM_P const pre, PGM_P const on, PGM_P const off, PGM_P const post=NULL); void serialprint_onoff(const bool onoff); void serialprintln_onoff(const bool onoff); +void serialprint_truefalse(const bool tf); void serial_spaces(uint8_t count); void print_bin(const uint16_t val); -#if ENABLED(DEBUG_LEVELING_FEATURE) - void print_xyz(PGM_P const prefix, PGM_P const suffix, const float x, const float y, const float z); - void print_xyz(PGM_P const prefix, PGM_P const suffix, const float xyz[]); - #define DEBUG_POS(SUFFIX,VAR) do { print_xyz(PSTR(" " STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n"), VAR); } while(0) -#endif +void print_xyz(PGM_P const prefix, PGM_P const suffix, const float x, const float y, const float z); +void print_xyz(PGM_P const prefix, PGM_P const suffix, const float xyz[]); +#define SERIAL_POS(SUFFIX,VAR) do { print_xyz(PSTR(" " STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n"), VAR); } while(0) +#define SERIAL_XYZ(PREFIX,...) do { print_xyz(PSTR(PREFIX), NULL, __VA_ARGS__); } while(0) diff --git a/Marlin/src/core/utility.cpp b/Marlin/src/core/utility.cpp index e2b44141d8..79c7018f51 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) || ENABLED(SD_FIRMWARE_UPDATE) +#if EITHER(EEPROM_SETTINGS, SD_FIRMWARE_UPDATE) void crc16(uint16_t *crc, const void * const data, uint16_t cnt) { uint8_t *ptr = (uint8_t *)data; @@ -48,7 +48,7 @@ void safe_delay(millis_t ms) { #endif // EEPROM_SETTINGS || SD_FIRMWARE_UPDATE -#if ENABLED(ULTRA_LCD) || ENABLED(DEBUG_LEVELING_FEATURE) || ENABLED(EXTENSIBLE_UI) +#if ANY(ULTRA_LCD, DEBUG_LEVELING_FEATURE, EXTENSIBLE_UI) char conv[8] = { 0 }; @@ -57,6 +57,16 @@ void safe_delay(millis_t ms) { #define RJDIGIT(n, f) ((n) >= (f) ? DIGIMOD(n, f) : ' ') #define MINUSOR(n, alt) (n >= 0 ? (alt) : (n = -n, '-')) + // Convert a full-range unsigned 8bit int to a percentage + char* ui8tostr_percent(const uint8_t i) { + const uint8_t percent = ui8_to_percent(i); + conv[3] = RJDIGIT(percent, 100); + conv[4] = RJDIGIT(percent, 10); + conv[5] = DIGIMOD(percent, 1); + conv[6] = '%'; + return &conv[3]; + } + // Convert unsigned 8bit int to string 123 format char* ui8tostr3(const uint8_t i) { conv[4] = RJDIGIT(i, 100); @@ -204,6 +214,19 @@ void safe_delay(millis_t ms) { return &conv[1]; } + // Convert signed float to string (5 digit) with -1.2345 / _0.0000 / +1.2345 format + char* ftostr54sign(const float &f, char plus/*=' '*/) { + long i = (f * 100000 + (f < 0 ? -5: 5)) / 10; + conv[0] = i ? MINUSOR(i, plus) : ' '; + conv[1] = DIGIMOD(i, 10000); + conv[2] = '.'; + conv[3] = DIGIMOD(i, 1000); + conv[4] = DIGIMOD(i, 100); + conv[5] = DIGIMOD(i, 10); + conv[6] = DIGIMOD(i, 1); + return &conv[0]; + } + // Convert unsigned float to rj string with 12345 format char* ftostr5rj(const float &f) { const long i = ((f < 0 ? -f : f) * 10 + 5) / 10; @@ -321,8 +344,11 @@ 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); + SERIAL_ECHOPAIR( + "Probe Offset X:" STRINGIFY(X_PROBE_OFFSET_FROM_EXTRUDER) + " Y:" STRINGIFY(Y_PROBE_OFFSET_FROM_EXTRUDER) + " Z:", zprobe_zoffset + ); if ((X_PROBE_OFFSET_FROM_EXTRUDER) > 0) SERIAL_ECHOPGM(" (Right"); else if ((X_PROBE_OFFSET_FROM_EXTRUDER) < 0) diff --git a/Marlin/src/core/utility.h b/Marlin/src/core/utility.h index 46dcd5af69..1ea4c4b0a3 100644 --- a/Marlin/src/core/utility.h +++ b/Marlin/src/core/utility.h @@ -37,11 +37,11 @@ inline void serial_delay(const millis_t ms) { #endif } -#if ENABLED(EEPROM_SETTINGS) || ENABLED(SD_FIRMWARE_UPDATE) +#if EITHER(EEPROM_SETTINGS, SD_FIRMWARE_UPDATE) void crc16(uint16_t *crc, const void * const data, uint16_t cnt); #endif -#if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION) +#if EITHER(AUTO_BED_LEVELING_UBL, G26_MESH_VALIDATION) /** * These support functions allow the use of large bit arrays of flags that take very * little RAM. Currently they are limited to being 16x16 in size. Changing the declaration @@ -53,7 +53,10 @@ inline void serial_delay(const 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) || ENABLED(EXTENSIBLE_UI) +#if ANY(ULTRA_LCD, DEBUG_LEVELING_FEATURE, EXTENSIBLE_UI) + + // Convert a full-range unsigned 8bit int to a percentage + char* ui8tostr_percent(const uint8_t i); // Convert uint8_t to string with 123 format char* ui8tostr3(const uint8_t x); @@ -88,6 +91,9 @@ inline void serial_delay(const millis_t ms) { // Convert signed float to string (6 digit) with -1.234 / _0.000 / +1.234 format char* ftostr43sign(const float &x, char plus=' '); + // Convert signed float to string (5 digit) with -1.2345 / _0.0000 / +1.2345 format + char* ftostr54sign(const float &x, char plus=' '); + // Convert unsigned float to rj string with 12345 format char* ftostr5rj(const float &x); @@ -118,6 +124,8 @@ inline void serial_delay(const millis_t ms) { #if ENABLED(DEBUG_LEVELING_FEATURE) void log_machine_info(); +#else + #define log_machine_info() NOOP #endif template @@ -133,3 +141,8 @@ public: #define REMEMBER(N,X, ...) restorer restorer_##N(X, ##__VA_ARGS__) #define RESTORE(N) restorer_##N.restore() + +// Converts from an uint8_t in the range of 0-255 to an uint8_t +// in the range 0-100 while avoiding rounding artifacts +constexpr uint8_t ui8_to_percent(const uint8_t i) { return (int(i) * 100 + 127) / 255; } +constexpr uint8_t all_on = 0xFF, all_off = 0x00; diff --git a/Marlin/src/feature/I2CPositionEncoder.cpp b/Marlin/src/feature/I2CPositionEncoder.cpp index f83ac8e3d4..c1c20021ea 100644 --- a/Marlin/src/feature/I2CPositionEncoder.cpp +++ b/Marlin/src/feature/I2CPositionEncoder.cpp @@ -37,7 +37,8 @@ #include "../module/temperature.h" #include "../module/stepper.h" #include "../gcode/parser.h" -#include + +#include "../feature/babystep.h" #include @@ -47,8 +48,7 @@ void I2CPositionEncoder::init(const uint8_t address, const AxisEnum axis) { initialized++; - SERIAL_ECHOPAIR("Setting up encoder on ", axis_codes[encoderAxis]); - SERIAL_ECHOLNPAIR(" axis, addr = ", address); + SERIAL_ECHOLNPAIR("Setting up encoder on ", axis_codes[encoderAxis], " axis, addr = ", address); position = get_position(); } @@ -66,8 +66,7 @@ void I2CPositionEncoder::update() { /* if (trusted) { //commented out as part of the note below trusted = false; - SERIAL_ECHOPAIR("Fault detected on ", axis_codes[encoderAxis]); - SERIAL_ECHOLNPGM(" axis encoder. Disengaging error correction until module is trusted again."); + SERIAL_ECHOLMPAIR("Fault detected on ", axis_codes[encoderAxis], " axis encoder. Disengaging error correction until module is trusted again."); } */ return; @@ -92,8 +91,7 @@ void I2CPositionEncoder::update() { if (millis() - lastErrorTime > I2CPE_TIME_TRUSTED) { trusted = true; - SERIAL_ECHOPAIR("Untrusted encoder module on ", axis_codes[encoderAxis]); - SERIAL_ECHOLNPGM(" axis has been fault-free for set duration, reinstating error correction."); + SERIAL_ECHOLNPAIR("Untrusted encoder module on ", axis_codes[encoderAxis], " axis has been fault-free for set duration, reinstating error correction."); //the encoder likely lost its place when the error occured, so we'll reset and use the printer's //idea of where it the axis is to re-initialize @@ -172,9 +170,8 @@ void I2CPositionEncoder::update() { LOOP_L_N(i, I2CPE_ERR_PRST_ARRAY_SIZE) sumP += errPrst[i]; const int32_t errorP = int32_t(sumP * (1.0f / (I2CPE_ERR_PRST_ARRAY_SIZE))); SERIAL_ECHO(axis_codes[encoderAxis]); - SERIAL_ECHOPAIR(" - err detected: ", errorP * planner.steps_to_mm[encoderAxis]); - SERIAL_ECHOLNPGM("mm; correcting!"); - thermalManager.babystepsTodo[encoderAxis] = -LROUND(errorP); + SERIAL_ECHOLNPAIR(" - err detected: ", errorP * planner.steps_to_mm[encoderAxis], "mm; correcting!"); + babystep.add_steps(encoderAxis, -LROUND(errorP)); errPrstIdx = 0; } } @@ -185,16 +182,14 @@ void I2CPositionEncoder::update() { if (ABS(error) > threshold * planner.settings.axis_steps_per_mm[encoderAxis]) { //SERIAL_ECHOLN(error); //SERIAL_ECHOLN(position); - thermalManager.babystepsTodo[encoderAxis] = -LROUND(error / 2); + babystep.add_steps(encoderAxis, -LROUND(error / 2)); } #endif 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]); - SERIAL_ECHOPAIR(" axis. error: ", (int)error); - SERIAL_ECHOLNPAIR("; diffSum: ", diffSum); + SERIAL_ECHOLNPAIR("Large error on ", axis_codes[encoderAxis], " axis. error: ", (int)error, "; diffSum: ", diffSum); errorCount++; nextErrorCountTime = ms + I2CPE_ERR_CNT_DEBOUNCE_MS; } @@ -215,8 +210,7 @@ void I2CPositionEncoder::set_homed() { #ifdef I2CPE_DEBUG SERIAL_ECHO(axis_codes[encoderAxis]); - SERIAL_ECHOPAIR(" axis encoder homed, offset of ", zeroOffset); - SERIAL_ECHOLNPGM(" ticks."); + SERIAL_ECHOLNPAIR(" axis encoder homed, offset of ", zeroOffset, " ticks."); #endif } } @@ -235,13 +229,11 @@ bool I2CPositionEncoder::passes_test(const bool report) { if (report) { if (H != I2CPE_MAG_SIG_GOOD) SERIAL_ECHOPGM("Warning. "); SERIAL_ECHO(axis_codes[encoderAxis]); - SERIAL_ECHOPGM(" axis "); - serialprintPGM(H == I2CPE_MAG_SIG_BAD ? PSTR("magnetic strip ") : PSTR("encoder ")); + serial_ternary(H == I2CPE_MAG_SIG_BAD, PSTR(" axis "), PSTR("magnetic strip "), PSTR("encoder ")); switch (H) { case I2CPE_MAG_SIG_GOOD: case I2CPE_MAG_SIG_MID: - SERIAL_ECHOLNPGM("passes test; field strength "); - serialprintPGM(H == I2CPE_MAG_SIG_GOOD ? PSTR("good.\n") : PSTR("fair.\n")); + serial_ternary(H == I2CPE_MAG_SIG_GOOD, PSTR("passes test; field strength "), PSTR("good"), PSTR("fair"), PSTR(".\n")); break; default: SERIAL_ECHOLNPGM("not detected!"); @@ -261,9 +253,7 @@ float I2CPositionEncoder::get_axis_error_mm(const bool report) { if (report) { SERIAL_ECHO(axis_codes[encoderAxis]); - SERIAL_ECHOPAIR(" axis target: ", target); - SERIAL_ECHOPAIR(", actual: ", actual); - SERIAL_ECHOLNPAIR(", error : ",error); + SERIAL_ECHOLNPAIR(" axis target: ", target, ", actual: ", actual, ", error : ",error); } return error; @@ -296,10 +286,7 @@ int32_t I2CPositionEncoder::get_axis_error_steps(const bool report) { if (report) { SERIAL_ECHO(axis_codes[encoderAxis]); - SERIAL_ECHOPAIR(" axis target: ", target); - SERIAL_ECHOPAIR(", actual: ", encoderCountInStepperTicksScaled); - SERIAL_ECHOLNPAIR(", error : ", error); - + SERIAL_ECHOLNPAIR(" axis target: ", target, ", actual: ", encoderCountInStepperTicksScaled, ", error : ", error); if (suppressOutput) SERIAL_ECHOLNPGM("Discontinuity detected, suppressing error."); } @@ -341,8 +328,8 @@ bool I2CPositionEncoder::test_axis() { float startCoord[NUM_AXIS] = { 0 }, endCoord[NUM_AXIS] = { 0 }; - const float startPosition = soft_endstop_min[encoderAxis] + 10, - endPosition = soft_endstop_max[encoderAxis] - 10, + const float startPosition = soft_endstop[encoderAxis].min + 10, + endPosition = soft_endstop[encoderAxis].max - 10, feedrate = FLOOR(MMM_TO_MMS((encoderAxis == Z_AXIS) ? HOMING_FEEDRATE_Z : HOMING_FEEDRATE_XY)); ec = false; @@ -403,7 +390,7 @@ void I2CPositionEncoder::calibrate_steps_mm(const uint8_t iter) { ec = false; startDistance = 20; - endDistance = soft_endstop_max[encoderAxis] - 20; + endDistance = soft_endstop[encoderAxis].max - 20; travelDistance = endDistance - startDistance; LOOP_NA(i) { @@ -436,11 +423,9 @@ void I2CPositionEncoder::calibrate_steps_mm(const uint8_t iter) { travelledDistance = mm_from_count(ABS(stopCount - startCount)); - SERIAL_ECHOPAIR("Attempted travel: ", travelDistance); - SERIAL_ECHOLNPGM("mm"); + SERIAL_ECHOLNPAIR("Attempted travel: ", travelDistance, "mm"); - SERIAL_ECHOPAIR(" Actual travel: ", travelledDistance); - SERIAL_ECHOLNPGM("mm"); + SERIAL_ECHOLNPAIR(" Actual travel: ", travelledDistance, "mm"); //Calculate new axis steps per unit old_steps_mm = planner.settings.axis_steps_per_mm[encoderAxis]; @@ -705,21 +690,18 @@ void I2CPositionEncodersMgr::change_module_address(const uint8_t oldaddr, const // First check 'new' address is not in use Wire.beginTransmission(I2C_ADDRESS(newaddr)); if (!Wire.endTransmission()) { - SERIAL_ECHOPAIR("?There is already a device with that address on the I2C bus! (", newaddr); - SERIAL_ECHOLNPGM(")"); + SERIAL_ECHOLNPAIR("?There is already a device with that address on the I2C bus! (", newaddr, ")"); return; } // Now check that we can find the module on the oldaddr address Wire.beginTransmission(I2C_ADDRESS(oldaddr)); if (Wire.endTransmission()) { - SERIAL_ECHOPAIR("?No module detected at this address! (", oldaddr); - SERIAL_ECHOLNPGM(")"); + SERIAL_ECHOLNPAIR("?No module detected at this address! (", oldaddr, ")"); return; } - SERIAL_ECHOPAIR("Module found at ", oldaddr); - SERIAL_ECHOLNPAIR(", changing address to ", newaddr); + SERIAL_ECHOLNPAIR("Module found at ", oldaddr, ", changing address to ", newaddr); // Change the modules address Wire.beginTransmission(I2C_ADDRESS(oldaddr)); @@ -755,13 +737,11 @@ void I2CPositionEncodersMgr::report_module_firmware(const uint8_t address) { // First check there is a module Wire.beginTransmission(I2C_ADDRESS(address)); if (Wire.endTransmission()) { - SERIAL_ECHOPAIR("?No module detected at this address! (", address); - SERIAL_ECHOLNPGM(")"); + SERIAL_ECHOLNPAIR("?No module detected at this address! (", address, ")"); return; } - SERIAL_ECHOPAIR("Requesting version info from module at address ", address); - SERIAL_ECHOLNPGM(":"); + SERIAL_ECHOLNPAIR("Requesting version info from module at address ", address, ":"); Wire.beginTransmission(I2C_ADDRESS(address)); Wire.write(I2CPE_SET_REPORT_MODE); @@ -808,15 +788,13 @@ int8_t I2CPositionEncodersMgr::parse() { else if (parser.seenval('I')) { if (!parser.has_value()) { - SERIAL_ECHOLNPAIR("?I seen, but no index specified! [0-", I2CPE_ENCODER_CNT - 1); - SERIAL_ECHOLNPGM("]"); + SERIAL_ECHOLNPAIR("?I seen, but no index specified! [0-", I2CPE_ENCODER_CNT - 1, "]"); return I2CPE_PARSE_ERR; }; I2CPE_idx = parser.value_byte(); if (I2CPE_idx >= I2CPE_ENCODER_CNT) { - SERIAL_ECHOLNPAIR("?Index out of range. [0-", I2CPE_ENCODER_CNT - 1); - SERIAL_ECHOLNPGM("]"); + SERIAL_ECHOLNPAIR("?Index out of range. [0-", I2CPE_ENCODER_CNT - 1, "]"); return I2CPE_PARSE_ERR; } @@ -995,8 +973,7 @@ void I2CPositionEncodersMgr::M864() { else return; } - SERIAL_ECHOPAIR("Changing module at address ", I2CPE_addr); - SERIAL_ECHOLNPAIR(" to address ", newAddress); + SERIAL_ECHOLNPAIR("Changing module at address ", I2CPE_addr, " to address ", newAddress); change_module_address(I2CPE_addr, newAddress); } diff --git a/Marlin/src/feature/I2CPositionEncoder.h b/Marlin/src/feature/I2CPositionEncoder.h index 6be24f681b..592aeb328d 100644 --- a/Marlin/src/feature/I2CPositionEncoder.h +++ b/Marlin/src/feature/I2CPositionEncoder.h @@ -238,8 +238,7 @@ class I2CPositionEncodersMgr { static void report_status(const int8_t idx) { CHECK_IDX(); - SERIAL_ECHOPAIR("Encoder ", idx); - SERIAL_ECHOPGM(": "); + SERIAL_ECHOLNPAIR("Encoder ", idx, ": "); encoders[idx].get_raw_count(); encoders[idx].passes_test(true); } @@ -264,40 +263,32 @@ class I2CPositionEncodersMgr { static void report_error_count(const int8_t idx, const AxisEnum axis) { CHECK_IDX(); - SERIAL_ECHOPAIR("Error count on ", axis_codes[axis]); - SERIAL_ECHOLNPAIR(" axis is ", encoders[idx].get_error_count()); + SERIAL_ECHOLNPAIR("Error count on ", axis_codes[axis], " axis is ", encoders[idx].get_error_count()); } static void reset_error_count(const int8_t idx, const AxisEnum axis) { CHECK_IDX(); encoders[idx].set_error_count(0); - SERIAL_ECHOPAIR("Error count on ", axis_codes[axis]); - SERIAL_ECHOLNPGM(" axis has been reset."); + SERIAL_ECHOLNPAIR("Error count on ", axis_codes[axis], " axis has been reset."); } static void enable_ec(const int8_t idx, const bool enabled, const AxisEnum axis) { CHECK_IDX(); encoders[idx].set_ec_enabled(enabled); SERIAL_ECHOPAIR("Error correction on ", axis_codes[axis]); - SERIAL_ECHOPGM(" axis is "); - serialprintPGM(encoders[idx].get_ec_enabled() ? PSTR("en") : PSTR("dis")); - SERIAL_ECHOLNPGM("abled."); + serial_ternary(encoders[idx].get_ec_enabled(), PSTR(" axis is "), PSTR("en"), PSTR("dis"), PSTR("abled.\n")); } static void set_ec_threshold(const int8_t idx, const float newThreshold, const AxisEnum axis) { CHECK_IDX(); encoders[idx].set_ec_threshold(newThreshold); - SERIAL_ECHOPAIR("Error correct threshold for ", axis_codes[axis]); - SERIAL_ECHOPAIR(" axis set to ", FIXFLOAT(newThreshold)); - SERIAL_ECHOLNPGM("mm."); + SERIAL_ECHOLNPAIR("Error correct threshold for ", axis_codes[axis], " axis set to ", FIXFLOAT(newThreshold), "mm."); } static void get_ec_threshold(const int8_t idx, const AxisEnum axis) { CHECK_IDX(); const float threshold = encoders[idx].get_ec_threshold(); - SERIAL_ECHOPAIR("Error correct threshold for ", axis_codes[axis]); - SERIAL_ECHOPAIR(" axis is ", FIXFLOAT(threshold)); - SERIAL_ECHOLNPGM("mm."); + SERIAL_ECHOLNPAIR("Error correct threshold for ", axis_codes[axis], " axis is ", FIXFLOAT(threshold), "mm."); } static int8_t idx_from_axis(const AxisEnum axis) { diff --git a/Marlin/src/feature/babystep.cpp b/Marlin/src/feature/babystep.cpp new file mode 100644 index 0000000000..efce79a092 --- /dev/null +++ b/Marlin/src/feature/babystep.cpp @@ -0,0 +1,135 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "../inc/MarlinConfig.h" + +#if ENABLED(BABYSTEPPING) + +#include "babystep.h" +#include "../Marlin.h" +#include "../module/planner.h" +#include "../module/stepper.h" + +#if ENABLED(BABYSTEP_ALWAYS_AVAILABLE) + #include "../gcode/gcode.h" +#endif + +Babystep babystep; + +volatile int16_t Babystep::todo[BS_TODO_AXIS(Z_AXIS) + 1]; + +#if HAS_LCD_MENU + int16_t Babystep::accum; + #if ENABLED(BABYSTEP_DISPLAY_TOTAL) + int16_t Babystep::axis_total[BS_TOTAL_AXIS(Z_AXIS) + 1]; + #endif +#endif + +void Babystep::step_axis(const AxisEnum axis) { + const int16_t curTodo = todo[BS_TODO_AXIS(axis)]; // get rid of volatile for performance + if (curTodo) { + stepper.babystep((AxisEnum)axis, curTodo > 0); + if (curTodo > 0) todo[BS_TODO_AXIS(axis)]--; else todo[BS_TODO_AXIS(axis)]++; + } +} + +void Babystep::task() { + #if EITHER(BABYSTEP_XY, I2C_POSITION_ENCODERS) + LOOP_XYZ(axis) step_axis((AxisEnum)axis); + #else + step_axis(Z_AXIS); + #endif +} + +void Babystep::add_mm(const AxisEnum axis, const float &mm) { + add_steps(axis, mm * planner.settings.axis_steps_per_mm[axis]); +} + +void Babystep::add_steps(const AxisEnum axis, const int32_t distance) { + + #if ENABLED(BABYSTEP_WITHOUT_HOMING) + #define CAN_BABYSTEP(AXIS) true + #else + extern uint8_t axis_known_position; + #define CAN_BABYSTEP(AXIS) TEST(axis_known_position, AXIS) + #endif + + if (!CAN_BABYSTEP(axis)) return; + + #if HAS_LCD_MENU + accum += distance; // Count up babysteps for the UI + #if ENABLED(BABYSTEP_DISPLAY_TOTAL) + axis_total[BS_TOTAL_AXIS(axis)] += distance; + #endif + #endif + + #if ENABLED(BABYSTEP_ALWAYS_AVAILABLE) + #define BSA_ENABLE(AXIS) do{ switch (AXIS) { case X_AXIS: enable_X(); break; case Y_AXIS: enable_Y(); break; case Z_AXIS: enable_Z(); } }while(0) + #else + #define BSA_ENABLE(AXIS) NOOP + #endif + + #if IS_CORE + #if ENABLED(BABYSTEP_XY) + switch (axis) { + case CORE_AXIS_1: // X on CoreXY and CoreXZ, Y on CoreYZ + BSA_ENABLE(CORE_AXIS_1); + BSA_ENABLE(CORE_AXIS_2); + todo[CORE_AXIS_1] += distance * 2; + todo[CORE_AXIS_2] += distance * 2; + break; + case CORE_AXIS_2: // Y on CoreXY, Z on CoreXZ and CoreYZ + BSA_ENABLE(CORE_AXIS_1); + BSA_ENABLE(CORE_AXIS_2); + todo[CORE_AXIS_1] += CORESIGN(distance * 2); + todo[CORE_AXIS_2] -= CORESIGN(distance * 2); + break; + case NORMAL_AXIS: // Z on CoreXY, Y on CoreXZ, X on CoreYZ + default: + BSA_ENABLE(NORMAL_AXIS); + todo[NORMAL_AXIS] += distance; + break; + } + #elif CORE_IS_XZ || CORE_IS_YZ + // Only Z stepping needs to be handled here + BSA_ENABLE(CORE_AXIS_1); + BSA_ENABLE(CORE_AXIS_2); + todo[CORE_AXIS_1] += CORESIGN(distance * 2); + todo[CORE_AXIS_2] -= CORESIGN(distance * 2); + #else + BSA_ENABLE(Z_AXIS); + todo[Z_AXIS] += distance; + #endif + #else + #if ENABLED(BABYSTEP_XY) + BSA_ENABLE(axis); + #else + BSA_ENABLE(Z_AXIS); + #endif + todo[BS_TODO_AXIS(axis)] += distance; + #endif + #if ENABLED(BABYSTEP_ALWAYS_AVAILABLE) + gcode.reset_stepper_timeout(); + #endif +} + +#endif // BABYSTEPPING diff --git a/Marlin/src/feature/babystep.h b/Marlin/src/feature/babystep.h new file mode 100644 index 0000000000..3f22fac11f --- /dev/null +++ b/Marlin/src/feature/babystep.h @@ -0,0 +1,63 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +#include "../inc/MarlinConfigPre.h" +#include "../core/enum.h" + +#if IS_CORE || EITHER(BABYSTEP_XY, I2C_POSITION_ENCODERS) + #define BS_TODO_AXIS(A) A +#else + #define BS_TODO_AXIS(A) 0 +#endif + +#if HAS_LCD_MENU && ENABLED(BABYSTEP_DISPLAY_TOTAL) + #if ENABLED(BABYSTEP_XY) + #define BS_TOTAL_AXIS(A) A + #else + #define BS_TOTAL_AXIS(A) 0 + #endif +#endif + +class Babystep { +public: + static volatile int16_t todo[BS_TODO_AXIS(Z_AXIS) + 1]; + #if HAS_LCD_MENU + static int16_t accum; // Total babysteps in current edit + #if ENABLED(BABYSTEP_DISPLAY_TOTAL) + static int16_t axis_total[BS_TOTAL_AXIS(Z_AXIS) + 1]; // Total babysteps since G28 + static inline void reset_total(const AxisEnum axis) { + #if ENABLED(BABYSTEP_XY) + if (axis == Z_AXIS) + #endif + axis_total[BS_TOTAL_AXIS(axis)] = 0; + } + #endif + #endif + static void add_steps(const AxisEnum axis, const int32_t distance); + static void add_mm(const AxisEnum axis, const float &mm); + static void task(); +private: + static void step_axis(const AxisEnum axis); +}; + +extern Babystep babystep; diff --git a/Marlin/src/feature/bedlevel/abl/abl.cpp b/Marlin/src/feature/bedlevel/abl/abl.cpp index ba4d5cfacb..ce2799cd38 100644 --- a/Marlin/src/feature/bedlevel/abl/abl.cpp +++ b/Marlin/src/feature/bedlevel/abl/abl.cpp @@ -29,6 +29,9 @@ #include "../../../module/motion.h" +#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) +#include "../../../core/debug_out.h" + int bilinear_grid_spacing[2], bilinear_start[2]; float bilinear_grid_factor[2], z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y]; @@ -37,26 +40,21 @@ float bilinear_grid_factor[2], * Extrapolate a single point from its neighbors */ static void extrapolate_one_point(const uint8_t x, const uint8_t y, const int8_t xdir, const int8_t ydir) { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPGM("Extrapolate ["); - if (x < 10) SERIAL_CHAR(' '); - SERIAL_ECHO((int)x); - SERIAL_CHAR(xdir ? (xdir > 0 ? '+' : '-') : ' '); - SERIAL_CHAR(' '); - if (y < 10) SERIAL_CHAR(' '); - SERIAL_ECHO((int)y); - SERIAL_CHAR(ydir ? (ydir > 0 ? '+' : '-') : ' '); - SERIAL_CHAR(']'); - } - #endif + if (DEBUGGING(LEVELING)) { + DEBUG_ECHOPGM("Extrapolate ["); + if (x < 10) DEBUG_CHAR(' '); + DEBUG_ECHO((int)x); + DEBUG_CHAR(xdir ? (xdir > 0 ? '+' : '-') : ' '); + DEBUG_CHAR(' '); + if (y < 10) DEBUG_CHAR(' '); + DEBUG_ECHO((int)y); + DEBUG_CHAR(ydir ? (ydir > 0 ? '+' : '-') : ' '); + DEBUG_ECHOLNPGM("]"); + } if (!isnan(z_values[x][y])) { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM(" (done)"); - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM(" (done)"); return; // Don't overwrite good values. } - SERIAL_EOL(); // Get X neighbors, Y neighbors, and XY neighbors const uint8_t x1 = x + xdir, y1 = y + ydir, x2 = x1 + xdir, y2 = y1 + ydir; @@ -76,6 +74,9 @@ static void extrapolate_one_point(const uint8_t x, const uint8_t y, const int8_t // Take the average instead of the median z_values[x][y] = (a + b + c) / 3.0; + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onMeshUpdate(x, y, z_values[x][y]); + #endif // Median is robust (ignores outliers). // z_values[x][y] = (a < b) ? ((b < c) ? b : (c < a) ? a : c) @@ -338,22 +339,11 @@ float bilinear_z_offset(const float raw[XYZ]) { /* static float last_offset = 0; if (ABS(last_offset - offset) > 0.2) { - SERIAL_ECHOPGM("Sudden Shift at "); - SERIAL_ECHOPAIR("x=", rx); - SERIAL_ECHOPAIR(" / ", bilinear_grid_spacing[X_AXIS]); - SERIAL_ECHOLNPAIR(" -> gridx=", gridx); - SERIAL_ECHOPAIR(" y=", ry); - SERIAL_ECHOPAIR(" / ", bilinear_grid_spacing[Y_AXIS]); - SERIAL_ECHOLNPAIR(" -> gridy=", gridy); - SERIAL_ECHOPAIR(" ratio_x=", ratio_x); - SERIAL_ECHOLNPAIR(" ratio_y=", ratio_y); - SERIAL_ECHOPAIR(" z1=", z1); - SERIAL_ECHOPAIR(" z2=", z2); - SERIAL_ECHOPAIR(" z3=", z3); - SERIAL_ECHOLNPAIR(" z4=", z4); - SERIAL_ECHOPAIR(" L=", L); - SERIAL_ECHOPAIR(" R=", R); - SERIAL_ECHOLNPAIR(" offset=", offset); + SERIAL_ECHOLNPAIR("Sudden Shift at x=", rx, " / ", bilinear_grid_spacing[X_AXIS], " -> gridx=", gridx); + SERIAL_ECHOLNPAIR(" y=", ry, " / ", bilinear_grid_spacing[Y_AXIS], " -> gridy=", gridy); + SERIAL_ECHOLNPAIR(" ratio_x=", ratio_x, " ratio_y=", ratio_y); + SERIAL_ECHOLNPAIR(" z1=", z1, " z2=", z2, " z3=", z3, " z4=", z4); + SERIAL_ECHOLNPAIR(" L=", L, " R=", R, " offset=", offset); } last_offset = offset; //*/ diff --git a/Marlin/src/feature/bedlevel/abl/abl.h b/Marlin/src/feature/bedlevel/abl/abl.h index 541d98a412..8f2a900beb 100644 --- a/Marlin/src/feature/bedlevel/abl/abl.h +++ b/Marlin/src/feature/bedlevel/abl/abl.h @@ -40,4 +40,6 @@ void refresh_bed_level(); void bilinear_line_to_destination(const float fr_mm_s, uint16_t x_splits=0xFFFF, uint16_t y_splits=0xFFFF); #endif -#define Z_VALUES(X,Y) z_values[X][Y] +#define _GET_MESH_X(I) (bilinear_start[X_AXIS] + (I) * bilinear_grid_spacing[X_AXIS]) +#define _GET_MESH_Y(J) (bilinear_start[Y_AXIS] + (J) * bilinear_grid_spacing[Y_AXIS]) +#define Z_VALUES_ARR z_values diff --git a/Marlin/src/feature/bedlevel/bedlevel.cpp b/Marlin/src/feature/bedlevel/bedlevel.cpp index 364e22ed44..55267b44e0 100644 --- a/Marlin/src/feature/bedlevel/bedlevel.cpp +++ b/Marlin/src/feature/bedlevel/bedlevel.cpp @@ -27,7 +27,7 @@ #include "bedlevel.h" #include "../../module/planner.h" -#if ENABLED(MESH_BED_LEVELING) || ENABLED(PROBE_MANUALLY) +#if EITHER(MESH_BED_LEVELING, PROBE_MANUALLY) #include "../../module/motion.h" #endif @@ -39,9 +39,8 @@ #include "../../lcd/ultralcd.h" #endif -#if ENABLED(G26_MESH_VALIDATION) - bool g26_debug_flag; // = false -#endif +#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) +#include "../../core/debug_out.h" bool leveling_is_valid() { return @@ -122,9 +121,7 @@ void set_bed_leveling_enabled(const bool enable/*=true*/) { * Reset calibration results to zero. */ void reset_bed_level() { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("reset_bed_level"); - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("reset_bed_level"); set_bed_leveling_enabled(false); #if ENABLED(MESH_BED_LEVELING) mbl.reset(); @@ -134,14 +131,18 @@ void reset_bed_level() { bilinear_start[X_AXIS] = bilinear_start[Y_AXIS] = bilinear_grid_spacing[X_AXIS] = bilinear_grid_spacing[Y_AXIS] = 0; for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++) - for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++) + for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++) { z_values[x][y] = NAN; + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onMeshUpdate(x, y, 0); + #endif + } #elif ABL_PLANAR planner.bed_level_matrix.set_to_identity(); #endif } -#if ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(MESH_BED_LEVELING) +#if EITHER(AUTO_BED_LEVELING_BILINEAR, MESH_BED_LEVELING) /** * Enable to produce output in JSON format suitable @@ -210,7 +211,7 @@ void reset_bed_level() { #endif // AUTO_BED_LEVELING_BILINEAR || MESH_BED_LEVELING -#if ENABLED(MESH_BED_LEVELING) || ENABLED(PROBE_MANUALLY) +#if EITHER(MESH_BED_LEVELING, PROBE_MANUALLY) void _manual_goto_xy(const float &rx, const float &ry) { diff --git a/Marlin/src/feature/bedlevel/bedlevel.h b/Marlin/src/feature/bedlevel/bedlevel.h index 9801bc9138..e2e7e182f1 100644 --- a/Marlin/src/feature/bedlevel/bedlevel.h +++ b/Marlin/src/feature/bedlevel/bedlevel.h @@ -28,12 +28,6 @@ typedef struct { float distance; // When populated, the distance from the search location } mesh_index_pair; -#if ENABLED(G26_MESH_VALIDATION) - extern bool g26_debug_flag; -#else - constexpr bool g26_debug_flag = false; -#endif - #if ENABLED(PROBE_MANUALLY) extern bool g29_in_progress; #else @@ -48,38 +42,35 @@ void reset_bed_level(); void set_z_fade_height(const float zfh, const bool do_report=true); #endif -#if ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(MESH_BED_LEVELING) - - #include - - typedef float (*element_2d_fn)(const uint8_t, const uint8_t); - - /** - * Print calibration results for plotting or manual frame adjustment. - */ - void print_2d_array(const uint8_t sx, const uint8_t sy, const uint8_t precision, element_2d_fn fn); - -#endif - -#if ENABLED(MESH_BED_LEVELING) || ENABLED(PROBE_MANUALLY) +#if EITHER(MESH_BED_LEVELING, PROBE_MANUALLY) void _manual_goto_xy(const float &x, const float &y); #endif -#if ENABLED(AUTO_BED_LEVELING_BILINEAR) - #define _GET_MESH_X(I) (bilinear_start[X_AXIS] + (I) * bilinear_grid_spacing[X_AXIS]) - #define _GET_MESH_Y(J) (bilinear_start[Y_AXIS] + (J) * bilinear_grid_spacing[Y_AXIS]) -#elif ENABLED(AUTO_BED_LEVELING_UBL) - #define _GET_MESH_X(I) ubl.mesh_index_to_xpos(I) - #define _GET_MESH_Y(J) ubl.mesh_index_to_ypos(J) -#elif ENABLED(MESH_BED_LEVELING) - #define _GET_MESH_X(I) mbl.index_to_xpos[I] - #define _GET_MESH_Y(J) mbl.index_to_ypos[J] -#endif +#if HAS_MESH + + typedef float (&bed_mesh_t)[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y]; + + #if ENABLED(AUTO_BED_LEVELING_BILINEAR) + #include "abl/abl.h" + #elif ENABLED(AUTO_BED_LEVELING_UBL) + #include "ubl/ubl.h" + #elif ENABLED(MESH_BED_LEVELING) + #include "mbl/mesh_bed_leveling.h" + #endif + + #define Z_VALUES(X,Y) Z_VALUES_ARR[X][Y] + + #if EITHER(AUTO_BED_LEVELING_BILINEAR, MESH_BED_LEVELING) + + #include + + typedef float (*element_2d_fn)(const uint8_t, const uint8_t); + + /** + * Print calibration results for plotting or manual frame adjustment. + */ + void print_2d_array(const uint8_t sx, const uint8_t sy, const uint8_t precision, element_2d_fn fn); + + #endif -#if ENABLED(MESH_BED_LEVELING) - #include "mbl/mesh_bed_leveling.h" -#elif ENABLED(AUTO_BED_LEVELING_UBL) - #include "ubl/ubl.h" -#elif ENABLED(AUTO_BED_LEVELING_BILINEAR) - #include "abl/abl.h" #endif diff --git a/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp b/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp index eb1dc4c88a..188ddb898d 100644 --- a/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp +++ b/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp @@ -47,6 +47,11 @@ void mesh_bed_leveling::reset() { z_offset = 0; ZERO(z_values); + #if ENABLED(EXTENSIBLE_UI) + for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++) + for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++) + ExtUI::onMeshUpdate(x, y, 0); + #endif } #if IS_CARTESIAN && DISABLED(SEGMENT_LEVELED_MOVES) diff --git a/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h b/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h index 9a746f6b91..1869187afe 100644 --- a/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h +++ b/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h @@ -34,6 +34,9 @@ enum MeshLevelingState : char { #define MESH_X_DIST ((MESH_MAX_X - (MESH_MIN_X)) / (GRID_MAX_POINTS_X - 1)) #define MESH_Y_DIST ((MESH_MAX_Y - (MESH_MIN_Y)) / (GRID_MAX_POINTS_Y - 1)) +#define _GET_MESH_X(I) mbl.index_to_xpos[I] +#define _GET_MESH_Y(J) mbl.index_to_ypos[J] +#define Z_VALUES_ARR mbl.z_values class mesh_bed_leveling { public: @@ -118,5 +121,3 @@ public: }; extern mesh_bed_leveling mbl; - -#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 349377c0c5..9e637c7deb 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl.cpp @@ -32,6 +32,10 @@ #include "../../../module/motion.h" #include "../../bedlevel/bedlevel.h" + #if ENABLED(EXTENSIBLE_UI) + #include "../../../lcd/extensible_ui/ui_api.h" + #endif + #include "math.h" void unified_bed_leveling::echo_name() { @@ -45,8 +49,7 @@ for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++) if (!isnan(z_values[x][y])) { SERIAL_ECHO_START(); - SERIAL_ECHOPAIR(" M421 I", x); - SERIAL_ECHOPAIR(" J", y); + SERIAL_ECHOPAIR(" M421 I", x, " J", y); SERIAL_ECHOPAIR_F(" Z", z_values[x][y], 2); SERIAL_EOL(); serial_delay(75); // Prevent Printrun from exploding @@ -55,54 +58,10 @@ void unified_bed_leveling::report_state() { echo_name(); - SERIAL_ECHOPGM(" System v" UBL_VERSION " "); - if (!planner.leveling_active) SERIAL_ECHOPGM("in"); - SERIAL_ECHOLNPGM("active."); + serial_ternary(planner.leveling_active, PSTR(" System v" UBL_VERSION " "), PSTR(""), PSTR("in"), PSTR("active\n")); serial_delay(50); } - #if ENABLED(UBL_DEVEL_DEBUGGING) - - static void debug_echo_axis(const AxisEnum axis) { - if (current_position[axis] == destination[axis]) - SERIAL_ECHOPGM("-------------"); - else - SERIAL_ECHO_F(destination[X_AXIS], 6); - } - - void debug_current_and_destination(PGM_P title) { - - // if the title message starts with a '!' it is so important, we are going to - // ignore the status of the g26_debug_flag - if (*title != '!' && !g26_debug_flag) return; - - const float de = destination[E_AXIS] - current_position[E_AXIS]; - - if (de == 0.0) return; // Printing moves only - - const float dx = destination[X_AXIS] - current_position[X_AXIS], - dy = destination[Y_AXIS] - current_position[Y_AXIS], - xy_dist = HYPOT(dx, dy); - - if (xy_dist == 0.0) return; - - const float fpmm = de / xy_dist; - SERIAL_ECHOPAIR_F(" fpmm=", fpmm, 6); - SERIAL_ECHOPAIR_F(" current=( ", current_position[X_AXIS], 6); - SERIAL_ECHOPAIR_F(", ", current_position[Y_AXIS], 6); - SERIAL_ECHOPAIR_F(", ", current_position[Z_AXIS], 6); - SERIAL_ECHOPAIR_F(", ", current_position[E_AXIS], 6); - SERIAL_ECHOPGM(" ) destination=( "); debug_echo_axis(X_AXIS); - SERIAL_ECHOPGM(", "); debug_echo_axis(Y_AXIS); - SERIAL_ECHOPGM(", "); debug_echo_axis(Z_AXIS); - SERIAL_ECHOPGM(", "); debug_echo_axis(E_AXIS); - SERIAL_ECHOPGM(" ) "); - serialprintPGM(title); - SERIAL_EOL(); - } - - #endif // UBL_DEVEL_DEBUGGING - int8_t unified_bed_leveling::storage_slot; float unified_bed_leveling::z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y]; @@ -130,6 +89,11 @@ planner.set_z_fade_height(10.0); #endif ZERO(z_values); + #if ENABLED(EXTENSIBLE_UI) + for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++) + for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++) + ExtUI::onMeshUpdate(x, y, 0); + #endif if (was_enabled) report_current_position(); } @@ -142,6 +106,9 @@ 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] = value; + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onMeshUpdate(x, y, value); + #endif } } } diff --git a/Marlin/src/feature/bedlevel/ubl/ubl.h b/Marlin/src/feature/bedlevel/ubl/ubl.h index c647f632a0..a7c7f033b3 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl.h +++ b/Marlin/src/feature/bedlevel/ubl/ubl.h @@ -29,6 +29,9 @@ #include "../../../lcd/ultralcd.h" #include "../../../Marlin.h" +#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) +#include "../../../core/debug_out.h" + #define UBL_VERSION "1.01" #define UBL_OK false #define UBL_ERR true @@ -36,14 +39,6 @@ #define USE_NOZZLE_AS_REFERENCE 0 #define USE_PROBE_AS_REFERENCE 1 -// ubl_motion.cpp - -#if ENABLED(UBL_DEVEL_DEBUGGING) - void debug_current_and_destination(PGM_P const title); -#else - FORCE_INLINE void debug_current_and_destination(PGM_P const title) { UNUSED(title); } -#endif - // ubl_G29.cpp enum MeshPointType : char { INVALID, REAL, SET_IN_BITMAP }; @@ -199,16 +194,11 @@ class unified_bed_leveling { */ static inline float z_correction_for_x_on_horizontal_mesh_line(const float &rx0, const int x1_i, const int yi) { if (!WITHIN(x1_i, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(yi, 0, GRID_MAX_POINTS_Y - 1)) { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - serialprintPGM( !WITHIN(x1_i, 0, GRID_MAX_POINTS_X - 1) ? PSTR("x1_i") : PSTR("yi") ); - SERIAL_ECHOPAIR(" out of bounds in z_correction_for_x_on_horizontal_mesh_line(rx0=", rx0); - SERIAL_ECHOPAIR(",x1_i=", x1_i); - SERIAL_ECHOPAIR(",yi=", yi); - SERIAL_CHAR(')'); - SERIAL_EOL(); - } - #endif + + if (DEBUGGING(LEVELING)) { + if (WITHIN(x1_i, 0, GRID_MAX_POINTS_X - 1)) DEBUG_ECHOPGM("yi"); else DEBUG_ECHOPGM("x1_i"); + DEBUG_ECHOLNPAIR(" out of bounds in z_correction_for_x_on_horizontal_mesh_line(rx0=", rx0, ",x1_i=", x1_i, ",yi=", yi, ")"); + } // The requested location is off the mesh. Return UBL_Z_RAISE_WHEN_OFF_MESH or NAN. return ( @@ -233,16 +223,11 @@ class unified_bed_leveling { // static inline float z_correction_for_y_on_vertical_mesh_line(const float &ry0, const int xi, const int y1_i) { if (!WITHIN(xi, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(y1_i, 0, GRID_MAX_POINTS_Y - 1)) { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - serialprintPGM( !WITHIN(xi, 0, GRID_MAX_POINTS_X - 1) ? PSTR("xi") : PSTR("y1_i") ); - SERIAL_ECHOPAIR(" out of bounds in z_correction_for_y_on_vertical_mesh_line(ry0=", ry0); - SERIAL_ECHOPAIR(", xi=", xi); - SERIAL_ECHOPAIR(", y1_i=", y1_i); - SERIAL_CHAR(')'); - SERIAL_EOL(); - } - #endif + + if (DEBUGGING(LEVELING)) { + if (WITHIN(xi, 0, GRID_MAX_POINTS_X - 1)) DEBUG_ECHOPGM("y1_i"); else DEBUG_ECHOPGM("xi"); + DEBUG_ECHOLNPAIR(" out of bounds in z_correction_for_y_on_vertical_mesh_line(ry0=", ry0, ", xi=", xi, ", y1_i=", y1_i, ")"); + } // The requested location is off the mesh. Return UBL_Z_RAISE_WHEN_OFF_MESH or NAN. return ( @@ -293,17 +278,12 @@ class unified_bed_leveling { mesh_index_to_ypos(cy), z1, mesh_index_to_ypos(cy + 1), z2); - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(MESH_ADJUST)) { - SERIAL_ECHOPAIR(" raw get_z_correction(", rx0); - SERIAL_CHAR(','); SERIAL_ECHO(ry0); - SERIAL_ECHOPAIR_F(") = ", z0, 6); - } - #endif - - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(MESH_ADJUST)) SERIAL_ECHOLNPAIR_F(" >>>---> ", z0, 6); - #endif + if (DEBUGGING(MESH_ADJUST)) { + DEBUG_ECHOPAIR(" raw get_z_correction(", rx0); + DEBUG_CHAR(','); DEBUG_ECHO(ry0); + DEBUG_ECHOPAIR_F(") = ", z0, 6); + DEBUG_ECHOLNPAIR_F(" >>>---> ", z0, 6); + } if (isnan(z0)) { // if part of the Mesh is undefined, it will show up as NAN z0 = 0.0; // in ubl.z_values[][] and propagate through the @@ -311,15 +291,13 @@ class unified_bed_leveling { // because part of the Mesh is undefined and we don't have the // information we need to complete the height correction. - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(MESH_ADJUST)) { - SERIAL_ECHOPAIR("??? Yikes! NAN in get_z_correction(", rx0); - SERIAL_CHAR(','); - SERIAL_ECHO(ry0); - SERIAL_CHAR(')'); - SERIAL_EOL(); - } - #endif + if (DEBUGGING(MESH_ADJUST)) { + DEBUG_ECHOPAIR("??? Yikes! NAN in get_z_correction(", rx0); + DEBUG_CHAR(','); + DEBUG_ECHO(ry0); + DEBUG_CHAR(')'); + DEBUG_EOL(); + } } return z0; } @@ -349,4 +327,9 @@ class unified_bed_leveling { extern unified_bed_leveling ubl; -#define Z_VALUES(X,Y) ubl.z_values[X][Y] +#define _GET_MESH_X(I) ubl.mesh_index_to_xpos(I) +#define _GET_MESH_Y(J) ubl.mesh_index_to_ypos(J) +#define Z_VALUES_ARR ubl.z_values + +// Prevent debugging propagating to other files +#include "../../../core/debug_out.h" diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp index 637f9bda4a..ba9205b9c3 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -24,8 +24,6 @@ #if ENABLED(AUTO_BED_LEVELING_UBL) - //#define UBL_DEVEL_DEBUGGING - #include "ubl.h" #include "../../../Marlin.h" @@ -46,6 +44,13 @@ #include "../../../module/tool_change.h" #endif + #define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) + #include "../../../core/debug_out.h" + + #if ENABLED(EXTENSIBLE_UI) + #include "../../../lcd/extensible_ui/ui_api.h" + #endif + #include #define UBL_G29_P31 @@ -335,6 +340,9 @@ break; // No more invalid Mesh Points to populate } z_values[location.x_index][location.y_index] = NAN; + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onMeshUpdate(location.x_index, location.y_index, 0); + #endif cnt++; } } @@ -362,6 +370,9 @@ const float p1 = 0.5f * (GRID_MAX_POINTS_X) - x, p2 = 0.5f * (GRID_MAX_POINTS_Y) - y; z_values[x][y] += 2.0f * HYPOT(p1, p2); + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onMeshUpdate(x, y, z_values[x][y]); + #endif } } break; @@ -370,14 +381,23 @@ 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 + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onMeshUpdate(x, x, z_values[x][x]); + ExtUI::onMeshUpdate(x, (x + (x < GRID_MAX_POINTS_Y - 1) ? 1 : -1), z_values[x][x + (x < GRID_MAX_POINTS_Y - 1) ? 1 : -1]); + #endif + } 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 - for (uint8_t y = (GRID_MAX_POINTS_Y) / 3; y < 2 * (GRID_MAX_POINTS_Y) / 3; y++) // the center of the bed + for (uint8_t x = (GRID_MAX_POINTS_X) / 3; x < 2 * (GRID_MAX_POINTS_X) / 3; x++) // Create a rectangular raised area in + for (uint8_t y = (GRID_MAX_POINTS_Y) / 3; y < 2 * (GRID_MAX_POINTS_Y) / 3; y++) { // the center of the bed z_values[x][y] += parser.seen('C') ? g29_constant : 9.99f; + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onMeshUpdate(x, y, z_values[x][y]); + #endif + } break; } } @@ -428,7 +448,7 @@ SERIAL_ECHOLNPGM("Mesh invalidated. Probing mesh."); } if (g29_verbose_level > 1) { - SERIAL_ECHOPAIR("Probing Mesh Points Closest to (", g29_x_pos); + SERIAL_ECHOPAIR("Probing around (", g29_x_pos); SERIAL_CHAR(','); SERIAL_ECHO(g29_y_pos); SERIAL_ECHOLNPGM(").\n"); @@ -519,6 +539,9 @@ break; // No more invalid Mesh Points to populate } z_values[location.x_index][location.y_index] = g29_constant; + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onMeshUpdate(location.x_index, location.y_index, z_values[location.x_index][location.y_index]); + #endif } } } @@ -598,8 +621,7 @@ } if (!WITHIN(g29_storage_slot, 0, a - 1)) { - SERIAL_ECHOLNPGM("?Invalid storage slot."); - SERIAL_ECHOLNPAIR("?Use 0 to ", a - 1); + SERIAL_ECHOLNPAIR("?Invalid storage slot.\n?Use 0 to ", a - 1); return; } @@ -627,8 +649,7 @@ } if (!WITHIN(g29_storage_slot, 0, a - 1)) { - SERIAL_ECHOLNPGM("?Invalid storage slot."); - SERIAL_ECHOLNPAIR("?Use 0 to ", a - 1); + SERIAL_ECHOLNPAIR("?Invalid storage slot.\n?Use 0 to ", a - 1); goto LEAVE; } @@ -683,15 +704,23 @@ if (cflag) for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++) for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++) - if (!isnan(z_values[x][y])) + if (!isnan(z_values[x][y])) { z_values[x][y] -= mean + value; + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onMeshUpdate(x, y, z_values[x][y]); + #endif + } } void unified_bed_leveling::shift_mesh_height() { for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++) for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++) - if (!isnan(z_values[x][y])) + if (!isnan(z_values[x][y])) { z_values[x][y] += g29_constant; + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onMeshUpdate(x, y, z_values[x][y]); + #endif + } } #if HAS_BED_PROBE @@ -734,10 +763,12 @@ if (location.x_index >= 0) { // mesh point found and is reachable by probe const float rawx = mesh_index_to_xpos(location.x_index), - rawy = mesh_index_to_ypos(location.y_index); - - const float measured_z = probe_pt(rawx, rawy, stow_probe ? PROBE_PT_STOW : PROBE_PT_RAISE, g29_verbose_level); // TODO: Needs error handling + rawy = mesh_index_to_ypos(location.y_index), + measured_z = probe_pt(rawx, rawy, stow_probe ? PROBE_PT_STOW : PROBE_PT_RAISE, g29_verbose_level); // TODO: Needs error handling z_values[location.x_index][location.y_index] = measured_z; + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onMeshUpdate(location.x_index, location.y_index, measured_z); + #endif } SERIAL_FLUSH(); // Prevent host M105 buffer overrun. } while (location.x_index >= 0 && --count); @@ -896,6 +927,10 @@ } z_values[location.x_index][location.y_index] = current_position[Z_AXIS] - thick; + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onMeshUpdate(location.x_index, location.y_index, z_values[location.x_index][location.y_index]); + #endif + if (g29_verbose_level > 2) SERIAL_ECHOLNPAIR_F("Mesh Point Measured at: ", z_values[location.x_index][location.y_index], 6); SERIAL_FLUSH(); // Prevent host M105 buffer overrun. @@ -996,6 +1031,9 @@ 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 + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onMeshUpdate(location.x_index, location.y_index, new_z); + #endif serial_delay(20); // No switch noise ui.refresh(); @@ -1300,6 +1338,11 @@ z_values[x][y] = z_values[x1][y1]; // Use nearest (maybe a little too high.) else z_values[x][y] = 2.0f * z_values[x1][y1] - z_values[x2][y2]; // Angled upward... + + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onMeshUpdate(x, y, z_values[x][y]); + #endif + return true; } return false; @@ -1424,27 +1467,24 @@ abort_flag = isnan(measured_z); - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_CHAR('('); - SERIAL_ECHO_F(rx, 7); - SERIAL_CHAR(','); - SERIAL_ECHO_F(ry, 7); - SERIAL_ECHOPGM(") logical: "); - SERIAL_CHAR('('); - SERIAL_ECHO_F(LOGICAL_X_POSITION(rx), 7); - SERIAL_CHAR(','); - SERIAL_ECHO_F(LOGICAL_Y_POSITION(ry), 7); - SERIAL_ECHOPAIR_F(") measured: ", measured_z, 7); - SERIAL_ECHOPAIR_F(" correction: ", get_z_correction(rx, ry), 7); - } - #endif + if (DEBUGGING(LEVELING)) { + DEBUG_CHAR('('); + DEBUG_ECHO_F(rx, 7); + DEBUG_CHAR(','); + DEBUG_ECHO_F(ry, 7); + DEBUG_ECHOPGM(") logical: "); + DEBUG_CHAR('('); + DEBUG_ECHO_F(LOGICAL_X_POSITION(rx), 7); + DEBUG_CHAR(','); + DEBUG_ECHO_F(LOGICAL_Y_POSITION(ry), 7); + DEBUG_ECHOPAIR_F(") measured: ", measured_z, 7); + DEBUG_ECHOPAIR_F(" correction: ", get_z_correction(rx, ry), 7); + } measured_z -= get_z_correction(rx, ry) /* + zprobe_zoffset */ ; - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPAIR_F(" final >>>---> ", measured_z, 7); - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR_F(" final >>>---> ", measured_z, 7); + if (g29_verbose_level > 3) { serial_spaces(16); SERIAL_ECHOLNPAIR("Corrected_Z=", measured_z); @@ -1485,92 +1525,88 @@ y_tmp = mesh_index_to_ypos(j), z_tmp = z_values[i][j]; - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR_F("before rotation = [", x_tmp, 7); - SERIAL_CHAR(','); - SERIAL_ECHO_F(y_tmp, 7); - SERIAL_CHAR(','); - SERIAL_ECHO_F(z_tmp, 7); - SERIAL_ECHOPGM("] ---> "); - serial_delay(20); - } - #endif + if (DEBUGGING(LEVELING)) { + DEBUG_ECHOPAIR_F("before rotation = [", x_tmp, 7); + DEBUG_CHAR(','); + DEBUG_ECHO_F(y_tmp, 7); + DEBUG_CHAR(','); + DEBUG_ECHO_F(z_tmp, 7); + DEBUG_ECHOPGM("] ---> "); + DEBUG_DELAY(20); + } apply_rotation_xyz(rotation, x_tmp, y_tmp, z_tmp); - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR_F("after rotation = [", x_tmp, 7); - SERIAL_CHAR(','); - SERIAL_ECHO_F(y_tmp, 7); - SERIAL_CHAR(','); - SERIAL_ECHO_F(z_tmp, 7); - SERIAL_ECHOLNPGM("]"); - serial_delay(55); - } - #endif + if (DEBUGGING(LEVELING)) { + DEBUG_ECHOPAIR_F("after rotation = [", x_tmp, 7); + DEBUG_CHAR(','); + DEBUG_ECHO_F(y_tmp, 7); + DEBUG_CHAR(','); + DEBUG_ECHO_F(z_tmp, 7); + DEBUG_ECHOLNPGM("]"); + DEBUG_DELAY(55); + } z_values[i][j] = z_tmp - lsf_results.D; + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onMeshUpdate(i, j, z_values[i][j]); + #endif } } - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - rotation.debug(PSTR("rotation matrix:\n")); - SERIAL_ECHOPAIR_F("LSF Results A=", lsf_results.A, 7); - SERIAL_ECHOPAIR_F(" B=", lsf_results.B, 7); - SERIAL_ECHOLNPAIR_F(" D=", lsf_results.D, 7); - serial_delay(55); + if (DEBUGGING(LEVELING)) { + rotation.debug(PSTR("rotation matrix:\n")); + DEBUG_ECHOPAIR_F("LSF Results A=", lsf_results.A, 7); + DEBUG_ECHOPAIR_F(" B=", lsf_results.B, 7); + DEBUG_ECHOLNPAIR_F(" D=", lsf_results.D, 7); + DEBUG_DELAY(55); - SERIAL_ECHOPAIR_F("bed plane normal = [", normal.x, 7); - SERIAL_CHAR(','); - SERIAL_ECHO_F(normal.y, 7); - SERIAL_CHAR(','); - SERIAL_ECHO_F(normal.z, 7); - SERIAL_ECHOLNPGM("]"); - SERIAL_EOL(); + DEBUG_ECHOPAIR_F("bed plane normal = [", normal.x, 7); + DEBUG_CHAR(','); + DEBUG_ECHO_F(normal.y, 7); + DEBUG_CHAR(','); + DEBUG_ECHO_F(normal.z, 7); + DEBUG_ECHOLNPGM("]"); + DEBUG_EOL(); - /** - * The following code can be used to check the validity of the mesh tilting algorithm. - * When a 3-Point Mesh Tilt is done, the same algorithm is used as the grid based tilting. - * The only difference is just 3 points are used in the calculations. That fact guarantees - * each probed point should have an exact match when a get_z_correction() for that location - * is calculated. The Z error between the probed point locations and the get_z_correction() - * numbers for those locations should be 0. - */ - #if 0 - float t, t1, d; - t = normal.x * (PROBE_PT_1_X) + normal.y * (PROBE_PT_1_Y); - d = t + normal.z * z1; - SERIAL_ECHOPAIR_F("D from 1st point: ", d, 6); - SERIAL_ECHOLNPAIR_F(" Z error: ", normal.z*z1-get_z_correction(PROBE_PT_1_X, PROBE_PT_1_Y), 6); + /** + * The following code can be used to check the validity of the mesh tilting algorithm. + * When a 3-Point Mesh Tilt is done, the same algorithm is used as the grid based tilting. + * The only difference is just 3 points are used in the calculations. That fact guarantees + * each probed point should have an exact match when a get_z_correction() for that location + * is calculated. The Z error between the probed point locations and the get_z_correction() + * numbers for those locations should be 0. + */ + #if 0 + float t, t1, d; + t = normal.x * (PROBE_PT_1_X) + normal.y * (PROBE_PT_1_Y); + d = t + normal.z * z1; + DEBUG_ECHOPAIR_F("D from 1st point: ", d, 6); + DEBUG_ECHOLNPAIR_F(" Z error: ", normal.z*z1-get_z_correction(PROBE_PT_1_X, PROBE_PT_1_Y), 6); - t = normal.x * (PROBE_PT_2_X) + normal.y * (PROBE_PT_2_Y); - d = t + normal.z * z2; - SERIAL_EOL(); - SERIAL_ECHOPAIR_F("D from 2nd point: ", d, 6); - SERIAL_ECHOLNPAIR_F(" Z error: ", normal.z*z2-get_z_correction(PROBE_PT_2_X, PROBE_PT_2_Y), 6); + t = normal.x * (PROBE_PT_2_X) + normal.y * (PROBE_PT_2_Y); + d = t + normal.z * z2; + DEBUG_EOL(); + DEBUG_ECHOPAIR_F("D from 2nd point: ", d, 6); + DEBUG_ECHOLNPAIR_F(" Z error: ", normal.z*z2-get_z_correction(PROBE_PT_2_X, PROBE_PT_2_Y), 6); - t = normal.x * (PROBE_PT_3_X) + normal.y * (PROBE_PT_3_Y); - d = t + normal.z * z3; - SERIAL_ECHOPAIR_F("D from 3rd point: ", d, 6); - SERIAL_ECHOLNPAIR_F(" Z error: ", normal.z*z3-get_z_correction(PROBE_PT_3_X, PROBE_PT_3_Y), 6); + t = normal.x * (PROBE_PT_3_X) + normal.y * (PROBE_PT_3_Y); + d = t + normal.z * z3; + DEBUG_ECHOPAIR_F("D from 3rd point: ", d, 6); + DEBUG_ECHOLNPAIR_F(" Z error: ", normal.z*z3-get_z_correction(PROBE_PT_3_X, PROBE_PT_3_Y), 6); - t = normal.x * (Z_SAFE_HOMING_X_POINT) + normal.y * (Z_SAFE_HOMING_Y_POINT); - d = t + normal.z * 0; - SERIAL_ECHOLNPAIR_F("D from home location with Z=0 : ", d, 6); + t = normal.x * (Z_SAFE_HOMING_X_POINT) + normal.y * (Z_SAFE_HOMING_Y_POINT); + d = t + normal.z * 0; + DEBUG_ECHOLNPAIR_F("D from home location with Z=0 : ", d, 6); - t = normal.x * (Z_SAFE_HOMING_X_POINT) + normal.y * (Z_SAFE_HOMING_Y_POINT); - d = t + get_z_correction(Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT); // normal.z * 0; - SERIAL_ECHOPAIR_F("D from home location using mesh value for Z: ", d, 6); + t = normal.x * (Z_SAFE_HOMING_X_POINT) + normal.y * (Z_SAFE_HOMING_Y_POINT); + d = t + get_z_correction(Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT); // normal.z * 0; + DEBUG_ECHOPAIR_F("D from home location using mesh value for Z: ", d, 6); - SERIAL_ECHOPAIR(" Z error: (", Z_SAFE_HOMING_X_POINT); - SERIAL_ECHOPAIR(",", Z_SAFE_HOMING_Y_POINT); - SERIAL_ECHOLNPAIR_F(") = ", get_z_correction(Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT), 6); - #endif - } // DEBUGGING(LEVELING) - #endif + DEBUG_ECHOPAIR(" Z error: (", Z_SAFE_HOMING_X_POINT, ",", Z_SAFE_HOMING_Y_POINT); + DEBUG_ECHOLNPAIR_F(") = ", get_z_correction(Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT), 6); + #endif + } // DEBUGGING(LEVELING) } @@ -1621,6 +1657,9 @@ } const float ez = -lsf_results.D - lsf_results.A * px - lsf_results.B * py; z_values[ix][iy] = ez; + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onMeshUpdate(ix, iy, z_values[ix][iy]); + #endif idle(); // housekeeping } } @@ -1640,10 +1679,8 @@ if (storage_slot == -1) SERIAL_ECHOPGM("No Mesh Loaded."); - else { - SERIAL_ECHOPAIR("Mesh ", storage_slot); - SERIAL_ECHOPGM(" Loaded."); - } + else + SERIAL_ECHOPAIR("Mesh ", storage_slot, " Loaded."); SERIAL_EOL(); serial_delay(50); @@ -1683,19 +1720,16 @@ SERIAL_EOL(); #if HAS_KILL - SERIAL_ECHOPAIR("Kill pin on :", KILL_PIN); - SERIAL_ECHOLNPAIR(" state:", READ(KILL_PIN)); + SERIAL_ECHOLNPAIR("Kill pin on :", int(KILL_PIN), " state:", READ(KILL_PIN)); #endif SERIAL_EOL(); serial_delay(50); #if ENABLED(UBL_DEVEL_DEBUGGING) - SERIAL_ECHOLNPAIR("ubl_state_at_invocation :", ubl_state_at_invocation); SERIAL_EOL(); - SERIAL_ECHOLNPAIR("ubl_state_recursion_chk :", ubl_state_recursion_chk); SERIAL_EOL(); + SERIAL_ECHOLNPAIR("ubl_state_at_invocation :", ubl_state_at_invocation, "\nubl_state_recursion_chk :", ubl_state_recursion_chk); serial_delay(50); - SERIAL_ECHOPAIR("Meshes go from ", hex_address((void*)settings.meshes_start_index())); - SERIAL_ECHOLNPAIR(" to ", hex_address((void*)settings.meshes_end_index())); + SERIAL_ECHOLNPAIR("Meshes go from ", hex_address((void*)settings.meshes_start_index()), " to ", hex_address((void*)settings.meshes_end_index())); serial_delay(50); SERIAL_ECHOLNPAIR("sizeof(ubl) : ", (int)sizeof(ubl)); SERIAL_EOL(); @@ -1705,8 +1739,7 @@ SERIAL_ECHOLNPAIR("EEPROM free for UBL: ", hex_address((void*)(settings.meshes_end_index() - settings.meshes_start_index()))); serial_delay(50); - SERIAL_ECHOPAIR("EEPROM can hold ", settings.calc_num_meshes()); - SERIAL_ECHOLNPGM(" meshes.\n"); + SERIAL_ECHOLNPAIR("EEPROM can hold ", settings.calc_num_meshes(), " meshes.\n"); serial_delay(25); #endif // UBL_DEVEL_DEBUGGING @@ -1745,36 +1778,32 @@ * 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(); + const int16_t a = settings.calc_num_meshes(); if (!a) { SERIAL_ECHOLNPGM("?EEPROM storage not available."); return; } - if (!parser.has_value()) { - SERIAL_ECHOLNPGM("?Storage slot # required."); - SERIAL_ECHOLNPAIR("?Use 0 to ", a - 1); + if (!parser.has_value() || !WITHIN(g29_storage_slot, 0, a - 1)) { + SERIAL_ECHOLNPAIR("?Invalid storage slot.\n?Use 0 to ", a - 1); return; } g29_storage_slot = parser.value_int(); - if (!WITHIN(g29_storage_slot, 0, a - 1)) { - SERIAL_ECHOLNPGM("?Invalid storage slot."); - SERIAL_ECHOLNPAIR("?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_ECHOPAIR("Subtracting mesh in slot ", g29_storage_slot); - SERIAL_ECHOLNPGM(" from current mesh."); + SERIAL_ECHOLNPAIR("Subtracting mesh in slot ", g29_storage_slot, " 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++) + for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++) { z_values[x][y] -= tmp_z_values[x][y]; + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onMeshUpdate(x, y, z_values[x][y]); + #endif + } } #endif // UBL_DEVEL_DEBUGGING diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp index 01773972a1..d3cf1ac924 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp @@ -64,16 +64,6 @@ cell_dest_xi = get_cell_index_x(end[X_AXIS]), cell_dest_yi = get_cell_index_y(end[Y_AXIS]); - if (g26_debug_flag) { - SERIAL_ECHOPAIR(" ubl.line_to_destination_cartesian(xe=", destination[X_AXIS]); - SERIAL_ECHOPAIR(", ye=", destination[Y_AXIS]); - SERIAL_ECHOPAIR(", ze=", destination[Z_AXIS]); - SERIAL_ECHOPAIR(", ee=", destination[E_AXIS]); - SERIAL_CHAR(')'); - SERIAL_EOL(); - debug_current_and_destination(PSTR("Start of ubl.line_to_destination_cartesian()")); - } - // A move within the same cell needs no splitting if (cell_start_xi == cell_dest_xi && cell_start_yi == cell_dest_yi) { @@ -92,9 +82,6 @@ planner.buffer_segment(end[X_AXIS], end[Y_AXIS], end[Z_AXIS] + z_raise, end[E_AXIS], feed_rate, extruder); set_current_from_destination(); - if (g26_debug_flag) - debug_current_and_destination(PSTR("out of bounds in ubl.line_to_destination_cartesian()")); - return; } @@ -118,9 +105,6 @@ // Replace NAN corrections with 0.0 to prevent NAN propagation. planner.buffer_segment(end[X_AXIS], end[Y_AXIS], end[Z_AXIS] + (isnan(z0) ? 0.0 : z0), end[E_AXIS], feed_rate, extruder); - if (g26_debug_flag) - debug_current_and_destination(PSTR("FINAL_MOVE in ubl.line_to_destination_cartesian()")); - set_current_from_destination(); return; } @@ -214,9 +198,6 @@ } //else printf("FIRST MOVE PRUNED "); } - if (g26_debug_flag) - debug_current_and_destination(PSTR("vertical move done in ubl.line_to_destination_cartesian()")); - // At the final destination? Usually not, but when on a Y Mesh Line it's completed. if (current_position[X_AXIS] != end[X_AXIS] || current_position[Y_AXIS] != end[Y_AXIS]) goto FINAL_MOVE; @@ -266,9 +247,6 @@ } //else printf("FIRST MOVE PRUNED "); } - if (g26_debug_flag) - debug_current_and_destination(PSTR("horizontal move done in ubl.line_to_destination_cartesian()")); - if (current_position[X_AXIS] != end[X_AXIS] || current_position[Y_AXIS] != end[Y_AXIS]) goto FINAL_MOVE; @@ -352,9 +330,6 @@ if (xi_cnt < 0 || yi_cnt < 0) break; // Too far! Exit the loop and go to FINAL_MOVE } - if (g26_debug_flag) - debug_current_and_destination(PSTR("generic move done in ubl.line_to_destination_cartesian()")); - if (current_position[X_AXIS] != end[X_AXIS] || current_position[Y_AXIS] != end[Y_AXIS]) goto FINAL_MOVE; diff --git a/Marlin/src/feature/bltouch.cpp b/Marlin/src/feature/bltouch.cpp new file mode 100644 index 0000000000..2e68835f39 --- /dev/null +++ b/Marlin/src/feature/bltouch.cpp @@ -0,0 +1,96 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "../inc/MarlinConfig.h" + +#if ENABLED(BLTOUCH) + +#include "bltouch.h" + +BLTouch bltouch; + +#include "../module/servo.h" + +void stop(); + +#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) +#include "../core/debug_out.h" + +void BLTouch::command(const BLTCommand cmd) { + //SERIAL_ECHOLNPAIR("BLTouch Command :", cmd); + MOVE_SERVO(Z_PROBE_SERVO_NR, cmd); + safe_delay(BLTOUCH_DELAY); +} + +void BLTouch::init() { + reset(); // Clear all BLTouch error conditions + stow(); +} + +bool BLTouch::triggered() { + return ( + #if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) + READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING + #else + READ(Z_MIN_PROBE_PIN) != Z_MIN_PROBE_ENDSTOP_INVERTING + #endif + ); +} + +bool BLTouch::set_deployed(const bool in_deploy) { + if (in_deploy && triggered()) { // If BLTouch says it's triggered + reset(); // try to reset it. + _deploy(); _stow(); // Deploy and stow to clear the "triggered" condition. + safe_delay(1500); // Wait for internal self-test to complete. + // (Measured completion time was 0.65 seconds + // after reset, deploy, and stow sequence) + if (triggered()) { // If it still claims to be triggered... + SERIAL_ERROR_MSG(MSG_STOP_BLTOUCH); + stop(); // punt! + return true; + } + } + + #if ENABLED(BLTOUCH_V3) + #if EITHER(BLTOUCH_FORCE_5V_MODE, ENDSTOPPULLUPS) \ + || ALL(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN, ENDSTOPPULLUP_ZMIN) \ + || (USES_Z_MIN_PROBE_ENDSTOP && ENABLED(ENDSTOPPULLUP_ZMIN_PROBE)) + set_5V_mode(); // Assume 5V DC logic level if endstop pullup resistors are enabled + #elif true || ENABLED(BLTOUCH_FORCE_OPEN_DRAIN_MODE) + set_OD_mode(); + #endif + #endif + + if (in_deploy) { + _deploy(); + #if ENABLED(BLTOUCH_V3) + set_SW_mode(); + #endif + } + else _stow(); + + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("bltouch.set_deployed(", in_deploy, ")"); + + return false; +} + +#endif // BLTOUCH diff --git a/Marlin/src/feature/bltouch.h b/Marlin/src/feature/bltouch.h new file mode 100644 index 0000000000..553caa60ad --- /dev/null +++ b/Marlin/src/feature/bltouch.h @@ -0,0 +1,62 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +#include "../inc/MarlinConfigPre.h" + +// BLTouch commands are sent as servo angles +typedef unsigned char BLTCommand; + +#define BLTOUCH_DEPLOY 10 +#define BLTOUCH_SW_MODE 60 +#define BLTOUCH_STOW 90 +#define BLTOUCH_SELFTEST 120 +#define BLTOUCH_5V_MODE 140 +#define BLTOUCH_OD_MODE 150 +#define BLTOUCH_RESET 160 + +class BLTouch { +public: + static void init(); + static void command(const BLTCommand cmd); + static bool triggered(); + + FORCE_INLINE static void reset() { command(BLTOUCH_RESET); } + FORCE_INLINE static void selftest() { command(BLTOUCH_SELFTEST); } + + FORCE_INLINE static void set_5V_mode() { command(BLTOUCH_5V_MODE); } + FORCE_INLINE static void set_OD_mode() { command(BLTOUCH_OD_MODE); } + FORCE_INLINE static void set_SW_mode() { command(BLTOUCH_SW_MODE); } + + FORCE_INLINE static bool deploy() { return set_deployed(true); } + FORCE_INLINE static bool stow() { return set_deployed(false); } + + FORCE_INLINE static void _deploy() { command(BLTOUCH_DEPLOY); } + FORCE_INLINE static void _stow() { command(BLTOUCH_STOW); } + +private: + static bool set_deployed(const bool deploy); +}; + +#define BLTOUCH_ANGLES { BLTOUCH_DEPLOY, BLTOUCH_STOW } + +extern BLTouch bltouch; diff --git a/Marlin/src/feature/caselight.cpp b/Marlin/src/feature/caselight.cpp index ba662360b2..1256acb6d7 100644 --- a/Marlin/src/feature/caselight.cpp +++ b/Marlin/src/feature/caselight.cpp @@ -69,7 +69,7 @@ void update_case_light() { #else // !CASE_LIGHT_USE_NEOPIXEL - if (USEABLE_HARDWARE_PWM(CASE_LIGHT_PIN)) + if (PWM_PIN(CASE_LIGHT_PIN)) analogWrite(CASE_LIGHT_PIN, n10ct); else { const bool s = case_light_on ? !INVERT_CASE_LIGHT : INVERT_CASE_LIGHT; diff --git a/Marlin/src/feature/controllerfan.cpp b/Marlin/src/feature/controllerfan.cpp index 52b17ff953..81af957873 100644 --- a/Marlin/src/feature/controllerfan.cpp +++ b/Marlin/src/feature/controllerfan.cpp @@ -39,7 +39,7 @@ void controllerfan_update() { // If any of the drivers or the bed are enabled... if (X_ENABLE_READ == X_ENABLE_ON || Y_ENABLE_READ == Y_ENABLE_ON || Z_ENABLE_READ == Z_ENABLE_ON #if HAS_HEATED_BED - || thermalManager.soft_pwm_amount_bed > 0 + || thermalManager.temp_bed.soft_pwm_amount > 0 #endif #if HAS_X2_ENABLE || X2_ENABLE_READ == X_ENABLE_ON diff --git a/Marlin/src/feature/dac/stepper_dac.cpp b/Marlin/src/feature/dac/stepper_dac.cpp index 3e10592b4a..821fcab1ab 100644 --- a/Marlin/src/feature/dac/stepper_dac.cpp +++ b/Marlin/src/feature/dac/stepper_dac.cpp @@ -105,15 +105,12 @@ void dac_print_values() { SERIAL_ECHO_MSG("Stepper current values in % (Amps):"); SERIAL_ECHO_START(); - SERIAL_ECHOPAIR(" X:", dac_perc(X_AXIS)); - SERIAL_ECHOPAIR(" (", dac_amps(X_AXIS)); - SERIAL_ECHOPAIR(") Y:", dac_perc(Y_AXIS)); - SERIAL_ECHOPAIR(" (", dac_amps(Y_AXIS)); - SERIAL_ECHOPAIR(") Z:", dac_perc(Z_AXIS)); - SERIAL_ECHOPAIR(" (", dac_amps(Z_AXIS)); - SERIAL_ECHOPAIR(") E:", dac_perc(E_AXIS)); - SERIAL_ECHOPAIR(" (", dac_amps(E_AXIS)); - SERIAL_ECHOLNPGM(")"); + SERIAL_ECHOLNPAIR( + " X:", dac_perc(X_AXIS), " (", dac_amps(X_AXIS), ")" + " Y:", dac_perc(Y_AXIS), " (", dac_amps(Y_AXIS), ")" + " Z:", dac_perc(Z_AXIS), " (", dac_amps(Z_AXIS), ")" + " E:", dac_perc(E_AXIS), " (", dac_amps(E_AXIS), ")" + ); } void dac_commit_eeprom() { diff --git a/Marlin/src/feature/digipot/digipot_mcp4018.cpp b/Marlin/src/feature/digipot/digipot_mcp4018.cpp index b601fbc3dd..917a7df99a 100644 --- a/Marlin/src/feature/digipot/digipot_mcp4018.cpp +++ b/Marlin/src/feature/digipot/digipot_mcp4018.cpp @@ -22,7 +22,7 @@ #include "../../inc/MarlinConfig.h" -#if ENABLED(DIGIPOT_I2C) && ENABLED(DIGIPOT_MCP4018) +#if BOTH(DIGIPOT_I2C, DIGIPOT_MCP4018) #include "../../core/enum.h" #include "Stream.h" diff --git a/Marlin/src/feature/emergency_parser.h b/Marlin/src/feature/emergency_parser.h index 4506313cc8..3ce5dfc7cf 100644 --- a/Marlin/src/feature/emergency_parser.h +++ b/Marlin/src/feature/emergency_parser.h @@ -32,9 +32,8 @@ #endif // External references -extern volatile bool wait_for_user, wait_for_heatup; +extern bool wait_for_user, wait_for_heatup; void quickstop_stepper(); -void host_response_handler(const uint8_t response); class EmergencyParser { diff --git a/Marlin/src/feature/fwretract.cpp b/Marlin/src/feature/fwretract.cpp index 582614bb90..f5f7cefc45 100644 --- a/Marlin/src/feature/fwretract.cpp +++ b/Marlin/src/feature/fwretract.cpp @@ -66,10 +66,10 @@ void FWRetract::reset() { 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_extra = 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_extra = RETRACT_RECOVER_LENGTH_SWAP; settings.swap_retract_recover_feedrate_mm_s = RETRACT_RECOVER_FEEDRATE_SWAP; current_hop = 0.0; @@ -112,15 +112,15 @@ void FWRetract::retract(const bool retracting #endif /* // debugging - SERIAL_ECHOLNPAIR("retracting ", retracting); - SERIAL_ECHOLNPAIR("swapping ", swapping); - SERIAL_ECHOLNPAIR("active extruder ", active_extruder); + SERIAL_ECHOLNPAIR( + "retracting ", retracting, + "swapping ", swapping + "active extruder ", active_extruder + ); for (uint8_t i = 0; i < EXTRUDERS; ++i) { - SERIAL_ECHOPAIR("retracted[", i); - SERIAL_ECHOLNPAIR("] ", retracted[i]); + SERIAL_ECHOLNPAIR("retracted[", i, "] ", retracted[i]); #if EXTRUDERS > 1 - SERIAL_ECHOPAIR("retracted_swap[", i); - SERIAL_ECHOLNPAIR("] ", retracted_swap[i]); + SERIAL_ECHOLNPAIR("retracted_swap[", i, "] ", retracted_swap[i]); #endif } SERIAL_ECHOLNPAIR("current_position[z] ", current_position[Z_AXIS]); @@ -175,7 +175,7 @@ void FWRetract::retract(const bool retracting planner.synchronize(); // Wait for move to complete } - const float extra_recover = swapping ? settings.swap_retract_recover_length : settings.retract_recover_length; + const float extra_recover = swapping ? settings.swap_retract_recover_extra : settings.retract_recover_extra; 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 @@ -209,11 +209,9 @@ void FWRetract::retract(const bool retracting SERIAL_ECHOLNPAIR("swapping ", swapping); SERIAL_ECHOLNPAIR("active_extruder ", active_extruder); for (uint8_t i = 0; i < EXTRUDERS; ++i) { - SERIAL_ECHOPAIR("retracted[", i); - SERIAL_ECHOLNPAIR("] ", retracted[i]); + SERIAL_ECHOLNPAIR("retracted[", i, "] ", retracted[i]); #if EXTRUDERS > 1 - SERIAL_ECHOPAIR("retracted_swap[", i); - SERIAL_ECHOLNPAIR("] ", retracted_swap[i]); + SERIAL_ECHOLNPAIR("retracted_swap[", i, "] ", retracted_swap[i]); #endif } SERIAL_ECHOLNPAIR("current_position[z] ", current_position[Z_AXIS]); diff --git a/Marlin/src/feature/fwretract.h b/Marlin/src/feature/fwretract.h index 6248833d5f..6c088acb87 100644 --- a/Marlin/src/feature/fwretract.h +++ b/Marlin/src/feature/fwretract.h @@ -32,11 +32,11 @@ 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_zraise, // M207 Z - G10 Retract hop size + retract_recover_extra, // 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_extra, // M208 W - G11 Swap Recover length swap_retract_recover_feedrate_mm_s; // M208 R - G11 Swap Recover feedrate } fwretract_settings_t; diff --git a/Marlin/src/feature/host_actions.cpp b/Marlin/src/feature/host_actions.cpp index 7f2de4f3c3..bad7bb75cf 100644 --- a/Marlin/src/feature/host_actions.cpp +++ b/Marlin/src/feature/host_actions.cpp @@ -37,7 +37,7 @@ #include "runout.h" #endif -extern volatile bool wait_for_user; +extern bool wait_for_user; void host_action(const char * const pstr, const bool eol) { SERIAL_ECHOPGM("//action:"); @@ -110,7 +110,7 @@ void host_action(const char * const pstr, const bool eol) { case PROMPT_FILAMENT_RUNOUT: msg = PSTR("FILAMENT_RUNOUT"); if (response == 0) { - advanced_pause_menu_response = ADVANCED_PAUSE_RESPONSE_EXTRUDE_MORE; + pause_menu_response = PAUSE_RESPONSE_EXTRUDE_MORE; host_action_prompt_end(); // Close current prompt host_action_prompt_begin(PSTR("Paused")); host_action_prompt_button(PSTR("Purge More")); @@ -133,7 +133,7 @@ void host_action(const char * const pstr, const bool eol) { runout.reset(); } #endif - advanced_pause_menu_response = ADVANCED_PAUSE_RESPONSE_RESUME_PRINT; + pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT; } break; case PROMPT_USER_CONTINUE: diff --git a/Marlin/src/feature/leds/leds.cpp b/Marlin/src/feature/leds/leds.cpp index f2b1a965ab..d490b86e6b 100644 --- a/Marlin/src/feature/leds/leds.cpp +++ b/Marlin/src/feature/leds/leds.cpp @@ -52,7 +52,7 @@ ); #endif -#if ENABLED(LED_CONTROL_MENU) || ENABLED(PRINTER_EVENT_LEDS) +#if EITHER(LED_CONTROL_MENU, PRINTER_EVENT_LEDS) LEDColor LEDLights::color; bool LEDLights::lights_on; #endif @@ -60,12 +60,12 @@ LEDLights leds; void LEDLights::setup() { - #if ENABLED(RGB_LED) || ENABLED(RGBW_LED) - SET_OUTPUT(RGB_LED_R_PIN); - SET_OUTPUT(RGB_LED_G_PIN); - SET_OUTPUT(RGB_LED_B_PIN); + #if EITHER(RGB_LED, RGBW_LED) + if (PWM_PIN(RGB_LED_R_PIN)) SET_PWM(RGB_LED_R_PIN); else SET_OUTPUT(RGB_LED_R_PIN); + if (PWM_PIN(RGB_LED_G_PIN)) SET_PWM(RGB_LED_G_PIN); else SET_OUTPUT(RGB_LED_G_PIN); + if (PWM_PIN(RGB_LED_B_PIN)) SET_PWM(RGB_LED_B_PIN); else SET_OUTPUT(RGB_LED_B_PIN); #if ENABLED(RGBW_LED) - SET_OUTPUT(RGB_LED_W_PIN); + if (PWM_PIN(RGB_LED_W_PIN)) SET_PWM(RGB_LED_W_PIN); else SET_OUTPUT(RGB_LED_W_PIN); #endif #endif #if ENABLED(NEOPIXEL_LED) @@ -108,20 +108,16 @@ void LEDLights::set_color(const LEDColor &incol #endif - #if ENABLED(RGB_LED) || ENABLED(RGBW_LED) + #if EITHER(RGB_LED, RGBW_LED) // This variant uses 3-4 separate pins for the RGB(W) components. // If the pins can do PWM then their intensity will be set. - WRITE(RGB_LED_R_PIN, incol.r ? HIGH : LOW); - WRITE(RGB_LED_G_PIN, incol.g ? HIGH : LOW); - WRITE(RGB_LED_B_PIN, incol.b ? HIGH : LOW); - analogWrite(RGB_LED_R_PIN, incol.r); - analogWrite(RGB_LED_G_PIN, incol.g); - analogWrite(RGB_LED_B_PIN, incol.b); - + #define UPDATE_RGBW(C,c) do{ if (PWM_PIN(RGB_LED_##C##_PIN)) analogWrite(RGB_LED_##C##_PIN, incol.c); else WRITE(RGB_LED_##C##_PIN, incol.c ? HIGH : LOW); }while(0) + UPDATE_RGBW(R,r); + UPDATE_RGBW(G,g); + UPDATE_RGBW(B,b); #if ENABLED(RGBW_LED) - WRITE(RGB_LED_W_PIN, incol.w ? HIGH : LOW); - analogWrite(RGB_LED_W_PIN, incol.w); + UPDATE_RGBW(W,w); #endif #endif @@ -135,7 +131,7 @@ void LEDLights::set_color(const LEDColor &incol RGBsetColor(incol.r, incol.g, incol.b, true); #endif - #if ENABLED(LED_CONTROL_MENU) || ENABLED(PRINTER_EVENT_LEDS) + #if EITHER(LED_CONTROL_MENU, PRINTER_EVENT_LEDS) // Don't update the color when OFF lights_on = !incol.is_off(); if (lights_on) color = incol; diff --git a/Marlin/src/feature/leds/leds.h b/Marlin/src/feature/leds/leds.h index 5a136cdd2b..bbd609c29a 100644 --- a/Marlin/src/feature/leds/leds.h +++ b/Marlin/src/feature/leds/leds.h @@ -33,7 +33,7 @@ #include "neopixel.h" #endif -#define HAS_WHITE_LED (ENABLED(RGBW_LED) || ENABLED(NEOPIXEL_LED)) +#define HAS_WHITE_LED EITHER(RGBW_LED, NEOPIXEL_LED) /** * LEDcolor type for use with leds.set_color @@ -183,7 +183,7 @@ public: static inline LEDColor get_color() { return lights_on ? color : LEDColorOff(); } #endif - #if ENABLED(LED_CONTROL_MENU) || ENABLED(PRINTER_EVENT_LEDS) + #if EITHER(LED_CONTROL_MENU, PRINTER_EVENT_LEDS) static LEDColor color; // last non-off color static bool lights_on; // the last set color was "on" #endif diff --git a/Marlin/src/feature/mixing.cpp b/Marlin/src/feature/mixing.cpp index dd1f886eb8..98b26e29ce 100644 --- a/Marlin/src/feature/mixing.cpp +++ b/Marlin/src/feature/mixing.cpp @@ -139,19 +139,11 @@ void Mixer::refresh_collector(const float proportion/*=1.0*/, const uint8_t t/*= cmax = MAX(cmax, v); csum += v; } - //SERIAL_ECHOPAIR("Mixer::refresh_collector(", proportion); - //SERIAL_ECHOPAIR(", ", int(t)); - //SERIAL_ECHOPAIR(") cmax=", cmax); - //SERIAL_ECHOPAIR(" csum=", csum); - //SERIAL_ECHOPGM(" color"); + //SERIAL_ECHOPAIR("Mixer::refresh_collector(", proportion, ", ", int(t), ") cmax=", cmax, " csum=", csum, " color"); const float inv_prop = proportion / csum; MIXER_STEPPER_LOOP(i) { collector[i] = color[t][i] * inv_prop; - //SERIAL_ECHOPAIR(" [", int(t)); - //SERIAL_ECHOPAIR("][", int(i)); - //SERIAL_ECHOPAIR("] = ", int(color[t][i])); - //SERIAL_ECHOPAIR(" (", collector[i]); - //SERIAL_ECHOPGM(") "); + //SERIAL_ECHOPAIR(" [", int(t), "][", int(i), "] = ", int(color[t][i]), " (", collector[i], ") "); } //SERIAL_EOL(); } diff --git a/Marlin/src/feature/mixing.h b/Marlin/src/feature/mixing.h index 718b40d021..bb069c97d7 100644 --- a/Marlin/src/feature/mixing.h +++ b/Marlin/src/feature/mixing.h @@ -148,11 +148,7 @@ class Mixer { MIXER_STEPPER_LOOP(i) tcolor[i] = mix[i] * scale; #ifdef MIXER_NORMALIZER_DEBUG - SERIAL_ECHOPAIR("Mix [", int(mix[0])); - SERIAL_ECHOPAIR(", ", int(mix[1])); - SERIAL_ECHOPAIR("] to Color [", int(tcolor[0])); - SERIAL_ECHOPAIR(", ", int(tcolor[1])); - SERIAL_ECHOLNPGM("]"); + SERIAL_ECHOLNPAIR("Mix [", int(mix[0]), ", ", int(mix[1]), "] to Color [", int(tcolor[0]), ", ", int(tcolor[1]), "]"); #endif } @@ -163,12 +159,7 @@ class Mixer { mix[0] = mixer_perc_t(100.0f * color[j][0] / ctot); mix[1] = 100 - mix[0]; #ifdef MIXER_NORMALIZER_DEBUG - SERIAL_ECHOPAIR("V-tool ", int(j)); - SERIAL_ECHOPAIR(" [", int(color[j][0])); - SERIAL_ECHOPAIR(", ", int(color[j][1])); - SERIAL_ECHOPAIR("] to Mix [", int(mix[0])); - SERIAL_ECHOPAIR(", ", int(mix[1])); - SERIAL_ECHOLNPGM("]"); + SERIAL_ECHOLNPAIR("V-tool ", int(j), " [", int(color[j][0]), ", ", int(color[j][1]), "] to Mix [", int(mix[0]), ", ", int(mix[1]), "]"); #endif } @@ -211,18 +202,14 @@ class Mixer { mix[0] = (mixer_perc_t)CEIL(100.0f * gradient.color[0] / ctot); mix[1] = 100 - mix[0]; #ifdef MIXER_NORMALIZER_DEBUG - SERIAL_ECHOPAIR("Gradient [", int(gradient.color[0])); - SERIAL_ECHOPAIR(", ", int(gradient.color[1])); - SERIAL_ECHOPAIR("] to Mix [", int(mix[0])); - SERIAL_ECHOPAIR(", ", int(mix[1])); - SERIAL_ECHOLNPGM("]"); + SERIAL_ECHOLNPAIR("Gradient [", int(gradient.color[0]), ", ", int(gradient.color[1]), "] to Mix [", int(mix[0]), ", ", int(mix[1]), "]"); #endif } // Refresh the gradient after a change static void refresh_gradient() { #if ENABLED(GRADIENT_VTOOL) - const bool is_grd = (selected_vtool == gradient.vtool_index || gradient.vtool_index == -1); + const bool is_grd = (gradient.vtool_index == -1 || selected_vtool == (uint8_t)gradient.vtool_index); #else constexpr bool is_grd = true; #endif diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index 1a61fe90e6..75705e1593 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -58,7 +58,9 @@ static float resume_position[XYZE]; -AdvancedPauseMenuResponse advanced_pause_menu_response; +PauseMode pause_mode = PAUSE_MODE_PAUSE_PRINT; + +PauseMenuResponse pause_menu_response; fil_change_settings_t fc_settings[EXTRUDERS]; @@ -68,6 +70,7 @@ fil_change_settings_t fc_settings[EXTRUDERS]; #if HAS_BUZZER static void filament_change_beep(const int8_t max_beep_count, const bool init=false) { + if (pause_mode == PAUSE_MODE_PAUSE_PRINT) return; static millis_t next_buzz = 0; static int8_t runout_beep = 0; @@ -93,7 +96,7 @@ fil_change_settings_t fc_settings[EXTRUDERS]; * * Returns 'true' if heating was completed, 'false' for abort */ -static bool ensure_safe_temperature(const AdvancedPauseMode mode=ADVANCED_PAUSE_MODE_SAME) { +static bool ensure_safe_temperature(const PauseMode mode=PAUSE_MODE_SAME) { #if ENABLED(PREVENT_COLD_EXTRUSION) if (!DEBUGGING(DRYRUN) && thermalManager.targetTooColdToExtrude(active_extruder)) { @@ -103,7 +106,7 @@ static bool ensure_safe_temperature(const AdvancedPauseMode mode=ADVANCED_PAUSE_ #endif #if HAS_LCD_MENU - lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_HEATING, mode); + lcd_pause_show_message(PAUSE_MESSAGE_HEATING, mode); #else UNUSED(mode); #endif @@ -134,7 +137,7 @@ void do_pause_e_move(const float &length, const float &fr_mm_s) { */ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_length/*=0*/, const float &purge_length/*=0*/, const int8_t max_beep_count/*=0*/, const bool show_lcd/*=false*/, const bool pause_for_user/*=false*/, - const AdvancedPauseMode mode/*=ADVANCED_PAUSE_MODE_PAUSE_PRINT*/ + const PauseMode mode/*=PAUSE_MODE_PAUSE_PRINT*/ DXC_ARGS ) { #if !HAS_LCD_MENU @@ -143,14 +146,14 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l if (!ensure_safe_temperature(mode)) { #if HAS_LCD_MENU - if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS, mode); + if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_STATUS, mode); #endif return false; } if (pause_for_user) { #if HAS_LCD_MENU - if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INSERT, mode); + if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_INSERT, mode); #endif SERIAL_ECHO_MSG(MSG_FILAMENT_CHANGE_INSERT); @@ -186,7 +189,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l } #if HAS_LCD_MENU - if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_LOAD, mode); + if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_LOAD, mode); #endif #if ENABLED(DUAL_X_CARRIAGE) @@ -222,7 +225,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l #if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE) #if HAS_LCD_MENU - if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_PURGE); + if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_PURGE); #endif wait_for_user = true; @@ -239,7 +242,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l if (purge_length > 0) { // "Wait for filament purge" #if HAS_LCD_MENU - if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_PURGE); + if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_PURGE); #endif // Extrude filament to get into hotend @@ -269,8 +272,8 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l if (show_lcd) { KEEPALIVE_STATE(PAUSED_FOR_USER); wait_for_user = false; - lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_OPTION); - while (advanced_pause_menu_response == ADVANCED_PAUSE_RESPONSE_WAIT_FOR) idle(true); + lcd_pause_show_message(PAUSE_MESSAGE_OPTION); + while (pause_menu_response == PAUSE_RESPONSE_WAIT_FOR) idle(true); KEEPALIVE_STATE(IN_HANDLER); } #endif @@ -278,7 +281,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l // Keep looping if "Purge More" was selected } while (false #if HAS_LCD_MENU - || (show_lcd && advanced_pause_menu_response == ADVANCED_PAUSE_RESPONSE_EXTRUDE_MORE) + || (show_lcd && pause_menu_response == PAUSE_RESPONSE_EXTRUDE_MORE) #endif ); @@ -298,7 +301,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l * Returns 'true' if unload was completed, 'false' for abort */ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/, - const AdvancedPauseMode mode/*=ADVANCED_PAUSE_MODE_PAUSE_PRINT*/ + const PauseMode mode/*=PAUSE_MODE_PAUSE_PRINT*/ ) { #if !HAS_LCD_MENU UNUSED(show_lcd); @@ -306,14 +309,14 @@ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/, if (!ensure_safe_temperature(mode)) { #if HAS_LCD_MENU - if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS); + if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_STATUS); #endif return false; } #if HAS_LCD_MENU - if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_UNLOAD, mode); + if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_UNLOAD, mode); #endif // Retract filament @@ -387,7 +390,7 @@ bool pause_print(const float &retract, const point_t &park_point, const float &u #if HAS_LCD_MENU if (show_lcd) { // Show status screen - lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS); + lcd_pause_show_message(PAUSE_MESSAGE_STATUS); LCD_MESSAGEPGM(MSG_M600_TOO_COLD); } #endif @@ -464,7 +467,7 @@ bool pause_print(const float &retract, const point_t &park_point, const float &u 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); + lcd_pause_show_message(is_reload ? PAUSE_MESSAGE_INSERT : PAUSE_MESSAGE_WAITING); #endif SERIAL_ECHO_START(); serialprintPGM(is_reload ? PSTR(_PMSG(MSG_FILAMENT_CHANGE_INSERT) "\n") : PSTR(_PMSG(MSG_FILAMENT_CHANGE_WAIT) "\n")); @@ -482,8 +485,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep // Start the heater idle timers const millis_t nozzle_timeout = (millis_t)(PAUSE_PARK_NOZZLE_TIMEOUT) * 1000UL; - HOTEND_LOOP() - thermalManager.start_heater_idle_timer(e, nozzle_timeout); + HOTEND_LOOP() thermalManager.hotend_idle[e].start(nozzle_timeout); #if ENABLED(DUAL_X_CARRIAGE) const int8_t saved_ext = active_extruder; @@ -505,13 +507,13 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep // 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.hotend_idle[e].timed_out; // 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 HAS_LCD_MENU - lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_HEAT); + lcd_pause_show_message(PAUSE_MESSAGE_HEAT); #endif SERIAL_ECHO_MSG(_PMSG(MSG_FILAMENT_CHANGE_HEAT)); @@ -538,8 +540,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep // Start the heater idle timers const millis_t nozzle_timeout = (millis_t)(PAUSE_PARK_NOZZLE_TIMEOUT) * 1000UL; - HOTEND_LOOP() - thermalManager.start_heater_idle_timer(e, nozzle_timeout); + HOTEND_LOOP() thermalManager.hotend_idle[e].start(nozzle_timeout); #if ENABLED(HOST_PROMPT_SUPPORT) host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Reheat Done"), PSTR("Continue")); #endif @@ -581,11 +582,12 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep */ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_length/*=0*/, const float &purge_length/*=ADVANCED_PAUSE_PURGE_LENGTH*/, const int8_t max_beep_count/*=0*/ DXC_ARGS) { /* - SERIAL_ECHOLNPGM("start of resume_print()"); - SERIAL_ECHOPAIR("\ndual_x_carriage_mode:", dual_x_carriage_mode); - SERIAL_ECHOPAIR("\nextruder_duplication_enabled:", extruder_duplication_enabled); - SERIAL_ECHOPAIR("\nactive_extruder:", active_extruder); - SERIAL_ECHOLNPGM("\n"); + SERIAL_ECHOLNPAIR( + "start of resume_print()\ndual_x_carriage_mode:", dual_x_carriage_mode, + "\nextruder_duplication_enabled:", extruder_duplication_enabled, + "\nactive_extruder:", active_extruder, + "\n" + ); //*/ if (!did_pause_print) return; @@ -593,15 +595,15 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le // Re-enable the heaters if they timed out bool nozzle_timed_out = false; HOTEND_LOOP() { - nozzle_timed_out |= thermalManager.is_heater_idle(e); + nozzle_timed_out |= thermalManager.hotend_idle[e].timed_out; thermalManager.reset_heater_idle_timer(e); } 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); + load_filament(slow_load_length, fast_load_length, purge_length, max_beep_count, true, nozzle_timed_out, PAUSE_MODE_PAUSE_PRINT DXC_PASS); #if HAS_LCD_MENU - lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_RESUME); + lcd_pause_show_message(PAUSE_MESSAGE_RESUME); #endif // Intelligent resuming @@ -629,7 +631,7 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le planner.set_e_position_mm((destination[E_AXIS] = current_position[E_AXIS] = resume_position[E_AXIS])); #if HAS_LCD_MENU - lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS); + lcd_pause_show_message(PAUSE_MESSAGE_STATUS); #endif #ifdef ACTION_ON_RESUMED diff --git a/Marlin/src/feature/pause.h b/Marlin/src/feature/pause.h index 6e82013a46..8a0653b2bd 100644 --- a/Marlin/src/feature/pause.h +++ b/Marlin/src/feature/pause.h @@ -36,34 +36,36 @@ typedef struct { #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 +enum PauseMode : char { + PAUSE_MODE_SAME, + PAUSE_MODE_PAUSE_PRINT, + PAUSE_MODE_LOAD_FILAMENT, + PAUSE_MODE_UNLOAD_FILAMENT }; -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, - ADVANCED_PAUSE_MESSAGE_OPTION, - ADVANCED_PAUSE_MESSAGE_RESUME, - ADVANCED_PAUSE_MESSAGE_STATUS, - ADVANCED_PAUSE_MESSAGE_HEAT, - ADVANCED_PAUSE_MESSAGE_HEATING +enum PauseMessage : char { + PAUSE_MESSAGE_PAUSING, + PAUSE_MESSAGE_CHANGING, + PAUSE_MESSAGE_WAITING, + PAUSE_MESSAGE_UNLOAD, + PAUSE_MESSAGE_INSERT, + PAUSE_MESSAGE_LOAD, + PAUSE_MESSAGE_PURGE, + PAUSE_MESSAGE_OPTION, + PAUSE_MESSAGE_RESUME, + PAUSE_MESSAGE_STATUS, + PAUSE_MESSAGE_HEAT, + PAUSE_MESSAGE_HEATING }; -enum AdvancedPauseMenuResponse : char { - ADVANCED_PAUSE_RESPONSE_WAIT_FOR, - ADVANCED_PAUSE_RESPONSE_EXTRUDE_MORE, - ADVANCED_PAUSE_RESPONSE_RESUME_PRINT +enum PauseMenuResponse : char { + PAUSE_RESPONSE_WAIT_FOR, + PAUSE_RESPONSE_EXTRUDE_MORE, + PAUSE_RESPONSE_RESUME_PRINT }; -extern AdvancedPauseMenuResponse advanced_pause_menu_response; +extern PauseMode pause_mode; +extern PauseMenuResponse pause_menu_response; extern fil_change_settings_t fc_settings[EXTRUDERS]; @@ -88,8 +90,8 @@ void wait_for_confirmation(const bool is_reload=false, const int8_t max_beep_cou 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); bool load_filament(const float &slow_load_length=0, const float &fast_load_length=0, const float &extrude_length=0, const int8_t max_beep_count=0, const bool show_lcd=false, - const bool pause_for_user=false, const AdvancedPauseMode mode=ADVANCED_PAUSE_MODE_PAUSE_PRINT DXC_PARAMS); + const bool pause_for_user=false, const PauseMode mode=PAUSE_MODE_PAUSE_PRINT DXC_PARAMS); -bool unload_filament(const float &unload_length, const bool show_lcd=false, const AdvancedPauseMode mode=ADVANCED_PAUSE_MODE_PAUSE_PRINT); +bool unload_filament(const float &unload_length, const bool show_lcd=false, const PauseMode mode=PAUSE_MODE_PAUSE_PRINT); #endif // ADVANCED_PAUSE_FEATURE diff --git a/Marlin/src/feature/power.cpp b/Marlin/src/feature/power.cpp index a4c32fa473..eed52634f1 100644 --- a/Marlin/src/feature/power.cpp +++ b/Marlin/src/feature/power.cpp @@ -46,14 +46,14 @@ bool Power::is_power_needed() { HOTEND_LOOP() if (thermalManager.autofan_speed[e]) return true; #endif - #if ENABLED(AUTO_POWER_CONTROLLERFAN) && HAS_CONTROLLER_FAN && ENABLED(USE_CONTROLLER_FAN) + #if ENABLED(AUTO_POWER_CONTROLLERFAN, USE_CONTROLLER_FAN) && HAS_CONTROLLER_FAN if (controllerfan_speed) return true; #endif // If any of the drivers or the bed are enabled... if (X_ENABLE_READ == X_ENABLE_ON || Y_ENABLE_READ == Y_ENABLE_ON || Z_ENABLE_READ == Z_ENABLE_ON #if HAS_HEATED_BED - || thermalManager.soft_pwm_amount_bed > 0 + || thermalManager.temp_bed.soft_pwm_amount > 0 #endif #if HAS_X2_ENABLE || X2_ENABLE_READ == X_ENABLE_ON diff --git a/Marlin/src/feature/power_loss_recovery.cpp b/Marlin/src/feature/power_loss_recovery.cpp index 7b8f15b65d..17ba4a101b 100644 --- a/Marlin/src/feature/power_loss_recovery.cpp +++ b/Marlin/src/feature/power_loss_recovery.cpp @@ -50,6 +50,9 @@ job_recovery_info_t PrintJobRecovery::info; #include "fwretract.h" #endif +#define DEBUG_OUT ENABLED(DEBUG_POWER_LOSS_RECOVERY) +#include "../core/debug_out.h" + PrintJobRecovery recovery; /** @@ -110,9 +113,7 @@ void PrintJobRecovery::load() { (void)file.read(&info, sizeof(info)); close(); } - #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) - debug(PSTR("Load")); - #endif + debug(PSTR("Load")); } /** @@ -125,6 +126,7 @@ void PrintJobRecovery::save(const bool force/*=false*/, const bool save_queue/*= millis_t ms = millis(); #endif + // Did Z change since the last call? 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 @@ -133,8 +135,8 @@ void PrintJobRecovery::save(const bool force/*=false*/, const bool save_queue/*= #if SAVE_INFO_INTERVAL_MS > 0 // Save if interval is elapsed || ELAPSED(ms, next_save_ms) #endif - // Save every time Z is higher than the last call - || current_position[Z_AXIS] > 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 ) { @@ -155,10 +157,10 @@ void PrintJobRecovery::save(const bool force/*=false*/, const bool save_queue/*= info.active_hotend = active_extruder; #endif - COPY(info.target_temperature, thermalManager.target_temperature); + HOTEND_LOOP() info.target_temperature[e] = thermalManager.temp_hotend[e].target; #if HAS_HEATED_BED - info.target_temperature_bed = thermalManager.target_temperature_bed; + info.target_temperature_bed = thermalManager.temp_bed.target; #endif #if FAN_COUNT @@ -185,6 +187,10 @@ void PrintJobRecovery::save(const bool force/*=false*/, const bool save_queue/*= info.retract_hop = fwretract.current_hop; #endif + //relative mode + info.relative_mode = relative_mode; + info.relative_modes_e = gcode.axis_relative_modes[E_AXIS]; + // Commands in the queue info.commands_in_queue = save_queue ? commands_in_queue : 0; info.cmd_queue_index_r = cmd_queue_index_r; @@ -211,18 +217,14 @@ void PrintJobRecovery::save(const bool force/*=false*/, const bool save_queue/*= */ void PrintJobRecovery::write() { - #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) - debug(PSTR("Write")); - #endif + debug(PSTR("Write")); open(false); file.seekSet(0); const int16_t ret = file.write(&info, sizeof(info)); - #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) - if (ret == -1) SERIAL_ECHOLNPGM("Power-loss file write failed."); - #else - UNUSED(ret); - #endif + close(); + + if (ret == -1) DEBUG_ECHOLNPGM("Power-loss file write failed."); } /** @@ -339,6 +341,10 @@ void PrintJobRecovery::resume() { sprintf_P(cmd, PSTR("G1 F%d"), info.feedrate); gcode.process_subcommands_now(cmd); + //relative mode + if (info.relative_mode) relative_mode = true; + if (info.relative_modes_e) gcode.axis_relative_modes[E_AXIS] = true; + // Process commands from the old pending queue uint8_t c = info.commands_in_queue, r = info.cmd_queue_index_r; for (; c--; r = (r + 1) % BUFSIZE) @@ -356,67 +362,65 @@ void PrintJobRecovery::resume() { #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)); + DEBUG_PRINT_P(prefix); + DEBUG_ECHOLNPAIR(" Job Recovery Info...\nvalid_head:", int(info.valid_head), " valid_foot:", int(info.valid_foot)); if (info.valid_head) { if (info.valid_head == info.valid_foot) { - SERIAL_ECHOPGM("current_position: "); + DEBUG_ECHOPGM("current_position: "); LOOP_XYZE(i) { - SERIAL_ECHO(info.current_position[i]); - if (i < E_AXIS) SERIAL_CHAR(','); + if (i) DEBUG_CHAR(','); + DEBUG_ECHO(info.current_position[i]); } - SERIAL_EOL(); - SERIAL_ECHOLNPAIR("feedrate: ", info.feedrate); + DEBUG_EOL(); + DEBUG_ECHOLNPAIR("feedrate: ", info.feedrate); #if HOTENDS > 1 - SERIAL_ECHOLNPAIR("active_hotend: ", int(info.active_hotend)); + DEBUG_ECHOLNPAIR("active_hotend: ", int(info.active_hotend)); #endif - SERIAL_ECHOPGM("target_temperature: "); + DEBUG_ECHOPGM("target_temperature: "); HOTEND_LOOP() { - SERIAL_ECHO(info.target_temperature[e]); - if (e < HOTENDS - 1) SERIAL_CHAR(','); + DEBUG_ECHO(info.target_temperature[e]); + if (e < HOTENDS - 1) DEBUG_CHAR(','); } - SERIAL_EOL(); + DEBUG_EOL(); #if HAS_HEATED_BED - SERIAL_ECHOLNPAIR("target_temperature_bed: ", info.target_temperature_bed); + DEBUG_ECHOLNPAIR("target_temperature_bed: ", info.target_temperature_bed); #endif #if FAN_COUNT - SERIAL_ECHOPGM("fan_speed: "); - for (int8_t i = 0; i < FAN_COUNT; i++) { - SERIAL_ECHO(int(info.fan_speed[i])); - if (i < FAN_COUNT - 1) SERIAL_CHAR(','); + DEBUG_ECHOPGM("fan_speed: "); + FANS_LOOP(i) { + DEBUG_ECHO(int(info.fan_speed[i])); + if (i < FAN_COUNT - 1) DEBUG_CHAR(','); } - SERIAL_EOL(); + DEBUG_EOL(); #endif #if HAS_LEVELING - SERIAL_ECHOPAIR("leveling: ", int(info.leveling)); - SERIAL_ECHOLNPAIR(" fade: ", int(info.fade)); + DEBUG_ECHOLNPAIR("leveling: ", int(info.leveling), "\n fade: ", int(info.fade)); #endif #if ENABLED(FWRETRACT) - SERIAL_ECHOPGM("retract: "); + DEBUG_ECHOPGM("retract: "); for (int8_t e = 0; e < EXTRUDERS; e++) { - SERIAL_ECHO(info.retract[e]); - if (e < EXTRUDERS - 1) SERIAL_CHAR(','); + DEBUG_ECHO(info.retract[e]); + if (e < EXTRUDERS - 1) DEBUG_CHAR(','); } - SERIAL_EOL(); - SERIAL_ECHOLNPAIR("retract_hop: ", info.retract_hop); + DEBUG_EOL(); + DEBUG_ECHOLNPAIR("retract_hop: ", info.retract_hop); #endif - SERIAL_ECHOLNPAIR("cmd_queue_index_r: ", int(info.cmd_queue_index_r)); - SERIAL_ECHOLNPAIR("commands_in_queue: ", int(info.commands_in_queue)); - for (uint8_t i = 0; i < info.commands_in_queue; i++) SERIAL_ECHOLNPAIR("> ", info.command_queue[i]); - SERIAL_ECHOLNPAIR("sd_filename: ", info.sd_filename); - SERIAL_ECHOLNPAIR("sdpos: ", info.sdpos); - SERIAL_ECHOLNPAIR("print_job_elapsed: ", info.print_job_elapsed); + DEBUG_ECHOLNPAIR("cmd_queue_index_r: ", int(info.cmd_queue_index_r)); + DEBUG_ECHOLNPAIR("commands_in_queue: ", int(info.commands_in_queue)); + for (uint8_t i = 0; i < info.commands_in_queue; i++) DEBUG_ECHOLNPAIR("> ", info.command_queue[i]); + DEBUG_ECHOLNPAIR("sd_filename: ", info.sd_filename); + DEBUG_ECHOLNPAIR("sdpos: ", info.sdpos); + DEBUG_ECHOLNPAIR("print_job_elapsed: ", info.print_job_elapsed); } else - SERIAL_ECHOLNPGM("INVALID DATA"); + DEBUG_ECHOLNPGM("INVALID DATA"); } - SERIAL_ECHOLNPGM("---"); + DEBUG_ECHOLNPGM("---"); } #endif // DEBUG_POWER_LOSS_RECOVERY diff --git a/Marlin/src/feature/power_loss_recovery.h b/Marlin/src/feature/power_loss_recovery.h index dd330652ea..45b057e752 100644 --- a/Marlin/src/feature/power_loss_recovery.h +++ b/Marlin/src/feature/power_loss_recovery.h @@ -76,6 +76,9 @@ typedef struct { #endif #endif + // Relative mode + bool relative_mode, relative_modes_e; + // Command queue uint8_t commands_in_queue, cmd_queue_index_r; char command_queue[BUFSIZE][MAX_CMD_SIZE]; @@ -122,9 +125,11 @@ class PrintJobRecovery { static inline bool valid() { return info.valid_head && info.valid_head == info.valid_foot; } - #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) - static void debug(PGM_P const prefix); - #endif + #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) + static void debug(PGM_P const prefix); + #else + static inline void debug(PGM_P const prefix) { UNUSED(prefix); } + #endif private: static void write(); diff --git a/Marlin/src/feature/prusa_MMU2/mmu2.cpp b/Marlin/src/feature/prusa_MMU2/mmu2.cpp index 92179774d0..d2134e4076 100644 --- a/Marlin/src/feature/prusa_MMU2/mmu2.cpp +++ b/Marlin/src/feature/prusa_MMU2/mmu2.cpp @@ -42,6 +42,9 @@ MMU2 mmu2; #include "../../feature/host_actions.h" #endif +#define DEBUG_OUT ENABLED(MMU2_DEBUG) +#include "../../core/debug_out.h" + #define MMU_TODELAY 100 #define MMU_TIMEOUT 10 #define MMU_CMD_TIMEOUT 60000ul //5min timeout for mmu commands (except P0) @@ -128,9 +131,7 @@ void MMU2::init() { } void MMU2::reset() { - #if ENABLED(MMU2_DEBUG) - SERIAL_ECHOLNPGM("MMU <= reset"); - #endif + DEBUG_ECHOLNPGM("MMU <= reset"); #if PIN_EXISTS(MMU2_RST) WRITE(MMU2_RST_PIN, LOW); @@ -153,10 +154,8 @@ void MMU2::mmuLoop() { case -1: if (rx_start()) { - #if ENABLED(MMU2_DEBUG) - SERIAL_ECHOLNPGM("MMU => 'start'"); - SERIAL_ECHOLNPGM("MMU <= 'S1'"); - #endif + DEBUG_ECHOLNPGM("MMU => 'start'"); + DEBUG_ECHOLNPGM("MMU <= 'S1'"); // send "read version" request tx_str_P(PSTR("S1\n")); @@ -173,10 +172,7 @@ void MMU2::mmuLoop() { if (rx_ok()) { sscanf(rx_buffer, "%uok\n", &version); - #if ENABLED(MMU2_DEBUG) - SERIAL_ECHOLNPAIR("MMU => ", version); - SERIAL_ECHOLNPGM("MMU <= 'S2'"); - #endif + DEBUG_ECHOLNPAIR("MMU => ", version, "\nMMU <= 'S2'"); tx_str_P(PSTR("S2\n")); // read build number state = -3; @@ -186,24 +182,19 @@ void MMU2::mmuLoop() { case -3: if (rx_ok()) { sscanf(rx_buffer, "%uok\n", &buildnr); - #if ENABLED(MMU2_DEBUG) - SERIAL_ECHOLNPAIR("MMU => ", buildnr); - #endif + + DEBUG_ECHOLNPAIR("MMU => ", buildnr); checkVersion(); #if ENABLED(MMU2_MODE_12V) - #if ENABLED(MMU2_DEBUG) - SERIAL_ECHOLNPGM("MMU <= 'M1'"); - #endif + DEBUG_ECHOLNPGM("MMU <= 'M1'"); tx_str_P(PSTR("M1\n")); // switch to stealth mode state = -5; #else - #if ENABLED(MMU2_DEBUG) - SERIAL_ECHOLNPGM("MMU <= 'P0'"); - #endif + DEBUG_ECHOLNPGM("MMU <= 'P0'"); tx_str_P(PSTR("P0\n")); // read finda state = -4; @@ -214,15 +205,11 @@ void MMU2::mmuLoop() { case -5: // response to M1 if (rx_ok()) { - #if ENABLED(MMU2_DEBUG) - SERIAL_ECHOLNPGM("MMU => ok"); - #endif + DEBUG_ECHOLNPGM("MMU => ok"); checkVersion(); - #if ENABLED(MMU2_DEBUG) - SERIAL_ECHOLNPGM("MMU <= 'P0'"); - #endif + DEBUG_ECHOLNPGM("MMU <= 'P0'"); tx_str_P(PSTR("P0\n")); // read finda state = -4; @@ -233,10 +220,7 @@ void MMU2::mmuLoop() { if (rx_ok()) { sscanf(rx_buffer, "%hhuok\n", &finda); - #if ENABLED(MMU2_DEBUG) - SERIAL_ECHOLNPAIR("MMU => ", finda); - SERIAL_ECHOLNPGM("MMU - ENABLED"); - #endif + DEBUG_ECHOLNPAIR("MMU => ", finda, "\nMMU - ENABLED"); enabled = true; state = 1; @@ -248,40 +232,26 @@ void MMU2::mmuLoop() { if (WITHIN(cmd, MMU_CMD_T0, MMU_CMD_T4)) { // tool change int filament = cmd - MMU_CMD_T0; - - #if ENABLED(MMU2_DEBUG) - SERIAL_ECHOLNPAIR("MMU <= T", filament); - #endif - + DEBUG_ECHOLNPAIR("MMU <= T", filament); tx_printf_P(PSTR("T%d\n"), filament); state = 3; // wait for response } else if (WITHIN(cmd, MMU_CMD_L0, MMU_CMD_L4)) { // load int filament = cmd - MMU_CMD_L0; - - #if ENABLED(MMU2_DEBUG) - SERIAL_ECHOLNPAIR("MMU <= L", filament); - #endif - + DEBUG_ECHOLNPAIR("MMU <= L", filament); tx_printf_P(PSTR("L%d\n"), filament); state = 3; // wait for response } else if (cmd == MMU_CMD_C0) { // continue loading - - #if ENABLED(MMU2_DEBUG) - SERIAL_ECHOLNPGM("MMU <= 'C0'"); - #endif - + DEBUG_ECHOLNPGM("MMU <= 'C0'"); tx_str_P(PSTR("C0\n")); state = 3; // wait for response } else if (cmd == MMU_CMD_U0) { // unload current - #if ENABLED(MMU2_DEBUG) - SERIAL_ECHOLNPGM("MMU <= 'U0'"); - #endif + DEBUG_ECHOLNPGM("MMU <= 'U0'"); tx_str_P(PSTR("U0\n")); state = 3; // wait for response @@ -289,32 +259,22 @@ void MMU2::mmuLoop() { else if (WITHIN(cmd, MMU_CMD_E0, MMU_CMD_E4)) { // eject filament int filament = cmd - MMU_CMD_E0; - - #if ENABLED(MMU2_DEBUG) - SERIAL_ECHOLNPAIR("MMU <= E", filament); - #endif + DEBUG_ECHOLNPAIR("MMU <= E", filament); tx_printf_P(PSTR("E%d\n"), filament); state = 3; // wait for response } else if (cmd == MMU_CMD_R0) { // recover after eject - #if ENABLED(MMU2_DEBUG) - SERIAL_ECHOLNPGM("MMU <= 'R0'"); - #endif - + DEBUG_ECHOLNPGM("MMU <= 'R0'"); tx_str_P(PSTR("R0\n")); state = 3; // wait for response } else if (WITHIN(cmd, MMU_CMD_F0, MMU_CMD_F4)) { // filament type int filament = cmd - MMU_CMD_F0; - #if ENABLED(MMU2_DEBUG) - SERIAL_ECHOPAIR("MMU <= F", filament); - SERIAL_ECHOPGM(" "); - SERIAL_ECHO_F(cmd_arg, DEC); - SERIAL_ECHOPGM("\n"); - #endif - + DEBUG_ECHOPAIR("MMU <= F", filament, " "); + DEBUG_ECHO_F(cmd_arg, DEC); + DEBUG_EOL(); tx_printf_P(PSTR("F%d %d\n"), filament, cmd_arg); state = 3; // wait for response } @@ -333,17 +293,8 @@ void MMU2::mmuLoop() { if (rx_ok()) { sscanf(rx_buffer, "%hhuok\n", &finda); - #if ENABLED(MMU2_DEBUG) - // This is super annoying. Only activate if necessary - /* - if (findaRunoutValid) { - SERIAL_ECHOLNPGM("MMU <= 'P0'"); - SERIAL_ECHOPGM("MMU => "); - SERIAL_ECHO_F(finda, DEC); - SERIAL_ECHOPGM("\n"); - } - */ - #endif + // This is super annoying. Only activate if necessary + // if (findaRunoutValid) DEBUG_ECHOLNPAIR_F("MMU <= 'P0'\nMMU => ", finda, 6); state = 1; @@ -358,10 +309,7 @@ void MMU2::mmuLoop() { case 3: // response to mmu commands if (rx_ok()) { - #if ENABLED(MMU2_DEBUG) - SERIAL_ECHOLNPGM("MMU => 'ok'"); - #endif - + DEBUG_ECHOLNPGM("MMU => 'ok'"); ready = true; state = 1; last_cmd = MMU_CMD_NONE; @@ -369,10 +317,7 @@ void MMU2::mmuLoop() { else if (ELAPSED(millis(), last_request + MMU_CMD_TIMEOUT)) { // resend request after timeout if (last_cmd) { - #if ENABLED(MMU2_DEBUG) - SERIAL_ECHOLNPGM("MMU retry"); - #endif - + DEBUG_ECHOLNPGM("MMU retry"); cmd = last_cmd; last_cmd = MMU_CMD_NONE; } @@ -407,10 +352,7 @@ bool MMU2::rx_str_P(const char* str) { rx_buffer[i] = '\0'; if (i == sizeof(rx_buffer) - 1) { - #if ENABLED(MMU2_DEBUG) - SERIAL_ECHOLNPGM("rx buffer overrun"); - #endif - + DEBUG_ECHOLNPGM("rx buffer overrun"); break; } } @@ -879,12 +821,8 @@ void MMU2::filamentRunout() { const float es = pgm_read_float(&(step->extrude)), fr = pgm_read_float(&(step->feedRate)); - #if ENABLED(MMU2_DEBUG) - SERIAL_ECHO_START(); - SERIAL_ECHOPAIR("E step ", es); - SERIAL_CHAR('/'); - SERIAL_ECHOLN(fr); - #endif + DEBUG_ECHO_START(); + DEBUG_ECHOLNPAIR("E step ", es, "/", fr); current_position[E_AXIS] += es; planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], diff --git a/Marlin/src/feature/runout.h b/Marlin/src/feature/runout.h index 2fa27c23ea..3f1e5fa018 100644 --- a/Marlin/src/feature/runout.h +++ b/Marlin/src/feature/runout.h @@ -49,7 +49,7 @@ class FilamentMonitorBase { #if ENABLED(HOST_ACTION_COMMANDS) static bool host_handling; #else - constexpr static bool host_handling = false; + static constexpr bool host_handling = false; #endif }; @@ -230,20 +230,23 @@ class FilamentSensorBase { private: static inline bool poll_runout_state(const uint8_t extruder) { const uint8_t runout_states = poll_runout_states(); + #if NUM_RUNOUT_SENSORS == 1 UNUSED(extruder); - return runout_states; // 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_states; // Any extruder - else - #elif ENABLED(DUAL_NOZZLE_DUPLICATION_MODE) - if (extruder_duplication_enabled) - return runout_states; // Any extruder - else + #endif + + if (true + #if NUM_RUNOUT_SENSORS > 1 + #if ENABLED(DUAL_X_CARRIAGE) + && (dual_x_carriage_mode == DXC_DUPLICATION_MODE || dual_x_carriage_mode == DXC_MIRRORED_MODE) + #elif ENABLED(MULTI_NOZZLE_DUPLICATION) + && extruder_duplication_enabled + #endif #endif - return TEST(runout_states, extruder); // Specific extruder + ) return runout_states; // Any extruder + + #if NUM_RUNOUT_SENSORS > 1 + return TEST(runout_states, extruder); // Specific extruder #endif } diff --git a/Marlin/src/feature/solenoid.cpp b/Marlin/src/feature/solenoid.cpp index 547a3b0df5..36430c5514 100644 --- a/Marlin/src/feature/solenoid.cpp +++ b/Marlin/src/feature/solenoid.cpp @@ -22,7 +22,7 @@ #include "../inc/MarlinConfig.h" -#if ENABLED(EXT_SOLENOID) || ENABLED(MANUAL_SOLENOID_CONTROL) +#if EITHER(EXT_SOLENOID, MANUAL_SOLENOID_CONTROL) #include "solenoid.h" @@ -95,4 +95,4 @@ void disable_all_solenoids() { #endif } -#endif // EXT_SOLENOID +#endif // EXT_SOLENOID || MANUAL_SOLENOID_CONTROL diff --git a/Marlin/src/feature/tmc_util.cpp b/Marlin/src/feature/tmc_util.cpp index ee28f70633..ff477818fe 100644 --- a/Marlin/src/feature/tmc_util.cpp +++ b/Marlin/src/feature/tmc_util.cpp @@ -474,7 +474,7 @@ switch (i) { case TMC_PWM_SCALE: SERIAL_PRINT(st.PWM_SCALE(), DEC); break; case TMC_SGT: SERIAL_PRINT(st.sgt(), DEC); break; - case TMC_STEALTHCHOP: serialprintPGM(st.en_pwm_mode() ? PSTR("true") : PSTR("false")); break; + case TMC_STEALTHCHOP: serialprint_truefalse(st.en_pwm_mode()); break; default: break; } } @@ -497,7 +497,7 @@ switch (i) { case TMC_PWM_SCALE: SERIAL_PRINT(st.PWM_SCALE(), DEC); break; case TMC_SGT: SERIAL_PRINT(st.sgt(), DEC); break; - case TMC_STEALTHCHOP: serialprintPGM(st.en_pwm_mode() ? PSTR("true") : PSTR("false")); break; + case TMC_STEALTHCHOP: serialprint_truefalse(st.en_pwm_mode()); break; case TMC_GLOBAL_SCALER: { uint16_t value = st.GLOBAL_SCALER(); @@ -514,7 +514,7 @@ static void tmc_status(TMC2208Stepper &st, const TMC_debug_enum i) { switch (i) { case TMC_PWM_SCALE: SERIAL_PRINT(st.pwm_scale_sum(), DEC); break; - case TMC_STEALTHCHOP: serialprintPGM(st.stealth() ? PSTR("true") : PSTR("false")); break; + case TMC_STEALTHCHOP: serialprint_truefalse(st.stealth()); break; case TMC_S2VSA: if (st.s2vsa()) SERIAL_CHAR('X'); break; case TMC_S2VSB: if (st.s2vsb()) SERIAL_CHAR('X'); break; default: break; @@ -541,7 +541,7 @@ SERIAL_CHAR('\t'); switch (i) { case TMC_CODES: st.printLabel(); break; - case TMC_ENABLED: serialprintPGM(st.isEnabled() ? PSTR("true") : PSTR("false")); break; + case TMC_ENABLED: serialprint_truefalse(st.isEnabled()); break; case TMC_CURRENT: SERIAL_ECHO(st.getMilliamps()); break; case TMC_RMS_CURRENT: SERIAL_ECHO(st.rms_current()); break; case TMC_MAX_CURRENT: SERIAL_PRINT((float)st.rms_current() * 1.41, 0); break; @@ -578,9 +578,9 @@ SERIAL_CHAR('-'); } break; - case TMC_OTPW: serialprintPGM(st.otpw() ? PSTR("true") : PSTR("false")); break; + case TMC_OTPW: serialprint_truefalse(st.otpw()); break; #if ENABLED(MONITOR_DRIVER_STATUS) - case TMC_OTPW_TRIGGERED: serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false")); break; + case TMC_OTPW_TRIGGERED: serialprint_truefalse(st.getOTPW()); break; #endif case TMC_TOFF: SERIAL_PRINT(st.toff(), DEC); break; case TMC_TBL: SERIAL_PRINT(st.blank_time(), DEC); break; @@ -596,7 +596,7 @@ SERIAL_CHAR('\t'); switch (i) { case TMC_CODES: st.printLabel(); break; - case TMC_ENABLED: serialprintPGM(st.isEnabled() ? PSTR("true") : PSTR("false")); break; + case TMC_ENABLED: serialprint_truefalse(st.isEnabled()); break; case TMC_CURRENT: SERIAL_ECHO(st.getMilliamps()); break; case TMC_RMS_CURRENT: SERIAL_ECHO(st.rms_current()); break; case TMC_MAX_CURRENT: SERIAL_PRINT((float)st.rms_current() * 1.41, 0); break; @@ -606,8 +606,8 @@ break; case TMC_VSENSE: serialprintPGM(st.vsense() ? PSTR("1=.165") : PSTR("0=.310")); break; case TMC_MICROSTEPS: SERIAL_ECHO(st.microsteps()); break; - //case TMC_OTPW: serialprintPGM(st.otpw() ? PSTR("true") : PSTR("false")); break; - //case TMC_OTPW_TRIGGERED: serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false")); break; + //case TMC_OTPW: serialprint_truefalse(st.otpw()); break; + //case TMC_OTPW_TRIGGERED: serialprint_truefalse(st.getOTPW()); break; case TMC_SGT: SERIAL_PRINT(st.sgt(), DEC); break; case TMC_TOFF: SERIAL_PRINT(st.toff(), DEC); break; case TMC_TBL: SERIAL_PRINT(st.blank_time(), DEC); break; diff --git a/Marlin/src/feature/tmc_util.h b/Marlin/src/feature/tmc_util.h index 81ef2e06a5..132efbb79e 100644 --- a/Marlin/src/feature/tmc_util.h +++ b/Marlin/src/feature/tmc_util.h @@ -227,7 +227,7 @@ void tmc_set_current(TMC &st, const int mA) { void tmc_report_otpw(TMC &st) { st.printLabel(); SERIAL_ECHOPGM(" temperature prewarn triggered: "); - serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false")); + serialprint_truefalse(st.getOTPW()); SERIAL_EOL(); } template diff --git a/Marlin/src/feature/twibus.cpp b/Marlin/src/feature/twibus.cpp index 6913284d33..826b714167 100644 --- a/Marlin/src/feature/twibus.cpp +++ b/Marlin/src/feature/twibus.cpp @@ -92,9 +92,7 @@ void TWIBus::send() { void TWIBus::echoprefix(uint8_t bytes, const char prefix[], uint8_t adr) { SERIAL_ECHO_START(); serialprintPGM(prefix); - SERIAL_ECHOPAIR(": from:", adr); - SERIAL_ECHOPAIR(" bytes:", bytes); - SERIAL_ECHOPGM(" data:"); + SERIAL_ECHOPAIR(": from:", adr, " bytes:", bytes, " data:"); } // static diff --git a/Marlin/src/gcode/bedlevel/G26.cpp b/Marlin/src/gcode/bedlevel/G26.cpp index cb7622900a..cdc2b7478e 100644 --- a/Marlin/src/gcode/bedlevel/G26.cpp +++ b/Marlin/src/gcode/bedlevel/G26.cpp @@ -50,6 +50,10 @@ #define INTERSECTION_CIRCLE_RADIUS 5 #define CROSSHAIRS_SIZE 3 +#ifndef G26_XY_FEEDRATE + #define G26_XY_FEEDRATE (PLANNER_XY_FEEDRATE() / 3.0) +#endif + #if CROSSHAIRS_SIZE >= INTERSECTION_CIRCLE_RADIUS #error "CROSSHAIRS_SIZE must be less than INTERSECTION_CIRCLE_RADIUS." #endif @@ -240,9 +244,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() / 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); + feed_value = has_xy_component ? G26_XY_FEEDRATE : planner.settings.max_feedrate_mm_s[E_AXIS] / 1.5; destination[X_AXIS] = rx; destination[Y_AXIS] = ry; @@ -323,19 +325,15 @@ inline bool look_for_lines_to_connect() { for (uint8_t j = 0; j < GRID_MAX_POINTS_Y; j++) { #if HAS_LCD_MENU - if (user_canceled()) return true; // Check if the user wants to stop the Mesh Validation + if (user_canceled()) return true; #endif - if (i < GRID_MAX_POINTS_X) { // We can't connect to anything to the right than GRID_MAX_POINTS_X. - // This is already a half circle because we are at the edge of the bed. + if (i < GRID_MAX_POINTS_X) { // Can't connect to anything to the right than GRID_MAX_POINTS_X. + // Already a half circle at the edge of the bed. if (is_bitmap_set(circle_flags, i, j) && is_bitmap_set(circle_flags, i + 1, j)) { // check if we can do a line to the left if (!is_bitmap_set(horizontal_mesh_line_flags, i, j)) { - - // - // We found two circles that need a horizontal line to connect them - // Print it! - // + // Two circles need a horizontal line to connect them sx = _GET_MESH_X( i ) + (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)); // right edge ex = _GET_MESH_X(i + 1) - (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)); // left edge @@ -343,32 +341,19 @@ inline bool look_for_lines_to_connect() { sy = ey = constrain(_GET_MESH_Y(j), Y_MIN_POS + 1, Y_MAX_POS - 1); ex = constrain(ex, X_MIN_POS + 1, X_MAX_POS - 1); - if (position_is_reachable(sx, sy) && position_is_reachable(ex, ey)) { - - if (g26_debug_flag) { - SERIAL_ECHOPAIR(" Connecting with horizontal line (sx=", sx); - SERIAL_ECHOPAIR(", sy=", sy); - SERIAL_ECHOPAIR(") -> (ex=", ex); - SERIAL_ECHOPAIR(", ey=", ey); - SERIAL_CHAR(')'); - SERIAL_EOL(); - //debug_current_and_destination(PSTR("Connecting horizontal line.")); - } + if (position_is_reachable(sx, sy) && position_is_reachable(ex, ey)) print_line_from_here_to_there(sx, sy, g26_layer_height, ex, ey, g26_layer_height); - } - bitmap_set(horizontal_mesh_line_flags, i, j); // Mark it as done so we don't do it again, even if we skipped it + + bitmap_set(horizontal_mesh_line_flags, i, j); // Mark done, even if skipped } } - if (j < GRID_MAX_POINTS_Y) { // We can't connect to anything further back than GRID_MAX_POINTS_Y. - // This is already a half circle because we are at the edge of the bed. + if (j < GRID_MAX_POINTS_Y) { // Can't connect to anything further back than GRID_MAX_POINTS_Y. + // Already a half circle at the edge of the bed. if (is_bitmap_set(circle_flags, i, j) && is_bitmap_set(circle_flags, i, j + 1)) { // check if we can do a line straight down if (!is_bitmap_set( vertical_mesh_line_flags, i, j)) { - // - // We found two circles that need a vertical line to connect them - // Print it! - // + // Two circles that need a vertical line to connect them sy = _GET_MESH_Y( j ) + (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)); // top edge ey = _GET_MESH_Y(j + 1) - (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)); // bottom edge @@ -376,23 +361,10 @@ inline bool look_for_lines_to_connect() { sy = constrain(sy, Y_MIN_POS + 1, Y_MAX_POS - 1); ey = constrain(ey, Y_MIN_POS + 1, Y_MAX_POS - 1); - if (position_is_reachable(sx, sy) && position_is_reachable(ex, ey)) { - - if (g26_debug_flag) { - SERIAL_ECHOPAIR(" Connecting with vertical line (sx=", sx); - SERIAL_ECHOPAIR(", sy=", sy); - SERIAL_ECHOPAIR(") -> (ex=", ex); - SERIAL_ECHOPAIR(", ey=", ey); - SERIAL_CHAR(')'); - SERIAL_EOL(); - - #if ENABLED(AUTO_BED_LEVELING_UBL) - debug_current_and_destination(PSTR("Connecting vertical line.")); - #endif - } + if (position_is_reachable(sx, sy) && position_is_reachable(ex, ey)) print_line_from_here_to_there(sx, sy, g26_layer_height, ex, ey, g26_layer_height); - } - bitmap_set(vertical_mesh_line_flags, i, j); // Mark it as done so we don't do it again, even if skipped + + bitmap_set(vertical_mesh_line_flags, i, j); // Mark done, even if skipped } } } @@ -570,13 +542,15 @@ void GcodeSuite::G26() { bool g26_continue_with_closest = parser.boolval('C'), g26_keep_heaters_on = parser.boolval('K'); - if (parser.seenval('B')) { - g26_bed_temp = parser.value_celsius(); - if (g26_bed_temp && !WITHIN(g26_bed_temp, 40, 140)) { - SERIAL_ECHOLNPGM("?Specified bed temperature not plausible (40-140C)."); - return; + #if HAS_HEATED_BED + if (parser.seenval('B')) { + g26_bed_temp = parser.value_celsius(); + if (g26_bed_temp && !WITHIN(g26_bed_temp, 40, (BED_MAXTEMP - 10))) { + SERIAL_ECHOLNPAIR("?Specified bed temperature not plausible (40-", int(BED_MAXTEMP - 10), "C)."); + return; + } } - } + #endif if (parser.seenval('L')) { g26_layer_height = parser.value_linear_units(); @@ -602,7 +576,7 @@ void GcodeSuite::G26() { if (parser.seenval('S')) { g26_nozzle = parser.value_float(); - if (!WITHIN(g26_nozzle, 0.1, 1.0)) { + if (!WITHIN(g26_nozzle, 0.1, 2.0)) { SERIAL_ECHOLNPGM("?Specified nozzle size not plausible."); return; } @@ -642,7 +616,7 @@ void GcodeSuite::G26() { if (parser.seenval('H')) { g26_hotend_temp = parser.value_celsius(); - if (!WITHIN(g26_hotend_temp, 165, 280)) { + if (!WITHIN(g26_hotend_temp, 165, (HEATER_0_MAXTEMP - 15))) { SERIAL_ECHOLNPGM("?Specified nozzle temperature not plausible."); return; } @@ -687,6 +661,12 @@ void GcodeSuite::G26() { set_current_from_destination(); } + #if DISABLED(NO_VOLUMETRICS) + bool volumetric_was_enabled = parser.volumetric_enabled; + parser.volumetric_enabled = false; + planner.calculate_volumetric_multipliers(); + #endif + if (turn_on_heaters() != G26_OK) goto LEAVE; current_position[E_AXIS] = 0.0; @@ -718,8 +698,6 @@ void GcodeSuite::G26() { ui.capture(); #endif - //debug_current_and_destination(PSTR("Starting G26 Mesh Validation Pattern.")); - #if DISABLED(ARC_SUPPORT) /** @@ -761,6 +739,7 @@ void GcodeSuite::G26() { #if ENABLED(ARC_SUPPORT) #define ARC_LENGTH(quarters) (INTERSECTION_CIRCLE_RADIUS * M_PI * (quarters) / 2) + #define INTERSECTION_CIRCLE_DIAM ((INTERSECTION_CIRCLE_RADIUS) * 2) float sx = circle_x + INTERSECTION_CIRCLE_RADIUS, // default to full circle ex = circle_x + INTERSECTION_CIRCLE_RADIUS, sy = circle_y, ey = circle_y, @@ -768,10 +747,8 @@ void GcodeSuite::G26() { // Figure out where to start and end the arc - we always print counterclockwise if (xi == 0) { // left edge - sx = f ? circle_x + INTERSECTION_CIRCLE_RADIUS : circle_x; - ex = b ? circle_x + INTERSECTION_CIRCLE_RADIUS : circle_x; - sy = f ? circle_y : circle_y - (INTERSECTION_CIRCLE_RADIUS); - ey = b ? circle_y : circle_y + INTERSECTION_CIRCLE_RADIUS; + if (!f) { sx = circle_x; sy -= INTERSECTION_CIRCLE_RADIUS; } + if (!b) { ex = circle_x; ey += INTERSECTION_CIRCLE_RADIUS; } arc_length = (f || b) ? ARC_LENGTH(1) : ARC_LENGTH(2); } else if (r) { // right edge @@ -782,30 +759,23 @@ void GcodeSuite::G26() { arc_length = (f || b) ? ARC_LENGTH(1) : ARC_LENGTH(2); } else if (f) { - sx = circle_x + INTERSECTION_CIRCLE_RADIUS; - ex = circle_x - (INTERSECTION_CIRCLE_RADIUS); - sy = ey = circle_y; + ex -= INTERSECTION_CIRCLE_DIAM; arc_length = ARC_LENGTH(2); } else if (b) { - sx = circle_x - (INTERSECTION_CIRCLE_RADIUS); - ex = circle_x + INTERSECTION_CIRCLE_RADIUS; - sy = ey = circle_y; + sx -= INTERSECTION_CIRCLE_DIAM; arc_length = ARC_LENGTH(2); } - const float arc_offset[2] = { - circle_x - sx, - circle_y - sy - }; - const float dx_s = current_position[X_AXIS] - sx, // find our distance from the start of the actual circle + const float arc_offset[2] = { circle_x - sx, circle_y - sy }, + dx_s = current_position[X_AXIS] - sx, // find our distance from the start of the actual circle dy_s = current_position[Y_AXIS] - sy, - dist_start = HYPOT2(dx_s, dy_s); - const float endpoint[XYZE] = { - ex, ey, - g26_layer_height, - current_position[E_AXIS] + (arc_length * g26_e_axis_feedrate * g26_extrusion_multiplier) - }; + dist_start = HYPOT2(dx_s, dy_s), + endpoint[XYZE] = { + ex, ey, + g26_layer_height, + current_position[E_AXIS] + (arc_length * g26_e_axis_feedrate * g26_extrusion_multiplier) + }; if (dist_start > 2.0) { retract_filament(destination); @@ -820,18 +790,6 @@ void GcodeSuite::G26() { const float save_feedrate = feedrate_mm_s; feedrate_mm_s = PLANNER_XY_FEEDRATE() / 10.0; - if (g26_debug_flag) { - SERIAL_ECHOPAIR(" plan_arc(ex=", endpoint[X_AXIS]); - SERIAL_ECHOPAIR(", ey=", endpoint[Y_AXIS]); - SERIAL_ECHOPAIR(", ez=", endpoint[Z_AXIS]); - SERIAL_ECHOPAIR(", len=", arc_length); - SERIAL_ECHOPAIR(") -> (ex=", current_position[X_AXIS]); - SERIAL_ECHOPAIR(", ey=", current_position[Y_AXIS]); - SERIAL_ECHOPAIR(", ez=", current_position[Z_AXIS]); - SERIAL_CHAR(')'); - SERIAL_EOL(); - } - plan_arc(endpoint, arc_offset, false); // Draw a counter-clockwise arc feedrate_mm_s = save_feedrate; set_destination_from_current(); @@ -899,16 +857,18 @@ void GcodeSuite::G26() { retract_filament(destination); destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES; - //debug_current_and_destination(PSTR("ready to do Z-Raise.")); move_to(destination, 0); // Raise the nozzle - //debug_current_and_destination(PSTR("done doing Z-Raise.")); destination[X_AXIS] = g26_x_pos; // Move back to the starting position destination[Y_AXIS] = g26_y_pos; //destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES; // Keep the nozzle where it is move_to(destination, 0); // Move back to the starting position - //debug_current_and_destination(PSTR("done doing X/Y move.")); + + #if DISABLED(NO_VOLUMETRICS) + parser.volumetric_enabled = volumetric_was_enabled; + planner.calculate_volumetric_multipliers(); + #endif #if HAS_LCD_MENU ui.release(); // Give back control of the LCD diff --git a/Marlin/src/gcode/bedlevel/M420.cpp b/Marlin/src/gcode/bedlevel/M420.cpp index 2ab4806365..f87c60fecb 100644 --- a/Marlin/src/gcode/bedlevel/M420.cpp +++ b/Marlin/src/gcode/bedlevel/M420.cpp @@ -66,8 +66,12 @@ void GcodeSuite::M420() { 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++) + for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++) { Z_VALUES(x, y) = 0.001 * random(-200, 200); + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onMeshUpdate(x, y, Z_VALUES(x, y)); + #endif + } 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); @@ -176,6 +180,9 @@ void GcodeSuite::M420() { #if ENABLED(ABL_BILINEAR_SUBDIVISION) bed_level_virt_interpolate(); #endif + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onMeshUpdate(x, y, Z_VALUES(x, y)); + #endif } #endif diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index 7d09c41689..675cd2b88e 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -36,7 +36,7 @@ #include "../../../module/probe.h" #include "../../queue.h" -#if ENABLED(LCD_BED_LEVELING) && ENABLED(PROBE_MANUALLY) +#if BOTH(LCD_BED_LEVELING, PROBE_MANUALLY) #include "../../../lcd/ultralcd.h" #endif @@ -48,6 +48,9 @@ #include "../../../libs/vector_3.h" #endif +#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) +#include "../../../core/debug_out.h" + #if ABL_GRID #if ENABLED(PROBE_Y_FIRST) #define PR_OUTER_VAR xCount @@ -148,7 +151,7 @@ */ G29_TYPE GcodeSuite::G29() { - #if ENABLED(DEBUG_LEVELING_FEATURE) || ENABLED(PROBE_MANUALLY) + #if EITHER(DEBUG_LEVELING_FEATURE, PROBE_MANUALLY) const bool seenQ = parser.seen('Q'); #else constexpr bool seenQ = false; @@ -187,12 +190,7 @@ G29_TYPE GcodeSuite::G29() { if (axis_unhomed_error()) G29_RETURN(false); if (!no_action && planner.leveling_active && parser.boolval('O')) { // Auto-level only if needed - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOLNPGM("> Auto-level not needed, skip"); - SERIAL_ECHOLNPGM("<<< G29"); - } - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> Auto-level not needed, skip\n<<< G29"); G29_RETURN(false); } @@ -207,12 +205,12 @@ G29_TYPE GcodeSuite::G29() { ABL_VAR float xProbe, yProbe, measured_z; ABL_VAR bool dryrun, abl_should_enable; - #if ENABLED(PROBE_MANUALLY) || ENABLED(AUTO_BED_LEVELING_LINEAR) + #if EITHER(PROBE_MANUALLY, AUTO_BED_LEVELING_LINEAR) ABL_VAR int abl_probe_index; #endif #if HAS_SOFTWARE_ENDSTOPS && ENABLED(PROBE_MANUALLY) - ABL_VAR bool enable_soft_endstops = true; + ABL_VAR bool saved_soft_endstops_state = true; #endif #if ABL_GRID @@ -282,7 +280,7 @@ G29_TYPE GcodeSuite::G29() { if (active_extruder != 0) tool_change(0); #endif - #if ENABLED(PROBE_MANUALLY) || ENABLED(AUTO_BED_LEVELING_LINEAR) + #if EITHER(PROBE_MANUALLY, AUTO_BED_LEVELING_LINEAR) abl_probe_index = -1; #endif @@ -321,6 +319,9 @@ G29_TYPE GcodeSuite::G29() { #if ENABLED(ABL_BILINEAR_SUBDIVISION) bed_level_virt_interpolate(); #endif + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onMeshUpdate(i, j, rz); + #endif set_bed_leveling_enabled(abl_should_enable); if (abl_should_enable) report_current_position(); } @@ -467,9 +468,7 @@ G29_TYPE GcodeSuite::G29() { #if ENABLED(AUTO_BED_LEVELING_3POINT) - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> 3-point Leveling"); - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> 3-point Leveling"); // Probe at 3 arbitrary points points[0].z = points[1].z = points[2].z = 0; @@ -491,7 +490,7 @@ G29_TYPE GcodeSuite::G29() { if (seenA && g29_in_progress) { SERIAL_ECHOLNPGM("Manual G29 aborted"); #if HAS_SOFTWARE_ENDSTOPS - soft_endstops_enabled = enable_soft_endstops; + soft_endstops_enabled = saved_soft_endstops_state; #endif set_bed_leveling_enabled(abl_should_enable); g29_in_progress = false; @@ -516,14 +515,14 @@ G29_TYPE GcodeSuite::G29() { if (abl_probe_index == 0) { // For the initial G29 S2 save software endstop state #if HAS_SOFTWARE_ENDSTOPS - enable_soft_endstops = soft_endstops_enabled; + saved_soft_endstops_state = soft_endstops_enabled; #endif // Move close to the bed before the first point do_blocking_move_to_z(0); } else { - #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_3POINT) + #if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_3POINT) const uint16_t index = abl_probe_index - 1; #endif @@ -548,15 +547,12 @@ G29_TYPE GcodeSuite::G29() { #elif ENABLED(AUTO_BED_LEVELING_BILINEAR) z_values[xCount][yCount] = measured_z + zoffset; - - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR("Save X", xCount); - SERIAL_ECHOPAIR(" Y", yCount); - SERIAL_ECHOLNPAIR(" Z", measured_z + zoffset); - } + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onMeshUpdate(xCount, yCount, z_values[xCount][yCount]); #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Save X", xCount, " Y", yCount, " Z", measured_z + zoffset); + #endif } @@ -611,7 +607,7 @@ G29_TYPE GcodeSuite::G29() { // Re-enable software endstops, if needed #if HAS_SOFTWARE_ENDSTOPS - soft_endstops_enabled = enable_soft_endstops; + soft_endstops_enabled = saved_soft_endstops_state; #endif } @@ -635,7 +631,7 @@ G29_TYPE GcodeSuite::G29() { // Re-enable software endstops, if needed #if HAS_SOFTWARE_ENDSTOPS - soft_endstops_enabled = enable_soft_endstops; + soft_endstops_enabled = saved_soft_endstops_state; #endif if (!dryrun) { @@ -723,6 +719,9 @@ G29_TYPE GcodeSuite::G29() { #elif ENABLED(AUTO_BED_LEVELING_BILINEAR) z_values[xCount][yCount] = measured_z + zoffset; + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onMeshUpdate(xCount, yCount, z_values[xCount][yCount]); + #endif #endif @@ -781,9 +780,7 @@ G29_TYPE GcodeSuite::G29() { // return or loop before this point. // - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("> probing complete", current_position); - #endif + if (DEBUGGING(LEVELING)) DEBUG_POS("> probing complete", current_position); #if ENABLED(PROBE_MANUALLY) g29_in_progress = false; @@ -920,9 +917,7 @@ G29_TYPE GcodeSuite::G29() { // Correct the current XYZ position based on the tilted plane. // - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("G29 uncorrected XYZ", current_position); - #endif + if (DEBUGGING(LEVELING)) DEBUG_POS("G29 uncorrected XYZ", current_position); float converted[XYZ]; COPY(converted, current_position); @@ -936,46 +931,32 @@ G29_TYPE GcodeSuite::G29() { && NEAR(current_position[Y_AXIS], yProbe - (Y_PROBE_OFFSET_FROM_EXTRUDER)) ) { const float simple_z = current_position[Z_AXIS] - measured_z; - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR("Z from Probe:", simple_z); - SERIAL_ECHOPAIR(" Matrix:", converted[Z_AXIS]); - SERIAL_ECHOLNPAIR(" Discrepancy:", simple_z - converted[Z_AXIS]); - } - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Probed Z", simple_z, " Matrix Z", converted[Z_AXIS], " Discrepancy ", simple_z - converted[Z_AXIS]); converted[Z_AXIS] = simple_z; } // The rotated XY and corrected Z are now current_position COPY(current_position, converted); - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("G29 corrected XYZ", current_position); - #endif + if (DEBUGGING(LEVELING)) DEBUG_POS("G29 corrected XYZ", current_position); } #elif ENABLED(AUTO_BED_LEVELING_BILINEAR) if (!dryrun) { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPAIR("G29 uncorrected Z:", current_position[Z_AXIS]); - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("G29 uncorrected Z:", current_position[Z_AXIS]); // Unapply the offset because it is going to be immediately applied // and cause compensation movement in Z current_position[Z_AXIS] -= bilinear_z_offset(current_position); - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPAIR(" corrected Z:", current_position[Z_AXIS]); - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR(" corrected Z:", current_position[Z_AXIS]); } #endif // ABL_PLANAR #ifdef Z_PROBE_END_SCRIPT - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPAIR("Z Probe End Script: ", Z_PROBE_END_SCRIPT); - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Z Probe End Script: ", Z_PROBE_END_SCRIPT); planner.synchronize(); enqueue_and_echo_commands_P(PSTR(Z_PROBE_END_SCRIPT)); #endif @@ -987,9 +968,7 @@ G29_TYPE GcodeSuite::G29() { // Restore state after probing if (!faux) clean_up_after_endstop_or_probe_move(); - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("<<< G29"); - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< G29"); KEEPALIVE_STATE(IN_HANDLER); diff --git a/Marlin/src/gcode/bedlevel/abl/M421.cpp b/Marlin/src/gcode/bedlevel/abl/M421.cpp index 3e2542c24f..cba905b4fb 100644 --- a/Marlin/src/gcode/bedlevel/abl/M421.cpp +++ b/Marlin/src/gcode/bedlevel/abl/M421.cpp @@ -54,6 +54,9 @@ void GcodeSuite::M421() { #if ENABLED(ABL_BILINEAR_SUBDIVISION) bed_level_virt_interpolate(); #endif + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onMeshUpdate(ix, iy, z_values[ix][iy]); + #endif } } diff --git a/Marlin/src/gcode/bedlevel/mbl/G29.cpp b/Marlin/src/gcode/bedlevel/mbl/G29.cpp index df24a58a99..15fbf82128 100644 --- a/Marlin/src/gcode/bedlevel/mbl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/mbl/G29.cpp @@ -59,7 +59,7 @@ void GcodeSuite::G29() { static int mbl_probe_index = -1; #if HAS_SOFTWARE_ENDSTOPS - static bool enable_soft_endstops; + static bool saved_soft_endstops_state; #endif MeshLevelingState state = (MeshLevelingState)parser.byteval('S', (int8_t)MeshReport); @@ -99,7 +99,7 @@ void GcodeSuite::G29() { if (mbl_probe_index == 0) { #if HAS_SOFTWARE_ENDSTOPS // For the initial G29 S2 save software endstop state - enable_soft_endstops = soft_endstops_enabled; + saved_soft_endstops_state = soft_endstops_enabled; #endif // Move close to the bed before the first point do_blocking_move_to_z(0); @@ -108,7 +108,7 @@ void GcodeSuite::G29() { // Save Z for the previous mesh position mbl.set_zigzag_z(mbl_probe_index - 1, current_position[Z_AXIS]); #if HAS_SOFTWARE_ENDSTOPS - soft_endstops_enabled = enable_soft_endstops; + soft_endstops_enabled = saved_soft_endstops_state; #endif } // If there's another point to sample, move there with optional lift. @@ -173,8 +173,12 @@ void GcodeSuite::G29() { else return echo_not_entered('J'); - if (parser.seenval('Z')) + if (parser.seenval('Z')) { mbl.z_values[ix][iy] = parser.value_linear_units(); + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onMeshUpdate(ix, iy, mbl.z_values[ix][iy]); + #endif + } else return echo_not_entered('Z'); break; diff --git a/Marlin/src/gcode/bedlevel/ubl/M421.cpp b/Marlin/src/gcode/bedlevel/ubl/M421.cpp index 5e01c659d0..1bb34eafa2 100644 --- a/Marlin/src/gcode/bedlevel/ubl/M421.cpp +++ b/Marlin/src/gcode/bedlevel/ubl/M421.cpp @@ -31,6 +31,10 @@ #include "../../gcode.h" #include "../../../feature/bedlevel/bedlevel.h" +#if ENABLED(EXTENSIBLE_UI) + #include "../../../lcd/extensible_ui/ui_api.h" +#endif + /** * M421: Set a single Mesh Bed Leveling Z coordinate * @@ -60,8 +64,12 @@ void GcodeSuite::M421() { SERIAL_ERROR_MSG(MSG_ERR_M421_PARAMETERS); else if (!WITHIN(ix, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(iy, 0, GRID_MAX_POINTS_Y - 1)) SERIAL_ERROR_MSG(MSG_ERR_MESH_XY); - else + else { ubl.z_values[ix][iy] = hasN ? NAN : parser.value_linear_units() + (hasQ ? ubl.z_values[ix][iy] : 0); + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onMeshUpdate(ix, iy, ubl.z_values[ix][iy]); + #endif + } } #endif // AUTO_BED_LEVELING_UBL diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp index fc5b5fedb7..1a6922cfa4 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -43,12 +43,19 @@ #include "../../module/probe.h" #endif +#if ENABLED(BLTOUCH) + #include "../../feature/bltouch.h" +#endif + #include "../../lcd/ultralcd.h" #if HAS_DRIVER(L6470) // set L6470 absolute position registers to counts #include "../../libs/L6470/L6470_Marlin.h" #endif +#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) +#include "../../core/debug_out.h" + #if ENABLED(QUICK_HOME) static void quick_home_xy() { @@ -113,9 +120,7 @@ return; } - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("Z_SAFE_HOMING >>>"); - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Z_SAFE_HOMING >>>"); sync_plan_position(); @@ -133,9 +138,7 @@ if (position_is_reachable(destination[X_AXIS], destination[Y_AXIS])) { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("Z_SAFE_HOMING", destination); - #endif + if (DEBUGGING(LEVELING)) DEBUG_POS("Z_SAFE_HOMING", destination); // This causes the carriage on Dual X to unpark #if ENABLED(DUAL_X_CARRIAGE) @@ -154,9 +157,7 @@ SERIAL_ECHO_MSG(MSG_ZPROBE_OUT); } - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("<<< Z_SAFE_HOMING"); - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< Z_SAFE_HOMING"); } #endif // Z_SAFE_HOMING @@ -181,13 +182,10 @@ * */ void GcodeSuite::G28(const bool always_home_all) { - - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOLNPGM(">>> G28"); - log_machine_info(); - } - #endif + if (DEBUGGING(LEVELING)) { + DEBUG_ECHOLNPGM(">>> G28"); + log_machine_info(); + } #if ENABLED(DUAL_X_CARRIAGE) bool IDEX_saved_duplication_state = extruder_duplication_enabled; @@ -200,9 +198,7 @@ void GcodeSuite::G28(const bool always_home_all) { sync_plan_position(); SERIAL_ECHOLNPGM("Simulated Homing"); report_current_position(); - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("<<< G28"); - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< G28"); return; } #endif @@ -215,12 +211,7 @@ void GcodeSuite::G28(const bool always_home_all) { 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 + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> homing not needed, skip\n<<< G28"); return; } } @@ -247,7 +238,7 @@ void GcodeSuite::G28(const bool always_home_all) { #endif #if ENABLED(BLTOUCH) - bltouch_init(); + bltouch.init(); #endif // Always home with tool 0 active @@ -258,7 +249,7 @@ void GcodeSuite::G28(const bool always_home_all) { tool_change(0, 0, true); #endif - #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE) + #if HAS_DUPLICATION_MODE extruder_duplication_enabled = false; #endif @@ -276,13 +267,16 @@ void GcodeSuite::G28(const bool always_home_all) { const bool homeX = always_home_all || parser.seen('X'), homeY = always_home_all || parser.seen('Y'), homeZ = always_home_all || parser.seen('Z'), - home_all = (!homeX && !homeY && !homeZ) || (homeX && homeY && homeZ); + home_all = (!homeX && !homeY && !homeZ) || (homeX && homeY && homeZ), + doX = home_all || homeX, + doY = home_all || homeY, + doZ = home_all || homeZ; set_destination_from_current(); #if Z_HOME_DIR > 0 // If homing away from BED do Z first - if (home_all || homeZ) homeaxis(Z_AXIS); + if (doZ) homeaxis(Z_AXIS); #endif @@ -293,41 +287,36 @@ void GcodeSuite::G28(const bool always_home_all) { (parser.seenval('R') ? parser.value_linear_units() : Z_HOMING_HEIGHT) ); - if (z_homing_height && (home_all || homeX || homeY)) { + if (z_homing_height && (doX || doY)) { // Raise Z before homing any other axes and z is not already high enough (never lower z) destination[Z_AXIS] = z_homing_height; if (destination[Z_AXIS] > current_position[Z_AXIS]) { - - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) - SERIAL_ECHOLNPAIR("Raise Z (before homing) to ", destination[Z_AXIS]); - #endif - + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Raise Z (before homing) to ", destination[Z_AXIS]); do_blocking_move_to_z(destination[Z_AXIS]); } } #if ENABLED(QUICK_HOME) - if (home_all || (homeX && homeY)) quick_home_xy(); + if (doX && doY) quick_home_xy(); #endif // Home Y (before X) #if ENABLED(HOME_Y_BEFORE_X) - if (home_all || homeY + if (doY #if ENABLED(CODEPENDENT_XY_HOMING) - || homeX + || doX #endif ) homeaxis(Y_AXIS); #endif // Home X - if (home_all || homeX + if (doX #if ENABLED(CODEPENDENT_XY_HOMING) && DISABLED(HOME_Y_BEFORE_X) - || homeY + || doY #endif ) { @@ -358,12 +347,12 @@ void GcodeSuite::G28(const bool always_home_all) { // Home Y (after X) #if DISABLED(HOME_Y_BEFORE_X) - if (home_all || homeY) homeaxis(Y_AXIS); + if (doY) homeaxis(Y_AXIS); #endif // Home Z last if homing towards the bed #if Z_HOME_DIR < 0 - if (home_all || homeZ) { + if (doZ) { #if ENABLED(Z_SAFE_HOMING) home_z_safely(); #else @@ -374,7 +363,7 @@ void GcodeSuite::G28(const bool always_home_all) { move_z_after_probing(); #endif - } // home_all || homeZ + } // doZ #endif // Z_HOME_DIR < 0 sync_plan_position(); @@ -415,9 +404,18 @@ void GcodeSuite::G28(const bool always_home_all) { #endif // DUAL_X_CARRIAGE + #ifdef HOMING_BACKOFF_MM + endstops.enable(false); + constexpr float endstop_backoff[XYZ] = HOMING_BACKOFF_MM; + const float backoff_x = doX ? ABS(endstop_backoff[X_AXIS]) * (X_HOME_DIR) : 0, + backoff_y = doY ? ABS(endstop_backoff[Y_AXIS]) * (Y_HOME_DIR) : 0, + backoff_z = doZ ? ABS(endstop_backoff[Z_AXIS]) * (Z_HOME_DIR) : 0; + if (backoff_z) do_blocking_move_to_z(current_position[Z_AXIS] - backoff_z); + if (backoff_x || backoff_y) do_blocking_move_to_xy(current_position[X_AXIS] - backoff_x, current_position[Y_AXIS] - backoff_y); + #endif endstops.not_homing(); - #if ENABLED(DELTA) && ENABLED(DELTA_HOME_TO_SAFE_ZONE) + #if BOTH(DELTA, DELTA_HOME_TO_SAFE_ZONE) // move to a height where we can use the full xy-area do_blocking_move_to_z(delta_clip_start_height); #endif @@ -430,7 +428,7 @@ void GcodeSuite::G28(const bool always_home_all) { // Restore the active tool after homing #if HOTENDS > 1 && (DISABLED(DELTA) || ENABLED(DELTA_HOME_TO_SAFE_ZONE)) - #if ENABLED(PARKING_EXTRUDER) + #if EITHER(PARKING_EXTRUDER, DUAL_X_CARRIAGE) #define NO_FETCH false // fetch the previous toolhead #else #define NO_FETCH true @@ -443,17 +441,15 @@ void GcodeSuite::G28(const bool always_home_all) { report_current_position(); #if ENABLED(NANODLP_Z_SYNC) #if ENABLED(NANODLP_ALL_AXIS) - #define _HOME_SYNC true // For any axis, output sync text. + #define _HOME_SYNC true // For any axis, output sync text. #else - #define _HOME_SYNC (home_all || homeZ) // Only for Z-axis + #define _HOME_SYNC doZ // Only for Z-axis #endif if (_HOME_SYNC) SERIAL_ECHOLNPGM(MSG_Z_MOVE_COMP); #endif - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("<<< G28"); - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< G28"); #if HAS_DRIVER(L6470) // Set L6470 absolute position registers to counts diff --git a/Marlin/src/gcode/calibrate/G34_M422.cpp b/Marlin/src/gcode/calibrate/G34_M422.cpp index 67baca6df6..9a26400a97 100644 --- a/Marlin/src/gcode/calibrate/G34_M422.cpp +++ b/Marlin/src/gcode/calibrate/G34_M422.cpp @@ -38,10 +38,17 @@ #include "../../module/probe.h" #endif +#if ENABLED(BLTOUCH) + #include "../../feature/bltouch.h" +#endif + #if HAS_LEVELING #include "../../feature/bedlevel/bedlevel.h" #endif +#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) +#include "../../core/debug_out.h" + float z_auto_align_xpos[Z_STEPPER_COUNT] = Z_STEPPER_ALIGN_X, z_auto_align_ypos[Z_STEPPER_COUNT] = Z_STEPPER_ALIGN_Y; @@ -59,19 +66,15 @@ inline void set_all_z_lock(const bool lock) { * Parameters: I T A */ void GcodeSuite::G34() { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOLNPGM(">>> G34"); - log_machine_info(); - } - #endif + if (DEBUGGING(LEVELING)) { + DEBUG_ECHOLNPGM(">>> G34"); + log_machine_info(); + } 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 + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> XY homing required."); break; } @@ -109,8 +112,8 @@ void GcodeSuite::G34() { #endif #if ENABLED(BLTOUCH) - bltouch_command(BLTOUCH_RESET); - set_bltouch_deployed(false); + bltouch.reset(); + bltouch.stow(); #endif // Always home with tool 0 active @@ -119,7 +122,7 @@ void GcodeSuite::G34() { tool_change(0, 0, true); #endif - #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE) + #if HAS_DUPLICATION_MODE extruder_duplication_enabled = false; #endif @@ -128,9 +131,7 @@ void GcodeSuite::G34() { 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 + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> probing all positions."); // Reset minimum value float z_measured_min = 100000.0f; @@ -141,19 +142,12 @@ void GcodeSuite::G34() { // Stop on error if (isnan(z_measured[zstepper])) { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> PROBING FAILED!"); - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> PROBING FAILED!"); 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 + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("> Z", int(zstepper + 1), " measured position is ", z_measured[zstepper]); // Remember the maximum position to calculate the correction z_measured_min = MIN(z_measured_min, z_measured[zstepper]); @@ -178,9 +172,7 @@ void GcodeSuite::G34() { // 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 + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> detected decreasing accuracy."); err_break = true; break; } @@ -190,12 +182,7 @@ void GcodeSuite::G34() { // 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 + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("> Z", int(zstepper + 1), " corrected by ", z_align_move); switch (zstepper) { case 0: stepper.set_z_lock(false); break; @@ -219,9 +206,7 @@ void GcodeSuite::G34() { stepper.set_separate_multi_axis(false); if (success_break) { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> achieved target accuracy."); - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> achieved target accuracy."); break; } } @@ -230,13 +215,13 @@ void GcodeSuite::G34() { // Restore the active tool after homing #if HOTENDS > 1 - tool_change(old_tool_index, 0, + tool_change(old_tool_index, 0, ( #if ENABLED(PARKING_EXTRUDER) false // Fetch the previous toolhead #else true #endif - ); + )); #endif #if HAS_LEVELING @@ -252,9 +237,7 @@ void GcodeSuite::G34() { } while(0); - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("<<< G34"); - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< G34"); } /** diff --git a/Marlin/src/gcode/calibrate/G425.cpp b/Marlin/src/gcode/calibrate/G425.cpp index 8446235807..1174fc38f8 100644 --- a/Marlin/src/gcode/calibrate/G425.cpp +++ b/Marlin/src/gcode/calibrate/G425.cpp @@ -52,11 +52,12 @@ #define CALIBRATION_MEASUREMENT_CERTAIN 0.5 // mm #endif -#define HAS_X_CENTER (ENABLED(CALIBRATION_MEASURE_LEFT) && ENABLED(CALIBRATION_MEASURE_RIGHT)) -#define HAS_Y_CENTER (ENABLED(CALIBRATION_MEASURE_FRONT) && ENABLED(CALIBRATION_MEASURE_BACK)) +#define HAS_X_CENTER BOTH(CALIBRATION_MEASURE_LEFT, CALIBRATION_MEASURE_RIGHT) +#define HAS_Y_CENTER BOTH(CALIBRATION_MEASURE_FRONT, CALIBRATION_MEASURE_BACK) #if ENABLED(BACKLASH_GCODE) - extern float backlash_distance_mm[], backlash_correction, backlash_smoothing_mm; + extern float backlash_distance_mm[], backlash_smoothing_mm; + extern uint8_t backlash_correction; #endif enum side_t : uint8_t { TOP, RIGHT, FRONT, LEFT, BACK, NUM_SIDES }; @@ -143,18 +144,15 @@ inline void park_above_object(measurements_t &m, const float uncertainty) { } #if HOTENDS > 1 - inline void set_nozzle(measurements_t &m, const uint8_t extruder) { if (extruder != active_extruder) { park_above_object(m, CALIBRATION_MEASUREMENT_UNKNOWN); tool_change(extruder); } } +#endif - inline void reset_nozzle_offsets() { - constexpr float tmp[XYZ][HOTENDS] = { HOTEND_OFFSET_X, HOTEND_OFFSET_Y, HOTEND_OFFSET_Z }; - LOOP_XYZ(i) HOTEND_LOOP() hotend_offset[i][e] = tmp[i][e]; - } +#if HAS_HOTEND_OFFSET inline void normalize_hotend_offsets() { for (uint8_t e = 1; e < HOTENDS; e++) { @@ -167,7 +165,7 @@ inline void park_above_object(measurements_t &m, const float uncertainty) { hotend_offset[Z_AXIS][0] = 0; } -#endif // HOTENDS > 1 +#endif inline bool read_calibration_pin() { #if HAS_CALIBRATION_PIN @@ -421,7 +419,7 @@ inline void probe_sides(measurements_t &m, const float uncertainty) { SERIAL_EOL(); } - #if HOTENDS > 1 + #if HAS_HOTEND_OFFSET // // This function requires normalize_hotend_offsets() to be called // @@ -449,7 +447,7 @@ inline void calibrate_backlash(measurements_t &m, const float uncertainty) { { // New scope for TEMPORARY_BACKLASH_CORRECTION - TEMPORARY_BACKLASH_CORRECTION(0.0f); + TEMPORARY_BACKLASH_CORRECTION(all_off); TEMPORARY_BACKLASH_SMOOTHING(0.0f); probe_sides(m, uncertainty); @@ -481,7 +479,7 @@ inline void calibrate_backlash(measurements_t &m, const float uncertainty) { { // New scope for TEMPORARY_BACKLASH_CORRECTION - TEMPORARY_BACKLASH_CORRECTION(1.0f); + TEMPORARY_BACKLASH_CORRECTION(all_on); TEMPORARY_BACKLASH_SMOOTHING(0.0f); move_to( X_AXIS, current_position[X_AXIS] + 3, @@ -516,7 +514,7 @@ inline void update_measurements(measurements_t &m, const AxisEnum axis) { * - Call calibrate_backlash() beforehand for best accuracy */ inline void calibrate_toolhead(measurements_t &m, const float uncertainty, const uint8_t extruder) { - TEMPORARY_BACKLASH_CORRECTION(1.0f); + TEMPORARY_BACKLASH_CORRECTION(all_on); TEMPORARY_BACKLASH_SMOOTHING(0.0f); #if HOTENDS > 1 @@ -526,7 +524,7 @@ inline void calibrate_toolhead(measurements_t &m, const float uncertainty, const probe_sides(m, uncertainty); // Adjust the hotend offset - #if HOTENDS > 1 + #if HAS_HOTEND_OFFSET #if HAS_X_CENTER hotend_offset[X_AXIS][extruder] += m.pos_error[X_AXIS]; #endif @@ -534,7 +532,6 @@ inline void calibrate_toolhead(measurements_t &m, const float uncertainty, const hotend_offset[Y_AXIS][extruder] += m.pos_error[Y_AXIS]; #endif hotend_offset[Z_AXIS][extruder] += m.pos_error[Z_AXIS]; - normalize_hotend_offsets(); #endif @@ -560,13 +557,16 @@ inline void calibrate_toolhead(measurements_t &m, const float uncertainty, const * uncertainty in - How far away from the object to begin probing */ inline void calibrate_all_toolheads(measurements_t &m, const float uncertainty) { - TEMPORARY_BACKLASH_CORRECTION(1.0f); + TEMPORARY_BACKLASH_CORRECTION(all_on); TEMPORARY_BACKLASH_SMOOTHING(0.0f); HOTEND_LOOP() calibrate_toolhead(m, uncertainty, e); - #if HOTENDS > 1 + #if HAS_HOTEND_OFFSET normalize_hotend_offsets(); + #endif + + #if HOTENDS > 1 set_nozzle(m, 0); #endif } @@ -585,11 +585,11 @@ inline void calibrate_all_toolheads(measurements_t &m, const float uncertainty) inline void calibrate_all() { measurements_t m; - #if HOTENDS > 1 - reset_nozzle_offsets(); + #if HAS_HOTEND_OFFSET + reset_hotend_offsets(); #endif - TEMPORARY_BACKLASH_CORRECTION(1.0f); + TEMPORARY_BACKLASH_CORRECTION(all_on); TEMPORARY_BACKLASH_SMOOTHING(0.0f); // Do a fast and rough calibration of the toolheads @@ -643,7 +643,7 @@ void GcodeSuite::G425() { report_measured_backlash(m); report_measured_nozzle_dimensions(m); report_measured_positional_error(m); - #if HOTENDS > 1 + #if HAS_HOTEND_OFFSET normalize_hotend_offsets(); report_hotend_offsets(); #endif diff --git a/Marlin/src/gcode/calibrate/M425.cpp b/Marlin/src/gcode/calibrate/M425.cpp index 2b82bb8842..e51c9301cf 100644 --- a/Marlin/src/gcode/calibrate/M425.cpp +++ b/Marlin/src/gcode/calibrate/M425.cpp @@ -26,8 +26,8 @@ #include "../../module/planner.h" -float backlash_distance_mm[XYZ] = BACKLASH_DISTANCE_MM, - backlash_correction = BACKLASH_CORRECTION; +float backlash_distance_mm[XYZ] = BACKLASH_DISTANCE_MM; +uint8_t backlash_correction = BACKLASH_CORRECTION * all_on; #ifdef BACKLASH_SMOOTHING_MM float backlash_smoothing_mm = BACKLASH_SMOOTHING_MM; @@ -74,7 +74,7 @@ void GcodeSuite::M425() { if (parser.seen('F')) { planner.synchronize(); - backlash_correction = MAX(0, MIN(1.0, parser.value_linear_units())); + backlash_correction = MAX(0, MIN(1.0, parser.value_float())) * all_on; noArgs = false; } @@ -90,8 +90,7 @@ void GcodeSuite::M425() { SERIAL_ECHOPGM("Backlash correction is "); if (!backlash_correction) SERIAL_ECHOPGM("in"); SERIAL_ECHOLNPGM("active:"); - SERIAL_ECHOPAIR(" Correction Amount/Fade-out: F", backlash_correction); - SERIAL_ECHOLNPGM(" (F1.0 = full, F0.0 = none)"); + SERIAL_ECHOLNPAIR(" Correction Amount/Fade-out: F", float(ui8_to_percent(backlash_correction)) / 100, " (F1.0 = full, F0.0 = none)"); SERIAL_ECHOPGM(" Backlash Distance (mm): "); LOOP_XYZ(a) { SERIAL_CHAR(' '); diff --git a/Marlin/src/gcode/calibrate/M666.cpp b/Marlin/src/gcode/calibrate/M666.cpp index 925b44647f..3af8fe7575 100644 --- a/Marlin/src/gcode/calibrate/M666.cpp +++ b/Marlin/src/gcode/calibrate/M666.cpp @@ -31,32 +31,22 @@ #include "../../module/delta.h" #include "../../module/motion.h" + #define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) + #include "../../core/debug_out.h" + /** * M666: Set delta endstop adjustment */ void GcodeSuite::M666() { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOLNPGM(">>> M666"); - } - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM(">>> M666"); LOOP_XYZ(i) { if (parser.seen(axis_codes[i])) { const float v = parser.value_linear_units(); if (v * Z_HOME_DIR <= 0) delta_endstop_adj[i] = v; - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR("delta_endstop_adj[", axis_codes[i]); - SERIAL_ECHOLNPAIR("] = ", delta_endstop_adj[i]); - } - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("delta_endstop_adj[", axis_codes[i], "] = ", delta_endstop_adj[i]); } } - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOLNPGM("<<< M666"); - } - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< M666"); } #elif HAS_EXTRA_ENDSTOPS diff --git a/Marlin/src/gcode/config/M217.cpp b/Marlin/src/gcode/config/M217.cpp index bcdaf4e687..31271ba2ca 100644 --- a/Marlin/src/gcode/config/M217.cpp +++ b/Marlin/src/gcode/config/M217.cpp @@ -27,10 +27,6 @@ #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 ENABLED(TOOLCHANGE_FILAMENT_SWAP) diff --git a/Marlin/src/gcode/config/M304.cpp b/Marlin/src/gcode/config/M304.cpp index e23efd771b..d3305a2ebc 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.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()); + if (parser.seen('P')) thermalManager.temp_bed.pid.Kp = parser.value_float(); + if (parser.seen('I')) thermalManager.temp_bed.pid.Ki = scalePID_i(parser.value_float()); + if (parser.seen('D')) thermalManager.temp_bed.pid.Kd = scalePID_d(parser.value_float()); SERIAL_ECHO_START(); - 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)); + SERIAL_ECHOPAIR(" p:", thermalManager.temp_bed.pid.Kp); + SERIAL_ECHOPAIR(" i:", unscalePID_i(thermalManager.temp_bed.pid.Ki)); + SERIAL_ECHOLNPAIR(" d:", unscalePID_d(thermalManager.temp_bed.pid.Kd)); } #endif // PIDTEMPBED diff --git a/Marlin/src/gcode/config/M43.cpp b/Marlin/src/gcode/config/M43.cpp index 25265bc4a0..e1445eaf6d 100644 --- a/Marlin/src/gcode/config/M43.cpp +++ b/Marlin/src/gcode/config/M43.cpp @@ -47,13 +47,13 @@ inline void toggle_pins() { for (uint8_t i = start; i <= end; i++) { pin_t pin = GET_PIN_MAP_PIN(i); - //report_pin_state_extended(pin, ignore_protection, false); if (!VALID_PIN(pin)) continue; - if (!ignore_protection && pin_is_protected(pin)) { + if (M43_NEVER_TOUCH(i) || (!ignore_protection && pin_is_protected(pin))) { report_pin_state_extended(pin, ignore_protection, true, "Untouched "); SERIAL_EOL(); } else { + watchdog_reset(); report_pin_state_extended(pin, ignore_protection, true, "Pulsing "); #if AVR_AT90USB1286_FAMILY // Teensy IDEs don't know about these pins so must use FASTIO if (pin == TEENSY_E2) { @@ -77,12 +77,12 @@ inline void toggle_pins() { { pinMode(pin, OUTPUT); for (int16_t j = 0; j < repeat; j++) { - digitalWrite(pin, 0); safe_delay(wait); - digitalWrite(pin, 1); safe_delay(wait); - digitalWrite(pin, 0); safe_delay(wait); + watchdog_reset(); extDigitalWrite(pin, 0); safe_delay(wait); + watchdog_reset(); extDigitalWrite(pin, 1); safe_delay(wait); + watchdog_reset(); extDigitalWrite(pin, 0); safe_delay(wait); + watchdog_reset(); } } - } SERIAL_EOL(); } @@ -277,7 +277,7 @@ void GcodeSuite::M43() { for (uint8_t i = first_pin; i <= last_pin; i++) { pin_t pin = GET_PIN_MAP_PIN(i); if (!VALID_PIN(pin)) continue; - if (!ignore_protection && pin_is_protected(pin)) continue; + if (M43_NEVER_TOUCH(i) || (!ignore_protection && pin_is_protected(pin))) continue; pinMode(pin, INPUT_PULLUP); delay(1); /* @@ -285,7 +285,7 @@ void GcodeSuite::M43() { pin_state[pin - first_pin] = analogRead(DIGITAL_PIN_TO_ANALOG_PIN(pin)); // int16_t pin_state[...] else //*/ - pin_state[i - first_pin] = digitalRead(pin); + pin_state[i - first_pin] = extDigitalRead(pin); } #if HAS_RESUME_CONTINUE @@ -300,14 +300,14 @@ void GcodeSuite::M43() { for (uint8_t i = first_pin; i <= last_pin; i++) { pin_t pin = GET_PIN_MAP_PIN(i); if (!VALID_PIN(pin)) continue; - if (!ignore_protection && pin_is_protected(pin)) continue; + if (M43_NEVER_TOUCH(i) || (!ignore_protection && pin_is_protected(pin))) continue; const byte val = /* IS_ANALOG(pin) ? analogRead(DIGITAL_PIN_TO_ANALOG_PIN(pin)) : // int16_t val : //*/ - digitalRead(pin); + extDigitalRead(pin); if (val != pin_state[i - first_pin]) { report_pin_state_extended(pin, ignore_protection, false); pin_state[i - first_pin] = val; diff --git a/Marlin/src/gcode/control/M111.cpp b/Marlin/src/gcode/control/M111.cpp index 86936dd5c2..f4bb6e1f62 100644 --- a/Marlin/src/gcode/control/M111.cpp +++ b/Marlin/src/gcode/control/M111.cpp @@ -34,14 +34,14 @@ void GcodeSuite::M111() { str_debug_8[] PROGMEM = MSG_DEBUG_DRYRUN, str_debug_16[] PROGMEM = MSG_DEBUG_COMMUNICATION #if ENABLED(DEBUG_LEVELING_FEATURE) - , str_debug_32[] PROGMEM = MSG_DEBUG_LEVELING + , str_debug_lvl[] PROGMEM = MSG_DEBUG_LEVELING #endif ; 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 + , str_debug_lvl #endif }; diff --git a/Marlin/src/gcode/control/M17_M18_M84.cpp b/Marlin/src/gcode/control/M17_M18_M84.cpp index c6f039a8ea..1aea995508 100644 --- a/Marlin/src/gcode/control/M17_M18_M84.cpp +++ b/Marlin/src/gcode/control/M17_M18_M84.cpp @@ -25,7 +25,7 @@ #include "../../lcd/ultralcd.h" #include "../../module/stepper.h" -#if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(ULTRA_LCD) +#if BOTH(AUTO_BED_LEVELING_UBL, ULTRA_LCD) #include "../../feature/bedlevel/bedlevel.h" #endif diff --git a/Marlin/src/gcode/control/M211.cpp b/Marlin/src/gcode/control/M211.cpp index d846e50bd4..3eb0ecf074 100644 --- a/Marlin/src/gcode/control/M211.cpp +++ b/Marlin/src/gcode/control/M211.cpp @@ -38,13 +38,13 @@ void GcodeSuite::M211() { 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])); - SERIAL_ECHOPAIR(" " MSG_Z, LOGICAL_Z_POSITION(soft_endstop_min[Z_AXIS])); + SERIAL_ECHOPAIR( MSG_X, LOGICAL_X_POSITION(soft_endstop[X_AXIS].min)); + SERIAL_ECHOPAIR(" " MSG_Y, LOGICAL_Y_POSITION(soft_endstop[Y_AXIS].min)); + SERIAL_ECHOPAIR(" " MSG_Z, LOGICAL_Z_POSITION(soft_endstop[Z_AXIS].min)); SERIAL_ECHOPGM(MSG_SOFT_MAX); - SERIAL_ECHOPAIR( MSG_X, LOGICAL_X_POSITION(soft_endstop_max[X_AXIS])); - SERIAL_ECHOPAIR(" " MSG_Y, LOGICAL_Y_POSITION(soft_endstop_max[Y_AXIS])); - SERIAL_ECHOLNPAIR(" " MSG_Z, LOGICAL_Z_POSITION(soft_endstop_max[Z_AXIS])); + SERIAL_ECHOPAIR( MSG_X, LOGICAL_X_POSITION(soft_endstop[X_AXIS].max)); + SERIAL_ECHOPAIR(" " MSG_Y, LOGICAL_Y_POSITION(soft_endstop[Y_AXIS].max)); + SERIAL_ECHOLNPAIR(" " MSG_Z, LOGICAL_Z_POSITION(soft_endstop[Z_AXIS].max)); } #endif diff --git a/Marlin/src/gcode/control/M226.cpp b/Marlin/src/gcode/control/M226.cpp index 5c8464586e..55f7dd8c50 100644 --- a/Marlin/src/gcode/control/M226.cpp +++ b/Marlin/src/gcode/control/M226.cpp @@ -43,9 +43,9 @@ void GcodeSuite::M226() { switch (pin_state) { case 1: target = HIGH; break; case 0: target = LOW; break; - case -1: target = !digitalRead(pin); break; + case -1: target = !extDigitalRead(pin); break; } - while (digitalRead(pin) != target) idle(); + while (extDigitalRead(pin) != target) idle(); } } // pin_state -1 0 1 && pin > -1 } // parser.seen('P') diff --git a/Marlin/src/gcode/control/M380_M381.cpp b/Marlin/src/gcode/control/M380_M381.cpp index 0cc00ecc5e..c23d7e5726 100644 --- a/Marlin/src/gcode/control/M380_M381.cpp +++ b/Marlin/src/gcode/control/M380_M381.cpp @@ -22,7 +22,7 @@ #include "../../inc/MarlinConfig.h" -#if ENABLED(EXT_SOLENOID) || ENABLED(MANUAL_SOLENOID_CONTROL) +#if EITHER(EXT_SOLENOID, MANUAL_SOLENOID_CONTROL) #include "../gcode.h" #include "../../feature/solenoid.h" diff --git a/Marlin/src/gcode/control/M42.cpp b/Marlin/src/gcode/control/M42.cpp index f75332cfec..bafc40762e 100644 --- a/Marlin/src/gcode/control/M42.cpp +++ b/Marlin/src/gcode/control/M42.cpp @@ -50,7 +50,7 @@ void GcodeSuite::M42() { if (!parser.boolval('I') && pin_is_protected(pin)) return protected_pin_err(); pinMode(pin, OUTPUT); - digitalWrite(pin, pin_status); + extDigitalWrite(pin, pin_status); analogWrite(pin, pin_status); #if FAN_COUNT > 0 diff --git a/Marlin/src/gcode/control/M605.cpp b/Marlin/src/gcode/control/M605.cpp index ce61f80a7d..f1f64f0ce3 100644 --- a/Marlin/src/gcode/control/M605.cpp +++ b/Marlin/src/gcode/control/M605.cpp @@ -22,7 +22,7 @@ #include "../../inc/MarlinConfig.h" -#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE) +#if HAS_DUPLICATION_MODE //#define DEBUG_DXC_MODE @@ -32,25 +32,34 @@ #include "../../module/tool_change.h" #include "../../module/planner.h" +#define DEBUG_OUT ENABLED(DEBUG_DXC_MODE) +#include "../../core/debug_out.h" + #if ENABLED(DUAL_X_CARRIAGE) /** * M605: Set dual x-carriage movement mode * - * M605 : Restore user specified DEFAULT_DUAL_X_CARRIAGE_MODE - * M605 S0: Full control mode. The slicer has full control over x-carriage movement - * M605 S1: Auto-park mode. The inactive head will auto park/unpark without slicer involvement - * M605 S2 [Xnnn] [Rmmm]: Duplication mode. The second extruder will duplicate the first with nnn - * units x-offset and an optional differential hotend temperature of - * mmm degrees. E.g., with "M605 S2 X100 R2" the second extruder will duplicate - * the first with a spacing of 100mm in the x direction and 2 degrees hotter. - * M605 S3 : Enable Scaled Duplication mode. The second extruder will duplicate the first extruder's - * movement similar to the M605 S2 mode. However, the second extruder will be producing - * a scaled image of the first extruder. The initial x-offset and temperature differential are - * set with M605 S2 [Xnnn] [Rmmm] and then followed with a M605 S3 to start the mirrored movement. + * M605 S0 : (FULL_CONTROL) The slicer has full control over both X-carriages and can achieve optimal travel + * results as long as it supports dual X-carriages. + * + * M605 S1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so that + * additional slicer support is not required. + * + * M605 S2 X R : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with "M605 S2" to initiate duplicated movement. For example, use "M605 S2 X100 R2" to + * make a copy 100mm to the right with E1 2° hotter than E0. + * + * M605 S3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * The temperature differential and initial X offset must be set with "M605 S2 X[offs] R[deg]", + * then followed by "M605 S3" to initiate mirrored movement. + * * M605 W : IDEX What? command. * - * Note: the X axis should be homed after changing dual x-carriage mode. + * Note: the X axis should be homed after changing Dual X-carriage mode. */ void GcodeSuite::M605() { planner.synchronize(); @@ -59,16 +68,16 @@ const DualXMode previous_mode = dual_x_carriage_mode; dual_x_carriage_mode = (DualXMode)parser.value_byte(); - scaled_duplication_mode = false; + mirrored_duplication_mode = false; - if (dual_x_carriage_mode == DXC_SCALED_DUPLICATION_MODE) { + if (dual_x_carriage_mode == DXC_MIRRORED_MODE) { if (previous_mode != DXC_DUPLICATION_MODE) { SERIAL_ECHOLNPGM("Printer must be in DXC_DUPLICATION_MODE prior to "); - SERIAL_ECHOLNPGM("specifying DXC_SCALED_DUPLICATION_MODE."); + SERIAL_ECHOLNPGM("specifying DXC_MIRRORED_MODE."); dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE; return; } - scaled_duplication_mode = true; + mirrored_duplication_mode = true; stepper.set_directions(); float x_jog = current_position[X_AXIS] - .1; for (uint8_t i = 2; --i;) { @@ -102,61 +111,71 @@ #ifdef DEBUG_DXC_MODE if (parser.seen('W')) { - SERIAL_ECHO_START(); - SERIAL_ECHOPGM("IDEX mode: "); + DEBUG_ECHO_START(); + DEBUG_ECHOPGM("Dual X Carriage 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; + case DXC_FULL_CONTROL_MODE: DEBUG_ECHOPGM("FULL_CONTROL"); break; + case DXC_AUTO_PARK_MODE: DEBUG_ECHOPGM("AUTO_PARK"); break; + case DXC_DUPLICATION_MODE: DEBUG_ECHOPGM("DUPLICATION"); break; + case DXC_MIRRORED_MODE: DEBUG_ECHOPGM("MIRRORED"); 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(); + DEBUG_ECHOPAIR("\nActive Ext: ", int(active_extruder)); + if (!active_extruder_parked) DEBUG_ECHOPGM(" NOT "); + DEBUG_ECHOPGM(" parked."); + DEBUG_ECHOPAIR("\nactive_extruder_x_pos: ", current_position[X_AXIS]); + DEBUG_ECHOPAIR("\ninactive_extruder_x_pos: ", inactive_extruder_x_pos); + DEBUG_ECHOPAIR("\nextruder_duplication_enabled: ", int(extruder_duplication_enabled)); + DEBUG_ECHOPAIR("\nduplicate_extruder_x_offset: ", duplicate_extruder_x_offset); + DEBUG_ECHOPAIR("\nduplicate_extruder_temp_offset: ", duplicate_extruder_temp_offset); + DEBUG_ECHOPAIR("\ndelayed_move_time: ", delayed_move_time); + DEBUG_ECHOPAIR("\nX1 Home X: ", x_home_pos(0), "\nX1_MIN_POS=", int(X1_MIN_POS), "\nX1_MAX_POS=", int(X1_MAX_POS)); + DEBUG_ECHOPAIR("\nX2 Home X: ", x_home_pos(1), "\nX2_MIN_POS=", int(X2_MIN_POS), "\nX2_MAX_POS=", int(X2_MAX_POS)); + DEBUG_ECHOPAIR("\nX2_HOME_DIR=", int(X2_HOME_DIR), "\nX2_HOME_POS=", int(X2_HOME_POS)); + DEBUG_ECHOPAIR("\nDEFAULT_DUAL_X_CARRIAGE_MODE=", STRINGIFY(DEFAULT_DUAL_X_CARRIAGE_MODE)); + DEBUG_ECHOPAIR("\nTOOLCHANGE_ZRAISE=", float(TOOLCHANGE_ZRAISE)); + DEBUG_ECHOPAIR("\nDEFAULT_DUPLICATION_X_OFFSET=", int(DEFAULT_DUPLICATION_X_OFFSET)); + DEBUG_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(); + HOTEND_LOOP() { + DEBUG_ECHOPAIR(" nozzle:", int(e)); + LOOP_XYZ(j) DEBUG_ECHOPAIR(" hotend_offset[", axis_codes[j], "_AXIS][", int(e), "]=", hotend_offset[j][e]); + DEBUG_EOL(); } - SERIAL_EOL(); + DEBUG_EOL(); } #endif // DEBUG_DXC_MODE } -#elif ENABLED(DUAL_NOZZLE_DUPLICATION_MODE) +#elif ENABLED(MULTI_NOZZLE_DUPLICATION) + /** + * M605: Set multi-nozzle duplication mode + * + * S2 - Enable duplication mode + * P[mask] - Bit-mask of nozzles to include in the duplication set. + * A value of 0 disables duplication. + * E[index] - Last nozzle index to include in the duplication set. + * A value of 0 disables duplication. + */ void GcodeSuite::M605() { - planner.synchronize(); - extruder_duplication_enabled = parser.intval('S') == (int)DXC_DUPLICATION_MODE; + if (parser.seen("EPS")) { + planner.synchronize(); + if (parser.seenval('P')) duplication_e_mask = parser.value_int(); // Set the mask directly + else if (parser.seenval('E')) duplication_e_mask = pow(2, e + 1) - 1; // Set the mask by E index + const bool ena = (2 == parser.intval('S', extruder_duplication_enabled ? 2 : 0)); + extruder_duplication_enabled = ena && (duplication_e_mask >= 3); + } SERIAL_ECHO_START(); SERIAL_ECHOPGM(MSG_DUPLICATION_MODE); - serialprintln_onoff(extruder_duplication_enabled); + serialprint_onoff(extruder_duplication_enabled); + if (ena) { + SERIAL_ECHOPGM(" ( "); + HOTEND_LOOP() if (TEST(duplication_e_mask, e)) { SERIAL_ECHO(e); SERIAL_CHAR(' '); } + SERIAL_CHAR(')'); + } + SERIAL_EOL(); } -#endif // DUAL_NOZZLE_DUPLICATION_MODE +#endif // MULTI_NOZZLE_DUPLICATION -#endif // DUAL_X_CARRIAGE || DUAL_NOZZLE_DUPLICATION_MODE +#endif // HAS_DUPICATION_MODE diff --git a/Marlin/src/gcode/control/T.cpp b/Marlin/src/gcode/control/T.cpp index 1d98866802..bcb180a968 100644 --- a/Marlin/src/gcode/control/T.cpp +++ b/Marlin/src/gcode/control/T.cpp @@ -31,6 +31,9 @@ #include "../../feature/prusa_MMU2/mmu2.h" #endif +#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) +#include "../../core/debug_out.h" + /** * T0-T: Switch tool, usually switching extruders * @@ -45,14 +48,10 @@ */ void GcodeSuite::T(const uint8_t tool_index) { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR(">>> T(", tool_index); - SERIAL_CHAR(')'); - SERIAL_EOL(); - DEBUG_POS("BEFORE", current_position); - } - #endif + if (DEBUGGING(LEVELING)) { + DEBUG_ECHOLNPAIR(">>> T(", tool_index, ")"); + DEBUG_POS("BEFORE", current_position); + } #if ENABLED(PRUSA_MMU2) if (parser.string_arg) { @@ -75,10 +74,8 @@ void GcodeSuite::T(const uint8_t tool_index) { #endif - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - DEBUG_POS("AFTER", current_position); - SERIAL_ECHOLNPGM("<<< T()"); - } - #endif + if (DEBUGGING(LEVELING)) { + DEBUG_POS("AFTER", current_position); + DEBUG_ECHOLNPGM("<<< T()"); + } } diff --git a/Marlin/src/gcode/eeprom/M500-M504.cpp b/Marlin/src/gcode/eeprom/M500-M504.cpp index d13e1718d5..12e323bd7b 100644 --- a/Marlin/src/gcode/eeprom/M500-M504.cpp +++ b/Marlin/src/gcode/eeprom/M500-M504.cpp @@ -29,10 +29,6 @@ #include "../../lcd/extensible_ui/ui_api.h" #endif -#if NUM_SERIAL > 1 - #include "../../gcode/queue.h" -#endif - /** * M500: Store settings in EEPROM */ diff --git a/Marlin/src/gcode/feature/L6470/M906.cpp b/Marlin/src/gcode/feature/L6470/M906.cpp index f13b205cb6..51bcfaee9e 100644 --- a/Marlin/src/gcode/feature/L6470/M906.cpp +++ b/Marlin/src/gcode/feature/L6470/M906.cpp @@ -29,6 +29,9 @@ #include "../../../module/stepper_indirection.h" #include "../../../module/planner.h" +#define DEBUG_OUT ENABLED(L6470_CHITCHAT) +#include "../../../core/debug_out.h" + /** * * M906: report or set KVAL_HOLD which sets the maximum effective voltage provided by the @@ -93,7 +96,7 @@ void L6470_report_current(L6470 &motor, const uint8_t axis) { L6470.say_axis(axis); #if ENABLED(L6470_CHITCHAT) sprintf_P(temp_buf, PSTR(" status: %4x "), status); - SERIAL_ECHO(temp_buf); + DEBUG_ECHO(temp_buf); print_bin(status); #endif sprintf_P(temp_buf, PSTR("\n...OverCurrent Threshold: %2d (%4d mA)"), overcurrent_threshold, (overcurrent_threshold + 1) * 375); @@ -134,7 +137,7 @@ void L6470_report_current(L6470 &motor, const uint8_t axis) { void GcodeSuite::M906() { #define L6470_SET_KVAL_HOLD(Q) stepper##Q.SetParam(L6470_KVAL_HOLD, value) - L6470_ECHOLNPGM("M906"); + DEBUG_ECHOLNPGM("M906"); bool report_current = true; diff --git a/Marlin/src/gcode/feature/L6470/M916-918.cpp b/Marlin/src/gcode/feature/L6470/M916-918.cpp index 1ec60363a7..590ae8c541 100644 --- a/Marlin/src/gcode/feature/L6470/M916-918.cpp +++ b/Marlin/src/gcode/feature/L6470/M916-918.cpp @@ -29,6 +29,9 @@ #include "../../../module/planner.h" #include "../../../libs/L6470/L6470_Marlin.h" +#define DEBUG_OUT ENABLED(L6470_CHITCHAT) +#include "../../../core/debug_out.h" + /** * * M916: increase KVAL_HOLD until get thermal warning @@ -59,7 +62,7 @@ void GcodeSuite::M916() { - L6470_ECHOLNPGM("M916"); + DEBUG_ECHOLNPGM("M916"); // Variables used by L6470_get_user_input function - some may not be used char axis_mon[3][3] = { " ", " ", " " }; // list of Axes to be monitored @@ -80,7 +83,7 @@ void GcodeSuite::M916() { if (L6470.get_user_input(driver_count, axis_index, axis_mon, position_max, position_min, final_feedrate, kval_hold, over_current_flag, ocd_th_val, stall_th_val, over_current_threshold)) return; // quit if invalid user input - L6470_ECHOLNPAIR("feedrate = ", final_feedrate); + DEBUG_ECHOLNPAIR("feedrate = ", final_feedrate); planner.synchronize(); // wait for all current movement commands to complete @@ -92,11 +95,11 @@ void GcodeSuite::M916() { char gcode_string[80]; uint16_t status_composite = 0; - L6470_ECHOLNPGM(".\n."); + DEBUG_ECHOLNPGM(".\n."); do { - L6470_ECHOLNPAIR("kval_hold = ", kval_hold); // set & report KVAL_HOLD for this run + DEBUG_ECHOLNPAIR("kval_hold = ", kval_hold); // set & report KVAL_HOLD for this run for (j = 0; j < driver_count; j++) L6470.set_param(axis_index[j], L6470_KVAL_HOLD, kval_hold); @@ -119,9 +122,9 @@ void GcodeSuite::M916() { } if (status_composite && (status_composite & STATUS_UVLO)) { - L6470_ECHOLNPGM("Test aborted (Undervoltage lockout active)"); + DEBUG_ECHOLNPGM("Test aborted (Undervoltage lockout active)"); for (j = 0; j < driver_count; j++) { - L6470_ECHOPGM("..."); + DEBUG_ECHOPGM("..."); L6470.error_status_decode(axis_status[j], axis_index[j]); } return; @@ -133,18 +136,18 @@ void GcodeSuite::M916() { } while (!(status_composite & (STATUS_TH_WRN | STATUS_TH_SD)) && kval_hold); // exit when kval_hold == 0 (rolls over) - L6470_ECHOPGM(".\n.\nThermal warning/shutdown "); + DEBUG_ECHOPGM(".\n.\nThermal warning/shutdown "); if ((status_composite & (STATUS_TH_WRN | STATUS_TH_SD))) { - L6470_ECHOLNPGM("has occurred"); + DEBUG_ECHOLNPGM("has occurred"); for (j = 0; j < driver_count; j++) { - L6470_ECHOPGM("..."); + DEBUG_ECHOPGM("..."); L6470.error_status_decode(axis_status[j], axis_index[j]); } } else - L6470_ECHOLNPGM("(Unable to get)"); + DEBUG_ECHOLNPGM("(Unable to get)"); - L6470_ECHOLNPGM("."); + DEBUG_ECHOLNPGM("."); } /** @@ -176,7 +179,7 @@ void GcodeSuite::M916() { */ void GcodeSuite::M917() { - L6470_ECHOLNPGM("M917"); + DEBUG_ECHOLNPGM("M917"); char axis_mon[3][3] = { " ", " ", " " }; // list of axes to be monitored uint8_t axis_index[3]; @@ -196,7 +199,7 @@ void GcodeSuite::M917() { if (L6470.get_user_input(driver_count, axis_index, axis_mon, position_max, position_min, final_feedrate, kval_hold, over_current_flag, ocd_th_val, stall_th_val, over_current_threshold)) return; // quit if invalid user input - L6470_ECHOLNPAIR("feedrate = ", final_feedrate); + DEBUG_ECHOLNPAIR("feedrate = ", final_feedrate); planner.synchronize(); // wait for all current movement commands to complete for (j = 0; j < driver_count; j++) @@ -211,16 +214,16 @@ void GcodeSuite::M917() { // 2 - OCD finalized - decreasing STALL - exit when STALL warning happens // 3 - OCD finalized - increasing STALL - exit when STALL warning stop // 4 - all testing completed - L6470_ECHOPAIR(".\n.\n.\nover_current threshold : ", (ocd_th_val + 1) * 375); // first status display - L6470_ECHOPAIR(" (OCD_TH: : ", ocd_th_val); - L6470_ECHOPAIR(") Stall threshold: ", (stall_th_val + 1) * 31.25); - L6470_ECHOPAIR(" (STALL_TH: ", stall_th_val); - L6470_ECHOLNPGM(")"); + DEBUG_ECHOPAIR(".\n.\n.\nover_current threshold : ", (ocd_th_val + 1) * 375); // first status display + DEBUG_ECHOPAIR(" (OCD_TH: : ", ocd_th_val); + DEBUG_ECHOPAIR(") Stall threshold: ", (stall_th_val + 1) * 31.25); + DEBUG_ECHOPAIR(" (STALL_TH: ", stall_th_val); + DEBUG_ECHOLNPGM(")"); do { - L6470_ECHOPAIR("STALL threshold : ", (stall_th_val + 1) * 31.25); - L6470_ECHOLNPAIR(" OCD threshold : ", (ocd_th_val + 1) * 375); + DEBUG_ECHOPAIR("STALL threshold : ", (stall_th_val + 1) * 31.25); + DEBUG_ECHOLNPAIR(" OCD threshold : ", (ocd_th_val + 1) * 375); sprintf_P(gcode_string, PSTR("G0 %s%4.3f F%4.3f"), temp_axis_string, position_min, final_feedrate); gcode.process_subcommands_now_P(gcode_string); @@ -238,16 +241,16 @@ void GcodeSuite::M917() { } if (status_composite && (status_composite & STATUS_UVLO)) { - L6470_ECHOLNPGM("Test aborted (Undervoltage lockout active)"); + DEBUG_ECHOLNPGM("Test aborted (Undervoltage lockout active)"); for (j = 0; j < driver_count; j++) { - L6470_ECHOPGM("..."); + DEBUG_ECHOPGM("..."); L6470.error_status_decode(axis_status[j], axis_index[j]); } return; } if (status_composite & (STATUS_TH_WRN | STATUS_TH_SD)) { - L6470_ECHOLNPGM("thermal problem - waiting for chip(s) to cool down "); + DEBUG_ECHOLNPGM("thermal problem - waiting for chip(s) to cool down "); uint16_t status_composite_temp = 0; uint8_t k = 0; do { @@ -255,11 +258,11 @@ void GcodeSuite::M917() { if (!(k % 4)) { kval_hold *= 0.95; L6470_EOL(); - L6470_ECHOLNPAIR("Lowering KVAL_HOLD by about 5% to ", kval_hold); + DEBUG_ECHOLNPAIR("Lowering KVAL_HOLD by about 5% to ", kval_hold); for (j = 0; j < driver_count; j++) L6470.set_param(axis_index[j], L6470_KVAL_HOLD, kval_hold); } - L6470_ECHOLNPGM("."); + DEBUG_ECHOLNPGM("."); gcode.reset_stepper_timeout(); // reset_stepper_timeout to keep steppers powered watchdog_reset(); // beat the dog safe_delay(5000); @@ -281,22 +284,22 @@ void GcodeSuite::M917() { if (ocd_th_val >=15) { ocd_th_val = 15; // limit to max test_phase = 2; // at highest value so skip phase 1 - L6470_ECHOLNPGM("LOGIC E0A OCD at highest - skip to 2"); + DEBUG_ECHOLNPGM("LOGIC E0A OCD at highest - skip to 2"); } else { ocd_th_val++; // normal exit to next phase test_phase = 1; // setup for first pass of phase 1 - L6470_ECHOLNPGM("LOGIC E0B - inc OCD & go to 1"); + DEBUG_ECHOLNPGM("LOGIC E0B - inc OCD & go to 1"); } } else { // phase 0 without OCD warning - keep on decrementing if can if (ocd_th_val) { ocd_th_val--; // try lower value - L6470_ECHOLNPGM("LOGIC E0C - dec OCD"); + DEBUG_ECHOLNPGM("LOGIC E0C - dec OCD"); } else { test_phase = 2; // at lowest value without warning so skip phase 1 - L6470_ECHOLNPGM("LOGIC E0D - OCD at latest - go to 2"); + DEBUG_ECHOLNPGM("LOGIC E0D - OCD at latest - go to 2"); } } } break; @@ -307,16 +310,16 @@ void GcodeSuite::M917() { if (ocd_th_val >= 15) { ocd_th_val = 15; // limit to max test_phase = 2; // at highest value so go to next phase - L6470_ECHOLNPGM("LOGIC E1A - OCD at max - go to 2"); + DEBUG_ECHOLNPGM("LOGIC E1A - OCD at max - go to 2"); } else { ocd_th_val++; // try a higher value - L6470_ECHOLNPGM("LOGIC E1B - inc OCD"); + DEBUG_ECHOLNPGM("LOGIC E1B - inc OCD"); } } else { // phase 1 without OCD warning - normal exit to phase 2 test_phase = 2; - L6470_ECHOLNPGM("LOGIC E1C - no OCD warning - go to 1"); + DEBUG_ECHOLNPGM("LOGIC E1C - no OCD warning - go to 1"); } } break; @@ -325,25 +328,25 @@ void GcodeSuite::M917() { // phase 2 with stall warning - time to go to next phase if (stall_th_val >= 127) { stall_th_val = 127; // limit to max - L6470_ECHOLNPGM("LOGIC E2A - STALL warning, STALL at max, quit"); - L6470_ECHOLNPGM("finished - STALL at maximum value but still have stall warning"); + DEBUG_ECHOLNPGM("LOGIC E2A - STALL warning, STALL at max, quit"); + DEBUG_ECHOLNPGM("finished - STALL at maximum value but still have stall warning"); test_phase = 4; } else { test_phase = 3; // normal exit to next phase (found failing value of STALL) stall_th_val++; // setup for first pass of phase 3 - L6470_ECHOLNPGM("LOGIC E2B - INC - STALL warning, inc Stall, go to 3"); + DEBUG_ECHOLNPGM("LOGIC E2B - INC - STALL warning, inc Stall, go to 3"); } } else { // phase 2 without stall warning - decrement if can if (stall_th_val) { stall_th_val--; // try a lower value - L6470_ECHOLNPGM("LOGIC E2C - no STALL, dec STALL"); + DEBUG_ECHOLNPGM("LOGIC E2C - no STALL, dec STALL"); } else { - L6470_ECHOLNPGM("finished - STALL at lowest value but still do NOT have stall warning"); + DEBUG_ECHOLNPGM("finished - STALL at lowest value but still do NOT have stall warning"); test_phase = 4; - L6470_ECHOLNPGM("LOGIC E2D - no STALL, at lowest so quit"); + DEBUG_ECHOLNPGM("LOGIC E2D - no STALL, at lowest so quit"); } } } break; @@ -353,19 +356,19 @@ void GcodeSuite::M917() { // phase 3 with stall warning - increment if can if (stall_th_val >= 127) { stall_th_val = 127; // limit to max - L6470_ECHOLNPGM("finished - STALL at maximum value but still have stall warning"); + DEBUG_ECHOLNPGM("finished - STALL at maximum value but still have stall warning"); test_phase = 4; - L6470_ECHOLNPGM("LOGIC E3A - STALL, at max so quit"); + DEBUG_ECHOLNPGM("LOGIC E3A - STALL, at max so quit"); } else { stall_th_val++; // still looking for passing value - L6470_ECHOLNPGM("LOGIC E3B - STALL, inc stall"); + DEBUG_ECHOLNPGM("LOGIC E3B - STALL, inc stall"); } } else { //phase 3 without stall warning but have OCD warning - L6470_ECHOLNPGM("Hardware problem - OCD warning without STALL warning"); + DEBUG_ECHOLNPGM("Hardware problem - OCD warning without STALL warning"); test_phase = 4; - L6470_ECHOLNPGM("LOGIC E3C - not STALLED, hardware problem (quit)"); + DEBUG_ECHOLNPGM("LOGIC E3C - not STALLED, hardware problem (quit)"); } } break; @@ -377,30 +380,30 @@ void GcodeSuite::M917() { case 0: { // phase 0 without OCD warning - keep on decrementing if can if (ocd_th_val) { ocd_th_val--; // try lower value - L6470_ECHOLNPGM("LOGIC N0A - DEC OCD"); + DEBUG_ECHOLNPGM("LOGIC N0A - DEC OCD"); } else { test_phase = 2; // at lowest value without warning so skip phase 1 - L6470_ECHOLNPGM("LOGIC N0B - OCD at lowest (go to phase 2)"); + DEBUG_ECHOLNPGM("LOGIC N0B - OCD at lowest (go to phase 2)"); } } break; - case 1: L6470_ECHOLNPGM("LOGIC N1 (go directly to 2)"); // phase 1 without OCD warning - drop directly to phase 2 + case 1: DEBUG_ECHOLNPGM("LOGIC N1 (go directly to 2)"); // phase 1 without OCD warning - drop directly to phase 2 case 2: { // phase 2 without stall warning - keep on decrementing if can if (stall_th_val) { stall_th_val--; // try a lower value (stay in phase 2) - L6470_ECHOLNPGM("LOGIC N2B - dec STALL"); + DEBUG_ECHOLNPGM("LOGIC N2B - dec STALL"); } else { - L6470_ECHOLNPGM("finished - STALL at lowest value but still no stall warning"); + DEBUG_ECHOLNPGM("finished - STALL at lowest value but still no stall warning"); test_phase = 4; - L6470_ECHOLNPGM("LOGIC N2C - STALL at lowest (quit)"); + DEBUG_ECHOLNPGM("LOGIC N2C - STALL at lowest (quit)"); } } break; case 3: { test_phase = 4; - L6470_ECHOLNPGM("LOGIC N3 - finished!"); + DEBUG_ECHOLNPGM("LOGIC N3 - finished!"); } break; // phase 3 without any warnings - desired exit } // } // end of status checks @@ -409,22 +412,22 @@ void GcodeSuite::M917() { for (j = 0; j < driver_count; j++) { // update threshold(s) L6470.set_param(axis_index[j], L6470_OCD_TH, ocd_th_val); L6470.set_param(axis_index[j], L6470_STALL_TH, stall_th_val); - if (L6470.get_param(axis_index[j], L6470_OCD_TH) != ocd_th_val) L6470_ECHOLNPGM("OCD mismatch"); - if (L6470.get_param(axis_index[j], L6470_STALL_TH) != stall_th_val) L6470_ECHOLNPGM("STALL mismatch"); + if (L6470.get_param(axis_index[j], L6470_OCD_TH) != ocd_th_val) DEBUG_ECHOLNPGM("OCD mismatch"); + if (L6470.get_param(axis_index[j], L6470_STALL_TH) != stall_th_val) DEBUG_ECHOLNPGM("STALL mismatch"); } } } while (test_phase != 4); if (status_composite) { - L6470_ECHOLNPGM("Completed with errors"); + DEBUG_ECHOLNPGM("Completed with errors"); for (j = 0; j < driver_count; j++) { - L6470_ECHOPGM("..."); + DEBUG_ECHOPGM("..."); L6470.error_status_decode(axis_status[j], axis_index[j]); } } else - L6470_ECHOLNPGM("Completed with no errors"); + DEBUG_ECHOLNPGM("Completed with no errors"); } // M917 @@ -448,7 +451,7 @@ void GcodeSuite::M917() { */ void GcodeSuite::M918() { - L6470_ECHOLNPGM("M918"); + DEBUG_ECHOLNPGM("M918"); char axis_mon[3][3] = { " ", " ", " " }; // List of axes to monitor uint8_t axis_index[3]; @@ -469,7 +472,7 @@ void GcodeSuite::M918() { uint8_t m_steps = parser.byteval('M'); LIMIT(m_steps, 0, 128); - L6470_ECHOLNPAIR("M = ", m_steps); + DEBUG_ECHOLNPAIR("M = ", m_steps); int8_t m_bits = -1; if (m_steps > 85) m_bits = 7; // 128 (no synch output) @@ -484,15 +487,15 @@ void GcodeSuite::M918() { if (m_bits >= 0) { const int micros = _BV(m_bits); - if (micros < 100) { L6470_CHAR(' '); if (micros < 10) L6470_CHAR(' '); } - L6470_ECHO(micros); - L6470_ECHOPGM(" uSTEPS"); + if (micros < 100) { DEBUG_CHAR(' '); if (micros < 10) DEBUG_CHAR(' '); } + DEBUG_ECHO(micros); + DEBUG_ECHOPGM(" uSTEPS"); } for (j = 0; j < driver_count; j++) L6470.set_param(axis_index[j], L6470_STEP_MODE, m_bits); // set microsteps - L6470_ECHOLNPAIR("target (maximum) feedrate = ",final_feedrate); + DEBUG_ECHOLNPAIR("target (maximum) feedrate = ",final_feedrate); float feedrate_inc = final_feedrate / 10, // start at 1/10 of max & go up by 1/10 per step) current_feedrate = 0; @@ -508,11 +511,11 @@ void GcodeSuite::M918() { char gcode_string[80]; uint16_t status_composite = 0; - L6470_ECHOLNPGM(".\n.\n."); // make the feedrate prints easier to see + DEBUG_ECHOLNPGM(".\n.\n."); // make the feedrate prints easier to see do { current_feedrate += feedrate_inc; - L6470_ECHOLNPAIR("...feedrate = ", current_feedrate); + DEBUG_ECHOLNPAIR("...feedrate = ", current_feedrate); sprintf_P(gcode_string, PSTR("G0 %s%4.3f F%4.3f"), temp_axis_string, position_min, current_feedrate); gcode.process_subcommands_now_P(gcode_string); @@ -529,15 +532,16 @@ void GcodeSuite::M918() { if (status_composite) break; // quit if any errors flags are raised } while (current_feedrate < final_feedrate * 0.99); + DEBUG_ECHOPGM("Completed with errors"); if (status_composite) { - L6470_ECHOLNPGM("Completed with errors"); + DEBUG_ECHOLNPGM("errors"); for (j = 0; j < driver_count; j++) { - L6470_ECHOPGM("..."); + DEBUG_ECHOPGM("..."); L6470.error_status_decode(axis_status[j], axis_index[j]); } } else - L6470_ECHOLNPGM("Completed with no errors"); + DEBUG_ECHOLNPGM("no errors"); } // M918 diff --git a/Marlin/src/gcode/feature/advance/M900.cpp b/Marlin/src/gcode/feature/advance/M900.cpp index 6b6a3d271e..ceb95dd54c 100644 --- a/Marlin/src/gcode/feature/advance/M900.cpp +++ b/Marlin/src/gcode/feature/advance/M900.cpp @@ -28,45 +28,115 @@ #include "../../../module/planner.h" #include "../../../module/stepper.h" +#if ENABLED(EXTRA_LIN_ADVANCE_K) + float saved_extruder_advance_K[EXTRUDERS]; + uint8_t lin_adv_slot = 0; +#endif + + /** * M900: Get or Set Linear Advance K-factor - * - * K Set advance K factor + * T Which tool to address + * K Set current advance K factor (Slot 0). + * L Set secondary advance K factor (Slot 1). Requires EXTRA_LIN_ADVANCE_K. + * S<0/1> Activate slot 0 or 1. Requires EXTRA_LIN_ADVANCE_K. */ void GcodeSuite::M900() { #if EXTRUDERS < 2 constexpr uint8_t tmp_extruder = 0; #else - const uint8_t tmp_extruder = parser.seenval('T') ? parser.value_int() : active_extruder; + const uint8_t tmp_extruder = parser.intval('T', active_extruder); if (tmp_extruder >= EXTRUDERS) { SERIAL_ECHOLNPGM("?T value out of range."); return; } #endif - if (parser.seenval('K')) { - const float newK = parser.floatval('K'); - if (WITHIN(newK, 0, 10)) { - planner.synchronize(); - planner.extruder_advance_K[tmp_extruder] = newK; - } - else - SERIAL_ECHOLNPGM("?K value out of range (0-10)."); - } - else { - SERIAL_ECHO_START(); - #if EXTRUDERS < 2 - SERIAL_ECHOLNPAIR("Advance K=", planner.extruder_advance_K[0]); - #else - SERIAL_ECHOPGM("Advance K"); - LOOP_L_N(i, EXTRUDERS) { - SERIAL_CHAR(' '); SERIAL_ECHO(int(i)); - SERIAL_CHAR('='); SERIAL_ECHO(planner.extruder_advance_K[i]); + #if ENABLED(EXTRA_LIN_ADVANCE_K) + + bool ext_slot = bitRead(lin_adv_slot, tmp_extruder); + + if (parser.seenval('S')) { + const bool slot = parser.value_bool(); + if (ext_slot != slot) { + ext_slot = slot; + bitWrite(lin_adv_slot, tmp_extruder, slot); + planner.synchronize(); + const float temp = planner.extruder_advance_K[tmp_extruder]; + planner.extruder_advance_K[tmp_extruder] = saved_extruder_advance_K[tmp_extruder]; + saved_extruder_advance_K[tmp_extruder] = temp; } - SERIAL_EOL(); - #endif - } + } + + if (parser.seenval('K')) { + const float newK = parser.value_float(); + if (WITHIN(newK, 0, 10)) { + if (ext_slot) + saved_extruder_advance_K[tmp_extruder] = newK; + else { + planner.synchronize(); + planner.extruder_advance_K[tmp_extruder] = newK; + } + } + else + SERIAL_ECHOLNPGM("?K value out of range (0-10)."); + } + + if (parser.seenval('L')) { + const float newL = parser.value_float(); + if (WITHIN(newL, 0, 10)) { + if (!ext_slot) + saved_extruder_advance_K[tmp_extruder] = newL; + else { + planner.synchronize(); + planner.extruder_advance_K[tmp_extruder] = newL; + } + } + else + SERIAL_ECHOLNPGM("?L value out of range (0-10)."); + } + + if (!parser.seen_any()) { + #if EXTRUDERS < 2 + SERIAL_ECHOLNPAIR("Advance S", ext_slot, " K", planner.extruder_advance_K[0]); + SERIAL_ECHOLNPAIR("(Slot ", 1 - ext_slot, " K", saved_extruder_advance_K[0], ")"); + #else + LOOP_L_N(i, EXTRUDERS) { + const int slot = (int)bitRead(lin_adv_slot, i); + SERIAL_ECHOLNPAIR("Advance T", int(i), " S", slot, " K", planner.extruder_advance_K[i]); + SERIAL_ECHOLNPAIR("(Slot ", 1 - slot, " K", saved_extruder_advance_K[i], ")"); + SERIAL_EOL(); + } + #endif + } + + #else + + if (parser.seenval('K')) { + const float newK = parser.value_float(); + if (WITHIN(newK, 0, 10)) { + planner.synchronize(); + planner.extruder_advance_K[tmp_extruder] = newK; + } + else + SERIAL_ECHOLNPGM("?K value out of range (0-10)."); + } + else { + SERIAL_ECHO_START(); + #if EXTRUDERS < 2 + SERIAL_ECHOLNPAIR("Advance K=", planner.extruder_advance_K[0]); + #else + SERIAL_ECHOPGM("Advance K"); + LOOP_L_N(i, EXTRUDERS) { + SERIAL_CHAR(' '); SERIAL_ECHO(int(i)); + SERIAL_CHAR('='); SERIAL_ECHO(planner.extruder_advance_K[i]); + } + SERIAL_EOL(); + #endif + } + + #endif } #endif // LIN_ADVANCE diff --git a/Marlin/src/gcode/feature/camera/M240.cpp b/Marlin/src/gcode/feature/camera/M240.cpp index 4c376be5b8..ca4dc00125 100644 --- a/Marlin/src/gcode/feature/camera/M240.cpp +++ b/Marlin/src/gcode/feature/camera/M240.cpp @@ -127,7 +127,7 @@ void GcodeSuite::M240() { parser.seenval('Y') ? RAW_Y_POSITION(parser.value_linear_units()) : photo_position[Y_AXIS], (parser.seenval('Z') ? parser.value_linear_units() : photo_position[Z_AXIS]) + current_position[Z_AXIS] }; - clamp_to_software_endstops(raw); + apply_motion_limits(raw); do_blocking_move_to(raw, fr_mm_s); #ifdef PHOTO_SWITCH_POSITION diff --git a/Marlin/src/gcode/feature/caselight/M355.cpp b/Marlin/src/gcode/feature/caselight/M355.cpp index 324a50f6ee..d3bc2c8399 100644 --- a/Marlin/src/gcode/feature/caselight/M355.cpp +++ b/Marlin/src/gcode/feature/caselight/M355.cpp @@ -57,7 +57,7 @@ SERIAL_ECHOLNPGM("Case light: off"); } else { - if (!USEABLE_HARDWARE_PWM(CASE_LIGHT_PIN)) SERIAL_ECHOLNPGM("Case light: on"); + if (!PWM_PIN(CASE_LIGHT_PIN)) SERIAL_ECHOLNPGM("Case light: on"); else SERIAL_ECHOLNPAIR("Case light: ", case_light_brightness); } } diff --git a/Marlin/src/gcode/feature/digipot/M907-M910.cpp b/Marlin/src/gcode/feature/digipot/M907-M910.cpp index e7cad77757..107c77f41c 100644 --- a/Marlin/src/gcode/feature/digipot/M907-M910.cpp +++ b/Marlin/src/gcode/feature/digipot/M907-M910.cpp @@ -22,7 +22,7 @@ #include "../../../inc/MarlinConfig.h" -#if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM || ENABLED(DIGIPOT_I2C) || ENABLED(DAC_STEPPER_CURRENT) +#if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM || EITHER(DIGIPOT_I2C, DAC_STEPPER_CURRENT) #include "../../gcode.h" @@ -50,7 +50,7 @@ void GcodeSuite::M907() { #elif HAS_MOTOR_CURRENT_PWM - #if PIN_EXISTS(MOTOR_CURRENT_PWM_X) || PIN_EXISTS(MOTOR_CURRENT_PWM_Y) || PIN_EXISTS(MOTOR_CURRENT_PWM_XY) + #if ANY_PIN(MOTOR_CURRENT_PWM_X, MOTOR_CURRENT_PWM_Y, MOTOR_CURRENT_PWM_XY) if (parser.seenval('X') || parser.seenval('Y')) stepper.digipot_current(0, parser.value_int()); #endif #if PIN_EXISTS(MOTOR_CURRENT_PWM_Z) diff --git a/Marlin/src/gcode/feature/fwretract/M207-M209.cpp b/Marlin/src/gcode/feature/fwretract/M207-M209.cpp index c3101b0841..b142972490 100644 --- a/Marlin/src/gcode/feature/fwretract/M207-M209.cpp +++ b/Marlin/src/gcode/feature/fwretract/M207-M209.cpp @@ -45,16 +45,16 @@ void GcodeSuite::M207() { /** * M208: Set firmware un-retraction values * - * S[+units] retract_recover_length (in addition to M207 S*) - * W[+units] swap_retract_recover_length (multi-extruder) + * S[+units] retract_recover_extra (in addition to M207 S*) + * W[+units] swap_retract_recover_extra (multi-extruder) * F[units/min] retract_recover_feedrate_mm_s * R[units/min] swap_retract_recover_feedrate_mm_s */ void GcodeSuite::M208() { - if (parser.seen('S')) fwretract.settings.retract_recover_length = parser.value_axis_units(E_AXIS); + if (parser.seen('S')) fwretract.settings.retract_recover_extra = 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 (parser.seen('W')) fwretract.settings.swap_retract_recover_extra = parser.value_axis_units(E_AXIS); } #if ENABLED(FWRETRACT_AUTORETRACT) diff --git a/Marlin/src/gcode/feature/pause/M125.cpp b/Marlin/src/gcode/feature/pause/M125.cpp index 796bd79a1b..7c6c3c54aa 100644 --- a/Marlin/src/gcode/feature/pause/M125.cpp +++ b/Marlin/src/gcode/feature/pause/M125.cpp @@ -36,7 +36,7 @@ #endif /** - * M125: Store current position and move to filament change position. + * M125: Store current position and move to parking position. * Called on pause (by M25) to prevent material leaking onto the * object. On resume (M24) the head will be moved back and the * print will resume. @@ -67,9 +67,9 @@ void GcodeSuite::M125() { // Lift Z axis if (parser.seenval('Z')) park_point.z = parser.linearval('Z'); - #if HAS_HOTEND_OFFSET && DISABLED(DUAL_X_CARRIAGE) && DISABLED(DELTA) - park_point.x += (active_extruder ? hotend_offset[X_AXIS][active_extruder] : 0); - park_point.y += (active_extruder ? hotend_offset[Y_AXIS][active_extruder] : 0); + #if HAS_HOTEND_OFFSET && DISABLED(DUAL_X_CARRIAGE, DELTA) + park_point.x += hotend_offset[X_AXIS][active_extruder]; + park_point.y += hotend_offset[Y_AXIS][active_extruder]; #endif #if ENABLED(SDSUPPORT) @@ -79,14 +79,14 @@ void GcodeSuite::M125() { #endif #if HAS_LCD_MENU - lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INIT, ADVANCED_PAUSE_MODE_PAUSE_PRINT); + lcd_pause_show_message(PAUSE_MESSAGE_PAUSING, PAUSE_MODE_PAUSE_PRINT); const bool show_lcd = parser.seenval('P'); #else constexpr bool show_lcd = false; #endif if (pause_print(retract, park_point, 0, show_lcd)) { - if (!sd_printing || show_lcd ) { + if (!sd_printing || show_lcd) { wait_for_confirmation(false, 0); resume_print(0, 0, PAUSE_PARK_RETRACT_LENGTH, 0); } diff --git a/Marlin/src/gcode/feature/pause/M600.cpp b/Marlin/src/gcode/feature/pause/M600.cpp index d42df6f5ab..78e7e8e658 100644 --- a/Marlin/src/gcode/feature/pause/M600.cpp +++ b/Marlin/src/gcode/feature/pause/M600.cpp @@ -76,7 +76,7 @@ void GcodeSuite::M600() { // Show initial "wait for start" message #if HAS_LCD_MENU && DISABLED(MMU2_MENUS) - lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INIT, ADVANCED_PAUSE_MODE_PAUSE_PRINT, target_extruder); + lcd_pause_show_message(PAUSE_MESSAGE_CHANGING, PAUSE_MODE_PAUSE_PRINT, target_extruder); #endif #if ENABLED(HOME_BEFORE_FILAMENT_CHANGE) @@ -90,7 +90,7 @@ void GcodeSuite::M600() { if ( active_extruder != target_extruder #if ENABLED(DUAL_X_CARRIAGE) - && dual_x_carriage_mode != DXC_DUPLICATION_MODE && dual_x_carriage_mode != DXC_SCALED_DUPLICATION_MODE + && dual_x_carriage_mode != DXC_DUPLICATION_MODE && dual_x_carriage_mode != DXC_MIRRORED_MODE #endif ) tool_change(target_extruder, 0, false); #endif @@ -109,9 +109,9 @@ void GcodeSuite::M600() { if (parser.seenval('X')) park_point.x = parser.linearval('X'); if (parser.seenval('Y')) park_point.y = parser.linearval('Y'); - #if HAS_HOTEND_OFFSET && DISABLED(DUAL_X_CARRIAGE) && DISABLED(DELTA) - park_point.x += (active_extruder ? hotend_offset[X_AXIS][active_extruder] : 0); - park_point.y += (active_extruder ? hotend_offset[Y_AXIS][active_extruder] : 0); + #if HAS_HOTEND_OFFSET && DISABLED(DUAL_X_CARRIAGE, DELTA) + park_point.x += hotend_offset[X_AXIS][active_extruder]; + park_point.y += hotend_offset[Y_AXIS][active_extruder]; #endif #if ENABLED(MMU2_MENUS) diff --git a/Marlin/src/gcode/feature/pause/M701_M702.cpp b/Marlin/src/gcode/feature/pause/M701_M702.cpp index 7c3e65c683..08c0b6a5d4 100644 --- a/Marlin/src/gcode/feature/pause/M701_M702.cpp +++ b/Marlin/src/gcode/feature/pause/M701_M702.cpp @@ -68,7 +68,7 @@ void GcodeSuite::M701() { // Show initial "wait for load" message #if HAS_LCD_MENU - lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_LOAD, ADVANCED_PAUSE_MODE_LOAD_FILAMENT, target_extruder); + lcd_pause_show_message(PAUSE_MESSAGE_LOAD, PAUSE_MODE_LOAD_FILAMENT, target_extruder); #endif #if EXTRUDERS > 1 && DISABLED(PRUSA_MMU2) @@ -90,7 +90,7 @@ void GcodeSuite::M701() { const float fast_load_length = ABS(parser.seen('L') ? parser.value_axis_units(E_AXIS) : fc_settings[active_extruder].load_length); load_filament(slow_load_length, fast_load_length, ADVANCED_PAUSE_PURGE_LENGTH, FILAMENT_CHANGE_ALERT_BEEPS, - true, thermalManager.still_heating(target_extruder), ADVANCED_PAUSE_MODE_LOAD_FILAMENT + true, thermalManager.still_heating(target_extruder), PAUSE_MODE_LOAD_FILAMENT #if ENABLED(DUAL_X_CARRIAGE) , target_extruder #endif @@ -109,7 +109,7 @@ void GcodeSuite::M701() { // Show status screen #if HAS_LCD_MENU - lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS); + lcd_pause_show_message(PAUSE_MESSAGE_STATUS); #endif } @@ -139,7 +139,7 @@ void GcodeSuite::M702() { // Show initial "wait for unload" message #if HAS_LCD_MENU - lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_UNLOAD, ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, target_extruder); + lcd_pause_show_message(PAUSE_MESSAGE_UNLOAD, PAUSE_MODE_UNLOAD_FILAMENT, target_extruder); #endif #if EXTRUDERS > 1 && DISABLED(PRUSA_MMU2) @@ -161,7 +161,7 @@ void GcodeSuite::M702() { if (!parser.seenval('T')) { HOTEND_LOOP() { if (e != active_extruder) tool_change(e, 0, false); - unload_filament(-fc_settings[e].unload_length, true, ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT); + unload_filament(-fc_settings[e].unload_length, true, PAUSE_MODE_UNLOAD_FILAMENT); } } else @@ -171,7 +171,7 @@ void GcodeSuite::M702() { 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); + unload_filament(unload_length, true, PAUSE_MODE_UNLOAD_FILAMENT); } #endif @@ -187,7 +187,7 @@ void GcodeSuite::M702() { // Show status screen #if HAS_LCD_MENU - lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS); + lcd_pause_show_message(PAUSE_MESSAGE_STATUS); #endif } diff --git a/Marlin/src/gcode/feature/powerloss/M1000.cpp b/Marlin/src/gcode/feature/powerloss/M1000.cpp index 06a3196869..dfa55fc759 100644 --- a/Marlin/src/gcode/feature/powerloss/M1000.cpp +++ b/Marlin/src/gcode/feature/powerloss/M1000.cpp @@ -29,17 +29,20 @@ #include "../../../module/motion.h" #include "../../../lcd/ultralcd.h" +#define DEBUG_OUT ENABLED(DEBUG_POWER_LOSS_RECOVERY) +#include "../../../core/debug_out.h" + void menu_job_recovery(); -#if ENABLED(DEBUG_POWER_LOSS_RECOVERY) - - inline void plr_error(PGM_P const prefix) { - SERIAL_ECHO_START(); +inline void plr_error(PGM_P const prefix) { + #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) + DEBUG_ECHO_START(); serialprintPGM(prefix); - SERIAL_ECHOLNPGM(" Power-Loss Recovery Data"); - } - -#endif + DEBUG_ECHOLNPGM(" Power-Loss Recovery Data"); + #else + UNUSED(prefix); + #endif +} /** * M1000: Resume from power-loss (undocumented) @@ -54,11 +57,8 @@ void GcodeSuite::M1000() { else recovery.resume(); } - else { - #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) - plr_error(recovery.info.valid_head ? PSTR("No") : PSTR("Invalid")); - #endif - } + else + plr_error(recovery.info.valid_head ? PSTR("No") : PSTR("Invalid")); } diff --git a/Marlin/src/gcode/feature/powerloss/M413.cpp b/Marlin/src/gcode/feature/powerloss/M413.cpp index 1a0e3a568c..4b7c253a7d 100644 --- a/Marlin/src/gcode/feature/powerloss/M413.cpp +++ b/Marlin/src/gcode/feature/powerloss/M413.cpp @@ -50,7 +50,7 @@ void GcodeSuite::M413() { 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('E')) serialprintPGM(recovery.exists() ? PSTR("PLR Exists\n") : PSTR("No PLR\n")); if (parser.seen('V')) serialprintPGM(recovery.valid() ? PSTR("Valid\n") : PSTR("Invalid\n")); #endif } diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index c9a6995170..0837e1d0fa 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -40,6 +40,11 @@ GcodeSuite gcode; #include "../feature/host_actions.h" #endif +#if ENABLED(POWER_LOSS_RECOVERY) + #include "../sd/cardreader.h" + #include "../feature/power_loss_recovery.h" +#endif + #include "../Marlin.h" // for idle() and suspend_auto_report millis_t GcodeSuite::previous_move_ms; @@ -86,8 +91,9 @@ int8_t GcodeSuite::get_target_extruder_from_command() { * - Set the feedrate, if included */ void GcodeSuite::get_destination_from_command() { + bool seen[XYZE] = { false, false, false, false }; LOOP_XYZE(i) { - if (parser.seen(axis_codes[i])) { + if ( (seen[i] = parser.seenval(axis_codes[i])) ) { const float v = parser.value_axis_units((AxisEnum)i); destination[i] = (axis_relative_modes[i] || relative_mode) ? current_position[i] + v @@ -97,6 +103,11 @@ void GcodeSuite::get_destination_from_command() { destination[i] = current_position[i]; } + #if ENABLED(POWER_LOSS_RECOVERY) + // Only update power loss recovery on moves with E + if (seen[E_AXIS] && (seen[X_AXIS] || seen[Y_AXIS]) && IS_SD_PRINTING()) recovery.save(); + #endif + if (parser.linearval('F') > 0) feedrate_mm_s = MMM_TO_MMS(parser.value_feedrate()); @@ -106,7 +117,7 @@ void GcodeSuite::get_destination_from_command() { #endif // Get ABCDHI mixing factors - #if ENABLED(MIXING_EXTRUDER) && ENABLED(DIRECT_MIXING_IN_G1) + #if BOTH(MIXING_EXTRUDER, DIRECT_MIXING_IN_G1) M165(); #endif } @@ -247,9 +258,14 @@ void GcodeSuite::process_parsed_command( #endif #if ENABLED(G38_PROBE_TARGET) - case 38: // G38.2 & G38.3: Probe towards target - if (parser.subcode == 2 || parser.subcode == 3) - G38(parser.subcode == 2); + case 38: // G38.2, G38.3: Probe towards target + if (WITHIN(parser.subcode, 2, + #if ENABLED(G38_PROBE_AWAY) + 5 + #else + 3 + #endif + )) G38(parser.subcode); // G38.4, G38.5: Probe away from target break; #endif @@ -314,7 +330,7 @@ void GcodeSuite::process_parsed_command( case 33: M33(); break; // M33: Get the long full path to a file or folder #endif - #if ENABLED(SDCARD_SORT_ALPHA) && ENABLED(SDSORT_GCODE) + #if BOTH(SDCARD_SORT_ALPHA, SDSORT_GCODE) case 34: M34(); break; // M34: Set SD card sorting options #endif @@ -332,10 +348,6 @@ void GcodeSuite::process_parsed_command( case 48: M48(); break; // M48: Z probe repeatability test #endif - #if ENABLED(G26_MESH_VALIDATION) - case 49: M49(); break; // M49: Turn on or off G26 debug flag for verbose output - #endif - #if ENABLED(LCD_SET_PROGRESS_MANUALLY) case 73: M73(); break; // M73: Set progress percentage (for display on LCD) #endif @@ -381,6 +393,11 @@ void GcodeSuite::process_parsed_command( case 190: M190(); break; // M190: Wait for bed temperature to reach target #endif + #if HAS_HEATED_CHAMBER + case 141: M141(); break; // M141: Set chamber temperature + //case 191: M191(); break; // M191: Wait for chamber temperature to reach target + #endif + case 105: M105(); KEEPALIVE_STATE(NOT_BUSY); return; // M105: Report Temperatures (and say "ok") #if ENABLED(AUTO_REPORT_TEMPERATURES) && HAS_TEMP_SENSOR @@ -473,7 +490,7 @@ void GcodeSuite::process_parsed_command( case 665: M665(); break; // M665: Set delta configurations #endif - #if ENABLED(DELTA) || ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS) + #if ANY(DELTA, X_DUAL_ENDSTOPS, Y_DUAL_ENDSTOPS, Z_DUAL_ENDSTOPS) case 666: M666(); break; // M666: Set delta or dual endstop adjustment #endif @@ -495,7 +512,7 @@ void GcodeSuite::process_parsed_command( case 217: M217(); break; // M217: Set filament swap parameters #endif - #if HOTENDS > 1 + #if HAS_HOTEND_OFFSET case 218: M218(); break; // M218: Set a tool offset #endif @@ -555,7 +572,7 @@ void GcodeSuite::process_parsed_command( case 364: if (M364()) return; break; // M364: SCARA Psi pos3 (90 deg to Theta) #endif - #if ENABLED(EXT_SOLENOID) || ENABLED(MANUAL_SOLENOID_CONTROL) + #if EITHER(EXT_SOLENOID, MANUAL_SOLENOID_CONTROL) case 380: M380(); break; // M380: Activate solenoid on active (or specified) extruder case 381: M381(); break; // M381: Disable all solenoids or, if MANUAL_SOLENOID_CONTROL, active (or specified) solenoid #endif @@ -629,7 +646,7 @@ void GcodeSuite::process_parsed_command( case 603: M603(); break; // M603: Configure Filament Change #endif - #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE) + #if HAS_DUPLICATION_MODE case 605: M605(); break; // M605: Set Dual X Carriage movement mode #endif @@ -652,7 +669,7 @@ void GcodeSuite::process_parsed_command( case 900: M900(); break; // M900: Set advance K factor. #endif - #if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM || ENABLED(DIGIPOT_I2C) || ENABLED(DAC_STEPPER_CURRENT) + #if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM || EITHER(DIGIPOT_I2C, DAC_STEPPER_CURRENT) case 907: M907(); break; // M907: Set digital trimpot motor current using axis codes. #if HAS_DIGIPOTSS || ENABLED(DAC_STEPPER_CURRENT) case 908: M908(); break; // M908: Control digital trimpot directly. diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 63ca8ac1ad..af99e4fbed 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -144,7 +144,7 @@ * M140 - Set bed target temp. S * M145 - Set heatup values for materials on the LCD. H B F for S (0=PLA, 1=ABS) * M149 - Set temperature units. (Requires TEMPERATURE_UNITS_SUPPORT) - * M150 - Set Status LED Color as R U B P. Values 0-255. (Requires BLINKM, RGB_LED, RGBW_LED, NEOPIXEL_LED, or PCA9632). + * M150 - Set Status LED Color as R U B P. Values 0-255. (Requires BLINKM, RGB_LED, RGBW_LED, NEOPIXEL_LED, PCA9533, 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 and save to a virtual tool (current, or as specified by 'S'). (Requires MIXING_EXTRUDER) @@ -415,7 +415,7 @@ private: #endif #if ENABLED(G38_PROBE_TARGET) - static void G38(const bool is_38_2); + static void G38(const int8_t subcode); #endif #if HAS_MESH @@ -480,7 +480,7 @@ private: #if ENABLED(LONG_FILENAME_HOST_SUPPORT) static void M33(); #endif - #if ENABLED(SDCARD_SORT_ALPHA) && ENABLED(SDSORT_GCODE) + #if BOTH(SDCARD_SORT_ALPHA, SDSORT_GCODE) static void M34(); #endif #endif @@ -495,10 +495,6 @@ private: static void M48(); #endif - #if ENABLED(G26_MESH_VALIDATION) - static void M49(); - #endif - #if ENABLED(LCD_SET_PROGRESS_MANUALLY) static void M73(); #endif @@ -576,6 +572,11 @@ private: static void M190(); #endif + #if HAS_HEATED_CHAMBER + static void M141(); + //static void M191(); + #endif + #if HAS_LCD_MENU static void M145(); #endif @@ -632,7 +633,7 @@ private: static void M217(); #endif - #if HOTENDS > 1 + #if HAS_HOTEND_OFFSET static void M218(); #endif @@ -701,7 +702,7 @@ private: static bool M364(); #endif - #if ENABLED(EXT_SOLENOID) || ENABLED(MANUAL_SOLENOID_CONTROL) + #if EITHER(EXT_SOLENOID, MANUAL_SOLENOID_CONTROL) static void M380(); static void M381(); #endif @@ -764,7 +765,7 @@ private: static void M603(); #endif - #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE) + #if HAS_DUPLICATION_MODE static void M605(); #endif @@ -840,7 +841,7 @@ private: static void M918(); #endif - #if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM || ENABLED(DIGIPOT_I2C) || ENABLED(DAC_STEPPER_CURRENT) + #if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM || EITHER(DIGIPOT_I2C, DAC_STEPPER_CURRENT) static void M907(); #if HAS_DIGIPOTSS || ENABLED(DAC_STEPPER_CURRENT) static void M908(); diff --git a/Marlin/src/gcode/host/M114.cpp b/Marlin/src/gcode/host/M114.cpp index ffb5f56de7..57ba258333 100644 --- a/Marlin/src/gcode/host/M114.cpp +++ b/Marlin/src/gcode/host/M114.cpp @@ -32,6 +32,8 @@ //C:\Users\bobku\Documents\GitHub\Marlin-Bob-2\Marlin\src\gcode\host\M114.cpp //C:\Users\bobku\Documents\GitHub\Marlin-Bob-2\Marlin\src\module\bob_L6470.cpp #include "../../module/L6470/L6470_Marlin.h" + #define DEBUG_OUT ENABLED(L6470_CHITCHAT) + #include "../../core/debug_out.h" #endif void report_xyze(const float pos[], const uint8_t n = 4, const uint8_t precision = 3) { @@ -95,10 +97,10 @@ temp = L6470_GETPARAM(L6470_ABS_POS,Q); \ if (temp & ABS_POS_SIGN_MASK) temp |= ABS_POS_SIGN_MASK; \ sprintf_P(temp_buf, PSTR(":%8ld "), temp); \ - L6470_ECHO(temp_buf); \ + DEBUG_ECHO(temp_buf); \ }while(0) - L6470_ECHOPGM("\nL6470:"); + DEBUG_ECHOPGM("\nL6470:"); #if AXIS_DRIVER_TYPE_X(L6470) REPORT_ABSOLUTE_POS(X); #endif diff --git a/Marlin/src/gcode/host/M115.cpp b/Marlin/src/gcode/host/M115.cpp index f0b9ac0ae5..c3702ab481 100644 --- a/Marlin/src/gcode/host/M115.cpp +++ b/Marlin/src/gcode/host/M115.cpp @@ -23,10 +23,6 @@ #include "../gcode.h" #include "../../inc/MarlinConfig.h" -#if NUM_SERIAL > 1 - #include "../../gcode/queue.h" -#endif - #if ENABLED(EXTENDED_CAPABILITIES_REPORT) static void cap_line(PGM_P const name, bool ena=false) { SERIAL_ECHOPGM("Cap:"); @@ -129,7 +125,7 @@ void GcodeSuite::M115() { ); cap_line(PSTR("CASE_LIGHT_BRIGHTNESS") #if HAS_CASE_LIGHT - , USEABLE_HARDWARE_PWM(CASE_LIGHT_PIN) + , PWM_PIN(CASE_LIGHT_PIN) #endif ); @@ -156,7 +152,7 @@ void GcodeSuite::M115() { // THERMAL_PROTECTION cap_line(PSTR("THERMAL_PROTECTION") - #if ENABLED(THERMAL_PROTECTION_HOTENDS) && ENABLED(THERMAL_PROTECTION_BED) + #if BOTH(THERMAL_PROTECTION_HOTENDS, THERMAL_PROTECTION_BED) , true #endif ); @@ -168,5 +164,13 @@ void GcodeSuite::M115() { #endif ); + // CHAMBER_TEMPERATURE (M141, M191) + cap_line(PSTR("CHAMBER_TEMPERATURE") + #if HAS_HEATED_CHAMBER + , 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 df20c62658..9b8b859e24 100644 --- a/Marlin/src/gcode/lcd/M0_M1.cpp +++ b/Marlin/src/gcode/lcd/M0_M1.cpp @@ -31,6 +31,10 @@ #include "../../lcd/ultralcd.h" #endif +#if ENABLED(EXTENSIBLE_UI) + #include "../../lcd/extensible_ui/ui_api.h" +#endif + #include "../../sd/cardreader.h" #if HAS_LEDS_OFF_FLAG @@ -74,6 +78,10 @@ void GcodeSuite::M0_M1() { #endif } + #elif ENABLED(EXTENSIBLE_UI) + + ExtUI::onUserConfirmRequired(has_message ? args : MSG_USERWAIT); // SRAM string + #else if (has_message) { @@ -97,6 +105,10 @@ void GcodeSuite::M0_M1() { else while (wait_for_user) idle(); + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onUserConfirmRequired(nullptr); + #endif + #if HAS_LEDS_OFF_FLAG printerEventLEDs.onResumeAfterWait(); #endif diff --git a/Marlin/src/gcode/lcd/M145.cpp b/Marlin/src/gcode/lcd/M145.cpp index 9645023340..3350f7256f 100644 --- a/Marlin/src/gcode/lcd/M145.cpp +++ b/Marlin/src/gcode/lcd/M145.cpp @@ -52,7 +52,7 @@ void GcodeSuite::M145() { #if TEMP_SENSOR_BED != 0 if (parser.seenval('B')) { v = parser.value_int(); - ui.preheat_bed_temp[material] = constrain(v, BED_MINTEMP, BED_MAXTEMP - 15); + ui.preheat_bed_temp[material] = constrain(v, BED_MINTEMP, BED_MAXTEMP - 10); } #endif } diff --git a/Marlin/src/gcode/lcd/M73.cpp b/Marlin/src/gcode/lcd/M73.cpp index 58a0a5c3dc..e2f17c4384 100644 --- a/Marlin/src/gcode/lcd/M73.cpp +++ b/Marlin/src/gcode/lcd/M73.cpp @@ -22,7 +22,7 @@ #include "../../inc/MarlinConfig.h" -#if ENABLED(LCD_SET_PROGRESS_MANUALLY) && (ENABLED(EXTENSIBLE_UI) || ENABLED(ULTRA_LCD)) +#if ENABLED(LCD_SET_PROGRESS_MANUALLY) && EITHER(EXTENSIBLE_UI, ULTRA_LCD) #include "../gcode.h" #include "../../lcd/ultralcd.h" @@ -42,4 +42,4 @@ void GcodeSuite::M73() { ui.set_progress(parser.value_byte()); } -#endif // LCD_SET_PROGRESS_MANUALLY && (ENABLED(EXTENSIBLE_UI) || ENABLED(ULTRA_LCD)) +#endif // LCD_SET_PROGRESS_MANUALLY && (EXTENSIBLE_UI || ULTRA_LCD) diff --git a/Marlin/src/gcode/motion/G0_G1.cpp b/Marlin/src/gcode/motion/G0_G1.cpp index cbec67b276..7e0e9f7b90 100644 --- a/Marlin/src/gcode/motion/G0_G1.cpp +++ b/Marlin/src/gcode/motion/G0_G1.cpp @@ -25,7 +25,7 @@ #include "../../Marlin.h" -#if ENABLED(FWRETRACT) && ENABLED(FWRETRACT_AUTORETRACT) +#if BOTH(FWRETRACT, FWRETRACT_AUTORETRACT) #include "../../feature/fwretract.h" #endif @@ -79,7 +79,7 @@ void GcodeSuite::G0_G1( } #endif - #if ENABLED(FWRETRACT) && ENABLED(FWRETRACT_AUTORETRACT) + #if BOTH(FWRETRACT, FWRETRACT_AUTORETRACT) if (MIN_AUTORETRACT <= MAX_AUTORETRACT) { // When M209 Autoretract is enabled, convert E-only moves to firmware retract/recover moves diff --git a/Marlin/src/gcode/motion/G2_G3.cpp b/Marlin/src/gcode/motion/G2_G3.cpp index 9193d25599..da07525dcf 100644 --- a/Marlin/src/gcode/motion/G2_G3.cpp +++ b/Marlin/src/gcode/motion/G2_G3.cpp @@ -83,18 +83,28 @@ void plan_arc( // CCW angle of rotation between position and target from the circle center. Only one atan2() trig computation required. float angular_travel = ATAN2(r_P * rt_Y - r_Q * rt_X, r_P * rt_X + r_Q * rt_Y); if (angular_travel < 0) angular_travel += RADIANS(360); + #ifdef MIN_ARC_SEGMENTS + uint16_t min_segments = CEIL((MIN_ARC_SEGMENTS) * (angular_travel / RADIANS(360))); + NOLESS(min_segments, 1U); + #else + constexpr uint16_t min_segments = 1; + #endif if (clockwise) angular_travel -= RADIANS(360); // Make a circle if the angular rotation is 0 and the target is current position - if (angular_travel == 0 && current_position[p_axis] == cart[p_axis] && current_position[q_axis] == cart[q_axis]) + if (angular_travel == 0 && current_position[p_axis] == cart[p_axis] && current_position[q_axis] == cart[q_axis]) { angular_travel = RADIANS(360); + #ifdef MIN_ARC_SEGMENTS + min_segments = MIN_ARC_SEGMENTS; + #endif + } const float flat_mm = radius * angular_travel, mm_of_travel = linear_travel ? HYPOT(flat_mm, linear_travel) : ABS(flat_mm); if (mm_of_travel < 0.001f) return; uint16_t segments = FLOOR(mm_of_travel / (MM_PER_ARC_SEGMENT)); - if (segments == 0) segments = 1; + NOLESS(segments, min_segments); /** * Vector rotation by transformation matrix: r is the original vector, r_T is the rotated vector, @@ -190,7 +200,7 @@ void plan_arc( #endif raw[E_AXIS] += extruder_per_segment; - clamp_to_software_endstops(raw); + apply_motion_limits(raw); #if HAS_LEVELING && !PLANNER_LEVELING planner.apply_leveling(raw); diff --git a/Marlin/src/gcode/motion/M290.cpp b/Marlin/src/gcode/motion/M290.cpp index e1222688e6..b816b5b9ab 100644 --- a/Marlin/src/gcode/motion/M290.cpp +++ b/Marlin/src/gcode/motion/M290.cpp @@ -25,6 +25,7 @@ #if ENABLED(BABYSTEPPING) #include "../gcode.h" +#include "../../feature/babystep.h" #include "../../module/probe.h" #include "../../module/temperature.h" #include "../../module/planner.h" @@ -64,7 +65,7 @@ void GcodeSuite::M290() { for (uint8_t a = X_AXIS; a <= Z_AXIS; a++) if (parser.seenval(axis_codes[a]) || (a == Z_AXIS && parser.seenval('S'))) { const float offs = constrain(parser.value_axis_units((AxisEnum)a), -2, 2); - thermalManager.babystep_axis((AxisEnum)a, offs * planner.settings.axis_steps_per_mm[a]); + babystep.add_mm((AxisEnum)a, offs); #if ENABLED(BABYSTEP_ZPROBE_OFFSET) if (a == Z_AXIS && (!parser.seen('P') || parser.value_bool())) mod_zprobe_zoffset(offs); #endif @@ -72,7 +73,7 @@ void GcodeSuite::M290() { #else if (parser.seenval('Z') || parser.seenval('S')) { const float offs = constrain(parser.value_axis_units(Z_AXIS), -2, 2); - thermalManager.babystep_axis(Z_AXIS, offs * planner.settings.axis_steps_per_mm[Z_AXIS]); + babystep.add_mm(Z_AXIS, offs); #if ENABLED(BABYSTEP_ZPROBE_OFFSET) if (!parser.seen('P') || parser.value_bool()) mod_zprobe_zoffset(offs); #endif diff --git a/Marlin/src/gcode/parser.cpp b/Marlin/src/gcode/parser.cpp index 984af54166..8d4c167951 100644 --- a/Marlin/src/gcode/parser.cpp +++ b/Marlin/src/gcode/parser.cpp @@ -272,8 +272,7 @@ void GCodeParser::parse(char *p) { #if ENABLED(DEBUG_GCODE_PARSER) if (debug) { - SERIAL_ECHOPAIR("Got letter ", code); - SERIAL_ECHOPAIR(" at index ", (int)(p - command_ptr - 1)); + SERIAL_ECHOPAIR("Got letter ", code, " at index ", (int)(p - command_ptr - 1)); if (has_num) SERIAL_ECHOPGM(" (has_num)"); } #endif @@ -329,47 +328,41 @@ void GCodeParser::parse(char *p) { void GCodeParser::unknown_command_error() { SERIAL_ECHO_START(); - SERIAL_ECHOPAIR(MSG_UNKNOWN_COMMAND, command_ptr); - SERIAL_CHAR('"'); - SERIAL_EOL(); + SERIAL_ECHOLNPAIR(MSG_UNKNOWN_COMMAND, command_ptr, "\""); } #if ENABLED(DEBUG_GCODE_PARSER) void GCodeParser::debug() { - SERIAL_ECHOPAIR("Command: ", command_ptr); - SERIAL_ECHOPAIR(" (", command_letter); + SERIAL_ECHOPAIR("Command: ", command_ptr, " (", command_letter); SERIAL_ECHO(codenum); SERIAL_ECHOLNPGM(")"); #if ENABLED(FASTER_GCODE_PARSER) - SERIAL_ECHOPGM(" args: \""); - for (char c = 'A'; c <= 'Z'; ++c) - if (seen(c)) { SERIAL_CHAR(c); SERIAL_CHAR(' '); } + SERIAL_ECHOPGM(" args: { "); + for (char c = 'A'; c <= 'Z'; ++c) if (seen(c)) { SERIAL_CHAR(c); SERIAL_CHAR(' '); } + SERIAL_CHAR('}'); #else - SERIAL_ECHOPAIR(" args: \"", command_args); + SERIAL_ECHOPAIR(" args: { ", command_args, " }"); #endif - SERIAL_CHAR('"'); - if (string_arg) { - SERIAL_ECHOPGM(" string: \""); - SERIAL_ECHO(string_arg); - SERIAL_CHAR('"'); - } + if (string_arg) SERIAL_ECHOPAIR(" string: \"", string_arg, "\""); SERIAL_ECHOLNPGM("\n"); for (char c = 'A'; c <= 'Z'; ++c) { if (seen(c)) { SERIAL_ECHOPAIR("Code '", c); SERIAL_ECHOPGM("':"); if (has_value()) { - SERIAL_ECHOPAIR("\n float: ", value_float()); - SERIAL_ECHOPAIR("\n long: ", value_long()); - SERIAL_ECHOPAIR("\n ulong: ", value_ulong()); - SERIAL_ECHOPAIR("\n millis: ", value_millis()); - SERIAL_ECHOPAIR("\n sec-ms: ", value_millis_from_seconds()); - SERIAL_ECHOPAIR("\n int: ", value_int()); - SERIAL_ECHOPAIR("\n ushort: ", value_ushort()); - SERIAL_ECHOPAIR("\n byte: ", (int)value_byte()); - SERIAL_ECHOPAIR("\n bool: ", (int)value_bool()); - SERIAL_ECHOPAIR("\n linear: ", value_linear_units()); - SERIAL_ECHOPAIR("\n celsius: ", value_celsius()); + SERIAL_ECHOPAIR( + "\n float: ", value_float(), + "\n long: ", value_long(), + "\n ulong: ", value_ulong(), + "\n millis: ", value_millis(), + "\n sec-ms: ", value_millis_from_seconds(), + "\n int: ", value_int(), + "\n ushort: ", value_ushort(), + "\n byte: ", (int)value_byte(), + "\n bool: ", (int)value_bool(), + "\n linear: ", value_linear_units(), + "\n celsius: ", value_celsius() + ); } else SERIAL_ECHOPGM(" (no value)"); diff --git a/Marlin/src/gcode/parser.h b/Marlin/src/gcode/parser.h index 73adfafccb..c5a473df6e 100644 --- a/Marlin/src/gcode/parser.h +++ b/Marlin/src/gcode/parser.h @@ -120,8 +120,7 @@ public: param[ind] = ptr ? ptr - command_ptr : 0; // parameter offset or 0 #if ENABLED(DEBUG_GCODE_PARSER) if (codenum == 800) { - SERIAL_ECHOPAIR("Set bit ", (int)ind); - SERIAL_ECHOPAIR(" of codebits (", hex_address((void*)(codebits >> 16))); + SERIAL_ECHOPAIR("Set bit ", (int)ind, " of codebits (", hex_address((void*)(codebits >> 16))); print_hex_word((uint16_t)(codebits & 0xFFFF)); SERIAL_ECHOLNPAIR(") | param = ", (int)param[ind]); } diff --git a/Marlin/src/gcode/probe/G38.cpp b/Marlin/src/gcode/probe/G38.cpp index fceab8313d..be9c58e861 100644 --- a/Marlin/src/gcode/probe/G38.cpp +++ b/Marlin/src/gcode/probe/G38.cpp @@ -31,7 +31,18 @@ #include "../../module/stepper.h" #include "../../module/probe.h" -static bool G38_run_probe() { +inline void G38_single_probe(const uint8_t move_value) { + endstops.enable(true); + G38_move = move_value; + prepare_move_to_destination(); + planner.synchronize(); + G38_move = 0; + endstops.hit_on_purpose(); + set_current_from_steppers_for_axis(ALL_AXES); + sync_plan_position(); +} + +inline bool G38_run_probe() { bool G38_pass_fail = false; @@ -46,19 +57,19 @@ static bool G38_run_probe() { planner.synchronize(); // wait until the machine is idle + // Move flag value + #if ENABLED(G38_PROBE_AWAY) + const uint8_t move_value = parser.subcode; + #else + constexpr uint8_t move_value = 1; + #endif + + G38_did_trigger = false; + // Move until destination reached or target hit - endstops.enable(true); - G38_move = true; - G38_endstop_hit = false; - prepare_move_to_destination(); - planner.synchronize(); - G38_move = false; + G38_single_probe(move_value); - endstops.hit_on_purpose(); - set_current_from_steppers_for_axis(ALL_AXES); - sync_plan_position(); - - if (G38_endstop_hit) { + if (G38_did_trigger) { G38_pass_fail = true; @@ -70,45 +81,50 @@ static bool G38_run_probe() { prepare_move_to_destination(); planner.synchronize(); - feedrate_mm_s /= 4; + REMEMBER(fr, feedrate_mm_s, feedrate_mm_s * 0.25); // Bump the target more slowly LOOP_XYZ(i) destination[i] -= retract_mm[i] * 2; - endstops.enable(true); - G38_move = true; - prepare_move_to_destination(); - planner.synchronize(); - G38_move = false; - - set_current_from_steppers_for_axis(ALL_AXES); - sync_plan_position(); + G38_single_probe(move_value); #endif } - endstops.hit_on_purpose(); endstops.not_homing(); return G38_pass_fail; } /** - * G38.2 - probe toward workpiece, stop on contact, signal error if failure - * G38.3 - probe toward workpiece, stop on contact + * G38 Probe Target * - * Like G28 except uses Z min probe for all axes + * G38.2 - Probe toward workpiece, stop on contact, signal error if failure + * G38.3 - Probe toward workpiece, stop on contact + * + * With G38_PROBE_AWAY: + * + * G38.4 - Probe away from workpiece, stop on contact break, signal error if failure + * G38.5 - Probe away from workpiece, stop on contact break */ -void GcodeSuite::G38(const bool is_38_2) { +void GcodeSuite::G38(const int8_t subcode) { // Get X Y Z E F get_destination_from_command(); setup_for_endstop_or_probe_move(); + const bool error_on_fail = + #if ENABLED(G38_PROBE_AWAY) + !TEST(subcode, 0) + #else + (subcode == 2) + #endif + ; + // If any axis has enough movement, do the move LOOP_XYZ(i) if (ABS(destination[i] - current_position[i]) >= G38_MINIMUM_MOVE) { if (!parser.seenval('F')) feedrate_mm_s = homing_feedrate((AxisEnum)i); // If G38.2 fails throw an error - if (!G38_run_probe() && is_38_2) SERIAL_ERROR_MSG("Failed to reach target"); + if (!G38_run_probe() && error_on_fail) SERIAL_ERROR_MSG("Failed to reach target"); break; } diff --git a/Marlin/src/gcode/queue.cpp b/Marlin/src/gcode/queue.cpp index eb7f6a74c4..f448efb117 100644 --- a/Marlin/src/gcode/queue.cpp +++ b/Marlin/src/gcode/queue.cpp @@ -37,10 +37,6 @@ #include "../feature/leds/printer_event_leds.h" #endif -#if ENABLED(POWER_LOSS_RECOVERY) - #include "../feature/power_loss_recovery.h" -#endif - /** * GCode line number handling. Hosts may opt to include line numbers when * sending commands to Marlin, and lines will be checked for sequentiality. @@ -150,9 +146,7 @@ bool enqueue_and_echo_command(const char* cmd) { if (_enqueuecommand(cmd)) { SERIAL_ECHO_START(); - SERIAL_ECHOPAIR(MSG_ENQUEUEING, cmd); - SERIAL_CHAR('"'); - SERIAL_EOL(); + SERIAL_ECHOLNPAIR(MSG_ENQUEUEING, cmd, "\""); return true; } return false; @@ -398,9 +392,10 @@ void gcode_line_error(PGM_P const err, const int8_t port) { stream_state = StreamState::PACKET_RESET; bytes_received = 0; time_stream_start = millis(); - SERIAL_ECHOPAIR("echo: Datastream initialized (", stream_header.filesize); - SERIAL_ECHOLNPGM(" bytes expected)"); - SERIAL_ECHOLNPAIR("so", buffer_size); // confirm active stream and the maximum block size supported + // confirm active stream and the maximum block size supported + SERIAL_ECHO_START(); + SERIAL_ECHOLNPAIR("Datastream initialized (", stream_header.filesize, " bytes expected)"); + SERIAL_ECHOLNPAIR("so", buffer_size); } else { SERIAL_ECHO_MSG("Datastream init error (invalid token)"); @@ -468,8 +463,7 @@ void gcode_line_error(PGM_P const err, const int8_t port) { } else { SERIAL_ECHO_START(); - SERIAL_ECHOPAIR("Block(", packet.header.id); - SERIAL_ECHOLNPGM(") Corrupt"); + SERIAL_ECHOLNPAIR("Block(", packet.header.id, ") Corrupt"); stream_state = StreamState::PACKET_FLUSHRX; } break; @@ -504,8 +498,7 @@ void gcode_line_error(PGM_P const err, const int8_t port) { card.flag.binary_mode = false; SERIAL_ECHO_START(); SERIAL_ECHO(card.filename); - SERIAL_ECHOPAIR(" transfer completed @ ", ((bytes_received / (millis() - time_stream_start) * 1000) / 1024)); - SERIAL_ECHOLNPGM("KiB/s"); + SERIAL_ECHOLNPAIR(" transfer completed @ ", ((bytes_received / (millis() - time_stream_start) * 1000) / 1024), "KiB/s"); SERIAL_ECHOLNPGM("sc"); // transmit stream complete token card.closefile(); return; @@ -868,12 +861,8 @@ void advance_command_queue() { ok_to_send(); } } - else { + else gcode.process_next_command(); - #if ENABLED(POWER_LOSS_RECOVERY) - if (IS_SD_PRINTING()) recovery.save(); - #endif - } #else diff --git a/Marlin/src/gcode/queue.h b/Marlin/src/gcode/queue.h index 2e232484aa..ac519bc77b 100644 --- a/Marlin/src/gcode/queue.h +++ b/Marlin/src/gcode/queue.h @@ -95,7 +95,7 @@ void enqueue_and_echo_commands_P(PGM_P const pgcode); */ bool enqueue_and_echo_command(const char* cmd); -#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_LCD_QUEUE_NOW (ENABLED(MALYAN_LCD) || (HAS_LCD_MENU && ANY(AUTO_BED_LEVELING_UBL, PID_AUTOTUNE_MENU, ADVANCED_PAUSE_FEATURE))) #define HAS_QUEUE_NOW (ENABLED(SDSUPPORT) || HAS_LCD_QUEUE_NOW) #if HAS_QUEUE_NOW diff --git a/Marlin/src/gcode/scara/M360-M364.cpp b/Marlin/src/gcode/scara/M360-M364.cpp index cbf9c751dc..463d303af1 100644 --- a/Marlin/src/gcode/scara/M360-M364.cpp +++ b/Marlin/src/gcode/scara/M360-M364.cpp @@ -32,10 +32,7 @@ inline bool SCARA_move_to_cal(const uint8_t delta_a, const uint8_t delta_b) { if (IsRunning()) { forward_kinematics_SCARA(delta_a, delta_b); - destination[X_AXIS] = cartes[X_AXIS]; - destination[Y_AXIS] = cartes[Y_AXIS]; - destination[Z_AXIS] = current_position[Z_AXIS]; - prepare_move_to_destination(); + do_blocking_move_to_xy(cartes[X_AXIS], cartes[Y_AXIS]); return true; } return false; diff --git a/Marlin/src/gcode/sdcard/M20-M30_M32-M34_M524_M928.cpp b/Marlin/src/gcode/sdcard/M20-M30_M32-M34_M524_M928.cpp deleted file mode 100644 index af8b72ae2e..0000000000 --- a/Marlin/src/gcode/sdcard/M20-M30_M32-M34_M524_M928.cpp +++ /dev/null @@ -1,303 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -#include "../../inc/MarlinConfig.h" - -#if ENABLED(SDSUPPORT) - -#include "../gcode.h" -#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" -#endif - -#if ENABLED(PARK_HEAD_ON_PAUSE) - #include "../../feature/pause.h" -#endif - -#if ENABLED(PARK_HEAD_ON_PAUSE) || NUM_SERIAL > 1 - #include "../queue.h" -#endif - -#if ENABLED(HOST_ACTION_COMMANDS) - #include "../../feature/host_actions.h" -#endif - -/** - * M20: List SD card to serial output - */ -void GcodeSuite::M20() { - SERIAL_ECHOLNPGM(MSG_BEGIN_FILE_LIST); - card.ls(); - SERIAL_ECHOLNPGM(MSG_END_FILE_LIST); -} - -/** - * M21: Init SD Card - */ -void GcodeSuite::M21() { card.initsd(); } - -/** - * M22: Release SD Card - */ -void GcodeSuite::M22() { card.release(); } - -/** - * M23: Open a file - */ -void GcodeSuite::M23() { - #if ENABLED(POWER_LOSS_RECOVERY) - card.removeJobRecoveryFile(); - #endif - // Simplify3D includes the size, so zero out all spaces (#7227) - for (char *fn = parser.string_arg; *fn; ++fn) if (*fn == ' ') *fn = '\0'; - card.openFile(parser.string_arg, true); -} - -/** - * M24: Start or Resume SD Print - */ -void GcodeSuite::M24() { - - #if ENABLED(POWER_LOSS_RECOVERY) - if (parser.seenval('S')) card.setIndex(parser.value_long()); - if (parser.seenval('T')) print_job_timer.resume(parser.value_long()); - #endif - - #if ENABLED(PARK_HEAD_ON_PAUSE) - if (did_pause_print) { - resume_print(); - return; - } - #endif - - if (card.isFileOpen()) { - card.startFileprint(); - print_job_timer.start(); - } - - #if ENABLED(HOST_ACTION_COMMANDS) - #if ENABLED(HOST_PROMPT_SUPPORT) - host_prompt_open(PROMPT_INFO, PSTR("Resume SD")); - #endif - #ifdef ACTION_ON_RESUME - host_action_resume(); - #endif - #endif - - ui.reset_status(); -} - -/** - * M25: Pause SD Print - */ -void GcodeSuite::M25() { - - // Set initial pause flag to prevent more commands from landing in the queue while we try to pause - #if ENABLED(SDSUPPORT) - if (IS_SD_PRINTING()) card.pauseSDPrint(); - #endif - - #if ENABLED(PARK_HEAD_ON_PAUSE) - - M125(); - - #else - - print_job_timer.pause(); - ui.reset_status(); - - #if ENABLED(HOST_ACTION_COMMANDS) - #if ENABLED(HOST_PROMPT_SUPPORT) - host_prompt_open(PROMPT_PAUSE_RESUME, PSTR("Pause SD"), PSTR("Resume")); - #endif - #ifdef ACTION_ON_PAUSE - host_action_pause(); - #endif - #endif - - #endif -} - -/** - * M26: Set SD Card file index - */ -void GcodeSuite::M26() { - if (card.isDetected() && parser.seenval('S')) - card.setIndex(parser.value_long()); -} - -/** - * M27: Get SD Card status - * OR, with 'S' set the SD status auto-report interval. (Requires AUTO_REPORT_SD_STATUS) - * OR, with 'C' get the current filename. - */ -void GcodeSuite::M27() { - if (parser.seen('C')) { - SERIAL_ECHOPGM("Current file: "); - card.printFilename(); - } - - #if ENABLED(AUTO_REPORT_SD_STATUS) - else if (parser.seenval('S')) - card.set_auto_report_interval(parser.value_byte()); - #endif - - else - card.report_status(); -} - -/** - * M28: Start SD Write - */ -void GcodeSuite::M28() { - - #if ENABLED(BINARY_FILE_TRANSFER) - - 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(); - SERIAL_ECHO(" preparing to receive: "); - SERIAL_ECHOLN(p); - card.openFile(p, false); - #if NUM_SERIAL > 1 - card.transfer_port_index = command_queue_port[cmd_queue_index_r]; - #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.flag.saving = false; -} - -/** - * M30 : Delete SD Card file - */ -void GcodeSuite::M30() { - if (card.isDetected()) { - card.closefile(); - card.removeFile(parser.string_arg); - } -} - -/** - * M32: Select file and start SD Print - * - * Examples: - * - * M32 !PATH/TO/FILE.GCO# ; Start FILE.GCO - * M32 P !PATH/TO/FILE.GCO# ; Start FILE.GCO as a procedure - * M32 S60 !PATH/TO/FILE.GCO# ; Start FILE.GCO at byte 60 - * - */ -void GcodeSuite::M32() { - if (IS_SD_PRINTING()) planner.synchronize(); - - if (card.isDetected()) { - const bool call_procedure = parser.boolval('P'); - - card.openFile(parser.string_arg, true, call_procedure); - - if (parser.seenval('S')) card.setIndex(parser.value_long()); - - card.startFileprint(); - - // Procedure calls count as normal print time. - if (!call_procedure) print_job_timer.start(); - } -} - -#if ENABLED(LONG_FILENAME_HOST_SUPPORT) - - /** - * M33: Get the long full path of a file or folder - * - * Parameters: - * Case-insensitive DOS-style path to a file or folder - * - * Example: - * M33 miscel~1/armchair/armcha~1.gco - * - * Output: - * /Miscellaneous/Armchair/Armchair.gcode - */ - void GcodeSuite::M33() { - card.printLongPath(parser.string_arg); - } - -#endif // LONG_FILENAME_HOST_SUPPORT - -#if ENABLED(SDCARD_SORT_ALPHA) && ENABLED(SDSORT_GCODE) - - /** - * M34: Set SD Card Sorting Options - */ - void GcodeSuite::M34() { - if (parser.seen('S')) card.setSortOn(parser.value_bool()); - if (parser.seenval('F')) { - const int v = parser.value_long(); - card.setSortFolders(v < 0 ? -1 : v > 0 ? 1 : 0); - } - //if (parser.seen('R')) card.setSortReverse(parser.value_bool()); - } - -#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 - */ -void GcodeSuite::M928() { - card.openLogFile(parser.string_arg); -} - -#endif // SDSUPPORT diff --git a/Marlin/src/gcode/sdcard/M20.cpp b/Marlin/src/gcode/sdcard/M20.cpp new file mode 100644 index 0000000000..0ca21c91c8 --- /dev/null +++ b/Marlin/src/gcode/sdcard/M20.cpp @@ -0,0 +1,39 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "../../inc/MarlinConfig.h" + +#if ENABLED(SDSUPPORT) + +#include "../gcode.h" +#include "../../sd/cardreader.h" + +/** + * M20: List SD card to serial output + */ +void GcodeSuite::M20() { + SERIAL_ECHOLNPGM(MSG_BEGIN_FILE_LIST); + card.ls(); + SERIAL_ECHOLNPGM(MSG_END_FILE_LIST); +} + +#endif // SDSUPPORT diff --git a/Marlin/src/gcode/sdcard/M21_M22.cpp b/Marlin/src/gcode/sdcard/M21_M22.cpp new file mode 100644 index 0000000000..e59106bb17 --- /dev/null +++ b/Marlin/src/gcode/sdcard/M21_M22.cpp @@ -0,0 +1,40 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "../../inc/MarlinConfig.h" + +#if ENABLED(SDSUPPORT) + +#include "../gcode.h" +#include "../../sd/cardreader.h" + +/** + * M21: Init SD Card + */ +void GcodeSuite::M21() { card.initsd(); } + +/** + * M22: Release SD Card + */ +void GcodeSuite::M22() { card.release(); } + +#endif // SDSUPPORT diff --git a/Marlin/src/gcode/sdcard/M23.cpp b/Marlin/src/gcode/sdcard/M23.cpp new file mode 100644 index 0000000000..92899a217a --- /dev/null +++ b/Marlin/src/gcode/sdcard/M23.cpp @@ -0,0 +1,42 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "../../inc/MarlinConfig.h" + +#if ENABLED(SDSUPPORT) + +#include "../gcode.h" +#include "../../sd/cardreader.h" + +/** + * M23: Open a file + */ +void GcodeSuite::M23() { + #if ENABLED(POWER_LOSS_RECOVERY) + card.removeJobRecoveryFile(); + #endif + // Simplify3D includes the size, so zero out all spaces (#7227) + for (char *fn = parser.string_arg; *fn; ++fn) if (*fn == ' ') *fn = '\0'; + card.openFile(parser.string_arg, true); +} + +#endif // SDSUPPORT diff --git a/Marlin/src/gcode/sdcard/M24_M25.cpp b/Marlin/src/gcode/sdcard/M24_M25.cpp new file mode 100644 index 0000000000..34543fb43e --- /dev/null +++ b/Marlin/src/gcode/sdcard/M24_M25.cpp @@ -0,0 +1,106 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "../../inc/MarlinConfig.h" + +#if ENABLED(SDSUPPORT) + +#include "../gcode.h" +#include "../../sd/cardreader.h" +#include "../../module/printcounter.h" +#include "../../lcd/ultralcd.h" + +#if ENABLED(PARK_HEAD_ON_PAUSE) + #include "../../feature/pause.h" + #include "../queue.h" +#endif + +#if ENABLED(HOST_ACTION_COMMANDS) + #include "../../feature/host_actions.h" +#endif + +/** + * M24: Start or Resume SD Print + */ +void GcodeSuite::M24() { + + #if ENABLED(POWER_LOSS_RECOVERY) + if (parser.seenval('S')) card.setIndex(parser.value_long()); + if (parser.seenval('T')) print_job_timer.resume(parser.value_long()); + #endif + + #if ENABLED(PARK_HEAD_ON_PAUSE) + if (did_pause_print) { + resume_print(); + return; + } + #endif + + if (card.isFileOpen()) { + card.startFileprint(); + print_job_timer.start(); + } + + #if ENABLED(HOST_ACTION_COMMANDS) + #if ENABLED(HOST_PROMPT_SUPPORT) + host_prompt_open(PROMPT_INFO, PSTR("Resume SD")); + #endif + #ifdef ACTION_ON_RESUME + host_action_resume(); + #endif + #endif + + ui.reset_status(); +} + +/** + * M25: Pause SD Print + */ +void GcodeSuite::M25() { + + // Set initial pause flag to prevent more commands from landing in the queue while we try to pause + #if ENABLED(SDSUPPORT) + if (IS_SD_PRINTING()) card.pauseSDPrint(); + #endif + + #if ENABLED(PARK_HEAD_ON_PAUSE) + + M125(); + + #else + + print_job_timer.pause(); + ui.reset_status(); + + #if ENABLED(HOST_ACTION_COMMANDS) + #if ENABLED(HOST_PROMPT_SUPPORT) + host_prompt_open(PROMPT_PAUSE_RESUME, PSTR("Pause SD"), PSTR("Resume")); + #endif + #ifdef ACTION_ON_PAUSE + host_action_pause(); + #endif + #endif + + #endif +} + +#endif // SDSUPPORT diff --git a/Marlin/src/gcode/sdcard/M26.cpp b/Marlin/src/gcode/sdcard/M26.cpp new file mode 100644 index 0000000000..e41c081d0c --- /dev/null +++ b/Marlin/src/gcode/sdcard/M26.cpp @@ -0,0 +1,38 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "../../inc/MarlinConfig.h" + +#if ENABLED(SDSUPPORT) + +#include "../gcode.h" +#include "../../sd/cardreader.h" + +/** + * M26: Set SD Card file index + */ +void GcodeSuite::M26() { + if (card.isDetected() && parser.seenval('S')) + card.setIndex(parser.value_long()); +} + +#endif // SDSUPPORT diff --git a/Marlin/src/gcode/sdcard/M27.cpp b/Marlin/src/gcode/sdcard/M27.cpp new file mode 100644 index 0000000000..e9d897229d --- /dev/null +++ b/Marlin/src/gcode/sdcard/M27.cpp @@ -0,0 +1,50 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "../../inc/MarlinConfig.h" + +#if ENABLED(SDSUPPORT) + +#include "../gcode.h" +#include "../../sd/cardreader.h" + +/** + * M27: Get SD Card status + * OR, with 'S' set the SD status auto-report interval. (Requires AUTO_REPORT_SD_STATUS) + * OR, with 'C' get the current filename. + */ +void GcodeSuite::M27() { + if (parser.seen('C')) { + SERIAL_ECHOPGM("Current file: "); + card.printFilename(); + } + + #if ENABLED(AUTO_REPORT_SD_STATUS) + else if (parser.seenval('S')) + card.set_auto_report_interval(parser.value_byte()); + #endif + + else + card.report_status(); +} + +#endif // SDSUPPORT diff --git a/Marlin/src/gcode/sdcard/M28_M29.cpp b/Marlin/src/gcode/sdcard/M28_M29.cpp new file mode 100644 index 0000000000..815a43ae0c --- /dev/null +++ b/Marlin/src/gcode/sdcard/M28_M29.cpp @@ -0,0 +1,77 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "../../inc/MarlinConfig.h" + +#if ENABLED(SDSUPPORT) + +#include "../gcode.h" +#include "../../sd/cardreader.h" + +#if NUM_SERIAL > 1 + #include "../queue.h" +#endif + +/** + * M28: Start SD Write + */ +void GcodeSuite::M28() { + + #if ENABLED(BINARY_FILE_TRANSFER) + + 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(); + SERIAL_ECHO(" preparing to receive: "); + SERIAL_ECHOLN(p); + card.openFile(p, false); + #if NUM_SERIAL > 1 + card.transfer_port_index = command_queue_port[cmd_queue_index_r]; + #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.flag.saving = false; +} + +#endif // SDSUPPORT diff --git a/Marlin/src/gcode/sdcard/M30.cpp b/Marlin/src/gcode/sdcard/M30.cpp new file mode 100644 index 0000000000..9b8b8874f5 --- /dev/null +++ b/Marlin/src/gcode/sdcard/M30.cpp @@ -0,0 +1,40 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "../../inc/MarlinConfig.h" + +#if ENABLED(SDSUPPORT) + +#include "../gcode.h" +#include "../../sd/cardreader.h" + +/** + * M30 : Delete SD Card file + */ +void GcodeSuite::M30() { + if (card.isDetected()) { + card.closefile(); + card.removeFile(parser.string_arg); + } +} + +#endif // SDSUPPORT diff --git a/Marlin/src/gcode/sdcard/M32.cpp b/Marlin/src/gcode/sdcard/M32.cpp new file mode 100644 index 0000000000..0dea320c83 --- /dev/null +++ b/Marlin/src/gcode/sdcard/M32.cpp @@ -0,0 +1,59 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "../../inc/MarlinConfig.h" + +#if ENABLED(SDSUPPORT) + +#include "../gcode.h" +#include "../../sd/cardreader.h" +#include "../../module/printcounter.h" +#include "../../module/planner.h" + +/** + * M32: Select file and start SD Print + * + * Examples: + * + * M32 !PATH/TO/FILE.GCO# ; Start FILE.GCO + * M32 P !PATH/TO/FILE.GCO# ; Start FILE.GCO as a procedure + * M32 S60 !PATH/TO/FILE.GCO# ; Start FILE.GCO at byte 60 + * + */ +void GcodeSuite::M32() { + if (IS_SD_PRINTING()) planner.synchronize(); + + if (card.isDetected()) { + const bool call_procedure = parser.boolval('P'); + + card.openFile(parser.string_arg, true, call_procedure); + + if (parser.seenval('S')) card.setIndex(parser.value_long()); + + card.startFileprint(); + + // Procedure calls count as normal print time. + if (!call_procedure) print_job_timer.start(); + } +} + +#endif // SDSUPPORT diff --git a/Marlin/src/gcode/sdcard/M33.cpp b/Marlin/src/gcode/sdcard/M33.cpp new file mode 100644 index 0000000000..df729aa9b3 --- /dev/null +++ b/Marlin/src/gcode/sdcard/M33.cpp @@ -0,0 +1,48 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "../../inc/MarlinConfig.h" + +#if ENABLED(LONG_FILENAME_HOST_SUPPORT) + +#include "../gcode.h" +#include "../../sd/cardreader.h" + +/** + * M33: Get the long full path of a file or folder + * + * Parameters: + * Case-insensitive DOS-style path to a file or folder + * + * Example: + * M33 miscel~1/armchair/armcha~1.gco + * + * Output: + * /Miscellaneous/Armchair/Armchair.gcode + */ +void GcodeSuite::M33() { + + card.printLongPath(parser.string_arg); + +} + +#endif // LONG_FILENAME_HOST_SUPPORT diff --git a/Marlin/src/gcode/sdcard/M34.cpp b/Marlin/src/gcode/sdcard/M34.cpp new file mode 100644 index 0000000000..979ed88a14 --- /dev/null +++ b/Marlin/src/gcode/sdcard/M34.cpp @@ -0,0 +1,42 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "../../inc/MarlinConfig.h" + +#if BOTH(SDCARD_SORT_ALPHA, SDSORT_GCODE) + +#include "../gcode.h" +#include "../../sd/cardreader.h" + +/** + * M34: Set SD Card Sorting Options + */ +void GcodeSuite::M34() { + if (parser.seen('S')) card.setSortOn(parser.value_bool()); + if (parser.seenval('F')) { + const int v = parser.value_long(); + card.setSortFolders(v < 0 ? -1 : v > 0 ? 1 : 0); + } + //if (parser.seen('R')) card.setSortReverse(parser.value_bool()); +} + +#endif // SDCARD_SORT_ALPHA && SDSORT_GCODE diff --git a/Marlin/src/gcode/bedlevel/ubl/M49.cpp b/Marlin/src/gcode/sdcard/M524.cpp similarity index 70% rename from Marlin/src/gcode/bedlevel/ubl/M49.cpp rename to Marlin/src/gcode/sdcard/M524.cpp index 5c1f096a72..3bcd527bd3 100644 --- a/Marlin/src/gcode/bedlevel/ubl/M49.cpp +++ b/Marlin/src/gcode/sdcard/M524.cpp @@ -20,21 +20,21 @@ * */ +#include "../../inc/MarlinConfig.h" + +#if ENABLED(SDSUPPORT) + +#include "../gcode.h" +#include "../../sd/cardreader.h" + /** - * M49.cpp - Toggle the G26 debug flag + * M524: Abort the current SD print job (started with M24) */ +void GcodeSuite::M524() { -#include "../../../inc/MarlinConfig.h" + if (IS_SD_PRINTING()) + card.flag.abort_sd_printing = true; -#if ENABLED(G26_MESH_VALIDATION) - -#include "../../gcode.h" -#include "../../../feature/bedlevel/bedlevel.h" - -void GcodeSuite::M49() { - g26_debug_flag ^= true; - SERIAL_ECHOPGM("G26 Debug: "); - serialprintPGM(g26_debug_flag ? PSTR("On\n") : PSTR("Off\n")); } -#endif // G26_MESH_VALIDATION +#endif // SDSUPPORT diff --git a/Marlin/src/gcode/sdcard/M928.cpp b/Marlin/src/gcode/sdcard/M928.cpp new file mode 100644 index 0000000000..4cbd5db575 --- /dev/null +++ b/Marlin/src/gcode/sdcard/M928.cpp @@ -0,0 +1,39 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "../../inc/MarlinConfig.h" + +#if ENABLED(SDSUPPORT) + +#include "../gcode.h" +#include "../../sd/cardreader.h" + +/** + * M928: Start SD Logging + */ +void GcodeSuite::M928() { + + card.openLogFile(parser.string_arg); + +} + +#endif // SDSUPPORT diff --git a/Marlin/src/gcode/stats/M31.cpp b/Marlin/src/gcode/stats/M31.cpp index 1a6d3e8d1a..dbda27e099 100644 --- a/Marlin/src/gcode/stats/M31.cpp +++ b/Marlin/src/gcode/stats/M31.cpp @@ -26,10 +26,6 @@ #include "../../libs/duration_t.h" #include "../../lcd/ultralcd.h" -#if NUM_SERIAL > 1 - #include "../../gcode/queue.h" -#endif - /** * M31: Get the time since the start of SD Print (or last M109) */ diff --git a/Marlin/src/gcode/temperature/M104_M109.cpp b/Marlin/src/gcode/temperature/M104_M109.cpp index 8c8ed1586b..1b8fb2ab73 100644 --- a/Marlin/src/gcode/temperature/M104_M109.cpp +++ b/Marlin/src/gcode/temperature/M104_M109.cpp @@ -125,7 +125,7 @@ void GcodeSuite::M109() { print_job_timer.start(); #endif - #if ENABLED(ULTRA_LCD) || ENABLED(EXTENSIBLE_UI) + #if EITHER(ULTRA_LCD, EXTENSIBLE_UI) if (thermalManager.isHeatingHotend(target_extruder) || !no_wait_for_cooling) thermalManager.set_heating_message(target_extruder); #endif diff --git a/Marlin/src/gcode/temperature/M105.cpp b/Marlin/src/gcode/temperature/M105.cpp index ec366b23f0..ea613e6316 100644 --- a/Marlin/src/gcode/temperature/M105.cpp +++ b/Marlin/src/gcode/temperature/M105.cpp @@ -23,10 +23,6 @@ #include "../gcode.h" #include "../../module/temperature.h" -#if NUM_SERIAL > 1 - #include "../../gcode/queue.h" -#endif - /** * M105: Read hot end and bed temperature */ diff --git a/Marlin/src/gcode/temperature/M106_M107.cpp b/Marlin/src/gcode/temperature/M106_M107.cpp index 49558a7716..9e8012fcc1 100644 --- a/Marlin/src/gcode/temperature/M106_M107.cpp +++ b/Marlin/src/gcode/temperature/M106_M107.cpp @@ -33,7 +33,7 @@ #define _CNT_P EXTRUDERS #else #define _ALT_P MIN(active_extruder, FAN_COUNT - 1) - #define _CNT_P MIN(EXTRUDERS, FAN_COUNT) + #define _CNT_P FAN_COUNT #endif /** @@ -58,8 +58,8 @@ void GcodeSuite::M106() { const uint16_t t = parser.intval('T'); if (t > 0) return thermalManager.set_temp_fan_speed(p, t); #endif - - uint16_t s = parser.ushortval('S', 255); + uint16_t d = parser.seen('A') ? thermalManager.fan_speed[active_extruder] : 255; + uint16_t s = parser.ushortval('S', d); NOMORE(s, 255U); thermalManager.set_fan_speed(p, s); diff --git a/Marlin/src/gcode/temperature/M141_M191.cpp b/Marlin/src/gcode/temperature/M141_M191.cpp new file mode 100644 index 0000000000..3aeba2bb0a --- /dev/null +++ b/Marlin/src/gcode/temperature/M141_M191.cpp @@ -0,0 +1,77 @@ +/** + * 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 HAS_HEATED_CHAMBER + +#include "../gcode.h" +#include "../../module/temperature.h" + +/* +#include "../../module/motion.h" +#include "../../lcd/ultralcd.h" + +#if ENABLED(PRINTJOB_TIMER_AUTOSTART) + #include "../../module/printcounter.h" +#endif + +#if ENABLED(PRINTER_EVENT_LEDS) + #include "../../feature/leds/leds.h" +#endif + +#include "../../Marlin.h" // for wait_for_heatup and idle() +*/ + +/** + * M141: Set chamber temperature + */ +void GcodeSuite::M141() { + if (DEBUGGING(DRYRUN)) return; + if (parser.seenval('S')) thermalManager.setTargetChamber(parser.value_celsius()); +} + +/** + * M191: Sxxx Wait for chamber current temp to reach target temp. Waits only when heating + * Rxxx Wait for chamber current temp to reach target temp. Waits when heating and cooling + */ +/* +void GcodeSuite::M191() { + if (DEBUGGING(DRYRUN)) return; + + const bool no_wait_for_cooling = parser.seenval('S'); + if (no_wait_for_cooling || parser.seenval('R')) { + thermalManager.setTargetBed(parser.value_celsius()); + #if ENABLED(PRINTJOB_TIMER_AUTOSTART) + if (parser.value_celsius() > BED_MINTEMP) + print_job_timer.start(); + #endif + } + else return; + + lcd_setstatusPGM(thermalManager.isHeatingBed() ? PSTR(MSG_BED_HEATING) : PSTR(MSG_BED_COOLING)); + + thermalManager.wait_for_bed(no_wait_for_cooling); +} +*/ + +#endif // HAS_HEATED_CHAMBER diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index f30f5a9277..5054b622dc 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -64,11 +64,11 @@ #define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER -#elif ENABLED(miniVIKI) || ENABLED(VIKI2) || ENABLED(ELB_FULL_GRAPHIC_CONTROLLER) || ENABLED(AZSMZ_12864) +#elif ANY(miniVIKI, VIKI2, ELB_FULL_GRAPHIC_CONTROLLER, AZSMZ_12864) - #define ULTRA_LCD //general LCD support, also 16x2 - #define DOGLCD // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family) - #define ULTIMAKERCONTROLLER //as available from the Ultimaker online store. + #define ULTRA_LCD + #define DOGLCD + #define ULTIMAKERCONTROLLER #if ENABLED(miniVIKI) #define LCD_CONTRAST_MIN 75 @@ -141,7 +141,7 @@ #endif -#if ENABLED(MAKRPANEL) || ENABLED(MINIPANEL) +#if EITHER(MAKRPANEL, MINIPANEL) #define DOGLCD #define ULTIPANEL #define DEFAULT_LCD_CONTRAST 17 @@ -159,13 +159,13 @@ #endif // 128x64 I2C OLED LCDs - SSD1306/SSD1309/SH1106 -#define HAS_SSD1306_OLED_I2C (ENABLED(U8GLIB_SSD1306) || ENABLED(U8GLIB_SSD1309) || ENABLED(U8GLIB_SH1106)) +#define HAS_SSD1306_OLED_I2C ANY(U8GLIB_SSD1306, U8GLIB_SSD1309, U8GLIB_SH1106) #if HAS_SSD1306_OLED_I2C #define ULTRA_LCD #define DOGLCD #endif -#if ENABLED(PANEL_ONE) || ENABLED(U8GLIB_SH1106) +#if EITHER(PANEL_ONE, U8GLIB_SH1106) #define ULTIMAKERCONTROLLER @@ -177,17 +177,13 @@ #endif -#if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) || ENABLED(LCD_FOR_MELZI) || ENABLED(SILVER_GATE_GLCD_CONTROLLER) +#if ANY(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER, LCD_FOR_MELZI, SILVER_GATE_GLCD_CONTROLLER) #define DOGLCD #define U8GLIB_ST7920 #define REPRAP_DISCOUNT_SMART_CONTROLLER #endif -#if ENABLED(ULTIMAKERCONTROLLER) \ - || ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) \ - || ENABLED(G3D_PANEL) \ - || ENABLED(RIGIDBOT_PANEL) \ - || ENABLED(ULTI_CONTROLLER) +#if ANY(ULTIMAKERCONTROLLER, REPRAP_DISCOUNT_SMART_CONTROLLER, G3D_PANEL, RIGIDBOT_PANEL, ULTI_CONTROLLER) #define ULTIPANEL #endif @@ -223,7 +219,7 @@ * I2C PANELS */ -#if ENABLED(LCD_SAINSMART_I2C_1602) || ENABLED(LCD_SAINSMART_I2C_2004) +#if EITHER(LCD_SAINSMART_I2C_1602, LCD_SAINSMART_I2C_2004) #define LCD_I2C_TYPE_PCF8575 #define LCD_I2C_ADDRESS 0x27 // I2C Address of the port expander @@ -267,15 +263,11 @@ #define STD_ENCODER_PULSES_PER_STEP 2 #define STD_ENCODER_STEPS_PER_MENU_ITEM 1 -#elif ENABLED(miniVIKI) || ENABLED(VIKI2) \ - || ENABLED(ELB_FULL_GRAPHIC_CONTROLLER) \ - || ENABLED(AZSMZ_12864) \ - || ENABLED(OLED_PANEL_TINYBOY2) \ - || ENABLED(BQ_LCD_SMART_CONTROLLER) \ - || ENABLED(LCD_I2C_PANELOLU2) \ - || ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) +#elif ANY(miniVIKI, VIKI2, ELB_FULL_GRAPHIC_CONTROLLER, AZSMZ_12864, OLED_PANEL_TINYBOY2, BQ_LCD_SMART_CONTROLLER, LCD_I2C_PANELOLU2, REPRAP_DISCOUNT_SMART_CONTROLLER) + #define STD_ENCODER_PULSES_PER_STEP 4 #define STD_ENCODER_STEPS_PER_MENU_ITEM 1 + #endif #ifndef STD_ENCODER_PULSES_PER_STEP @@ -320,12 +312,6 @@ #define HAS_LCD_MENU (ENABLED(ULTIPANEL) && DISABLED(NO_LCD_MENUS)) #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)) - -// I2C buttons must be read in the main thread -#define HAS_SLOW_BUTTONS (ENABLED(LCD_I2C_VIKI) || ENABLED(LCD_I2C_PANELOLU2)) #if HAS_GRAPHICAL_LCD /** @@ -352,13 +338,6 @@ #endif #endif -// Boot screens -#if !HAS_SPI_LCD - #undef SHOW_BOOTSCREEN -#elif !defined(BOOTSCREEN_TIMEOUT) - #define BOOTSCREEN_TIMEOUT 2500 -#endif - /** * Extruders have some combination of stepper motors and hotends * so we separate these concepts into the defines: @@ -406,16 +385,16 @@ #endif // No inactive extruders with MK2_MULTIPLEXER or SWITCHING_NOZZLE -#if ENABLED(MK2_MULTIPLEXER) || ENABLED(SWITCHING_NOZZLE) +#if EITHER(MK2_MULTIPLEXER, SWITCHING_NOZZLE) #undef DISABLE_INACTIVE_EXTRUDER #endif // Prusa MK2 Multiplexer and MMU 2.0 force SINGLENOZZLE -#if ENABLED(MK2_MULTIPLEXER) || ENABLED(PRUSA_MMU2) +#if EITHER(MK2_MULTIPLEXER, PRUSA_MMU2) #define SINGLENOZZLE #endif -#if ENABLED(SINGLENOZZLE) || ENABLED(MIXING_EXTRUDER) // One hotend, one thermistor, no XY offset +#if EITHER(SINGLENOZZLE, MIXING_EXTRUDER) // One hotend, one thermistor, no XY offset #undef HOTENDS #define HOTENDS 1 #undef TEMP_SENSOR_1_AS_REDUNDANT @@ -441,6 +420,7 @@ #define SWITCHING_NOZZLE_TWO_SERVOS defined(SWITCHING_NOZZLE_E1_SERVO_NR) #define HAS_HOTEND_OFFSET (HOTENDS > 1) +#define HAS_DUPLICATION_MODE EITHER(DUAL_X_CARRIAGE, MULTI_NOZZLE_DUPLICATION) /** * DISTINCT_E_FACTORS affects how some E factors are accessed @@ -473,25 +453,13 @@ #ifndef BLTOUCH_DELAY #define BLTOUCH_DELAY 375 #endif - #undef Z_SERVO_ANGLES - #define Z_SERVO_ANGLES { BLTOUCH_DEPLOY, BLTOUCH_STOW } - - #define BLTOUCH_DEPLOY 10 - #define BLTOUCH_STOW 90 - #define BLTOUCH_SELFTEST 120 - #define BLTOUCH_RESET 160 - #define _TEST_BLTOUCH(P) (READ(P##_PIN) != P##_ENDSTOP_INVERTING) // Always disable probe pin inverting for BLTouch #undef Z_MIN_PROBE_ENDSTOP_INVERTING #define Z_MIN_PROBE_ENDSTOP_INVERTING false - #if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) #undef Z_MIN_ENDSTOP_INVERTING - #define Z_MIN_ENDSTOP_INVERTING Z_MIN_PROBE_ENDSTOP_INVERTING - #define TEST_BLTOUCH() _TEST_BLTOUCH(Z_MIN) - #else - #define TEST_BLTOUCH() _TEST_BLTOUCH(Z_MIN_PROBE) + #define Z_MIN_ENDSTOP_INVERTING false #endif #endif @@ -511,8 +479,8 @@ /** * 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) || ENABLED(SENSORLESS_PROBING) || ENABLED(RACK_AND_PINION_PROBE)) -#define PROBE_SELECTED (HAS_BED_PROBE || ENABLED(PROBE_MANUALLY) || ENABLED(MESH_BED_LEVELING)) +#define HAS_BED_PROBE (HAS_Z_SERVO_PROBE || ANY(FIX_MOUNTED_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, SOLENOID_PROBE, SENSORLESS_PROBING, RACK_AND_PINION_PROBE)) +#define PROBE_SELECTED (HAS_BED_PROBE || EITHER(PROBE_MANUALLY, MESH_BED_LEVELING)) #if HAS_BED_PROBE #define USES_Z_MIN_PROBE_ENDSTOP DISABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) @@ -533,19 +501,22 @@ #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(EXTENSIBLE_UI) || ENABLED(NEWPANEL) || ENABLED(EMERGENCY_PARSER)) -#define HAS_COLOR_LEDS (ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632) || ENABLED(PCA9533) || 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 HAS_SOFTWARE_ENDSTOPS EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) +#define HAS_RESUME_CONTINUE ANY(EXTENSIBLE_UI, NEWPANEL, EMERGENCY_PARSER) +#define HAS_COLOR_LEDS ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) +#define HAS_LEDS_OFF_FLAG (BOTH(PRINTER_EVENT_LEDS, SDSUPPORT) && HAS_RESUME_CONTINUE) +#define HAS_PRINT_PROGRESS EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY) #define HAS_SERVICE_INTERVALS (SERVICE_INTERVAL_1 > 0 || SERVICE_INTERVAL_2 > 0 || SERVICE_INTERVAL_3 > 0) -#define HAS_FILAMENT_SENSOR ENABLED(FILAMENT_RUNOUT_SENSOR) +#define HAS_FILAMENT_SENSOR ENABLED(FILAMENT_RUNOUT_SENSOR) -#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)) -#define HAS_EXTRA_ENDSTOPS (ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS) +#define Z_MULTI_STEPPER_DRIVERS EITHER(Z_DUAL_STEPPER_DRIVERS, Z_TRIPLE_STEPPER_DRIVERS) +#define Z_MULTI_ENDSTOPS EITHER(Z_DUAL_ENDSTOPS, Z_TRIPLE_ENDSTOPS) +#define HAS_EXTRA_ENDSTOPS (EITHER(X_DUAL_ENDSTOPS, Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS) -#define IS_SCARA (ENABLED(MORGAN_SCARA) || ENABLED(MAKERARM_SCARA)) +#define HAS_GAMES ANY(MARLIN_BRICKOUT, MARLIN_INVADERS, MARLIN_SNAKE, MARLIN_MAZE) +#define HAS_GAME_MENU (1 < ENABLED(MARLIN_BRICKOUT) + ENABLED(MARLIN_INVADERS) + ENABLED(MARLIN_SNAKE) + ENABLED(MARLIN_MAZE)) + +#define IS_SCARA EITHER(MORGAN_SCARA, MAKERARM_SCARA) #define IS_KINEMATIC (ENABLED(DELTA) || IS_SCARA) #define IS_CARTESIAN !IS_KINEMATIC diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index f7dd0446c2..d82f238097 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -106,9 +106,9 @@ /** * CoreXY, CoreXZ, and CoreYZ - and their reverse */ -#define CORE_IS_XY (ENABLED(COREXY) || ENABLED(COREYX)) -#define CORE_IS_XZ (ENABLED(COREXZ) || ENABLED(COREZX)) -#define CORE_IS_YZ (ENABLED(COREYZ) || ENABLED(COREZY)) +#define CORE_IS_XY EITHER(COREXY, COREYX) +#define CORE_IS_XZ EITHER(COREXZ, COREZX) +#define CORE_IS_YZ EITHER(COREYZ, COREZY) #define IS_CORE (CORE_IS_XY || CORE_IS_XZ || CORE_IS_YZ) #if IS_CORE #if CORE_IS_XY @@ -124,7 +124,7 @@ #define CORE_AXIS_1 B_AXIS #define CORE_AXIS_2 C_AXIS #endif - #if ENABLED(COREYX) || ENABLED(COREZX) || ENABLED(COREZY) + #if ANY(COREYX, COREZX, COREZY) #define CORESIGN(n) (-(n)) #else #define CORESIGN(n) (n) @@ -426,12 +426,12 @@ #define HEATER_CHAMBER_USES_THERMISTOR #endif -#define HOTEND_USES_THERMISTOR (ENABLED(HEATER_0_USES_THERMISTOR) || ENABLED(HEATER_1_USES_THERMISTOR) || ENABLED(HEATER_2_USES_THERMISTOR) || ENABLED(HEATER_3_USES_THERMISTOR) || ENABLED(HEATER_4_USES_THERMISTOR)) +#define HOTEND_USES_THERMISTOR ANY(HEATER_0_USES_THERMISTOR, HEATER_1_USES_THERMISTOR, HEATER_2_USES_THERMISTOR, HEATER_3_USES_THERMISTOR, HEATER_4_USES_THERMISTOR) /** * Default hotend offsets, if not defined */ -#if HOTENDS > 1 +#if HAS_HOTEND_OFFSET #ifndef HOTEND_OFFSET_X #define HOTEND_OFFSET_X { 0 } // X offsets for each extruder #endif @@ -877,8 +877,8 @@ #define AXIS_HAS_STALLGUARD(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2160) || AXIS_DRIVER_TYPE(ST, TMC2660) || AXIS_DRIVER_TYPE(ST, TMC5130) || AXIS_DRIVER_TYPE(ST, TMC5160)) #define AXIS_HAS_STEALTHCHOP(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2160) || AXIS_DRIVER_TYPE(ST, TMC2208) || AXIS_DRIVER_TYPE(ST, TMC5130) || AXIS_DRIVER_TYPE(ST, TMC5160)) - #define STEALTHCHOP_ENABLED (ENABLED(STEALTHCHOP_XY) || ENABLED(STEALTHCHOP_Z) || ENABLED(STEALTHCHOP_E)) - #define USE_SENSORLESS (ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING)) + #define STEALTHCHOP_ENABLED ANY(STEALTHCHOP_XY, STEALTHCHOP_Z, STEALTHCHOP_E) + #define USE_SENSORLESS EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) // Disable Z axis sensorless homing if a probe is used to home the Z axis #if HOMING_Z_WITH_PROBE #undef Z_STALL_SENSITIVITY @@ -914,12 +914,14 @@ #define HAS_TEMP_ADC_2 HAS_ADC_TEST(2) #define HAS_TEMP_ADC_3 HAS_ADC_TEST(3) #define HAS_TEMP_ADC_4 HAS_ADC_TEST(4) +#define HAS_TEMP_ADC_5 HAS_ADC_TEST(5) #define HAS_TEMP_ADC_BED HAS_ADC_TEST(BED) #define HAS_TEMP_ADC_CHAMBER HAS_ADC_TEST(CHAMBER) #define HAS_TEMP_HOTEND (HAS_TEMP_ADC_0 || ENABLED(HEATER_0_USES_MAX6675)) #define HAS_TEMP_BED HAS_TEMP_ADC_BED #define HAS_TEMP_CHAMBER HAS_TEMP_ADC_CHAMBER +#define HAS_HEATED_CHAMBER (HAS_TEMP_CHAMBER && PIN_EXISTS(CHAMBER_HEATER)) // Heaters #define HAS_HEATER_0 (PIN_EXISTS(HEATER_0)) @@ -927,6 +929,7 @@ #define HAS_HEATER_2 (PIN_EXISTS(HEATER_2)) #define HAS_HEATER_3 (PIN_EXISTS(HEATER_3)) #define HAS_HEATER_4 (PIN_EXISTS(HEATER_4)) +#define HAS_HEATER_5 (PIN_EXISTS(HEATER_5)) #define HAS_HEATER_BED (PIN_EXISTS(HEATER_BED)) // Shorthand for common combinations @@ -937,13 +940,14 @@ #if !HAS_HEATED_BED #undef PIDTEMPBED #endif -#define HAS_PID_HEATING (ENABLED(PIDTEMP) || ENABLED(PIDTEMPBED)) -#define HAS_PID_FOR_BOTH (ENABLED(PIDTEMP) && ENABLED(PIDTEMPBED)) +#define HAS_PID_HEATING EITHER(PIDTEMP, PIDTEMPBED) +#define HAS_PID_FOR_BOTH BOTH(PIDTEMP, PIDTEMPBED) // Thermal protection #define HAS_THERMALLY_PROTECTED_BED (HAS_HEATED_BED && ENABLED(THERMAL_PROTECTION_BED)) #define WATCH_HOTENDS (ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0) -#define WATCH_THE_BED (HAS_THERMALLY_PROTECTED_BED && WATCH_BED_TEMP_PERIOD > 0) +#define WATCH_BED (HAS_THERMALLY_PROTECTED_BED && WATCH_BED_TEMP_PERIOD > 0) +#define WATCH_CHAMBER (HAS_HEATED_CHAMBER && ENABLED(THERMAL_PROTECTION_CHAMBER) && WATCH_CHAMBER_TEMP_PERIOD > 0) // Auto fans #define HAS_AUTO_FAN_0 (PIN_EXISTS(E0_AUTO_FAN)) @@ -954,27 +958,6 @@ #define HAS_AUTO_FAN_5 (HOTENDS > 5 && PIN_EXISTS(E5_AUTO_FAN)) #define HAS_AUTO_CHAMBER_FAN (PIN_EXISTS(CHAMBER_AUTO_FAN)) #define HAS_AUTO_FAN (HAS_AUTO_FAN_0 || HAS_AUTO_FAN_1 || HAS_AUTO_FAN_2 || HAS_AUTO_FAN_3 || HAS_AUTO_FAN_4 || HAS_AUTO_FAN_5 || HAS_AUTO_CHAMBER_FAN) -#define AUTO_1_IS_0 (E1_AUTO_FAN_PIN == E0_AUTO_FAN_PIN) -#define AUTO_2_IS_0 (E2_AUTO_FAN_PIN == E0_AUTO_FAN_PIN) -#define AUTO_2_IS_1 (E2_AUTO_FAN_PIN == E1_AUTO_FAN_PIN) -#define AUTO_3_IS_0 (E3_AUTO_FAN_PIN == E0_AUTO_FAN_PIN) -#define AUTO_3_IS_1 (E3_AUTO_FAN_PIN == E1_AUTO_FAN_PIN) -#define AUTO_3_IS_2 (E3_AUTO_FAN_PIN == E2_AUTO_FAN_PIN) -#define AUTO_4_IS_0 (E4_AUTO_FAN_PIN == E0_AUTO_FAN_PIN) -#define AUTO_4_IS_1 (E4_AUTO_FAN_PIN == E1_AUTO_FAN_PIN) -#define AUTO_4_IS_2 (E4_AUTO_FAN_PIN == E2_AUTO_FAN_PIN) -#define AUTO_4_IS_3 (E4_AUTO_FAN_PIN == E3_AUTO_FAN_PIN) -#define AUTO_5_IS_0 (E5_AUTO_FAN_PIN == E0_AUTO_FAN_PIN) -#define AUTO_5_IS_1 (E5_AUTO_FAN_PIN == E1_AUTO_FAN_PIN) -#define AUTO_5_IS_2 (E5_AUTO_FAN_PIN == E2_AUTO_FAN_PIN) -#define AUTO_5_IS_3 (E5_AUTO_FAN_PIN == E3_AUTO_FAN_PIN) -#define AUTO_5_IS_4 (E5_AUTO_FAN_PIN == E4_AUTO_FAN_PIN) -#define AUTO_CHAMBER_IS_0 (CHAMBER_AUTO_FAN_PIN == E0_AUTO_FAN_PIN) -#define AUTO_CHAMBER_IS_1 (CHAMBER_AUTO_FAN_PIN == E1_AUTO_FAN_PIN) -#define AUTO_CHAMBER_IS_2 (CHAMBER_AUTO_FAN_PIN == E2_AUTO_FAN_PIN) -#define AUTO_CHAMBER_IS_3 (CHAMBER_AUTO_FAN_PIN == E3_AUTO_FAN_PIN) -#define AUTO_CHAMBER_IS_4 (CHAMBER_AUTO_FAN_PIN == E4_AUTO_FAN_PIN) -#define AUTO_CHAMBER_IS_5 (CHAMBER_AUTO_FAN_PIN == E5_AUTO_FAN_PIN) // Other fans #define HAS_FAN0 (PIN_EXISTS(FAN)) @@ -993,9 +976,9 @@ #define Z_PROBE_SERVO_NR -1 #endif -#define HAS_SERVO_ANGLES (ENABLED(SWITCHING_EXTRUDER) || ENABLED(SWITCHING_NOZZLE) || (HAS_Z_SERVO_PROBE && defined(Z_PROBE_SERVO_NR))) +#define HAS_SERVO_ANGLES (EITHER(SWITCHING_EXTRUDER, SWITCHING_NOZZLE) || (HAS_Z_SERVO_PROBE && defined(Z_PROBE_SERVO_NR))) -#if !HAS_SERVO_ANGLES +#if !HAS_SERVO_ANGLES || ENABLED(BLTOUCH) #undef EDITABLE_SERVO_ANGLES #endif @@ -1003,17 +986,17 @@ #define HAS_FILAMENT_WIDTH_SENSOR (PIN_EXISTS(FILWIDTH)) // User Interface -#define HAS_HOME (PIN_EXISTS(HOME)) -#define HAS_KILL (PIN_EXISTS(KILL)) -#define HAS_SUICIDE (PIN_EXISTS(SUICIDE)) -#define HAS_PHOTOGRAPH (PIN_EXISTS(PHOTOGRAPH)) -#define HAS_BUZZER (PIN_EXISTS(BEEPER) || ENABLED(LCD_USE_I2C_BUZZER)) -#define HAS_CASE_LIGHT (PIN_EXISTS(CASE_LIGHT) && ENABLED(CASE_LIGHT_ENABLE)) +#define HAS_HOME (PIN_EXISTS(HOME)) +#define HAS_KILL (PIN_EXISTS(KILL)) +#define HAS_SUICIDE (PIN_EXISTS(SUICIDE)) +#define HAS_PHOTOGRAPH (PIN_EXISTS(PHOTOGRAPH)) +#define HAS_BUZZER (PIN_EXISTS(BEEPER) || ENABLED(LCD_USE_I2C_BUZZER)) +#define HAS_CASE_LIGHT (PIN_EXISTS(CASE_LIGHT) && ENABLED(CASE_LIGHT_ENABLE)) // Digital control -#define HAS_STEPPER_RESET (PIN_EXISTS(STEPPER_RESET)) -#define HAS_DIGIPOTSS (PIN_EXISTS(DIGIPOTSS)) -#define HAS_MOTOR_CURRENT_PWM (PIN_EXISTS(MOTOR_CURRENT_PWM_X) || PIN_EXISTS(MOTOR_CURRENT_PWM_Y) || PIN_EXISTS(MOTOR_CURRENT_PWM_XY) || PIN_EXISTS(MOTOR_CURRENT_PWM_Z) || PIN_EXISTS(MOTOR_CURRENT_PWM_E)) +#define HAS_STEPPER_RESET (PIN_EXISTS(STEPPER_RESET)) +#define HAS_DIGIPOTSS (PIN_EXISTS(DIGIPOTSS)) +#define HAS_MOTOR_CURRENT_PWM ANY_PIN(MOTOR_CURRENT_PWM_X, MOTOR_CURRENT_PWM_Y, MOTOR_CURRENT_PWM_XY, MOTOR_CURRENT_PWM_Z, 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) @@ -1072,7 +1055,7 @@ #undef AUTO_REPORT_TEMPERATURES #endif -#define HAS_AUTO_REPORTING (ENABLED(AUTO_REPORT_TEMPERATURES) || ENABLED(AUTO_REPORT_SD_STATUS)) +#define HAS_AUTO_REPORTING EITHER(AUTO_REPORT_TEMPERATURES, AUTO_REPORT_SD_STATUS) /** * This setting is also used by M109 when trying to calculate @@ -1106,6 +1089,10 @@ #define HEATER_4_INVERTING false #endif +#if HAS_HEATER_5 && !defined(HEATER_5_INVERTING) + #define HEATER_5_INVERTING false +#endif + /** * Helper Macros for heaters and extruder fan */ @@ -1145,9 +1132,26 @@ #define WRITE_HEATER_BED(v) WRITE(HEATER_BED_PIN, (v) ^ HEATER_BED_INVERTING) #endif +/** + * Heated chamber requires settings + */ +#if HAS_HEATED_CHAMBER + #ifndef MAX_CHAMBER_POWER + #define MAX_CHAMBER_POWER 255 + #endif + #ifndef HEATER_CHAMBER_INVERTING + #define HEATER_CHAMBER_INVERTING false + #endif + #define WRITE_HEATER_CHAMBER(v) WRITE(HEATER_CHAMBER_PIN, (v) ^ HEATER_CHAMBER_INVERTING) +#endif + /** * Up to 3 PWM fans */ +#ifndef FAN_INVERTING + #define FAN_INVERTING false +#endif + #if HAS_FAN2 #define FAN_COUNT 3 #elif HAS_FAN1 @@ -1159,14 +1163,14 @@ #endif #if HAS_FAN0 - #define WRITE_FAN(v) WRITE(FAN_PIN, v) + #define WRITE_FAN(v) WRITE(FAN_PIN, (v) ^ FAN_INVERTING) #define WRITE_FAN0(v) WRITE_FAN(v) #endif #if HAS_FAN1 - #define WRITE_FAN1(v) WRITE(FAN1_PIN, v) + #define WRITE_FAN1(v) WRITE(FAN1_PIN, (v) ^ FAN_INVERTING) #endif #if HAS_FAN2 - #define WRITE_FAN2(v) WRITE(FAN2_PIN, v) + #define WRITE_FAN2(v) WRITE(FAN2_PIN, (v) ^ FAN_INVERTING) #endif #define WRITE_FAN_N(n, v) WRITE_FAN##n(v) @@ -1192,6 +1196,13 @@ #error "FAN_MIN_PWM must be less than or equal to FAN_MAX_PWM." #endif +/** + * FAST PWM FAN Settings + */ +#if ENABLED(FAST_PWM_FAN) && !defined(FAST_PWM_FAN_FREQUENCY) + #define FAST_PWM_FAN_FREQUENCY ((F_CPU) / (2 * 255 * 1)) // Fan frequency default +#endif + /** * Bed Probe dependencies */ @@ -1261,14 +1272,14 @@ /** * Set granular options based on the specific type of leveling */ -#define UBL_SEGMENTED (ENABLED(AUTO_BED_LEVELING_UBL) && (ENABLED(DELTA))) -#define ABL_PLANAR (ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_3POINT)) -#define ABL_GRID (ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)) +#define UBL_SEGMENTED BOTH(AUTO_BED_LEVELING_UBL, DELTA) +#define ABL_PLANAR EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_3POINT) +#define ABL_GRID EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) #define HAS_ABL_NOT_UBL (ABL_PLANAR || ABL_GRID) #define HAS_ABL_OR_UBL (HAS_ABL_NOT_UBL || ENABLED(AUTO_BED_LEVELING_UBL)) #define HAS_LEVELING (HAS_ABL_OR_UBL || ENABLED(MESH_BED_LEVELING)) #define HAS_AUTOLEVEL (HAS_ABL_OR_UBL && DISABLED(PROBE_MANUALLY)) -#define HAS_MESH (ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(MESH_BED_LEVELING)) +#define HAS_MESH ANY(AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_UBL, MESH_BED_LEVELING) #define PLANNER_LEVELING (HAS_LEVELING && DISABLED(AUTO_BED_LEVELING_UBL)) #define HAS_PROBING_PROCEDURE (HAS_ABL_OR_UBL || ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST)) #define HAS_POSITION_MODIFIERS (ENABLED(FWRETRACT) || HAS_LEVELING || ENABLED(SKEW_CORRECTION)) @@ -1286,8 +1297,8 @@ #undef NO_FAN_SLOWING_IN_PID_TUNING #endif -#define QUIET_PROBING (HAS_BED_PROBE && (ENABLED(PROBING_HEATERS_OFF) || ENABLED(PROBING_FANS_OFF) || DELAY_BEFORE_PROBING > 0)) -#define HEATER_IDLE_HANDLER (ENABLED(ADVANCED_PAUSE_FEATURE) || ENABLED(PROBING_HEATERS_OFF)) +#define QUIET_PROBING (HAS_BED_PROBE && (EITHER(PROBING_HEATERS_OFF, PROBING_FANS_OFF) || DELAY_BEFORE_PROBING > 0)) +#define HEATER_IDLE_HANDLER EITHER(ADVANCED_PAUSE_FEATURE, PROBING_HEATERS_OFF) #if ENABLED(ADVANCED_PAUSE_FEATURE) && !defined(FILAMENT_CHANGE_SLOW_LOAD_LENGTH) #define FILAMENT_CHANGE_SLOW_LOAD_LENGTH 0 @@ -1389,7 +1400,7 @@ /** * Default mesh area is an area with an inset margin on the print area. */ -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_UBL) +#if EITHER(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL) #if IS_KINEMATIC // Probing points may be verified at compile time within the radius // using static_assert(HYPOT2(X2-X1,Y2-Y1)<=sq(DELTA_PRINTABLE_RADIUS),"bad probe point!") @@ -1429,7 +1440,7 @@ #endif // MESH_BED_LEVELING || AUTO_BED_LEVELING_UBL -#if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(AUTO_BED_LEVELING_3POINT) +#if EITHER(AUTO_BED_LEVELING_UBL, AUTO_BED_LEVELING_3POINT) #if IS_KINEMATIC #define SIN0 0.0 #define SIN120 0.866025 @@ -1477,7 +1488,7 @@ #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) #ifndef LEFT_PROBE_BED_POSITION #define LEFT_PROBE_BED_POSITION MIN_PROBE_X #endif @@ -1512,9 +1523,9 @@ #endif /** - * VIKI2, miniVIKI, AZSMZ_12864, and MKS_12864OLED_SSD1306 require DOGLCD_SCK and DOGLCD_MOSI to be defined. + * Make sure DOGLCD_SCK and DOGLCD_MOSI are defined. */ -#if ENABLED(VIKI2) || ENABLED(miniVIKI) || ENABLED(AZSMZ_12864) || ENABLED(MKS_12864OLED_SSD1306) +#if ENABLED(DOGLCD) #ifndef DOGLCD_SCK #define DOGLCD_SCK SCK_PIN #endif @@ -1571,7 +1582,7 @@ #endif // 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) +#define USE_GCODE_SUBCODES ANY(G38_PROBE_TARGET, CNC_COORDINATE_SYSTEMS, POWER_LOSS_RECOVERY) // Parking Extruder #if ENABLED(PARKING_EXTRUDER) @@ -1613,8 +1624,8 @@ #endif #endif -// Nozzle park -#if ENABLED(NOZZLE_PARK_FEATURE) && ENABLED(DELTA) +// Nozzle park for Delta +#if BOTH(NOZZLE_PARK_FEATURE, DELTA) #undef NOZZLE_PARK_Z_FEEDRATE #define NOZZLE_PARK_Z_FEEDRATE NOZZLE_PARK_XY_FEEDRATE #endif @@ -1655,7 +1666,7 @@ // If platform requires early initialization of watchdog to properly boot #define EARLY_WATCHDOG (ENABLED(USE_WATCHDOG) && defined(ARDUINO_ARCH_SAM)) -#define USE_EXECUTE_COMMANDS_IMMEDIATE (ENABLED(G29_RETRY_AND_RECOVER) || ENABLED(GCODE_MACROS) || ENABLED(POWER_LOSS_RECOVERY) || HAS_DRIVER(L6470)) +#define USE_EXECUTE_COMMANDS_IMMEDIATE (ANY(G29_RETRY_AND_RECOVER, GCODE_MACROS, POWER_LOSS_RECOVERY) || HAS_DRIVER(L6470)) #if ENABLED(Z_TRIPLE_STEPPER_DRIVERS) #define Z_STEPPER_COUNT 3 diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 6965d8bddb..11de3fa178 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -345,6 +345,8 @@ #error "TMC_Z_CALIBRATION has been deprecated in favor of Z_STEPPER_AUTO_ALIGN. Please update your configuration." #elif defined(Z_MIN_PROBE_ENDSTOP) #error "Z_MIN_PROBE_ENDSTOP is no longer required. Please remove it from Configuration.h." +#elif defined(DUAL_NOZZLE_DUPLICATION_MODE) + #error "DUAL_NOZZLE_DUPLICATION_MODE is now MULTI_NOZZLE_DUPLICATION. Please update your configuration." #endif #define BOARD_MKS_13 -47 @@ -391,9 +393,9 @@ #elif RX_BUFFER_SIZE && (RX_BUFFER_SIZE < 2 || !IS_POWER_OF_2(RX_BUFFER_SIZE)) #error "RX_BUFFER_SIZE must be a power of 2 greater than 1." #elif TX_BUFFER_SIZE && (TX_BUFFER_SIZE < 2 || TX_BUFFER_SIZE > 256 || !IS_POWER_OF_2(TX_BUFFER_SIZE)) - #error "TX_BUFFER_SIZE must be 0, a power of 2 greater than 1, and no greater than 256." + #error "TX_BUFFER_SIZE must be 0 or a power of 2 between 1 and 256." #endif -#elif ENABLED(SERIAL_XON_XOFF) || ENABLED(SERIAL_STATS_MAX_RX_QUEUED) || ENABLED(SERIAL_STATS_DROPPED_RX) +#elif ANY(SERIAL_XON_XOFF, SERIAL_STATS_MAX_RX_QUEUED, SERIAL_STATS_DROPPED_RX) #error "SERIAL_XON_XOFF and SERIAL_STATS_* features not supported on USB-native AVR devices." #endif @@ -408,7 +410,7 @@ /** * Dual / Triple Stepper Drivers */ -#if ENABLED(X_DUAL_STEPPER_DRIVERS) && ENABLED(DUAL_X_CARRIAGE) +#if BOTH(X_DUAL_STEPPER_DRIVERS, DUAL_X_CARRIAGE) #error "DUAL_X_CARRIAGE is not compatible with X_DUAL_STEPPER_DRIVERS." #elif ENABLED(X_DUAL_STEPPER_DRIVERS) && !(HAS_X2_ENABLE && HAS_X2_STEP && HAS_X2_DIR) #error "X_DUAL_STEPPER_DRIVERS requires X2 pins (and an extra E plug)." @@ -436,7 +438,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #if ENABLED(MIN_SOFTWARE_ENDSTOPS) && DISABLED(MIN_SOFTWARE_ENDSTOP_Z) #if IS_KINEMATIC #error "MIN_SOFTWARE_ENDSTOPS on DELTA/SCARA also requires MIN_SOFTWARE_ENDSTOP_Z." - #elif DISABLED(MIN_SOFTWARE_ENDSTOP_X) && DISABLED(MIN_SOFTWARE_ENDSTOP_Y) + #elif DISABLED(MIN_SOFTWARE_ENDSTOP_X, MIN_SOFTWARE_ENDSTOP_Y) #error "MIN_SOFTWARE_ENDSTOPS requires at least one of the MIN_SOFTWARE_ENDSTOP_[XYZ] options." #endif #endif @@ -444,7 +446,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #if ENABLED(MAX_SOFTWARE_ENDSTOPS) && DISABLED(MAX_SOFTWARE_ENDSTOP_Z) #if IS_KINEMATIC #error "MAX_SOFTWARE_ENDSTOPS on DELTA/SCARA also requires MAX_SOFTWARE_ENDSTOP_Z." - #elif DISABLED(MAX_SOFTWARE_ENDSTOP_X) && DISABLED(MAX_SOFTWARE_ENDSTOP_Y) + #elif DISABLED(MAX_SOFTWARE_ENDSTOP_X, MAX_SOFTWARE_ENDSTOP_Y) #error "MAX_SOFTWARE_ENDSTOPS requires at least one of the MAX_SOFTWARE_ENDSTOP_[XYZ] options." #endif #endif @@ -460,21 +462,21 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "PULLDOWN pin mode is not available on the selected board." #endif -#if ENABLED(ENDSTOPPULLUPS) && ENABLED(ENDSTOPPULLDOWNS) +#if BOTH(ENDSTOPPULLUPS, ENDSTOPPULLDOWNS) #error "Enable only one of ENDSTOPPULLUPS or ENDSTOPPULLDOWNS." -#elif ENABLED(FIL_RUNOUT_PULLUP) && ENABLED(FIL_RUNOUT_PULLDOWN) +#elif BOTH(FIL_RUNOUT_PULLUP, FIL_RUNOUT_PULLDOWN) #error "Enable only one of FIL_RUNOUT_PULLUP or FIL_RUNOUT_PULLDOWN." -#elif ENABLED(ENDSTOPPULLUP_XMAX) && ENABLED(ENDSTOPPULLDOWN_XMAX) +#elif BOTH(ENDSTOPPULLUP_XMAX, ENDSTOPPULLDOWN_XMAX) #error "Enable only one of ENDSTOPPULLUP_X_MAX or ENDSTOPPULLDOWN_X_MAX." -#elif ENABLED(ENDSTOPPULLUP_YMAX) && ENABLED(ENDSTOPPULLDOWN_YMAX) +#elif BOTH(ENDSTOPPULLUP_YMAX, ENDSTOPPULLDOWN_YMAX) #error "Enable only one of ENDSTOPPULLUP_Y_MAX or ENDSTOPPULLDOWN_Y_MAX." -#elif ENABLED(ENDSTOPPULLUP_ZMAX) && ENABLED(ENDSTOPPULLDOWN_ZMAX) +#elif BOTH(ENDSTOPPULLUP_ZMAX, ENDSTOPPULLDOWN_ZMAX) #error "Enable only one of ENDSTOPPULLUP_Z_MAX or ENDSTOPPULLDOWN_Z_MAX." -#elif ENABLED(ENDSTOPPULLUP_XMIN) && ENABLED(ENDSTOPPULLDOWN_XMIN) +#elif BOTH(ENDSTOPPULLUP_XMIN, ENDSTOPPULLDOWN_XMIN) #error "Enable only one of ENDSTOPPULLUP_X_MIN or ENDSTOPPULLDOWN_X_MIN." -#elif ENABLED(ENDSTOPPULLUP_YMIN) && ENABLED(ENDSTOPPULLDOWN_YMIN) +#elif BOTH(ENDSTOPPULLUP_YMIN, ENDSTOPPULLDOWN_YMIN) #error "Enable only one of ENDSTOPPULLUP_Y_MIN or ENDSTOPPULLDOWN_Y_MIN." -#elif ENABLED(ENDSTOPPULLUP_ZMIN) && ENABLED(ENDSTOPPULLDOWN_ZMIN) +#elif BOTH(ENDSTOPPULLUP_ZMIN, ENDSTOPPULLDOWN_ZMIN) #error "Enable only one of ENDSTOPPULLUP_Z_MIN or ENDSTOPPULLDOWN_Z_MIN." #endif @@ -493,7 +495,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS * Progress Bar */ #if ENABLED(LCD_PROGRESS_BAR) - #if DISABLED(SDSUPPORT) && DISABLED(LCD_SET_PROGRESS_MANUALLY) + #if DISABLED(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY) #error "LCD_PROGRESS_BAR requires SDSUPPORT or LCD_SET_PROGRESS_MANUALLY." #elif !HAS_CHARACTER_LCD #error "LCD_PROGRESS_BAR requires a character LCD." @@ -511,7 +513,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS /** * Custom Boot and Status screens */ -#if DISABLED(DOGLCD) && (ENABLED(SHOW_CUSTOM_BOOTSCREEN) || ENABLED(CUSTOM_STATUS_SCREEN_IMAGE)) +#if DISABLED(DOGLCD) && EITHER(SHOW_CUSTOM_BOOTSCREEN, CUSTOM_STATUS_SCREEN_IMAGE) #error "Graphical LCD is required for SHOW_CUSTOM_BOOTSCREEN and CUSTOM_STATUS_SCREEN_IMAGE." #endif @@ -549,6 +551,10 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #endif #endif +#if defined(EVENT_GCODE_SD_STOP) && DISABLED(NOZZLE_PARK_FEATURE) + static_assert(NULL == strstr(EVENT_GCODE_SD_STOP, "G27"), "NOZZLE_PARK_FEATURE is required to use G27 in EVENT_GCODE_SD_STOP."); +#endif + /** * I2C Position Encoders */ @@ -566,9 +572,9 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #if ENABLED(BABYSTEPPING) #if ENABLED(SCARA) #error "BABYSTEPPING is not implemented for SCARA yet." - #elif ENABLED(DELTA) && ENABLED(BABYSTEP_XY) + #elif BOTH(DELTA, BABYSTEP_XY) #error "BABYSTEPPING only implemented for Z axis on deltabots." - #elif ENABLED(BABYSTEP_ZPROBE_OFFSET) && ENABLED(MESH_BED_LEVELING) + #elif BOTH(BABYSTEP_ZPROBE_OFFSET, MESH_BED_LEVELING) #error "MESH_BED_LEVELING and BABYSTEP_ZPROBE_OFFSET is not a valid combination" #elif ENABLED(BABYSTEP_ZPROBE_OFFSET) && !HAS_BED_PROBE #error "BABYSTEP_ZPROBE_OFFSET requires a probe." @@ -578,7 +584,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "BABYSTEP_ZPROBE_GFX_OVERLAY requires a BABYSTEP_ZPROBE_OFFSET." #elif ENABLED(BABYSTEP_HOTEND_Z_OFFSET) && !HAS_HOTEND_OFFSET #error "BABYSTEP_HOTEND_Z_OFFSET requires 2 or more HOTENDS." - #elif ENABLED(BABYSTEP_ALWAYS_AVAILABLE) && ENABLED(MOVE_Z_WHEN_IDLE) + #elif BOTH(BABYSTEP_ALWAYS_AVAILABLE, MOVE_Z_WHEN_IDLE) #error "BABYSTEP_ALWAYS_AVAILABLE and MOVE_Z_WHEN_IDLE are incompatible." #endif #endif @@ -601,7 +607,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "FILAMENT_RUNOUT_SENSOR with NUM_RUNOUT_SENSORS > 4 requires FIL_RUNOUT5_PIN." #elif NUM_RUNOUT_SENSORS > 5 && !PIN_EXISTS(FIL_RUNOUT6) #error "FILAMENT_RUNOUT_SENSOR with NUM_RUNOUT_SENSORS > 5 requires FIL_RUNOUT6_PIN." - #elif DISABLED(SDSUPPORT) && DISABLED(PRINTJOB_TIMER_AUTOSTART) + #elif DISABLED(SDSUPPORT, PRINTJOB_TIMER_AUTOSTART) #error "FILAMENT_RUNOUT_SENSOR requires SDSUPPORT or PRINTJOB_TIMER_AUTOSTART." #elif DISABLED(ADVANCED_PAUSE_FEATURE) static_assert(NULL == strstr(FILAMENT_RUNOUT_SCRIPT, "M600"), "ADVANCED_PAUSE_FEATURE is required to use M600 with FILAMENT_RUNOUT_SENSOR."); @@ -616,7 +622,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "ADVANCED_PAUSE_FEATURE currently requires an LCD controller or EMERGENCY_PARSER." #elif ENABLED(EXTRUDER_RUNOUT_PREVENT) #error "EXTRUDER_RUNOUT_PREVENT is incompatible with ADVANCED_PAUSE_FEATURE." - #elif ENABLED(PARK_HEAD_ON_PAUSE) && DISABLED(SDSUPPORT) && DISABLED(NEWPANEL) && DISABLED(EMERGENCY_PARSER) + #elif ENABLED(PARK_HEAD_ON_PAUSE) && DISABLED(SDSUPPORT, NEWPANEL, EMERGENCY_PARSER) #error "PARK_HEAD_ON_PAUSE requires SDSUPPORT, EMERGENCY_PARSER, or an LCD controller." #elif ENABLED(HOME_BEFORE_FILAMENT_CHANGE) && DISABLED(PAUSE_PARK_NO_STEPPER_TIMEOUT) #error "HOME_BEFORE_FILAMENT_CHANGE requires PAUSE_PARK_NO_STEPPER_TIMEOUT." @@ -639,7 +645,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS /** * Individual axis homing is useless for DELTAS */ -#if ENABLED(INDIVIDUAL_AXIS_HOMING_MENU) && ENABLED(DELTA) +#if BOTH(INDIVIDUAL_AXIS_HOMING_MENU, DELTA) #error "INDIVIDUAL_AXIS_HOMING_MENU is incompatible with DELTA kinematics." #endif @@ -808,7 +814,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "Enable only one of PARKING_EXTRUDER and MAGNETIC_PARKING_EXTRUDER." #elif EXTRUDERS != 2 #error "PARKING_EXTRUDER requires exactly 2 EXTRUDERS." - #elif !PIN_EXISTS(SOL0) || !PIN_EXISTS(SOL1) + #elif !PIN_EXISTS(SOL0, SOL1) #error "PARKING_EXTRUDER requires SOL0_PIN and SOL1_PIN." #elif !defined(PARKING_EXTRUDER_PARKING_X) #error "PARKING_EXTRUDER requires PARKING_EXTRUDER_PARKING_X." @@ -905,7 +911,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS /** * Bed Heating Options - PID vs Limit Switching */ -#if ENABLED(PIDTEMPBED) && ENABLED(BED_LIMIT_SWITCHING) +#if BOTH(PIDTEMPBED, BED_LIMIT_SWITCHING) #error "To use BED_LIMIT_SWITCHING you must disable PIDTEMPBED." #endif @@ -933,7 +939,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS * Delta requirements */ #if ENABLED(DELTA) - #if DISABLED(USE_XMAX_PLUG) && DISABLED(USE_YMAX_PLUG) && DISABLED(USE_ZMAX_PLUG) + #if DISABLED(USE_XMAX_PLUG, USE_YMAX_PLUG, USE_ZMAX_PLUG) #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." @@ -972,7 +978,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS /** * Z_PROBE_SLED is incompatible with DELTA */ - #if ENABLED(Z_PROBE_SLED) && ENABLED(DELTA) + #if BOTH(Z_PROBE_SLED, DELTA) #error "You cannot use Z_PROBE_SLED with DELTA." #endif @@ -1085,7 +1091,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS * Bed Leveling Requirements */ -#if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(AUTO_BED_LEVELING_3POINT) +#if EITHER(AUTO_BED_LEVELING_UBL, AUTO_BED_LEVELING_3POINT) static_assert(WITHIN(PROBE_PT_1_X, MIN_PROBE_X, MAX_PROBE_X), "PROBE_PT_1_X is outside the probe region."); static_assert(WITHIN(PROBE_PT_2_X, MIN_PROBE_X, MAX_PROBE_X), "PROBE_PT_2_X is outside the probe region."); static_assert(WITHIN(PROBE_PT_3_X, MIN_PROBE_X, MAX_PROBE_X), "PROBE_PT_3_X is outside the probe region."); @@ -1219,8 +1225,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS /** * Make sure DISABLE_[XYZ] compatible with selected homing options */ -#if ENABLED(DISABLE_X) || ENABLED(DISABLE_Y) || ENABLED(DISABLE_Z) - #if ENABLED(HOME_AFTER_DEACTIVATE) || ENABLED(Z_SAFE_HOMING) +#if ANY(DISABLE_X, DISABLE_Y, DISABLE_Z) + #if EITHER(HOME_AFTER_DEACTIVATE, Z_SAFE_HOMING) #error "DISABLE_[XYZ] is not compatible with HOME_AFTER_DEACTIVATE or Z_SAFE_HOMING." #endif #endif @@ -1239,7 +1245,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS /** * ULTIPANEL encoder */ -#if ENABLED(ULTIPANEL) && DISABLED(NEWPANEL) && DISABLED(SR_LCD_2W_NL) && !defined(SHIFT_CLK) +#if ENABLED(ULTIPANEL) && DISABLED(NEWPANEL, SR_LCD_2W_NL) && !defined(SHIFT_CLK) #error "ULTIPANEL requires some kind of encoder." #endif @@ -1251,9 +1257,9 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS * SAV_3DGLCD display options */ #if ENABLED(SAV_3DGLCD) - #if DISABLED(U8GLIB_SSD1306) && DISABLED(U8GLIB_SH1106) + #if DISABLED(U8GLIB_SSD1306, U8GLIB_SH1106) #error "Enable a SAV_3DGLCD display type: U8GLIB_SSD1306 or U8GLIB_SH1106." - #elif ENABLED(U8GLIB_SSD1306) && ENABLED(U8GLIB_SH1106) + #elif BOTH(U8GLIB_SSD1306, U8GLIB_SH1106) #error "Only enable one SAV_3DGLCD display type: U8GLIB_SSD1306 or U8GLIB_SH1106." #endif #endif @@ -1332,11 +1338,11 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS */ #if !HAS_HEATER_0 #error "HEATER_0_PIN not defined for this board." -#elif !PIN_EXISTS(TEMP_0) && !PIN_EXISTS(MAX6675_SS) +#elif !ANY_PIN(TEMP_0, 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))) +#elif ((defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)) && !PIN_EXISTS(E0_STEP, E0_DIR)) #error "E0_STEP_PIN or E0_DIR_PIN not defined for this board." -#elif ( !(defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)) && (!PIN_EXISTS(E0_STEP) || !PIN_EXISTS(E0_DIR) || !HAS_E0_ENABLE)) +#elif ( !(defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)) && (!PIN_EXISTS(E0_STEP, E0_DIR) || !HAS_E0_ENABLE)) #error "E0_STEP_PIN, E0_DIR_PIN, or E0_ENABLE_PIN not defined for this board." #elif TEMP_SENSOR_0 == 0 #error "TEMP_SENSOR_0 is required." @@ -1354,7 +1360,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #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) && !PIN_EXISTS(MAX6675_SS2) + #elif !ANY_PIN(TEMP_1, MAX6675_SS2) #error "TEMP_1_PIN not defined for this board." #endif #if HOTENDS > 2 @@ -1432,7 +1438,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS /** * Temperature status LEDs */ -#if ENABLED(TEMP_STAT_LEDS) && !PIN_EXISTS(STAT_LED_RED) && !PIN_EXISTS(STAT_LED_BLUE) +#if ENABLED(TEMP_STAT_LEDS) && !ANY_PIN(STAT_LED_RED, STAT_LED_BLUE) #error "TEMP_STAT_LEDS requires STAT_LED_RED_PIN or STAT_LED_BLUE_PIN, preferably both." #endif @@ -1440,23 +1446,23 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS * LED Control Menu */ #if ENABLED(LED_CONTROL_MENU) && !HAS_COLOR_LEDS - #error "LED_CONTROL_MENU requires BLINKM, RGB_LED, RGBW_LED, PCA9632, or NEOPIXEL_LED." + #error "LED_CONTROL_MENU requires BLINKM, RGB_LED, RGBW_LED, PCA9533, PCA9632, or NEOPIXEL_LED." #endif /** - * Basic 2-nozzle duplication mode + * Basic multi hotend duplication mode */ -#if ENABLED(DUAL_NOZZLE_DUPLICATION_MODE) - #if HOTENDS != 2 - #error "DUAL_NOZZLE_DUPLICATION_MODE requires exactly 2 hotends." +#if ENABLED(MULTI_NOZZLE_DUPLICATION) + #if HOTENDS < 2 + #error "MULTI_NOZZLE_DUPLICATION requires 2 or more hotends." #elif ENABLED(DUAL_X_CARRIAGE) - #error "DUAL_NOZZLE_DUPLICATION_MODE is incompatible with DUAL_X_CARRIAGE." + #error "MULTI_NOZZLE_DUPLICATION is incompatible with DUAL_X_CARRIAGE." #elif ENABLED(SINGLENOZZLE) - #error "DUAL_NOZZLE_DUPLICATION_MODE is incompatible with SINGLENOZZLE." + #error "MULTI_NOZZLE_DUPLICATION is incompatible with SINGLENOZZLE." #elif ENABLED(MIXING_EXTRUDER) - #error "DUAL_NOZZLE_DUPLICATION_MODE is incompatible with MIXING_EXTRUDER." + #error "MULTI_NOZZLE_DUPLICATION is incompatible with MIXING_EXTRUDER." #elif ENABLED(SWITCHING_EXTRUDER) - #error "DUAL_NOZZLE_DUPLICATION_MODE is incompatible with SWITCHING_EXTRUDER." + #error "MULTI_NOZZLE_DUPLICATION is incompatible with SWITCHING_EXTRUDER." #endif #endif @@ -1465,27 +1471,27 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS */ #if DISABLED(MK2_MULTIPLEXER) // MK2_MULTIPLEXER uses E0 stepper only #if E_STEPPERS - #if !(PIN_EXISTS(E0_STEP) && PIN_EXISTS(E0_DIR) && HAS_E0_ENABLE) + #if !(PIN_EXISTS(E0_STEP, E0_DIR) && HAS_E0_ENABLE) #error "E0_STEP_PIN, E0_DIR_PIN, or E0_ENABLE_PIN not defined for this board." #endif #if E_STEPPERS > 1 - #if !(PIN_EXISTS(E1_STEP) && PIN_EXISTS(E1_DIR) && HAS_E1_ENABLE) + #if !(PIN_EXISTS(E1_STEP, E1_DIR) && HAS_E1_ENABLE) #error "E1_STEP_PIN, E1_DIR_PIN, or E1_ENABLE_PIN not defined for this board." #endif #if E_STEPPERS > 2 - #if !(PIN_EXISTS(E2_STEP) && PIN_EXISTS(E2_DIR) && HAS_E2_ENABLE) + #if !(PIN_EXISTS(E2_STEP, E2_DIR) && HAS_E2_ENABLE) #error "E2_STEP_PIN, E2_DIR_PIN, or E2_ENABLE_PIN not defined for this board." #endif #if E_STEPPERS > 3 - #if !(PIN_EXISTS(E3_STEP) && PIN_EXISTS(E3_DIR) && HAS_E3_ENABLE) + #if !(PIN_EXISTS(E3_STEP, E3_DIR) && HAS_E3_ENABLE) #error "E3_STEP_PIN, E3_DIR_PIN, or E3_ENABLE_PIN not defined for this board." #endif #if E_STEPPERS > 4 - #if !(PIN_EXISTS(E4_STEP) && PIN_EXISTS(E4_DIR) && HAS_E4_ENABLE) + #if !(PIN_EXISTS(E4_STEP, E4_DIR) && HAS_E4_ENABLE) #error "E4_STEP_PIN, E4_DIR_PIN, or E4_ENABLE_PIN not defined for this board." #endif #if E_STEPPERS > 5 - #if !(PIN_EXISTS(E5_STEP) && PIN_EXISTS(E5_DIR) && HAS_E5_ENABLE) + #if !(PIN_EXISTS(E5_STEP, E5_DIR) && HAS_E5_ENABLE) #error "E5_STEP_PIN, E5_DIR_PIN, or E5_ENABLE_PIN not defined for this board." #endif #endif // E_STEPPERS > 5 @@ -1500,7 +1506,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS * Endstop Tests */ -#define _PLUG_UNUSED_TEST(AXIS,PLUG) (DISABLED(USE_##PLUG##MIN_PLUG) && DISABLED(USE_##PLUG##MAX_PLUG) && !(ENABLED(AXIS##_DUAL_ENDSTOPS) && WITHIN(AXIS##2_USE_ENDSTOP, _##PLUG##MAX_, _##PLUG##MIN_))) +#define _PLUG_UNUSED_TEST(AXIS,PLUG) (DISABLED(USE_##PLUG##MIN_PLUG, USE_##PLUG##MAX_PLUG) && !(ENABLED(AXIS##_DUAL_ENDSTOPS) && WITHIN(AXIS##2_USE_ENDSTOP, _##PLUG##MAX_, _##PLUG##MIN_))) #define _AXIS_PLUG_UNUSED_TEST(AXIS) (_PLUG_UNUSED_TEST(AXIS,X) && _PLUG_UNUSED_TEST(AXIS,Y) && _PLUG_UNUSED_TEST(AXIS,Z)) // At least 3 endstop plugs must be used @@ -1673,9 +1679,9 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS /** * RGB_LED Requirements */ -#define _RGB_TEST (PIN_EXISTS(RGB_LED_R) && PIN_EXISTS(RGB_LED_G) && PIN_EXISTS(RGB_LED_B)) +#define _RGB_TEST (PIN_EXISTS(RGB_LED_R, RGB_LED_G, RGB_LED_B)) #if ENABLED(PRINTER_EVENT_LEDS) && !HAS_COLOR_LEDS - #error "PRINTER_EVENT_LEDS requires BLINKM, PCA9632, RGB_LED, RGBW_LED or NEOPIXEL_LED." + #error "PRINTER_EVENT_LEDS requires BLINKM, PCA9533, 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." @@ -1698,13 +1704,13 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #if HAS_AUTO_FAN && EXTRUDER_AUTO_FAN_SPEED != 255 #define AF_ERR_SUFF "_AUTO_FAN_PIN is not a PWM pin. Set EXTRUDER_AUTO_FAN_SPEED to 255." #if HAS_AUTO_FAN_0 - static_assert(GET_TIMER(E0_AUTO_FAN_PIN), "E0" AF_ERR_SUFF); + static_assert(PWM_PIN(E0_AUTO_FAN_PIN), "E0" AF_ERR_SUFF); #elif HAS_AUTO_FAN_1 - static_assert(GET_TIMER(E1_AUTO_FAN_PIN), "E1" AF_ERR_SUFF); + static_assert(PWM_PIN(E1_AUTO_FAN_PIN), "E1" AF_ERR_SUFF); #elif HAS_AUTO_FAN_2 - static_assert(GET_TIMER(E2_AUTO_FAN_PIN), "E2" AF_ERR_SUFF); + static_assert(PWM_PIN(E2_AUTO_FAN_PIN), "E2" AF_ERR_SUFF); #elif HAS_AUTO_FAN_3 - static_assert(GET_TIMER(E3_AUTO_FAN_PIN), "E3" AF_ERR_SUFF); + static_assert(PWM_PIN(E3_AUTO_FAN_PIN), "E3" AF_ERR_SUFF); #endif #endif @@ -1756,7 +1762,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS + ENABLED(G3D_PANEL) \ + (ENABLED(MINIPANEL) && DISABLED(MKS_MINI_12864)) \ + ENABLED(MKS_MINI_12864) \ - + (ENABLED(REPRAPWORLD_KEYPAD) && DISABLED(CARTESIO_UI) && DISABLED(ZONESTAR_LCD)) \ + + (ENABLED(REPRAPWORLD_KEYPAD) && DISABLED(CARTESIO_UI, ZONESTAR_LCD)) \ + ENABLED(RIGIDBOT_PANEL) \ + ENABLED(RA_CONTROL_PANEL) \ + ENABLED(LCD_SAINSMART_I2C_1602) \ @@ -1764,13 +1770,14 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS + ENABLED(LCM1602) \ + ENABLED(LCD_I2C_PANELOLU2) \ + ENABLED(LCD_I2C_VIKI) \ - + (ENABLED(U8GLIB_SSD1306) && DISABLED(OLED_PANEL_TINYBOY2) && DISABLED(MKS_12864OLED_SSD1306)) \ + + (ENABLED(U8GLIB_SSD1306) && DISABLED(OLED_PANEL_TINYBOY2, MKS_12864OLED_SSD1306)) \ + ENABLED(SAV_3DLCD) \ + ENABLED(BQ_LCD_SMART_CONTROLLER) \ + ENABLED(SAV_3DGLCD) \ + ENABLED(OLED_PANEL_TINYBOY2) \ + ENABLED(ZONESTAR_LCD) \ - + ENABLED(ULTI_CONTROLLER) + + ENABLED(ULTI_CONTROLLER) \ + + ENABLED(EXTENSIBLE_UI) #error "Please select no more than one LCD controller option." #endif @@ -1810,7 +1817,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS /** * 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)))) +#define INVALID_TMC2208(ST) (AXIS_DRIVER_TYPE(ST, TMC2208) && !(defined(ST##_HARDWARE_SERIAL) || (PIN_EXISTS(ST##_SERIAL_RX, 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) @@ -1884,7 +1891,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS // is necessary in order to reset the stallGuard indication between the initial movement of all three // towers to +Z and the individual homing of each tower. This restriction can be removed once a means of // clearing the stallGuard activated status is found. - #if ENABLED(DELTA) && !(ENABLED(STEALTHCHOP_XY) && ENABLED(STEALTHCHOP_Z)) + #if ENABLED(DELTA) && !BOTH(STEALTHCHOP_XY, STEALTHCHOP_Z) #error "SENSORLESS_HOMING on DELTA currently requires STEALTHCHOP_XY and STEALTHCHOP_Z." #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." @@ -1906,7 +1913,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS // 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) +#elif BOTH(SENSORLESS_PROBING, 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." @@ -1978,7 +1985,7 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2) #undef _ARR_TEST -#if ENABLED(CNC_COORDINATE_SYSTEMS) && ENABLED(NO_WORKSPACE_OFFSETS) +#if BOTH(CNC_COORDINATE_SYSTEMS, NO_WORKSPACE_OFFSETS) #error "CNC_COORDINATE_SYSTEMS is incompatible with NO_WORKSPACE_OFFSETS." #endif @@ -2012,10 +2019,6 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2) #error "POWER_LOSS_RECOVERY currently requires an LCD Controller." #endif -#if ENABLED(FAST_PWM_FAN) && !(defined(ARDUINO) && !defined(ARDUINO_ARCH_SAM)) - #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." @@ -2033,7 +2036,7 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2) #error "PRINTCOUNTER requires EEPROM_SETTINGS. Please update your Configuration." #endif -#if ENABLED(USB_FLASH_DRIVE_SUPPORT) && !(PIN_EXISTS(USB_CS) && PIN_EXISTS(USB_INTR)) +#if ENABLED(USB_FLASH_DRIVE_SUPPORT) && !PIN_EXISTS(USB_CS, USB_INTR) #error "USB_CS_PIN and USB_INTR_PIN are required for USB_FLASH_DRIVE_SUPPORT." #endif @@ -2118,3 +2121,14 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2) #error "Both SERVICE_NAME_3 and SERVICE_INTERVAL_3 are required." #endif #endif + +/** + * Require soft endstops for certain setups + */ +#if DISABLED(MIN_SOFTWARE_ENDSTOPS) || DISABLED(MAX_SOFTWARE_ENDSTOPS) + #if ENABLED(DUAL_X_CARRIAGE) + #error "DUAL_X_CARRIAGE requires both MIN_ and MAX_SOFTWARE_ENDSTOPS." + #elif HAS_HOTEND_OFFSET + #error "MIN_ and MAX_SOFTWARE_ENDSTOPS are both required with offset hotends." + #endif +#endif diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index a0005e10cc..688beb154f 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -38,7 +38,7 @@ /** * Marlin release version identifier */ - #define SHORT_BUILD_VERSION "2.0.x_R11" + #define SHORT_BUILD_VERSION "2.0.x_R12" /** * Verbose version identifier which should contain a reference to the location @@ -51,7 +51,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ - #define STRING_DISTRIBUTION_DATE "2019-03-02" + #define STRING_DISTRIBUTION_DATE "2019-04-08" /** * Required minimum Configuration.h and Configuration_adv.h file versions. diff --git a/Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp b/Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp index dc7858589a..d400915e7e 100644 --- a/Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp +++ b/Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp @@ -40,7 +40,7 @@ #include "../../module/planner.h" #include "../../module/motion.h" -#if DISABLED(LCD_PROGRESS_BAR) && ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) +#if DISABLED(LCD_PROGRESS_BAR) && BOTH(FILAMENT_LCD_DISPLAY, SDSUPPORT) #include "../../feature/filwidth.h" #include "../../gcode/parser.h" #endif @@ -57,7 +57,7 @@ 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) || ENABLED(LCD_I2C_TYPE_MCP23008) +#elif EITHER(LCD_I2C_TYPE_MCP23017, LCD_I2C_TYPE_MCP23008) LCD_CLASS lcd(LCD_I2C_ADDRESS #ifdef DETECT_DEVICE @@ -111,7 +111,7 @@ static void createChar_P(const char c, const byte * const ptr) { #endif void MarlinUI::set_custom_characters(const HD44780CharSet screen_charset/*=CHARSET_INFO*/) { - #if DISABLED(LCD_PROGRESS_BAR) && DISABLED(SHOW_BOOTSCREEN) + #if DISABLED(LCD_PROGRESS_BAR, SHOW_BOOTSCREEN) UNUSED(screen_charset); #endif @@ -515,7 +515,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const 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 DISABLED(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) if (!TEST(axis_known_position, axis)) lcd_put_u8str_P(axis == Z_AXIS ? PSTR(" ") : PSTR(" ")); else @@ -544,9 +544,9 @@ FORCE_INLINE void _draw_heater_status(const int8_t heater, const char prefix, co #else const bool is_idle = ( #if HAS_HEATED_BED - isBed ? thermalManager.is_bed_idle() : + isBed ? thermalManager.bed_idle.timed_out : #endif - thermalManager.is_heater_idle(heater) + thermalManager.hotend_idle[heater].timed_out ); if (!blink && is_idle) { @@ -628,7 +628,7 @@ void MarlinUI::draw_status_message(const bool blink) { if (progress > 2) return draw_progress_bar(progress); } - #elif ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) + #elif BOTH(FILAMENT_LCD_DISPLAY, SDSUPPORT) // Alternate Status message and Filament display if (ELAPSED(millis(), next_filament_display)) { @@ -660,33 +660,22 @@ void MarlinUI::draw_status_message(const bool blink) { lcd_put_u8str(status_message); // Fill the rest with spaces - while (slen < LCD_WIDTH) { - lcd_put_wchar(' '); - ++slen; - } + 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 = status_message + status_scroll_offset; + // and the string remaining length + uint8_t rlen; + const char *stat = status_and_len(rlen); + lcd_put_u8str_max(stat, LCD_WIDTH); // The string leaves space - // 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_WIDTH); - } - else { - - // The remaining string does not completely fill the screen - lcd_put_u8str_max(stat, LCD_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 + // If the remaining string doesn't completely fill the screen + if (rlen < LCD_WIDTH) { + lcd_put_wchar('.'); // Always at 1+ spaces left, draw a dot + uint8_t chars = LCD_WIDTH - rlen; // Amount of space left in characters + if (--chars) { // Draw a second dot if there's space lcd_put_wchar('.'); if (--chars) lcd_put_u8str_max(status_message, chars); // Print a second copy of the message @@ -694,15 +683,7 @@ void MarlinUI::draw_status_message(const bool blink) { } 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; + advance_status_scroll(); } } #else @@ -1044,7 +1025,7 @@ void MarlinUI::draw_status_screen() { } void draw_edit_screen(PGM_P const pstr, const char* const value/*=NULL*/) { - lcd_moveto(1, 1); + lcd_moveto(0, 1); lcd_put_u8str_P(pstr); if (value != NULL) { lcd_put_wchar(':'); diff --git a/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h b/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h index 190d63f736..0785cb79a6 100644 --- a/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h +++ b/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h @@ -47,7 +47,7 @@ uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); #define U8G_COM_SSD_I2C_HAL u8g_com_arduino_ssd_i2c_fn - #if defined(STM32F1) || defined(STM32F1xx) + #if defined(ARDUINO_ARCH_STM32F1) uint8_t u8g_com_stm32duino_fsmc_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); #define U8G_COM_HAL_FSMC_FN u8g_com_stm32duino_fsmc_fn #else diff --git a/Marlin/src/lcd/dogm/dogm_Bootscreen.h b/Marlin/src/lcd/dogm/dogm_Bootscreen.h index 4c118c3a6a..7361ca0d46 100644 --- a/Marlin/src/lcd/dogm/dogm_Bootscreen.h +++ b/Marlin/src/lcd/dogm/dogm_Bootscreen.h @@ -27,111 +27,101 @@ * http://marlinfw.org/tools/u8glib/converter.html */ -#include - #include "../../inc/MarlinConfig.h" -#if ENABLED(SHOW_BOOTSCREEN) +//#define START_BMPHIGH // Costs 399 bytes more flash - //#define START_BMPHIGH // Costs 399 bytes more flash +#if ENABLED(SHOW_CUSTOM_BOOTSCREEN) - #if ENABLED(SHOW_CUSTOM_BOOTSCREEN) - - #include "../../../_Bootscreen.h" - - #ifndef CUSTOM_BOOTSCREEN_TIMEOUT - #define CUSTOM_BOOTSCREEN_TIMEOUT 2500 - #endif + #include "../../../_Bootscreen.h" + #ifndef CUSTOM_BOOTSCREEN_BMP_BYTEWIDTH + #define CUSTOM_BOOTSCREEN_BMP_BYTEWIDTH ((CUSTOM_BOOTSCREEN_BMPWIDTH + 7) / 8) #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 - }; - + #ifndef CUSTOM_BOOTSCREEN_BMPHEIGHT + #define CUSTOM_BOOTSCREEN_BMPHEIGHT (sizeof(custom_start_bmp) / (CUSTOM_BOOTSCREEN_BMP_BYTEWIDTH)) #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) +#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 CUSTOM_BOOTSCREEN_BMPHEIGHT - #define CUSTOM_BOOTSCREEN_BMPHEIGHT (sizeof(custom_start_bmp) / (CUSTOM_BOOTSCREEN_BMP_BYTEWIDTH)) + +#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."); diff --git a/Marlin/src/lcd/dogm/dogm_Statusscreen.h b/Marlin/src/lcd/dogm/dogm_Statusscreen.h index f93395f884..438d57ac7f 100644 --- a/Marlin/src/lcd/dogm/dogm_Statusscreen.h +++ b/Marlin/src/lcd/dogm/dogm_Statusscreen.h @@ -27,8 +27,6 @@ * http://marlinfw.org/tools/u8glib/converter.html */ -#include - #include "../../inc/MarlinConfig.h" #define BW(N) ((N + 7) / 8) diff --git a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp index 1994910d74..e101a56829 100644 --- a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp +++ b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp @@ -208,7 +208,7 @@ FORCE_INLINE void _draw_heater_status(const int8_t heater, const bool blink) { if (PAGE_UNDER(7)) { #if HEATER_IDLE_HANDLER - const bool is_idle = IFBED(thermalManager.is_bed_idle(), thermalManager.is_heater_idle(heater)), + const bool is_idle = IFBED(thermalManager.bed_idle.timed_out, thermalManager.hotend_idle[heater].timed_out), dodraw = (blink || !is_idle); #else constexpr bool dodraw = true; @@ -243,7 +243,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const 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 DISABLED(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) if (!TEST(axis_known_position, axis)) lcd_put_u8str_P(axis == Z_AXIS ? PSTR(" ") : PSTR(" ")); else @@ -572,7 +572,7 @@ void MarlinUI::draw_status_screen() { if (PAGE_CONTAINS(STATUS_BASELINE - INFO_FONT_ASCENT, STATUS_BASELINE + INFO_FONT_DESCENT)) { lcd_moveto(0, STATUS_BASELINE); - #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) + #if BOTH(FILAMENT_LCD_DISPLAY, SDSUPPORT) // Alternate Status message and Filament display if (ELAPSED(millis(), next_filament_display)) { lcd_put_u8str_P(PSTR(LCD_STR_FILAM_DIA)); @@ -612,31 +612,24 @@ void MarlinUI::draw_status_message(const bool blink) { 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(' '); + while (slen < LCD_WIDTH) { lcd_put_wchar(' '); ++slen; } } 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; + // and the string remaining length + uint8_t rlen; + const char *stat = status_and_len(rlen); + lcd_put_u8str_max(stat, LCD_PIXEL_WIDTH); - // 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 + // If the remaining string doesn't completely fill the screen + if (rlen < LCD_WIDTH) { + lcd_put_wchar('.'); // Always at 1+ spaces left, draw a dot + uint8_t chars = LCD_WIDTH - rlen; // Amount of space left in characters + if (--chars) { // Draw a second dot if there's space lcd_put_wchar('.'); - if (--chars) { - // Print a second copy of the message + if (--chars) { // Print a second copy of the message lcd_put_u8str_max(status_message, LCD_PIXEL_WIDTH - (rlen + 2) * (MENU_FONT_WIDTH)); lcd_put_wchar(' '); } @@ -644,15 +637,7 @@ void MarlinUI::draw_status_message(const bool blink) { } 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; + advance_status_scroll(); } } diff --git a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp index 6375d5cb74..a72b3e4fc8 100644 --- a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp +++ b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp @@ -580,12 +580,7 @@ void ST7920_Lite_Status_Screen::draw_extruder_2_temp(const int16_t temp, const i #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 - ); + draw_temps(HOTENDS > 1 ? 2 : 1, temp, target, show_target, display_state.bed_show_target != show_target || forceUpdate); display_state.bed_show_target = show_target; } #endif @@ -632,43 +627,27 @@ void ST7920_Lite_Status_Screen::draw_status_message() { if (slen <= LCD_WIDTH) { // String fits the LCD, so just print it write_str(str); - for (; slen < LCD_WIDTH; ++slen) write_byte(' '); + while (slen < LCD_WIDTH) { 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 + 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 + // and the string remaining length + uint8_t rlen; + const char *stat = ui.status_and_len(rlen); + write_str(stat, LCD_WIDTH); + // If the remaining string doesn't completely fill the screen + if (rlen < LCD_WIDTH) { write_byte('.'); // Always at 1+ spaces left, draw a dot + uint8_t chars = LCD_WIDTH - rlen; // Amount of space left in characters 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 + 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; + ui.advance_status_scroll(); } #else @@ -867,7 +846,7 @@ void ST7920_Lite_Status_Screen::update_status_or_position(bool forceUpdate) { } void ST7920_Lite_Status_Screen::update_progress(const bool forceUpdate) { - #if ENABLED(LCD_SET_PROGRESS_MANUALLY) || ENABLED(SDSUPPORT) + #if EITHER(LCD_SET_PROGRESS_MANUALLY, SDSUPPORT) // Since the progress bar involves writing // quite a few bytes to GDRAM, only do this 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 17d93e9a22..089a268f19 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp @@ -21,7 +21,7 @@ */ /** - * u8g_dev_st7565_64128n_HAL.c (Displaytech) + * Based on u8g_dev_st7565_64128n_HAL.c (Displaytech) * * Universal 8bit Graphics Library * 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 ed5036f30d..4c34f8209f 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp @@ -21,7 +21,7 @@ */ /** - * u8g_dev_st7920_128x64_HAL.c + * Based on u8g_dev_st7920_128x64.c * * Universal 8bit Graphics Library * 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 84adc25b4a..35f7d4161a 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp @@ -20,42 +20,38 @@ * */ - -/* - - based on u8g_dev_uc1701_mini12864_HAL.c (dealextreme) - - Universal 8bit Graphics Library - - Copyright (c) 2011, olikraus@gmail.com - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or other - materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -*/ +/** + * Based on u8g_dev_uc1701_mini12864.c (dealextreme) + * + * Universal 8bit Graphics Library + * + * Copyright (c) 2011, olikraus@gmail.com + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #include "../../inc/MarlinConfigPre.h" diff --git a/Marlin/src/lcd/dogm/ultralcd_DOGM.cpp b/Marlin/src/lcd/dogm/ultralcd_DOGM.cpp index df83625f0a..f8d95e8f18 100644 --- a/Marlin/src/lcd/dogm/ultralcd_DOGM.cpp +++ b/Marlin/src/lcd/dogm/ultralcd_DOGM.cpp @@ -41,7 +41,10 @@ #include "ultralcd_DOGM.h" #include "u8g_fontutf8.h" -#include "dogm_Bootscreen.h" + +#if ENABLED(SHOW_BOOTSCREEN) + #include "dogm_Bootscreen.h" +#endif #include "../lcdprint.h" #include "../fontutils.h" @@ -138,6 +141,9 @@ void MarlinUI::set_font(const MarlinFont font_nr) { #else draw_custom_bootscreen(custom_start_bmp); #endif + #ifndef CUSTOM_BOOTSCREEN_TIMEOUT + #define CUSTOM_BOOTSCREEN_TIMEOUT 2500 + #endif safe_delay(CUSTOM_BOOTSCREEN_TIMEOUT); } @@ -173,6 +179,9 @@ void MarlinUI::set_font(const MarlinFont font_nr) { u8g.drawStr(txt2X, height - (MENU_FONT_HEIGHT) * 1 / 2, STRING_SPLASH_LINE2); #endif } while (u8g.nextPage()); + #ifndef BOOTSCREEN_TIMEOUT + #define BOOTSCREEN_TIMEOUT 2500 + #endif safe_delay(BOOTSCREEN_TIMEOUT); } @@ -189,7 +198,7 @@ void MarlinUI::init_lcd() { OUT_WRITE(LCD_BACKLIGHT_PIN, HIGH); #endif - #if ENABLED(MKS_12864OLED) || ENABLED(MKS_12864OLED_SSD1306) + #if EITHER(MKS_12864OLED, MKS_12864OLED_SSD1306) SET_OUTPUT(LCD_PINS_DC); #if !defined(LCD_RESET_PIN) #define LCD_RESET_PIN LCD_PINS_RS @@ -261,7 +270,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop lcd_put_u8str(i16tostr3(thermalManager.degHotend(extruder))); lcd_put_wchar('/'); - if (get_blink() || !thermalManager.is_heater_idle(extruder)) + if (get_blink() || !thermalManager.hotend_idle[extruder].timed_out) lcd_put_u8str(i16tostr3(thermalManager.degTargetHotend(extruder))); } @@ -380,7 +389,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop if (value != NULL) { lcd_put_wchar(':'); if (extra_row) { - // Assume the value is numeric (with no descender) + // Assume that value is numeric (with no descender) baseline += EDIT_FONT_ASCENT + 2; onpage = PAGE_CONTAINS(baseline - (EDIT_FONT_ASCENT - 1), baseline); } @@ -497,7 +506,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop #endif // AUTO_BED_LEVELING_UBL - #if ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY) || ENABLED(MESH_EDIT_GFX_OVERLAY) + #if EITHER(BABYSTEP_ZPROBE_GFX_OVERLAY, MESH_EDIT_GFX_OVERLAY) const unsigned char cw_bmp[] PROGMEM = { B00000011,B11111000,B00000000, diff --git a/Marlin/src/lcd/extensible_ui/lib/example.cpp b/Marlin/src/lcd/extensible_ui/lib/example.cpp index 51040cde04..2a11d5c3c4 100644 --- a/Marlin/src/lcd/extensible_ui/lib/example.cpp +++ b/Marlin/src/lcd/extensible_ui/lib/example.cpp @@ -46,7 +46,7 @@ namespace ExtUI { */ } void onIdle() {} - void onPrinterKilled(const char* msg) {} + void onPrinterKilled(PGM_P const msg) {} void onMediaInserted() {}; void onMediaError() {}; void onMediaRemoved() {}; @@ -55,6 +55,7 @@ namespace ExtUI { void onPrintTimerPaused() {} void onPrintTimerStopped() {} void onFilamentRunout() {} + void onUserConfirmRequired(const char * const msg) {} void onStatusChanged(const char * const msg) {} void onFactoryReset() {} void onLoadSettings() {} diff --git a/Marlin/src/lcd/extensible_ui/ui_api.cpp b/Marlin/src/lcd/extensible_ui/ui_api.cpp index 7165b5eefa..aa71743e12 100644 --- a/Marlin/src/lcd/extensible_ui/ui_api.cpp +++ b/Marlin/src/lcd/extensible_ui/ui_api.cpp @@ -51,10 +51,15 @@ #include "../../module/planner.h" #include "../../module/probe.h" #include "../../module/temperature.h" +#include "../../module/printcounter.h" #include "../../libs/duration_t.h" #include "../../HAL/shared/Delay.h" -#if DO_SWITCH_EXTRUDER || ENABLED(SWITCHING_NOZZLE) || ENABLED(PARKING_EXTRUDER) +#if ENABLED(PRINTCOUNTER) + #include "../../core/utility.h" +#endif + +#if DO_SWITCH_EXTRUDER || EITHER(SWITCHING_NOZZLE, PARKING_EXTRUDER) #include "../../module/tool_change.h" #endif @@ -69,28 +74,33 @@ #define IFSD(A,B) (B) #endif -#if ENABLED(PRINTCOUNTER) - #include "../../core/utility.h" - #include "../../module/printcounter.h" -#endif - -#if HAS_TRINAMIC && HAS_LCD_MENU +#if HAS_TRINAMIC #include "../../feature/tmc_util.h" + #include "../../module/stepper_indirection.h" #endif #include "ui_api.h" #if ENABLED(BACKLASH_GCODE) - extern float backlash_distance_mm[XYZ], backlash_correction; + extern float backlash_distance_mm[XYZ]; + extern uint8_t backlash_correction; #ifdef BACKLASH_SMOOTHING_MM extern float backlash_smoothing_mm; #endif #endif +#if HAS_LEVELING + #include "../../feature/bedlevel/bedlevel.h" +#endif + #if HAS_FILAMENT_SENSOR #include "../../feature/runout.h" #endif +#if ENABLED(BABYSTEPPING) + #include "../../feature/babystep.h" +#endif + inline float clamp(const float value, const float minimum, const float maximum) { return MAX(MIN(value, maximum), minimum); } @@ -213,26 +223,26 @@ namespace ExtUI { if (soft_endstops_enabled) switch (axis) { case X_AXIS: #if ENABLED(MIN_SOFTWARE_ENDSTOP_X) - min = soft_endstop_min[X_AXIS]; + min = soft_endstop[X_AXIS].min; #endif #if ENABLED(MAX_SOFTWARE_ENDSTOP_X) - max = soft_endstop_max[X_AXIS]; + max = soft_endstop[X_AXIS].max; #endif break; case Y_AXIS: #if ENABLED(MIN_SOFTWARE_ENDSTOP_Y) - min = soft_endstop_min[Y_AXIS]; + min = soft_endstop[Y_AXIS].min; #endif #if ENABLED(MAX_SOFTWARE_ENDSTOP_Y) - max = soft_endstop_max[Y_AXIS]; + max = soft_endstop[Y_AXIS].max; #endif break; case Z_AXIS: #if ENABLED(MIN_SOFTWARE_ENDSTOP_Z) - min = soft_endstop_min[Z_AXIS]; + min = soft_endstop[Z_AXIS].min; #endif #if ENABLED(MAX_SOFTWARE_ENDSTOP_Z) - max = soft_endstop_max[Z_AXIS]; + max = soft_endstop[Z_AXIS].max; #endif default: break; } @@ -297,7 +307,7 @@ namespace ExtUI { 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 DO_SWITCH_EXTRUDER || EITHER(SWITCHING_NOZZLE, PARKING_EXTRUDER) if (e != active_extruder) tool_change(e, 0, no_move); #endif @@ -335,6 +345,126 @@ namespace ExtUI { return !thermalManager.tooColdToExtrude(extruder - E0); } + #if HAS_SOFTWARE_ENDSTOPS + bool getSoftEndstopState() { + return soft_endstops_enabled; + } + + void setSoftEndstopState(const bool value) { + soft_endstops_enabled = value; + } + #endif + + #if HAS_TRINAMIC + float getAxisCurrent_mA(const axis_t axis) { + switch (axis) { + #if AXIS_IS_TMC(X) + case X: return stepperX.getMilliamps(); + #endif + #if AXIS_IS_TMC(Y) + case Y: return stepperY.getMilliamps(); + #endif + #if AXIS_IS_TMC(Z) + case Z: return stepperZ.getMilliamps(); + #endif + default: return NAN; + }; + } + + float getAxisCurrent_mA(const extruder_t extruder) { + switch (extruder) { + #if AXIS_IS_TMC(E0) + case E0: return stepperE0.getMilliamps(); + #endif + #if AXIS_IS_TMC(E1) + case E1: return stepperE1.getMilliamps(); + #endif + #if AXIS_IS_TMC(E2) + case E2: return stepperE2.getMilliamps(); + #endif + #if AXIS_IS_TMC(E3) + case E3: return stepperE3.getMilliamps(); + #endif + #if AXIS_IS_TMC(E4) + case E4: return stepperE4.getMilliamps(); + #endif + #if AXIS_IS_TMC(E5) + case E5: return stepperE5.getMilliamps(); + #endif + default: return NAN; + }; + } + + void setAxisCurrent_mA(const float mA, const axis_t axis) { + switch (axis) { + #if AXIS_IS_TMC(X) + case X: stepperX.rms_current(clamp(mA, 500, 1500)); break; + #endif + #if AXIS_IS_TMC(Y) + case Y: stepperY.rms_current(clamp(mA, 500, 1500)); break; + #endif + #if AXIS_IS_TMC(Z) + case Z: stepperZ.rms_current(clamp(mA, 500, 1500)); break; + #endif + default: break; + }; + } + + void setAxisCurrent_mA(const float mA, const extruder_t extruder) { + switch (extruder) { + #if AXIS_IS_TMC(E0) + case E0: stepperE0.rms_current(clamp(mA, 500, 1500)); break; + #endif + #if AXIS_IS_TMC(E1) + case E1: stepperE1.rms_current(clamp(mA, 500, 1500)); break; + #endif + #if AXIS_IS_TMC(E2) + case E2: stepperE2.rms_current(clamp(mA, 500, 1500)); break; + #endif + #if AXIS_IS_TMC(E3) + case E3: stepperE3.rms_current(clamp(mA, 500, 1500)); break; + #endif + #if AXIS_IS_TMC(E4) + case E4: stepperE4.rms_current(clamp(mA, 500, 1500)); break; + #endif + #if AXIS_IS_TMC(E5) + case E5: stepperE5.rms_current(clamp(mA, 500, 1500)); break; + #endif + default: break; + }; + } + + int getTMCBumpSensitivity(const axis_t axis) { + switch (axis) { + #if X_SENSORLESS && AXIS_HAS_STALLGUARD(X) + case X: return stepperX.sgt(); + #endif + #if Y_SENSORLESS && AXIS_HAS_STALLGUARD(Y) + case Y: return stepperY.sgt(); + #endif + #if Z_SENSORLESS && AXIS_HAS_STALLGUARD(Z) + case Z: return stepperZ.sgt(); + #endif + default: return 0; + } + } + + void setTMCBumpSensitivity(const float value, const axis_t axis) { + switch (axis) { + #if X_SENSORLESS && AXIS_HAS_STALLGUARD(X) + case X: stepperX.sgt(clamp(value, -64, 63)); break; + #endif + #if Y_SENSORLESS && AXIS_HAS_STALLGUARD(Y) + case Y: stepperY.sgt(clamp(value, -64, 63)); break; + #endif + #if Z_SENSORLESS && AXIS_HAS_STALLGUARD(Z) + case Z: stepperZ.sgt(clamp(value, -64, 63)); break; + #endif + default: break; + } + } + #endif + float getAxisSteps_per_mm(const axis_t axis) { return planner.settings.axis_steps_per_mm[axis]; } @@ -417,7 +547,9 @@ namespace ExtUI { void setJunctionDeviation_mm(const float value) { planner.junction_deviation_mm = clamp(value, 0.01, 0.3); - planner.recalculate_max_e_jerk(); + #if ENABLED(LIN_ADVANCE) + planner.recalculate_max_e_jerk(); + #endif } #else @@ -456,10 +588,10 @@ namespace ExtUI { bool babystepAxis_steps(const int16_t steps, const axis_t axis) { switch (axis) { #if ENABLED(BABYSTEP_XY) - case X: thermalManager.babystep_axis(X_AXIS, steps); break; - case Y: thermalManager.babystep_axis(Y_AXIS, steps); break; + case X: babystep.add_steps(X_AXIS, steps); break; + case Y: babystep.add_steps(Y_AXIS, steps); break; #endif - case Z: thermalManager.babystep_axis(Z_AXIS, steps); break; + case Z: babystep.add_steps(Z_AXIS, steps); break; default: return false; }; return true; @@ -530,7 +662,7 @@ namespace ExtUI { } #endif // HAS_BED_PROBE - #if HOTENDS > 1 + #if HAS_HOTEND_OFFSET float getNozzleOffset_mm(const axis_t axis, const extruder_t extruder) { if (extruder - E0 >= HOTENDS) return 0; @@ -552,15 +684,15 @@ namespace ExtUI { HOTEND_LOOP() hotend_offset[axis][e] -= offs; } - #endif // HOTENDS > 1 + #endif // HAS_HOTEND_OFFSET #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; } + float getBacklashCorrection_percent() { return ui8_to_percent(backlash_correction); } + void setBacklashCorrection_percent(const float value) { backlash_correction = map(clamp(value, 0, 100), 0, 100, 0, 255); } #ifdef BACKLASH_SMOOTHING_MM float getBacklashSmoothing_mm() { return backlash_smoothing_mm; } @@ -569,7 +701,7 @@ namespace ExtUI { #endif uint8_t getProgress_percent() { - return IFSD(card.percentDone(), 0); + return ui.get_progress(); } uint32_t getProgress_seconds_elapsed() { @@ -577,6 +709,27 @@ namespace ExtUI { return elapsed.value; } + #if HAS_LEVELING + bool getLevelingActive() { return planner.leveling_active; } + void setLevelingActive(const bool state) { set_bed_leveling_enabled(state); } + #if HAS_MESH + bool getMeshValid() { return leveling_is_valid(); } + bed_mesh_t getMeshArray() { return Z_VALUES_ARR; } + void setMeshPoint(const uint8_t xpos, const uint8_t ypos, const float zoff) { + if (WITHIN(xpos, 0, GRID_MAX_POINTS_X) && WITHIN(ypos, 0, GRID_MAX_POINTS_Y)) { + Z_VALUES(xpos, ypos) = zoff; + #if ENABLED(ABL_BILINEAR_SUBDIVISION) + bed_level_virt_interpolate(); + #endif + } + } + #endif + #endif + + #if ENABLED(HOST_PROMPT_SUPPORT) + void setHostResponse(const uint8_t response) { host_response_handler(response); } + #endif + #if ENABLED(PRINTCOUNTER) char* getTotalPrints_str(char buffer[21]) { strcpy(buffer,i16tostr3left(print_job_timer.getStats().totalPrints)); return buffer; } char* getFinishedPrints_str(char buffer[21]) { strcpy(buffer,i16tostr3left(print_job_timer.getStats().finishedPrints)); return buffer; } @@ -609,7 +762,7 @@ namespace ExtUI { const int16_t e = heater - H0; #if HAS_HEATED_BED if (heater == BED) - thermalManager.setTargetBed(clamp(value, 0, BED_MAXTEMP - 15)); + thermalManager.setTargetBed(clamp(value, 0, BED_MAXTEMP - 10)); else #endif thermalManager.setTargetHotend(clamp(value, 0, heater_maxtemp[e] - 15), e); @@ -630,6 +783,12 @@ namespace ExtUI { feedrate_percentage = clamp(value, 10, 500); } + void setUserConfirmed(void) { + #if HAS_RESUME_CONTINUE + wait_for_user = false; + #endif + } + void printFile(const char *filename) { IFSD(card.openAndPrintFile(filename), NOOP); } @@ -754,10 +913,6 @@ void MarlinUI::init() { SET_INPUT_PULLUP(SD_DETECT_PIN); #endif - #if HAS_TRINAMIC && HAS_LCD_MENU - init_tmc_section(); - #endif - ExtUI::onStartup(); } diff --git a/Marlin/src/lcd/extensible_ui/ui_api.h b/Marlin/src/lcd/extensible_ui/ui_api.h index 0a7ffbea63..b5be58dcca 100644 --- a/Marlin/src/lcd/extensible_ui/ui_api.h +++ b/Marlin/src/lcd/extensible_ui/ui_api.h @@ -68,6 +68,21 @@ namespace ExtUI { */ PGM_P getFirmwareName_str(); + #if HAS_SOFTWARE_ENDSTOPS + bool getSoftEndstopState(); + void setSoftEndstopState(const bool); + #endif + + #if HAS_TRINAMIC + float getAxisCurrent_mA(const axis_t); + float getAxisCurrent_mA(const extruder_t); + void setAxisCurrent_mA(const float, const axis_t); + void setAxisCurrent_mA(const float, const extruder_t); + + int getTMCBumpSensitivity(const axis_t); + void setTMCBumpSensitivity(const float, const axis_t); + #endif + float getActualTemp_celsius(const heater_t); float getActualTemp_celsius(const extruder_t); float getTargetTemp_celsius(const heater_t); @@ -91,6 +106,21 @@ namespace ExtUI { uint8_t getProgress_percent(); uint32_t getProgress_seconds_elapsed(); + #if HAS_LEVELING + bool getLevelingActive(); + void setLevelingActive(const bool); + #if HAS_MESH + bool getMeshValid(); + bed_mesh_t getMeshArray(); + void setMeshPoint(const uint8_t xpos, const uint8_t ypos, const float zval); + void onMeshUpdate(const uint8_t xpos, const uint8_t ypos, const float zval); + #endif + #endif + + #if ENABLED(HOST_PROMPT_SUPPORT) + void setHostResponse(const uint8_t); + #endif + #if ENABLED(PRINTCOUNTER) char* getTotalPrints_str(char buffer[21]); char* getFinishedPrints_str(char buffer[21]); @@ -117,6 +147,7 @@ namespace ExtUI { void setRetractAcceleration_mm_s2(const float); void setTravelAcceleration_mm_s2(const float); void setFeedrate_percent(const float); + void setUserConfirmed(void); #if ENABLED(LIN_ADVANCE) float getLinearAdvance_mm_mm_s(const extruder_t); @@ -143,7 +174,7 @@ namespace ExtUI { void smartAdjustAxis_steps(const int16_t steps, const axis_t axis, bool linked_nozzles); #endif - #if HOTENDS > 1 + #if HAS_HOTEND_OFFSET float getNozzleOffset_mm(const axis_t, const extruder_t); void setNozzleOffset_mm(const float, const axis_t, const extruder_t); void normalizeNozzleOffset(const axis_t axis); @@ -239,11 +270,12 @@ namespace ExtUI { void onMediaError(); void onMediaRemoved(); void onPlayTone(const uint16_t frequency, const uint16_t duration); - void onPrinterKilled(const char* msg); + void onPrinterKilled(PGM_P const msg); void onPrintTimerStarted(); void onPrintTimerPaused(); void onPrintTimerStopped(); void onFilamentRunout(const extruder_t extruder); + void onUserConfirmRequired(const char * const msg); void onStatusChanged(const char * const msg); void onFactoryReset(); void onStoreSettings(); diff --git a/Marlin/src/lcd/language/language_de.h b/Marlin/src/lcd/language/language_de.h index 5c3c6d2cb1..b844c1052b 100644 --- a/Marlin/src/lcd/language/language_de.h +++ b/Marlin/src/lcd/language/language_de.h @@ -99,7 +99,7 @@ #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_MIRRORED_COPY _UxGT("Spiegelkopie") #define MSG_IDEX_MODE_FULL_CTRL _UxGT("vollstä. Kontrolle") #define MSG_IDEX_X_OFFSET _UxGT("2. Düse X") #define MSG_IDEX_Y_OFFSET _UxGT("2. Düse Y") diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 97f04028d9..b5b77e21d4 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -247,8 +247,8 @@ #ifndef MSG_IDEX_MODE_DUPLICATE #define MSG_IDEX_MODE_DUPLICATE _UxGT("Duplication") #endif -#ifndef MSG_IDEX_MODE_SCALED_COPY - #define MSG_IDEX_MODE_SCALED_COPY _UxGT("Scaled copy") +#ifndef MSG_IDEX_MODE_MIRRORED_COPY + #define MSG_IDEX_MODE_MIRRORED_COPY _UxGT("Mirrored copy") #endif #ifndef MSG_IDEX_MODE_FULL_CTRL #define MSG_IDEX_MODE_FULL_CTRL _UxGT("Full control") @@ -537,6 +537,9 @@ #ifndef MSG_BED #define MSG_BED _UxGT("Bed") #endif +#ifndef MSG_CHAMBER + #define MSG_CHAMBER _UxGT("Enclosure") +#endif #ifndef MSG_FAN_SPEED #define MSG_FAN_SPEED _UxGT("Fan speed") #endif @@ -864,6 +867,15 @@ #ifndef MSG_BLTOUCH_DEPLOY #define MSG_BLTOUCH_DEPLOY _UxGT("Deploy BLTouch") #endif +#ifndef MSG_BLTOUCH_SW_MODE + #define MSG_BLTOUCH_SW_MODE _UxGT("SW Deploy BLTouch") +#endif +#ifndef MSG_BLTOUCH_5V_MODE + #define MSG_BLTOUCH_5V_MODE _UxGT("BLTouch 5V Mode") +#endif +#ifndef MSG_BLTOUCH_OD_MODE + #define MSG_BLTOUCH_OD_MODE _UxGT("BLTouch OD Mode") +#endif #ifndef MSG_BLTOUCH_STOW #define MSG_BLTOUCH_STOW _UxGT("Stow BLTouch") #endif @@ -891,6 +903,9 @@ #ifndef MSG_BABYSTEP_Z #define MSG_BABYSTEP_Z _UxGT("Babystep Z") #endif +#ifndef MSG_BABYSTEP_TOTAL + #define MSG_BABYSTEP_TOTAL _UxGT("Total") +#endif #ifndef MSG_ENDSTOP_ABORT #define MSG_ENDSTOP_ABORT _UxGT("Endstop abort") #endif @@ -921,6 +936,12 @@ #ifndef MSG_ERR_MINTEMP_BED #define MSG_ERR_MINTEMP_BED _UxGT("Err: MINTEMP BED") #endif +#ifndef MSG_ERR_MAXTEMP_CHAMBER + #define MSG_ERR_MAXTEMP_CHAMBER _UxGT("Err: MAXTEMP CHAMBER") +#endif +#ifndef MSG_ERR_MINTEMP_CHAMBER + #define MSG_ERR_MINTEMP_CHAMBER _UxGT("Err: MINTEMP CHAMBER") +#endif #ifndef MSG_ERR_Z_HOMING #define MSG_ERR_Z_HOMING MSG_HOME _UxGT(" ") MSG_X MSG_Y _UxGT(" ") MSG_FIRST #endif @@ -1259,6 +1280,18 @@ #ifndef MSG_END_Z #define MSG_END_Z _UxGT(" End Z") #endif +#ifndef MSG_BRICKOUT + #define MSG_BRICKOUT _UxGT("Brickout") +#endif +#ifndef MSG_INVADERS + #define MSG_INVADERS _UxGT("Invaders") +#endif +#ifndef MSG_SNAKE + #define MSG_SNAKE _UxGT("Sn4k3") +#endif +#ifndef MSG_MAZE + #define MSG_MAZE _UxGT("Maze") +#endif // // Filament Change screens show up to 3 lines on a 4-line display @@ -1269,6 +1302,9 @@ #define MSG_ADVANCED_PAUSE_WAITING_1 _UxGT("Press button") #define MSG_ADVANCED_PAUSE_WAITING_2 _UxGT("to resume print") #endif + #ifndef MSG_PAUSE_PRINT_INIT_1 + #define MSG_PAUSE_PRINT_INIT_1 _UxGT("Parking...") + #endif #ifndef MSG_FILAMENT_CHANGE_INIT_1 #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Wait for") #define MSG_FILAMENT_CHANGE_INIT_2 _UxGT("filament change") @@ -1365,3 +1401,13 @@ #ifndef MSG_SERVICE_IN #define MSG_SERVICE_IN _UxGT(" in:") #endif + +#ifndef MSG_BACKLASH + #define MSG_BACKLASH _UxGT("Backlash") +#endif +#ifndef MSG_BACKLASH_CORRECTION + #define MSG_BACKLASH_CORRECTION _UxGT("Correction") +#endif +#ifndef MSG_BACKLASH_SMOOTHING + #define MSG_BACKLASH_SMOOTHING _UxGT("Smoothing") +#endif diff --git a/Marlin/src/lcd/language/language_it.h b/Marlin/src/lcd/language/language_it.h index d859f7dd6c..5c2e2f5ebc 100644 --- a/Marlin/src/lcd/language/language_it.h +++ b/Marlin/src/lcd/language/language_it.h @@ -97,7 +97,7 @@ #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_MIRRORED_COPY _UxGT("Copia speculare") #define MSG_IDEX_MODE_FULL_CTRL _UxGT("Pieno controllo") #define MSG_IDEX_X_OFFSET _UxGT("2° ugello X") #define MSG_IDEX_Y_OFFSET _UxGT("2° ugello Y") @@ -195,6 +195,7 @@ #define MSG_BED_Z _UxGT("Piatto Z") #define MSG_NOZZLE _UxGT("Ugello") #define MSG_BED _UxGT("Piatto") +#define MSG_CHAMBER _UxGT("Camera") #define MSG_FAN_SPEED _UxGT("Velocità ventola") #define MSG_EXTRA_FAN_SPEED _UxGT("Extra vel. ventola") #define MSG_FLOW _UxGT("Flusso") @@ -308,6 +309,9 @@ #define MSG_BLTOUCH_SELFTEST _UxGT("Autotest BLTouch") #define MSG_BLTOUCH_RESET _UxGT("Resetta BLTouch") #define MSG_BLTOUCH_DEPLOY _UxGT("Estendi BLTouch") +#define MSG_BLTOUCH_SW_MODE _UxGT("BLTouch modo SW") +#define MSG_BLTOUCH_5V_MODE _UxGT("BLTouch modo 5V") +#define MSG_BLTOUCH_OD_MODE _UxGT("BLTouch modo OD") #define MSG_BLTOUCH_STOW _UxGT("Ritrai BLTouch") #define MSG_MANUAL_DEPLOY _UxGT("Estendi Sonda-Z") #define MSG_MANUAL_STOW _UxGT("Ritrai Sonda-Z") @@ -327,6 +331,8 @@ #define MSG_ERR_MINTEMP _UxGT("Err: TEMP MINIMA") #define MSG_ERR_MAXTEMP_BED _UxGT("Err: TEMP MAX PIATTO") #define MSG_ERR_MINTEMP_BED _UxGT("Err: TEMP MIN PIATTO") +#define MSG_ERR_MAXTEMP_CHAMBER _UxGT("Err: TEMP MAX CAMERA") +#define MSG_ERR_MINTEMP_CHAMBER _UxGT("Err: TEMP MIN CAMERA") #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") @@ -451,6 +457,7 @@ #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_PAUSE_PRINT_INIT_1 _UxGT("Parcheggiando...") #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") @@ -497,3 +504,4 @@ #define MSG_TMC_STEALTH_ENABLED _UxGT("StealthChop abil.") #define MSG_SERVICE_RESET _UxGT("Resetta") +#define MSG_SERVICE_IN _UxGT(" tra:") diff --git a/Marlin/src/lcd/language/language_ko_KR.h b/Marlin/src/lcd/language/language_ko_KR.h index 9566cac7b6..e367b501f7 100644 --- a/Marlin/src/lcd/language/language_ko_KR.h +++ b/Marlin/src/lcd/language/language_ko_KR.h @@ -88,7 +88,7 @@ #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_MIRRORED_COPY _UxGT("미러 사본") #define MSG_IDEX_MODE_FULL_CTRL _UxGT("Full control") #define MSG_IDEX_X_OFFSET _UxGT("2nd nozzle X") #define MSG_IDEX_Y_OFFSET _UxGT("2nd nozzle Y") diff --git a/Marlin/src/lcd/language/language_pt-br.h b/Marlin/src/lcd/language/language_pt-br.h index d799fb428f..d48046776c 100644 --- a/Marlin/src/lcd/language/language_pt-br.h +++ b/Marlin/src/lcd/language/language_pt-br.h @@ -99,7 +99,7 @@ #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_MIRRORED_COPY _UxGT("Cópia espelhada") #define MSG_IDEX_MODE_FULL_CTRL _UxGT("Controle Total") #define MSG_IDEX_X_OFFSET _UxGT("2o bico X") #define MSG_IDEX_Y_OFFSET _UxGT("2o bico Y") diff --git a/Marlin/src/lcd/language/language_sk.h b/Marlin/src/lcd/language/language_sk.h index 8be4b13b7b..8841a57170 100644 --- a/Marlin/src/lcd/language/language_sk.h +++ b/Marlin/src/lcd/language/language_sk.h @@ -103,10 +103,10 @@ #define MSG_UBL_UNHOMED _UxGT("Prejdite domov") #define MSG_UBL_TOOLS _UxGT("Nástroje UBL") #define MSG_UBL_LEVEL_BED _UxGT("UBL rovnanie") -#define MSG_IDEX_MENU _UxGT("IDEX mód") +#define MSG_IDEX_MENU _UxGT("IDEX režim") #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_MIRRORED_COPY _UxGT("Zrkadlená kópia") #define MSG_IDEX_MODE_FULL_CTRL _UxGT("Plná kontrola") #define MSG_IDEX_X_OFFSET _UxGT("2. tryska X") #define MSG_IDEX_Y_OFFSET _UxGT("2. tryska Y") @@ -204,6 +204,7 @@ #define MSG_BED_Z _UxGT("Výška podl.") #define MSG_NOZZLE _UxGT("Tryska") #define MSG_BED _UxGT("Podložka") +#define MSG_CHAMBER _UxGT("Komora") #define MSG_FAN_SPEED _UxGT("Rýchlosť vent.") #define MSG_EXTRA_FAN_SPEED _UxGT("Rýchlosť ex. vent.") #define MSG_FLOW _UxGT("Prietok") @@ -318,6 +319,9 @@ #define MSG_BLTOUCH_SELFTEST _UxGT("Self-Test BLTouch") #define MSG_BLTOUCH_RESET _UxGT("Reset BLTouch") #define MSG_BLTOUCH_DEPLOY _UxGT("Vysunúť BLTouch") +#define MSG_BLTOUCH_SW_MODE _UxGT("SW vysun. BLTouch") +#define MSG_BLTOUCH_5V_MODE _UxGT("BLTouch režim 5V") +#define MSG_BLTOUCH_OD_MODE _UxGT("BLTouch režim OD") #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") @@ -337,6 +341,8 @@ #define MSG_ERR_MINTEMP _UxGT("Chyba: MINTEMP") #define MSG_ERR_MAXTEMP_BED _UxGT("Chyba: MAXTEMP PODL.") #define MSG_ERR_MINTEMP_BED _UxGT("Chyba: MINTEMP PODL.") +#define MSG_ERR_MAXTEMP_CHAMBER _UxGT("Chyba: MAXTEMP KOMO.") +#define MSG_ERR_MINTEMP_CHAMBER _UxGT("Chyba: MINTEMP KOMO.") #define MSG_ERR_Z_HOMING MSG_HOME _UxGT(" ") MSG_X MSG_Y _UxGT(" ") MSG_FIRST #define MSG_HALTED _UxGT("TLAČIAREŇ ZASTAVENÁ") #define MSG_PLEASE_RESET _UxGT("Spravte reset") @@ -464,6 +470,7 @@ #if LCD_HEIGHT >= 4 #define MSG_ADVANCED_PAUSE_WAITING_1 _UxGT("Stlačte tlačidlo") #define MSG_ADVANCED_PAUSE_WAITING_2 _UxGT("pre obnovu tlače") + #define MSG_PAUSE_PRINT_INIT_1 _UxGT("Parkovanie...") #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") diff --git a/Marlin/src/lcd/language/language_tr.h b/Marlin/src/lcd/language/language_tr.h index 692751060c..0edb2e539b 100644 --- a/Marlin/src/lcd/language/language_tr.h +++ b/Marlin/src/lcd/language/language_tr.h @@ -98,7 +98,7 @@ #define MSG_IDEX_MENU _UxGT("IDEX Modu") #define MSG_IDEX_MODE_AUTOPARK _UxGT("Oto-Park") #define MSG_IDEX_MODE_DUPLICATE _UxGT("Kopyala") -#define MSG_IDEX_MODE_SCALED_COPY _UxGT("Ölçeklenmiş Kopya") +#define MSG_IDEX_MODE_MIRRORED_COPY _UxGT("Yansıtılmış kopya") #define MSG_IDEX_MODE_FULL_CTRL _UxGT("Tam Kontrol") #define MSG_IDEX_X_OFFSET _UxGT("2. nozul X") #define MSG_IDEX_Y_OFFSET _UxGT("2. nozul Y") diff --git a/Marlin/src/lcd/language/language_zh_CN.h b/Marlin/src/lcd/language/language_zh_CN.h index eb78ddd62c..0a94e9d5b0 100644 --- a/Marlin/src/lcd/language/language_zh_CN.h +++ b/Marlin/src/lcd/language/language_zh_CN.h @@ -256,8 +256,8 @@ #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_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_RECOVER _UxGT("回抽恢复长度mm") //"UnRet +mm" retract_recover_extra, additional recover length (mm, added to retract length when recovering) +#define MSG_CONTROL_RETRACT_RECOVER_SWAP _UxGT("换手回抽恢复长度mm") //"S UnRet+mm" swap_retract_recover_extra, 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) #define MSG_CONTROL_RETRACT_RECOVER_SWAPF _UxGT("S UnRet V") // "S UnRet V" #define MSG_AUTORETRACT _UxGT("自动抽回") //"AutoRetr." autoretract_enabled, diff --git a/Marlin/src/lcd/language/language_zh_TW.h b/Marlin/src/lcd/language/language_zh_TW.h index 23d3a997e3..40a1448c11 100644 --- a/Marlin/src/lcd/language/language_zh_TW.h +++ b/Marlin/src/lcd/language/language_zh_TW.h @@ -256,8 +256,8 @@ #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_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_RECOVER _UxGT("回縮恢復長度mm") //"UnRet +mm" retract_recover_extra, additional recover length (mm, added to retract length when recovering) +#define MSG_CONTROL_RETRACT_RECOVER_SWAP _UxGT("換手回縮恢復長度mm") //"S UnRet+mm" swap_retract_recover_extra, 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) #define MSG_CONTROL_RETRACT_RECOVER_SWAPF _UxGT("S UnRet V") // "S UnRet V" #define MSG_AUTORETRACT _UxGT("自動回縮") //"AutoRetr." autoretract_enabled, diff --git a/Marlin/src/lcd/menu/game/brickout.cpp b/Marlin/src/lcd/menu/game/brickout.cpp new file mode 100644 index 0000000000..4686072da7 --- /dev/null +++ b/Marlin/src/lcd/menu/game/brickout.cpp @@ -0,0 +1,213 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "../../../inc/MarlinConfigPre.h" + +#if ENABLED(MARLIN_BRICKOUT) + +#include "game.h" + +#define BRICK_H 5 +#define BRICK_TOP MENU_FONT_ASCENT +#define BRICK_ROWS 4 +#define BRICK_COLS 16 + +#define PADDLE_H 2 +#define PADDLE_VEL 3 +#define PADDLE_W ((LCD_PIXEL_WIDTH) / 8) +#define PADDLE_Y (LCD_PIXEL_HEIGHT - 1 - PADDLE_H) + +#define BRICK_W ((LCD_PIXEL_WIDTH) / (BRICK_COLS)) +#define BRICK_BOT (BRICK_TOP + BRICK_H * BRICK_ROWS - 1) + +#define BRICK_COL(X) ((X) / (BRICK_W)) +#define BRICK_ROW(Y) ((Y - (BRICK_TOP)) / (BRICK_H)) + +uint8_t balls_left, brick_count; +uint16_t bricks[BRICK_ROWS]; + +inline void reset_bricks(const uint16_t v) { + brick_count = (BRICK_COLS) * (BRICK_ROWS); + LOOP_L_N(i, BRICK_ROWS) bricks[i] = v; +} + +int8_t paddle_x, hit_dir; +fixed_t ballx, bally, ballh, ballv; + +void reset_ball() { + constexpr uint8_t ball_dist = 24; + bally = BTOF(PADDLE_Y - ball_dist); + ballv = FTOP(1.3f); + ballh = -FTOP(1.25f); + uint8_t bx = paddle_x + (PADDLE_W) / 2 + ball_dist; + if (bx >= LCD_PIXEL_WIDTH - 10) { bx -= ball_dist * 2; ballh = -ballh; } + ballx = BTOF(bx); + hit_dir = -1; +} + +void BrickoutGame::game_screen() { + if (game_frame()) { // Run logic twice for finer resolution + // Update Paddle Position + paddle_x = (int8_t)ui.encoderPosition; + paddle_x = constrain(paddle_x, 0, (LCD_PIXEL_WIDTH - (PADDLE_W)) / (PADDLE_VEL)); + ui.encoderPosition = paddle_x; + paddle_x *= (PADDLE_VEL); + + // Run the ball logic + if (game_state) do { + + // Provisionally update the ball position + const fixed_t newx = ballx + ballh, newy = bally + ballv; // current next position + if (!WITHIN(newx, 0, BTOF(LCD_PIXEL_WIDTH - 1))) { // out in x? + ballh = -ballh; _BUZZ(5, 220); // bounce x + } + if (newy < 0) { // out in y? + ballv = -ballv; _BUZZ(5, 280); // bounce v + hit_dir = 1; + } + // Did the ball go below the bottom? + else if (newy > BTOF(LCD_PIXEL_HEIGHT)) { + BUZZ(500, 75); + if (--balls_left) reset_ball(); else game_state = 0; + break; // done + } + + // Is the ball colliding with a brick? + if (WITHIN(newy, BTOF(BRICK_TOP), BTOF(BRICK_BOT))) { + const int8_t bit = BRICK_COL(FTOB(newx)), row = BRICK_ROW(FTOB(newy)); + const uint16_t mask = _BV(bit); + if (bricks[row] & mask) { + // Yes. Remove it! + bricks[row] &= ~mask; + // Score! + score += BRICK_ROWS - row; + // If bricks are gone, go to reset state + if (!--brick_count) game_state = 2; + // Bounce the ball cleverly + if ((ballv < 0) == (hit_dir < 0)) { ballv = -ballv; ballh += fixed_t(random(-16, 16)); _BUZZ(5, 880); } + else { ballh = -ballh; ballv += fixed_t(random(-16, 16)); _BUZZ(5, 640); } + } + } + // Is the ball moving down and in paddle range? + else if (ballv > 0 && WITHIN(newy, BTOF(PADDLE_Y), BTOF(PADDLE_Y + PADDLE_H))) { + // Ball actually hitting paddle + const int8_t diff = FTOB(newx) - paddle_x; + if (WITHIN(diff, 0, PADDLE_W - 1)) { + + // Reverse Y direction + ballv = -ballv; _BUZZ(3, 880); + hit_dir = -1; + + // Near edges affects X velocity + const bool is_left_edge = (diff <= 1); + if (is_left_edge || diff >= PADDLE_W-1 - 1) { + if ((ballh > 0) == is_left_edge) ballh = -ballh; + } + else if (diff <= 3) { + ballh += fixed_t(random(-64, 0)); + NOLESS(ballh, BTOF(-2)); + NOMORE(ballh, BTOF(2)); + } + else if (diff >= PADDLE_W-1 - 3) { + ballh += fixed_t(random( 0, 64)); + NOLESS(ballh, BTOF(-2)); + NOMORE(ballh, BTOF(2)); + } + + // Paddle hit after clearing the board? Reset the board. + if (game_state == 2) { reset_bricks(0xFFFF); game_state = 1; } + } + } + + ballx += ballh; bally += ballv; // update with new velocity + + } while (false); + } + + u8g.setColorIndex(1); + + // Draw bricks + if (PAGE_CONTAINS(BRICK_TOP, BRICK_BOT)) { + for (uint8_t y = 0; y < BRICK_ROWS; ++y) { + const uint8_t yy = y * BRICK_H + BRICK_TOP; + if (PAGE_CONTAINS(yy, yy + BRICK_H - 1)) { + for (uint8_t x = 0; x < BRICK_COLS; ++x) { + if (TEST(bricks[y], x)) { + const uint8_t xx = x * BRICK_W; + for (uint8_t v = 0; v < BRICK_H - 1; ++v) + if (PAGE_CONTAINS(yy + v, yy + v)) + u8g.drawHLine(xx, yy + v, BRICK_W - 1); + } + } + } + } + } + + // Draw paddle + if (PAGE_CONTAINS(PADDLE_Y-1, PADDLE_Y)) { + u8g.drawHLine(paddle_x, PADDLE_Y, PADDLE_W); + #if PADDLE_H > 1 + u8g.drawHLine(paddle_x, PADDLE_Y-1, PADDLE_W); + #if PADDLE_H > 2 + u8g.drawHLine(paddle_x, PADDLE_Y-2, PADDLE_W); + #endif + #endif + } + + // Draw ball while game is running + if (game_state) { + const uint8_t by = FTOB(bally); + if (PAGE_CONTAINS(by, by+1)) + u8g.drawFrame(FTOB(ballx), by, 2, 2); + } + // Or draw GAME OVER + else + draw_game_over(); + + if (PAGE_UNDER(MENU_FONT_ASCENT)) { + // Score Digits + //const uint8_t sx = (LCD_PIXEL_WIDTH - (score >= 10 ? score >= 100 ? score >= 1000 ? 4 : 3 : 2 : 1) * MENU_FONT_WIDTH) / 2; + constexpr uint8_t sx = 0; + lcd_moveto(sx, MENU_FONT_ASCENT - 1); + lcd_put_int(score); + + // Balls Left + lcd_moveto(LCD_PIXEL_WIDTH - MENU_FONT_WIDTH * 3, MENU_FONT_ASCENT - 1); + PGM_P const ohs = PSTR("ooo\0\0"); + lcd_put_u8str_P(ohs + 3 - balls_left); + } + + // A click always exits this game + if (ui.use_click()) exit_game(); +} + +void BrickoutGame::enter_game() { + init_game(2, game_screen); // 2 = reset bricks on paddle hit + constexpr uint8_t paddle_start = SCREEN_M - (PADDLE_W) / 2; + paddle_x = paddle_start; + balls_left = 3; + reset_bricks(0x0000); + reset_ball(); + ui.encoderPosition = paddle_start / (PADDLE_VEL); +} + +#endif // MARLIN_BRICKOUT diff --git a/Marlin/src/lcd/menu/game/game.cpp b/Marlin/src/lcd/menu/game/game.cpp new file mode 100644 index 0000000000..1b1d838a8e --- /dev/null +++ b/Marlin/src/lcd/menu/game/game.cpp @@ -0,0 +1,69 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "../../../inc/MarlinConfigPre.h" + +#if HAS_GAMES + +#include "game.h" + +int MarlinGame::score; +uint8_t MarlinGame::game_state; +millis_t MarlinGame::next_frame; + +bool MarlinGame::game_frame() { + static int8_t slew; + if (ui.first_page) slew = 2; + ui.refresh(LCDVIEW_CALL_NO_REDRAW); // Refresh as often as possible + return (game_state && slew-- > 0); +} + +void MarlinGame::draw_game_over() { + constexpr int8_t gowide = (MENU_FONT_WIDTH) * 9, + gohigh = MENU_FONT_ASCENT - 3, + lx = (LCD_PIXEL_WIDTH - gowide) / 2, + ly = (LCD_PIXEL_HEIGHT + gohigh) / 2; + if (PAGE_CONTAINS(ly - gohigh - 1, ly + 1)) { + u8g.setColorIndex(0); + u8g.drawBox(lx - 1, ly - gohigh - 1, gowide + 2, gohigh + 2); + u8g.setColorIndex(1); + if (ui.get_blink()) { + lcd_moveto(lx, ly); + lcd_put_u8str_P(PSTR("GAME OVER")); + } + } +} + +void MarlinGame::init_game(const uint8_t init_state, const screenFunc_t screen) { + score = 0; + game_state = init_state; + ui.encoder_direction_normal(); + ui.goto_screen(screen); + ui.defer_status_screen(); +} + +void MarlinGame::exit_game() { + ui.goto_previous_screen(); + ui.defer_status_screen(false); +} + +#endif // HAS_GAMES diff --git a/Marlin/src/lcd/menu/game/game.h b/Marlin/src/lcd/menu/game/game.h new file mode 100644 index 0000000000..a4cfda56d6 --- /dev/null +++ b/Marlin/src/lcd/menu/game/game.h @@ -0,0 +1,78 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +#include "../../../inc/MarlinConfigPre.h" +#include "../../dogm/ultralcd_DOGM.h" +#include "../../lcdprint.h" +#include "../../ultralcd.h" + +//#define MUTE_GAMES + +#ifdef MUTE_GAMES + #define _BUZZ(D,F) NOOP +#else + #define _BUZZ(D,F) BUZZ(D,F) +#endif + +// Simple 8:8 fixed-point +typedef int16_t fixed_t; +#define FTOP(F) fixed_t((F)*256.0f) +#define PTOF(P) (float(P)*(1.0f/256.0f)) +#define BTOF(X) (fixed_t(X)<<8) +#define FTOB(X) int8_t(fixed_t(X)>>8) + +#define SCREEN_M ((LCD_PIXEL_WIDTH) / 2) + +#if HAS_GAME_MENU + void menu_game(); +#endif + +class MarlinGame { +protected: + static int score; + static uint8_t game_state; + static millis_t next_frame; + + static bool game_frame(); + static void draw_game_over(); + static void exit_game(); +public: + static void init_game(const uint8_t init_state, const screenFunc_t screen); +}; + +#if ENABLED(MARLIN_BRICKOUT) + class BrickoutGame : MarlinGame { public: static void enter_game(); static void game_screen(); }; + extern BrickoutGame brickout; +#endif +#if ENABLED(MARLIN_INVADERS) + class InvadersGame : MarlinGame { public: static void enter_game(); static void game_screen(); }; + extern InvadersGame invaders; +#endif +#if ENABLED(MARLIN_SNAKE) + class SnakeGame : MarlinGame { public: static void enter_game(); static void game_screen(); }; + extern SnakeGame snake; +#endif +#if ENABLED(MARLIN_MAZE) + class MazeGame : MarlinGame { public: static void enter_game(); static void game_screen(); }; + extern MazeGame maze; +#endif diff --git a/Marlin/src/lcd/menu/game/invaders.cpp b/Marlin/src/lcd/menu/game/invaders.cpp new file mode 100644 index 0000000000..d9660f52f3 --- /dev/null +++ b/Marlin/src/lcd/menu/game/invaders.cpp @@ -0,0 +1,468 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "../../../inc/MarlinConfigPre.h" + +#if ENABLED(MARLIN_INVADERS) + +#include "game.h" + +// 11x8 +const unsigned char invader[3][2][16] PROGMEM = { + { { B00000110,B00000000, + B00001111,B00000000, + B00011111,B10000000, + B00110110,B11000000, + B00111111,B11000000, + B00001001,B00000000, + B00010110,B10000000, + B00101001,B01000000 + }, { + B00000110,B00000000, + B00001111,B00000000, + B00011111,B10000000, + B00110110,B11000000, + B00111111,B11000000, + B00010110,B10000000, + B00100000,B01000000, + B00010000,B10000000 + } + }, { + { B00010000,B01000000, + B00001000,B10000000, + B00011111,B11000000, + B00110111,B01100000, + B01111111,B11110000, + B01011111,B11010000, + B01010000,B01010000, + B00001101,B10000000 + }, { + B00010000,B01000000, + B01001000,B10010000, + B01011111,B11010000, + B01110111,B01110000, + B01111111,B11110000, + B00011111,B11000000, + B00010000,B01000000, + B00100000,B00100000 + } + }, { + { B00001111,B00000000, + B01111111,B11100000, + B11111111,B11110000, + B11100110,B01110000, + B11111111,B11110000, + B00011001,B10000000, + B00110110,B11000000, + B11000000,B00110000 + }, { + B00001111,B00000000, + B01111111,B11100000, + B11111111,B11110000, + B11100110,B01110000, + B11111111,B11110000, + B00011001,B10000000, + B00110110,B11000000, + B00011001,B10000000 + } + } +}; +const unsigned char cannon[] PROGMEM = { + B00000100,B00000000, + B00001110,B00000000, + B00001110,B00000000, + B01111111,B11000000, + B11111111,B11100000, + B11111111,B11100000, + B11111111,B11100000, + B11111111,B11100000 +}; +const unsigned char life[] PROGMEM = { + B00010000, + B01111100, + B11111110, + B11111110, + B11111110 +}; +const unsigned char explosion[] PROGMEM = { + B01000100,B01000000, + B00100100,B10000000, + B00000000,B00000000, + B00110001,B10000000, + B00000000,B00000000, + B00100100,B10000000, + B01000100,B01000000 +}; +const unsigned char ufo[] PROGMEM = { + B00011111,B11000000, + B01111111,B11110000, + B11011101,B11011000, + B11111111,B11111000, + B01111111,B11110000 +}; + +#define INVASION_SIZE 3 + +#if INVASION_SIZE == 3 + #define INVADER_COLS 5 +#elif INVASION_SIZE == 4 + #define INVADER_COLS 6 +#else + #define INVADER_COLS 8 + #undef INVASION_SIZE + #define INVASION_SIZE 5 +#endif + +#define INVADER_ROWS INVASION_SIZE + +constexpr uint8_t inv_type[] = { + #if INVADER_ROWS == 5 + 0, 1, 1, 2, 2 + #elif INVADER_ROWS == 4 + 0, 1, 1, 2 + #elif INVADER_ROWS == 3 + 0, 1, 2 + #else + #error "INVASION_SIZE must be 3, 4, or 5." + #endif +}; + +#define INVADER_RIGHT ((INVADER_COLS) * (COL_W)) + +#define CANNON_W 11 +#define CANNON_H 8 +#define CANNON_VEL 4 +#define CANNON_Y (LCD_PIXEL_HEIGHT - 1 - CANNON_H) + +#define COL_W 14 +#define INVADER_H 8 +#define ROW_H (INVADER_H + 2) +#define INVADER_VEL 3 + +#define INVADER_TOP MENU_FONT_ASCENT +#define INVADERS_WIDE ((COL_W) * (INVADER_COLS)) +#define INVADERS_HIGH ((ROW_H) * (INVADER_ROWS)) + +#define UFO_H 5 +#define UFO_W 13 + +#define LASER_H 4 +#define SHOT_H 3 +#define EXPL_W 11 +#define LIFE_W 8 +#define LIFE_H 5 + +#define INVADER_COL(X) ((X - invaders_x) / (COL_W)) +#define INVADER_ROW(Y) ((Y - invaders_y + 2) / (ROW_H)) + +#define INV_X_LEFT(C,T) (invaders_x + (C) * (COL_W) + inv_off[T]) +#define INV_X_CTR(C,T) (INV_X_LEFT(C,T) + inv_wide[T] / 2) +#define INV_Y_BOT(R) (invaders_y + (R + 1) * (ROW_H) - 2) + +typedef struct { int8_t x, y, v; } laser_t; + +uint8_t cannons_left; +int8_t cannon_x; +laser_t explod, laser, bullet[10]; +constexpr uint8_t inv_off[] = { 2, 1, 0 }, inv_wide[] = { 8, 11, 12 }; +int8_t invaders_x, invaders_y, invaders_dir, leftmost, rightmost, botmost; +uint8_t invader_count, quit_count, bugs[INVADER_ROWS], shooters[(INVADER_ROWS) * (INVADER_COLS)]; + +inline void update_invader_data() { + uint8_t inv_mask = 0; + // Get a list of all active invaders + uint8_t sc = 0; + LOOP_L_N(y, INVADER_ROWS) { + uint8_t m = bugs[y]; + if (m) botmost = y + 1; + inv_mask |= m; + for (uint8_t x = 0; x < INVADER_COLS; ++x) + if (TEST(m, x)) shooters[sc++] = (y << 4) | x; + } + leftmost = 0; + LOOP_L_N(i, INVADER_COLS) { if (TEST(inv_mask, i)) break; leftmost -= COL_W; } + rightmost = LCD_PIXEL_WIDTH - (INVADERS_WIDE); + for (uint8_t i = INVADER_COLS; i--;) { if (TEST(inv_mask, i)) break; rightmost += COL_W; } + if (invader_count == 2) invaders_dir = invaders_dir > 0 ? INVADER_VEL + 1 : -(INVADER_VEL + 1); +} + +inline void reset_bullets() { + LOOP_L_N(i, COUNT(bullet)) bullet[i].v = 0; +} + +inline void reset_invaders() { + invaders_x = 0; invaders_y = INVADER_TOP; + invaders_dir = INVADER_VEL; + invader_count = (INVADER_COLS) * (INVADER_ROWS); + LOOP_L_N(i, INVADER_ROWS) bugs[i] = _BV(INVADER_COLS) - 1; + update_invader_data(); + reset_bullets(); +} + +int8_t ufox, ufov; +inline void spawn_ufo() { + ufov = random(0, 2) ? 1 : -1; + ufox = ufov > 0 ? -(UFO_W) : LCD_PIXEL_WIDTH - 1; +} + +inline void reset_player() { + cannon_x = 0; + ui.encoderPosition = 0; +} + +inline void fire_cannon() { + laser.x = cannon_x + CANNON_W / 2; + laser.y = LCD_PIXEL_HEIGHT - CANNON_H - (LASER_H); + laser.v = -(LASER_H); +} + +inline void explode(const int8_t x, const int8_t y, const int8_t v=4) { + explod.x = x - (EXPL_W) / 2; + explod.y = y; + explod.v = v; +} + +inline void kill_cannon(uint8_t &game_state, const uint8_t st) { + reset_bullets(); + explode(cannon_x + (CANNON_W) / 2, CANNON_Y, 6); + _BUZZ(1000, 10); + if (--cannons_left) { + laser.v = 0; + game_state = st; + reset_player(); + } + else + game_state = 0; +} + +void InvadersGame::game_screen() { + static bool game_blink; + + ui.refresh(LCDVIEW_CALL_NO_REDRAW); // Call as often as possible + + // Run game logic once per full screen + if (ui.first_page) { + + // Update Cannon Position + int32_t ep = (int32_t)ui.encoderPosition; + ep = constrain(ep, 0, (LCD_PIXEL_WIDTH - (CANNON_W)) / (CANNON_VEL)); + ui.encoderPosition = ep; + + ep *= (CANNON_VEL); + if (ep > cannon_x) { cannon_x += CANNON_VEL - 1; if (ep - cannon_x < 2) cannon_x = ep; } + if (ep < cannon_x) { cannon_x -= CANNON_VEL - 1; if (cannon_x - ep < 2) cannon_x = ep; } + + // Run the game logic + if (game_state) do { + + // Move the UFO, if any + if (ufov) { ufox += ufov; if (!WITHIN(ufox, -(UFO_W), LCD_PIXEL_WIDTH - 1)) ufov = 0; } + + if (game_state > 1) { if (--game_state == 2) { reset_invaders(); } else if (game_state == 100) { game_state = 1; } break; } + + static uint8_t blink_count; + const bool did_blink = (++blink_count > invader_count >> 1); + if (did_blink) { + game_blink = !game_blink; + blink_count = 0; + } + + if (invader_count && did_blink) { + const int8_t newx = invaders_x + invaders_dir; + if (!WITHIN(newx, leftmost, rightmost)) { // Invaders reached the edge? + invaders_dir *= -1; // Invaders change direction + invaders_y += (ROW_H) / 2; // Invaders move down + invaders_x -= invaders_dir; // ...and only move down this time. + if (invaders_y + botmost * (ROW_H) - 2 >= CANNON_Y) // Invaders reached the bottom? + kill_cannon(game_state, 20); // Kill the cannon. Reset invaders. + } + + invaders_x += invaders_dir; // Invaders take one step left/right + + // Randomly shoot if invaders are listed + if (invader_count && !random(0, 20)) { + + // Find a free bullet + laser_t *b = NULL; + LOOP_L_N(i, COUNT(bullet)) if (!bullet[i].v) { b = &bullet[i]; break; } + if (b) { + // Pick a random shooter and update the bullet + //SERIAL_ECHOLNPGM("free bullet found"); + const uint8_t inv = shooters[random(0, invader_count + 1)], col = inv & 0x0F, row = inv >> 4, type = inv_type[row]; + b->x = INV_X_CTR(col, type); + b->y = INV_Y_BOT(row); + b->v = 2 + random(0, 2); + } + } + } + + // Update the laser position + if (laser.v) { + laser.y += laser.v; + if (laser.y < 0) laser.v = 0; + } + + // Did the laser collide with an invader? + if (laser.v && WITHIN(laser.y, invaders_y, invaders_y + INVADERS_HIGH - 1)) { + const int8_t col = INVADER_COL(laser.x); + if (WITHIN(col, 0, INVADER_COLS - 1)) { + const int8_t row = INVADER_ROW(laser.y); + if (WITHIN(row, 0, INVADER_ROWS - 1)) { + const uint8_t mask = _BV(col); + if (bugs[row] & mask) { + const uint8_t type = inv_type[row]; + const int8_t invx = INV_X_LEFT(col, type); + if (WITHIN(laser.x, invx, invx + inv_wide[type] - 1)) { + // Turn off laser + laser.v = 0; + // Remove the invader! + bugs[row] &= ~mask; + // Score! + score += INVADER_ROWS - row; + // Explode sound! + _BUZZ(40, 10); + // Explosion bitmap! + explode(invx + inv_wide[type] / 2, invaders_y + row * (ROW_H)); + // If invaders are gone, go to reset invaders state + if (--invader_count) update_invader_data(); else { game_state = 20; reset_bullets(); } + } // laser x hit + } // invader exists + } // good row + } // good col + } // laser in invader zone + + // Handle alien bullets + LOOP_L_N(s, COUNT(bullet)) { + laser_t *b = &bullet[s]; + if (b->v) { + // Update alien bullet position + b->y += b->v; + if (b->y >= LCD_PIXEL_HEIGHT) + b->v = 0; // Offscreen + else if (b->y >= CANNON_Y && WITHIN(b->x, cannon_x, cannon_x + CANNON_W - 1)) + kill_cannon(game_state, 120); // Hit the cannon + } + } + + // Randomly spawn a UFO + if (!ufov && !random(0,500)) spawn_ufo(); + + // Did the laser hit a ufo? + if (laser.v && ufov && laser.y < UFO_H + 2 && WITHIN(laser.x, ufox, ufox + UFO_W - 1)) { + // Turn off laser and UFO + laser.v = ufov = 0; + // Score! + score += 10; + // Explode! + _BUZZ(40, 10); + // Explosion bitmap + explode(ufox + (UFO_W) / 2, 1); + } + + } while (false); + + } + + // Click-and-hold to abort + if (ui.button_pressed()) --quit_count; else quit_count = 10; + + // Click to fire or exit + if (ui.use_click()) { + if (!game_state) + quit_count = 0; + else if (game_state == 1 && !laser.v) + fire_cannon(); + } + + if (!quit_count) exit_game(); + + u8g.setColorIndex(1); + + // Draw invaders + if (PAGE_CONTAINS(invaders_y, invaders_y + botmost * (ROW_H) - 2 - 1)) { + int8_t yy = invaders_y; + for (uint8_t y = 0; y < INVADER_ROWS; ++y) { + const uint8_t type = inv_type[y]; + if (PAGE_CONTAINS(yy, yy + INVADER_H - 1)) { + int8_t xx = invaders_x; + for (uint8_t x = 0; x < INVADER_COLS; ++x) { + if (TEST(bugs[y], x)) + u8g.drawBitmapP(xx, yy, 2, INVADER_H, invader[type][game_blink]); + xx += COL_W; + } + } + yy += ROW_H; + } + } + + // Draw UFO + if (ufov && PAGE_UNDER(UFO_H + 2)) + u8g.drawBitmapP(ufox, 2, 2, UFO_H, ufo); + + // Draw cannon + if (game_state && PAGE_CONTAINS(CANNON_Y, CANNON_Y + CANNON_H - 1) && (game_state < 2 || (game_state & 0x02))) + u8g.drawBitmapP(cannon_x, CANNON_Y, 2, CANNON_H, cannon); + + // Draw laser + if (laser.v && PAGE_CONTAINS(laser.y, laser.y + LASER_H - 1)) + u8g.drawVLine(laser.x, laser.y, LASER_H); + + // Draw invader bullets + LOOP_L_N (i, COUNT(bullet)) { + if (bullet[i].v && PAGE_CONTAINS(bullet[i].y - (SHOT_H - 1), bullet[i].y)) + u8g.drawVLine(bullet[i].x, bullet[i].y - (SHOT_H - 1), SHOT_H); + } + + // Draw explosion + if (explod.v && PAGE_CONTAINS(explod.y, explod.y + 7 - 1)) { + u8g.drawBitmapP(explod.x, explod.y, 2, 7, explosion); + --explod.v; + } + + // Blink GAME OVER when game is over + if (!game_state) draw_game_over(); + + if (PAGE_UNDER(MENU_FONT_ASCENT - 1)) { + // Draw Score + //const uint8_t sx = (LCD_PIXEL_WIDTH - (score >= 10 ? score >= 100 ? score >= 1000 ? 4 : 3 : 2 : 1) * MENU_FONT_WIDTH) / 2; + constexpr uint8_t sx = 0; + lcd_moveto(sx, MENU_FONT_ASCENT - 1); + lcd_put_int(score); + + // Draw lives + if (cannons_left) + for (uint8_t i = 1; i <= cannons_left; ++i) + u8g.drawBitmapP(LCD_PIXEL_WIDTH - i * (LIFE_W), 6 - (LIFE_H), 1, LIFE_H, life); + } + +} + +void InvadersGame::enter_game() { + init_game(20, game_screen); // countdown to reset invaders + cannons_left = 3; + quit_count = 10; + laser.v = 0; + reset_invaders(); + reset_player(); +} + +#endif // MARLIN_INVADERS diff --git a/Marlin/src/lcd/menu/game/maze.cpp b/Marlin/src/lcd/menu/game/maze.cpp new file mode 100644 index 0000000000..c84c504537 --- /dev/null +++ b/Marlin/src/lcd/menu/game/maze.cpp @@ -0,0 +1,137 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "../../../inc/MarlinConfigPre.h" + +#if ENABLED(MARLIN_MAZE) + +#include "game.h" + +int8_t move_dir, last_move_dir, // NESW0 + prizex, prizey, prize_cnt, old_encoder; +fixed_t playerx, playery; + +// Up to 50 lines, then you win! +typedef struct { int8_t x, y; } pos_t; +uint8_t head_ind; +pos_t maze_walls[50] = { + { 0, 0 } +}; + +// Turn the player cw or ccw +inline void turn_player(const bool cw) { + if (move_dir == 4) move_dir = last_move_dir; + move_dir += cw ? 1 : -1; + move_dir &= 0x03; + last_move_dir = move_dir; +} + +// Reset the player for a new game +void player_reset() { + // Init position + playerx = BTOF(1); + playery = BTOF(GAME_H / 2); + + // Init motion with a ccw turn + move_dir = 0; + turn_player(false); + + // Clear prize flag + prize_cnt = 255; + + // Clear the controls + ui.encoderPosition = 0; + old_encoder = 0; +} + +void MazeGame::game_screen() { + // Run the sprite logic + if (game_frame()) do { // Run logic twice for finer resolution + + // Move the man one unit in the current direction + // Direction index 4 is for the stopped man + const int8_t oldx = FTOB(playerx), oldy = FTOB(playery); + pos_t dir_add[] = { { 0, -1 }, { 1, 0 }, { 0, 1 }, { -1, 0 }, { 0, 0 } }; + playerx += dir_add[move_dir].x; + playery += dir_add[move_dir].y; + const int8_t x = FTOB(playerx), y = FTOB(playery); + + } while(0); + + u8g.setColorIndex(1); + + // Draw Score + if (PAGE_UNDER(HEADER_H)) { + lcd_moveto(0, HEADER_H - 1); + lcd_put_int(score); + } + + // Draw the maze + // for (uint8_t n = 0; n < head_ind; ++n) { + // const pos_t &p = maze_walls[n], &q = maze_walls[n + 1]; + // if (p.x == q.x) { + // const int8_t y1 = GAMEY(MIN(p.y, q.y)), y2 = GAMEY(MAX(p.y, q.y)); + // if (PAGE_CONTAINS(y1, y2)) + // u8g.drawVLine(GAMEX(p.x), y1, y2 - y1 + 1); + // } + // else if (PAGE_CONTAINS(GAMEY(p.y), GAMEY(p.y))) { + // const int8_t x1 = GAMEX(MIN(p.x, q.x)), x2 = GAMEX(MAX(p.x, q.x)); + // u8g.drawHLine(x1, GAMEY(p.y), x2 - x1 + 1); + // } + // } + + // Draw Man + // const int8_t fy = GAMEY(foody); + // if (PAGE_CONTAINS(fy, fy + FOOD_WH - 1)) { + // const int8_t fx = GAMEX(foodx); + // u8g.drawFrame(fx, fy, FOOD_WH, FOOD_WH); + // if (FOOD_WH == 5) u8g.drawPixel(fx + 2, fy + 2); + // } + + // Draw Ghosts + // const int8_t fy = GAMEY(foody); + // if (PAGE_CONTAINS(fy, fy + FOOD_WH - 1)) { + // const int8_t fx = GAMEX(foodx); + // u8g.drawFrame(fx, fy, FOOD_WH, FOOD_WH); + // if (FOOD_WH == 5) u8g.drawPixel(fx + 2, fy + 2); + // } + + // Draw Prize + // if (PAGE_CONTAINS(prizey, prizey + PRIZE_WH - 1)) { + // u8g.drawFrame(prizex, prizey, PRIZE_WH, PRIZE_WH); + // if (PRIZE_WH == 5) u8g.drawPixel(prizex + 2, prizey + 2); + // } + + // Draw GAME OVER + if (!game_state) draw_game_over(); + + // A click always exits this game + if (ui.use_click()) exit_game(); +} + +void MazeGame::enter_game() { + init_game(1, game_screen); // Game running + reset_player(); + reset_enemies(); +} + +#endif // MARLIN_MAZE diff --git a/Marlin/src/lcd/menu/game/snake.cpp b/Marlin/src/lcd/menu/game/snake.cpp new file mode 100644 index 0000000000..d34f6f4b11 --- /dev/null +++ b/Marlin/src/lcd/menu/game/snake.cpp @@ -0,0 +1,334 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "../../../inc/MarlinConfigPre.h" + +#if ENABLED(MARLIN_SNAKE) + +#include "game.h" + +#define SNAKE_BOX 4 + +#define HEADER_H (MENU_FONT_ASCENT - 2) +#define SNAKE_WH (SNAKE_BOX + 1) + +#define IDEAL_L 2 +#define IDEAL_R (LCD_PIXEL_WIDTH - 1 - 2) +#define IDEAL_T (HEADER_H + 2) +#define IDEAL_B (LCD_PIXEL_HEIGHT - 1 - 2) +#define IDEAL_W (IDEAL_R - (IDEAL_L) + 1) +#define IDEAL_H (IDEAL_B - (IDEAL_T) + 1) + +#define GAME_W int((IDEAL_W) / (SNAKE_WH)) +#define GAME_H int((IDEAL_H) / (SNAKE_WH)) + +#define BOARD_W ((SNAKE_WH) * (GAME_W) + 1) +#define BOARD_H ((SNAKE_WH) * (GAME_H) + 1) +#define BOARD_L ((LCD_PIXEL_WIDTH - (BOARD_W) + 1) / 2) +#define BOARD_R (BOARD_L + BOARD_W - 1) +#define BOARD_T (((LCD_PIXEL_HEIGHT + IDEAL_T) - (BOARD_H)) / 2) +#define BOARD_B (BOARD_T + BOARD_H - 1) + +#define GAMEX(X) (BOARD_L + ((X) * (SNAKE_WH))) +#define GAMEY(Y) (BOARD_T + ((Y) * (SNAKE_WH))) + +#if SNAKE_BOX > 2 + #define FOOD_WH SNAKE_BOX +#else + #define FOOD_WH 2 +#endif + +#if SNAKE_BOX < 1 + #define SNAKE_SIZ 1 +#else + #define SNAKE_SIZ SNAKE_BOX +#endif + +constexpr fixed_t snakev = FTOP(0.20); + +int8_t snake_dir, // NESW + foodx, foody, food_cnt, + old_encoder; +fixed_t snakex, snakey; + +// Up to 50 lines, then you win! +typedef struct { int8_t x, y; } pos_t; +uint8_t head_ind; +pos_t snake_tail[50]; + +// Remove the first pixel from the tail. +// If needed, shift out the first segment. +void shorten_tail() { + pos_t &p = snake_tail[0], &q = snake_tail[1]; + bool shift = false; + if (p.x == q.x) { + // Vertical line + p.y += (q.y > p.y) ? 1 : -1; + shift = p.y == q.y; + } + else { + // Horizontal line + p.x += (q.x > p.x) ? 1 : -1; + shift = p.x == q.x; + } + if (shift) { + head_ind--; + for (uint8_t i = 0; i <= head_ind; ++i) + snake_tail[i] = snake_tail[i + 1]; + } +} + +// The food is on a line +inline bool food_on_line() { + for (uint8_t n = 0; n < head_ind; ++n) { + pos_t &p = snake_tail[n], &q = snake_tail[n + 1]; + if (p.x == q.x) { + if ((foodx == p.x - 1 || foodx == p.x) && WITHIN(foody, MIN(p.y, q.y), MAX(p.y, q.y))) + return true; + } + else if ((foody == p.y - 1 || foody == p.y) && WITHIN(foodx, MIN(p.x, q.x), MAX(p.x, q.x))) + return true; + } + return false; +} + +// Add a new food blob +void food_reset() { + do { + foodx = random(0, GAME_W); + foody = random(0, GAME_H); + } while (food_on_line()); +} + +// Turn the snake cw or ccw +inline void turn_snake(const bool cw) { + snake_dir += cw ? 1 : -1; + snake_dir &= 0x03; + head_ind++; + snake_tail[head_ind].x = FTOB(snakex); + snake_tail[head_ind].y = FTOB(snakey); +} + +// Reset the snake for a new game +void snake_reset() { + // Init the head and velocity + snakex = BTOF(1); + snakey = BTOF(GAME_H / 2); + //snakev = FTOP(0.25); + + // Init the tail with a cw turn + snake_dir = 0; + head_ind = 0; + snake_tail[0].x = 0; + snake_tail[0].y = GAME_H / 2; + turn_snake(true); + + // Clear food flag + food_cnt = 5; + + // Clear the controls + ui.encoderPosition = 0; + old_encoder = 0; +} + +// Check if head segment overlaps another +bool snake_overlap() { + // 4 lines must exist before a collision is possible + if (head_ind < 4) return false; + // Is the last segment crossing any others? + const pos_t &h1 = snake_tail[head_ind - 1], &h2 = snake_tail[head_ind]; + // VERTICAL head segment? + if (h1.x == h2.x) { + // Loop from oldest to segment two away from head + for (uint8_t n = 0; n < head_ind - 2; ++n) { + // Segment p to q + const pos_t &p = snake_tail[n], &q = snake_tail[n + 1]; + if (p.x != q.x) { + // Crossing horizontal segment + if (WITHIN(h1.x, MIN(p.x, q.x), MAX(p.x, q.x)) && (h1.y <= p.y) == (h2.y >= p.y)) return true; + } // Overlapping vertical segment + else if (h1.x == p.x && MIN(h1.y, h2.y) <= MAX(p.y, q.y) && MAX(h1.y, h2.y) >= MIN(p.y, q.y)) return true; + } + } + else { + // Loop from oldest to segment two away from head + for (uint8_t n = 0; n < head_ind - 2; ++n) { + // Segment p to q + const pos_t &p = snake_tail[n], &q = snake_tail[n + 1]; + if (p.y != q.y) { + // Crossing vertical segment + if (WITHIN(h1.y, MIN(p.y, q.y), MAX(p.y, q.y)) && (h1.x <= p.x) == (h2.x >= p.x)) return true; + } // Overlapping horizontal segment + else if (h1.y == p.y && MIN(h1.x, h2.x) <= MAX(p.x, q.x) && MAX(h1.x, h2.x) >= MIN(p.x, q.x)) return true; + } + } + return false; +} + +void SnakeGame::game_screen() { + // Run the snake logic + if (game_frame()) do { // Run logic twice for finer resolution + + // Move the snake's head one unit in the current direction + const int8_t oldx = FTOB(snakex), oldy = FTOB(snakey); + switch (snake_dir) { + case 0: snakey -= snakev; break; + case 1: snakex += snakev; break; + case 2: snakey += snakev; break; + case 3: snakex -= snakev; break; + } + const int8_t x = FTOB(snakex), y = FTOB(snakey); + + // If movement took place... + if (oldx != x || oldy != y) { + + if (!WITHIN(x, 0, GAME_W - 1) || !WITHIN(y, 0, GAME_H - 1)) { + game_state = 0; // Game Over + _BUZZ(400, 40); // Bzzzt! + break; // ...out of do-while + } + + snake_tail[head_ind].x = x; + snake_tail[head_ind].y = y; + + // Change snake direction if set + const int8_t enc = int8_t(ui.encoderPosition), diff = enc - old_encoder; + if (diff) { + old_encoder = enc; + turn_snake(diff > 0); + } + + if (food_cnt) --food_cnt; else shorten_tail(); + + // Did the snake collide with itself or go out of bounds? + if (snake_overlap()) { + game_state = 0; // Game Over + _BUZZ(400, 40); // Bzzzt! + } + // Is the snake at the food? + else if (x == foodx && y == foody) { + _BUZZ(5, 220); + _BUZZ(5, 280); + score++; + food_cnt = 2; + food_reset(); + } + } + + } while(0); + + u8g.setColorIndex(1); + + // Draw Score + if (PAGE_UNDER(HEADER_H)) { + lcd_moveto(0, HEADER_H - 1); + lcd_put_int(score); + } + + // DRAW THE PLAYFIELD BORDER + u8g.drawFrame(BOARD_L - 2, BOARD_T - 2, BOARD_R - BOARD_L + 4, BOARD_B - BOARD_T + 4); + + // Draw the snake (tail) + #if SNAKE_WH < 2 + + // At this scale just draw a line + for (uint8_t n = 0; n < head_ind; ++n) { + const pos_t &p = snake_tail[n], &q = snake_tail[n + 1]; + if (p.x == q.x) { + const int8_t y1 = GAMEY(MIN(p.y, q.y)), y2 = GAMEY(MAX(p.y, q.y)); + if (PAGE_CONTAINS(y1, y2)) + u8g.drawVLine(GAMEX(p.x), y1, y2 - y1 + 1); + } + else if (PAGE_CONTAINS(GAMEY(p.y), GAMEY(p.y))) { + const int8_t x1 = GAMEX(MIN(p.x, q.x)), x2 = GAMEX(MAX(p.x, q.x)); + u8g.drawHLine(x1, GAMEY(p.y), x2 - x1 + 1); + } + } + + #elif SNAKE_WH == 2 + + // At this scale draw two lines + for (uint8_t n = 0; n < head_ind; ++n) { + const pos_t &p = snake_tail[n], &q = snake_tail[n + 1]; + if (p.x == q.x) { + const int8_t y1 = GAMEY(MIN(p.y, q.y)), y2 = GAMEY(MAX(p.y, q.y)); + if (PAGE_CONTAINS(y1, y2 + 1)) + u8g.drawFrame(GAMEX(p.x), y1, 2, y2 - y1 + 1 + 1); + } + else { + const int8_t py = GAMEY(p.y); + if (PAGE_CONTAINS(py, py + 1)) { + const int8_t x1 = GAMEX(MIN(p.x, q.x)), x2 = GAMEX(MAX(p.x, q.x)); + u8g.drawFrame(x1, py, x2 - x1 + 1 + 1, 2); + } + } + } + + #else + + // Draw a series of boxes + for (uint8_t n = 0; n < head_ind; ++n) { + const pos_t &p = snake_tail[n], &q = snake_tail[n + 1]; + if (p.x == q.x) { + const int8_t y1 = MIN(p.y, q.y), y2 = MAX(p.y, q.y); + if (PAGE_CONTAINS(GAMEY(y1), GAMEY(y2) + SNAKE_SIZ - 1)) { + for (int8_t i = y1; i <= y2; ++i) { + const int8_t y = GAMEY(i); + if (PAGE_CONTAINS(y, y + SNAKE_SIZ - 1)) + u8g.drawBox(GAMEX(p.x), y, SNAKE_SIZ, SNAKE_SIZ); + } + } + } + else { + const int8_t py = GAMEY(p.y); + if (PAGE_CONTAINS(py, py + SNAKE_SIZ - 1)) { + const int8_t x1 = MIN(p.x, q.x), x2 = MAX(p.x, q.x); + for (int8_t i = x1; i <= x2; ++i) + u8g.drawBox(GAMEX(i), py, SNAKE_SIZ, SNAKE_SIZ); + } + } + } + + #endif + + // Draw food + const int8_t fy = GAMEY(foody); + if (PAGE_CONTAINS(fy, fy + FOOD_WH - 1)) { + const int8_t fx = GAMEX(foodx); + u8g.drawFrame(fx, fy, FOOD_WH, FOOD_WH); + if (FOOD_WH == 5) u8g.drawPixel(fx + 2, fy + 2); + } + + // Draw GAME OVER + if (!game_state) draw_game_over(); + + // A click always exits this game + if (ui.use_click()) exit_game(); +} + +void SnakeGame::enter_game() { + init_game(1, game_screen); // 1 = Game running + snake_reset(); + food_reset(); +} + +#endif // MARLIN_SNAKE diff --git a/Marlin/src/lcd/menu/menu.cpp b/Marlin/src/lcd/menu/menu.cpp index f6a5e2c317..d69238eb27 100644 --- a/Marlin/src/lcd/menu/menu.cpp +++ b/Marlin/src/lcd/menu/menu.cpp @@ -37,7 +37,7 @@ #include "../../module/configuration_store.h" #endif -#if WATCH_HOTENDS || WATCH_THE_BED || ENABLED(BABYSTEP_ZPROBE_OFFSET) +#if WATCH_HOTENDS || WATCH_BED #include "../../module/temperature.h" #endif @@ -45,7 +45,7 @@ #include "../../module/probe.h" #endif -#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) || ENABLED(AUTO_BED_LEVELING_UBL) +#if EITHER(ENABLE_LEVELING_FADE_HEIGHT, AUTO_BED_LEVELING_UBL) #include "../../feature/bedlevel/bedlevel.h" #endif @@ -54,10 +54,12 @@ //////////////////////////////////////////// // Menu Navigation -int8_t encoderTopLine; +int8_t encoderTopLine, encoderLine, screen_items; + typedef struct { screenFunc_t menu_function; uint32_t encoder_position; + int8_t top_line, items; } menuPosition; menuPosition screen_history[6]; uint8_t screen_history_depth = 0; @@ -80,20 +82,14 @@ bool no_reentry = false; 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; - } + if (screen_history_depth < COUNT(screen_history)) + screen_history[screen_history_depth++] = { currentScreen, encoderPosition, encoderTopLine, screen_items }; } 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 - ); + menuPosition &sh = screen_history[--screen_history_depth]; + goto_screen(sh.menu_function, sh.encoder_position, sh.top_line, sh.items); } else return_to_status(); @@ -197,7 +193,7 @@ bool printer_busy() { /** * General function to go directly to a screen */ -void MarlinUI::goto_screen(screenFunc_t screen, const uint32_t encoder/*=0*/) { +void MarlinUI::goto_screen(screenFunc_t screen, const uint32_t encoder/*=0*/, const uint8_t top/*=0*/, const uint8_t items/*=0*/) { if (currentScreen != screen) { #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) @@ -205,7 +201,7 @@ void MarlinUI::goto_screen(screenFunc_t screen, const uint32_t encoder/*=0*/) { lcd_z_fade_height = planner.z_fade_height; #endif - #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) && ENABLED(BABYSTEPPING) + #if BOTH(DOUBLECLICK_FOR_Z_BABYSTEPPING, 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. @@ -246,6 +242,8 @@ void MarlinUI::goto_screen(screenFunc_t screen, const uint32_t encoder/*=0*/) { currentScreen = screen; encoderPosition = encoder; + encoderTopLine = top; + screen_items = items; if (screen == status_screen) { defer_status_screen(false); #if ENABLED(AUTO_BED_LEVELING_UBL) @@ -314,7 +312,6 @@ void MarlinUI::synchronize(PGM_P const msg/*=NULL*/) { * _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); @@ -355,9 +352,11 @@ void MarlinUI::completion_feedback(const bool good/*=true*/) { #if ENABLED(BABYSTEP_ZPROBE_OFFSET) + #include "../../feature/babystep.h" + void lcd_babystep_zoffset() { if (ui.use_click()) return ui.goto_previous_screen_no_defer(); - ui.defer_status_screen(true); + ui.defer_status_screen(); #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET) const bool do_probe = (active_extruder == 0); #else @@ -379,7 +378,7 @@ void MarlinUI::completion_feedback(const bool good/*=true*/) { ; if (WITHIN(new_offs, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) { - thermalManager.babystep_axis(Z_AXIS, babystep_increment); + babystep.add_steps(Z_AXIS, babystep_increment); if (do_probe) zprobe_zoffset = new_offs; #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET) @@ -405,40 +404,7 @@ void MarlinUI::completion_feedback(const bool good/*=true*/) { #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) +#if ANY(AUTO_BED_LEVELING_UBL, PID_AUTOTUNE_MENU, ADVANCED_PAUSE_FEATURE) void lcd_enqueue_command(const char * const cmd) { no_reentry = true; diff --git a/Marlin/src/lcd/menu/menu.h b/Marlin/src/lcd/menu/menu.h index 9da44c5d04..e695a02433 100644 --- a/Marlin/src/lcd/menu/menu.h +++ b/Marlin/src/lcd/menu/menu.h @@ -43,6 +43,7 @@ bool printer_busy(); static inline char* strfunc(const float value) { return STRFUNC((TYPE) value); } \ }; +DECLARE_MENU_EDIT_TYPE(uint8_t, percent, ui8tostr_percent,1 ); // 100% right-justified DECLARE_MENU_EDIT_TYPE(int16_t, int3, i16tostr3, 1 ); // 123, -12 right-justified DECLARE_MENU_EDIT_TYPE(int16_t, int4, i16tostr4sign, 1 ); // 1234, -123 right-justified DECLARE_MENU_EDIT_TYPE(int8_t, int8, i8tostr3, 1 ); // 123, -12 right-justified @@ -82,7 +83,7 @@ FORCE_INLINE void draw_menu_item_edit_P(const bool sel, const uint8_t row, PGM_P 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)) +#if HAS_GRAPHICAL_LCD && EITHER(BABYSTEP_ZPROBE_GFX_OVERLAY, MESH_EDIT_GFX_OVERLAY) void _lcd_zoffset_overlay_gfx(const float zvalue); #endif @@ -102,6 +103,7 @@ FORCE_INLINE void draw_menu_item_edit_P(const bool sel, const uint8_t row, PGM_P 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(percent); // 100% right-justified DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(int3); // 123, -12 right-justified DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(int4); // 1234, -123 right-justified DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(int8); // 123, -12 right-justified @@ -174,6 +176,7 @@ class TMenuItem : MenuItemBase { #define DECLARE_MENU_EDIT_ITEM(NAME) typedef TMenuItem MenuItem_##NAME; +DECLARE_MENU_EDIT_ITEM(percent); DECLARE_MENU_EDIT_ITEM(int3); DECLARE_MENU_EDIT_ITEM(int4); DECLARE_MENU_EDIT_ITEM(int8); @@ -296,18 +299,18 @@ class MenuItem_bool { ++_thisItemNr; \ } while(0) -#define MENU_ITEM_ADDON_START(X) \ +#define MENU_ITEM_ADDON_START(X) do{ \ if (ui.should_draw() && _menuLineNr == _thisItemNr - 1) { \ SETCURSOR(X, _lcdLineNr) -#define MENU_ITEM_ADDON_END() } (0) +#define MENU_ITEM_ADDON_END() } }while(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_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__) @@ -340,21 +343,13 @@ void menu_move(); 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)) +#define HAS_LINE_TO_Z ANY(DELTA, PROBE_MANUALLY, MESH_BED_LEVELING, 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) +#if ANY(AUTO_BED_LEVELING_UBL, PID_AUTOTUNE_MENU, ADVANCED_PAUSE_FEATURE) void lcd_enqueue_command(const char * const cmd); void lcd_enqueue_commands_P(PGM_P const cmd); #endif diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index 7e1a7112a2..89955484b0 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -37,9 +37,11 @@ #if HAS_BED_PROBE #include "../../module/probe.h" - #if ENABLED(BLTOUCH) - #include "../../module/endstops.h" - #endif +#endif + +#if ENABLED(BLTOUCH) + #include "../../module/endstops.h" + #include "../../feature/bltouch.h" #endif #if ENABLED(PIDTEMP) @@ -47,6 +49,7 @@ #endif void menu_tmc(); +void menu_backlash(); #if ENABLED(DAC_STEPPER_CURRENT) @@ -300,26 +303,28 @@ void menu_tmc(); #define DEFINE_PIDTEMP_FUNCS(N) _DEFINE_PIDTEMP_BASE_FUNCS(N); // #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 +#if HOTENDS + 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 // HOTENDS -#define SHOW_MENU_ADVANCED_TEMPERATURE ((ENABLED(AUTOTEMP) && HAS_TEMP_HOTEND) || ENABLED(PID_AUTOTUNE_MENU) || ENABLED(PID_EDIT_MENU)) +#define SHOW_MENU_ADVANCED_TEMPERATURE ((ENABLED(AUTOTEMP) && HAS_TEMP_HOTEND) || EITHER(PID_AUTOTUNE_MENU, PID_EDIT_MENU)) // // Advanced Settings > Temperature @@ -643,6 +648,10 @@ void menu_advanced_settings() { } #endif // !SLIM_LCD_MENUS + #if ENABLED(BACKLASH_GCODE) + MENU_ITEM(submenu, MSG_BACKLASH, menu_backlash); + #endif + #if ENABLED(DAC_STEPPER_CURRENT) MENU_ITEM(submenu, MSG_DRIVE_STRENGTH, menu_dac); #endif @@ -692,7 +701,7 @@ void menu_advanced_settings() { // #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()) + if (!endstops.z_probe_enabled && bltouch.triggered()) MENU_ITEM(gcode, MSG_BLTOUCH_RESET, PSTR("M280 P" STRINGIFY(Z_PROBE_SERVO_NR) " S" STRINGIFY(BLTOUCH_RESET))); #endif diff --git a/Marlin/src/lcd/menu/menu_backlash.cpp b/Marlin/src/lcd/menu/menu_backlash.cpp new file mode 100644 index 0000000000..1b183e1063 --- /dev/null +++ b/Marlin/src/lcd/menu/menu_backlash.cpp @@ -0,0 +1,58 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +// +// Backlash Menu +// + +#include "../../inc/MarlinConfigPre.h" + +#if HAS_LCD_MENU && ENABLED(BACKLASH_GCODE) + +#include "menu.h" + +extern float backlash_distance_mm[XYZ]; +extern uint8_t backlash_correction; + +#ifdef BACKLASH_SMOOTHING_MM + extern float backlash_smoothing_mm; +#endif + +void menu_backlash() { + START_MENU(); + MENU_BACK(MSG_MAIN); + + MENU_MULTIPLIER_ITEM_EDIT(percent, MSG_BACKLASH_CORRECTION, &backlash_correction, all_off, all_on); + + #define EDIT_BACKLASH_DISTANCE(N) MENU_MULTIPLIER_ITEM_EDIT(float43, MSG_##N, &backlash_distance_mm[_AXIS(N)], 0.0f, 9.9f); + EDIT_BACKLASH_DISTANCE(A); + EDIT_BACKLASH_DISTANCE(B); + EDIT_BACKLASH_DISTANCE(C); + + #ifdef BACKLASH_SMOOTHING_MM + MENU_MULTIPLIER_ITEM_EDIT(float43, MSG_BACKLASH_SMOOTHING, &backlash_smoothing_mm, 0.0f, 9.9f); + #endif + + END_MENU(); +} + +#endif // HAS_LCD_MENU && BACKLASH_COMPENSATION diff --git a/Marlin/src/lcd/menu/menu_bed_corners.cpp b/Marlin/src/lcd/menu/menu_bed_corners.cpp index c9b014b947..b36d8dd3b1 100644 --- a/Marlin/src/lcd/menu/menu_bed_corners.cpp +++ b/Marlin/src/lcd/menu/menu_bed_corners.cpp @@ -32,17 +32,36 @@ #include "../../module/motion.h" #include "../../module/planner.h" +#if HAS_LEVELING + #include "../../feature/bedlevel/bedlevel.h" +#endif + #ifndef LEVEL_CORNERS_Z_HOP #define LEVEL_CORNERS_Z_HOP 4.0 #endif +#ifndef LEVEL_CORNERS_HEIGHT + #define LEVEL_CORNERS_HEIGHT 0.0 +#endif + static_assert(LEVEL_CORNERS_Z_HOP >= 0, "LEVEL_CORNERS_Z_HOP must be >= 0. Please update your configuration."); +#if HAS_LEVELING + static bool leveling_was_active = false; +#endif + +static inline void _lcd_level_bed_corners_back() { + #if HAS_LEVELING + set_bed_leveling_enabled(leveling_was_active); + #endif + ui.goto_previous_screen_no_defer(); +} + /** * Level corners, starting in the front-left corner. */ static int8_t bed_corner; -void _lcd_goto_next_corner() { +static inline void _lcd_goto_next_corner() { line_to_z(LEVEL_CORNERS_Z_HOP); switch (bed_corner) { case 0: @@ -66,7 +85,7 @@ void _lcd_goto_next_corner() { #endif } planner.buffer_line(current_position, MMM_TO_MMS(manual_feedrate_mm_m[X_AXIS]), active_extruder); - line_to_z(0.0); + line_to_z(LEVEL_CORNERS_HEIGHT); if (++bed_corner > 3 #if ENABLED(LEVEL_CENTER_TOO) + 1 @@ -74,7 +93,7 @@ void _lcd_goto_next_corner() { ) bed_corner = 0; } -void menu_level_bed_corners() { +static inline void menu_level_bed_corners() { START_MENU(); MENU_ITEM(function, #if ENABLED(LEVEL_CENTER_TOO) @@ -82,12 +101,13 @@ void menu_level_bed_corners() { #else MSG_NEXT_CORNER #endif - , _lcd_goto_next_corner); - MENU_ITEM(function, MSG_BACK, ui.goto_previous_screen_no_defer); + , _lcd_goto_next_corner + ); + MENU_ITEM(function, MSG_BACK, _lcd_level_bed_corners_back); END_MENU(); } -void _lcd_level_bed_corners_homing() { +static inline void _lcd_level_bed_corners_homing() { _lcd_draw_homing(); if (all_axes_homed()) { bed_corner = 0; @@ -97,11 +117,18 @@ void _lcd_level_bed_corners_homing() { } void _lcd_level_bed_corners() { - ui.defer_status_screen(true); + ui.defer_status_screen(); if (!all_axes_known()) { set_all_unhomed(); enqueue_and_echo_commands_P(PSTR("G28")); } + + // Disable leveling so the planner won't mess with us + #if HAS_LEVELING + leveling_was_active = planner.leveling_active; + set_bed_leveling_enabled(false); + #endif + ui.goto_screen(_lcd_level_bed_corners_homing); } diff --git a/Marlin/src/lcd/menu/menu_bed_leveling.cpp b/Marlin/src/lcd/menu/menu_bed_leveling.cpp index d3d04d45a5..3e2508647e 100644 --- a/Marlin/src/lcd/menu/menu_bed_leveling.cpp +++ b/Marlin/src/lcd/menu/menu_bed_leveling.cpp @@ -36,7 +36,7 @@ #include "../../module/probe.h" #endif -#if ENABLED(PROBE_MANUALLY) || ENABLED(MESH_BED_LEVELING) +#if EITHER(PROBE_MANUALLY, MESH_BED_LEVELING) #include "../../module/motion.h" #include "../../gcode/queue.h" @@ -191,7 +191,7 @@ // Step 2: Continue Bed Leveling... // void _lcd_level_bed_continue() { - ui.defer_status_screen(true); + ui.defer_status_screen(); set_all_unhomed(); ui.goto_screen(_lcd_level_bed_homing); enqueue_and_echo_commands_P(PSTR("G28")); @@ -239,12 +239,12 @@ void menu_bed_leveling() { const bool is_homed = all_axes_known(); // Auto Home if not using manual probing - #if DISABLED(PROBE_MANUALLY) && DISABLED(MESH_BED_LEVELING) + #if DISABLED(PROBE_MANUALLY, 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) + #if EITHER(PROBE_MANUALLY, MESH_BED_LEVELING) // Manual leveling uses a guided procedure MENU_ITEM(submenu, MSG_LEVEL_BED, _lcd_level_bed_continue); #else diff --git a/Marlin/src/lcd/menu/menu_configuration.cpp b/Marlin/src/lcd/menu/menu_configuration.cpp index e90488fdc8..d6115f5501 100644 --- a/Marlin/src/lcd/menu/menu_configuration.cpp +++ b/Marlin/src/lcd/menu/menu_configuration.cpp @@ -42,6 +42,9 @@ #if HAS_BED_PROBE #include "../../module/probe.h" + #if ENABLED(BLTOUCH) + #include "../../feature/bltouch.h" + #endif #endif #define HAS_DEBUG_MENU ENABLED(LCD_PROGRESS_BAR_TEST) @@ -138,10 +141,10 @@ static void lcd_factory_settings() { ? 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_MIRRORED_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); @@ -157,10 +160,15 @@ static void lcd_factory_settings() { 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))); + MENU_ITEM(function, MSG_BLTOUCH_RESET, bltouch.reset); + MENU_ITEM(function, MSG_BLTOUCH_SELFTEST, bltouch.selftest); + MENU_ITEM(function, MSG_BLTOUCH_DEPLOY, bltouch._deploy); + MENU_ITEM(function, MSG_BLTOUCH_STOW, bltouch._stow); + #if ENABLED(BLTOUCH_V3) + MENU_ITEM(function, MSG_BLTOUCH_SW_MODE, bltouch.set_SW_mode); + MENU_ITEM(function, MSG_BLTOUCH_5V_MODE, bltouch.set_5V_mode); + MENU_ITEM(function, MSG_BLTOUCH_OD_MODE, bltouch.set_OD_mode); + #endif END_MENU(); } @@ -196,9 +204,9 @@ static void lcd_factory_settings() { #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); + MENU_ITEM_EDIT(float52sign, MSG_CONTROL_RETRACT_RECOVER, &fwretract.settings.retract_recover_extra, -100, 100); #if EXTRUDERS > 1 - MENU_ITEM_EDIT(float52sign, MSG_CONTROL_RETRACT_RECOVER_SWAP, &fwretract.settings.swap_retract_recover_length, -100, 100); + MENU_ITEM_EDIT(float52sign, MSG_CONTROL_RETRACT_RECOVER_SWAP, &fwretract.settings.swap_retract_recover_extra, -100, 100); #endif MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACT_RECOVERF, &fwretract.settings.retract_recover_feedrate_mm_s, 1, 999); #if EXTRUDERS > 1 @@ -238,7 +246,7 @@ static void lcd_factory_settings() { 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); + MENU_ITEM_EDIT(int3, MSG_BED, &ui.preheat_bed_temp[material], BED_MINTEMP, BED_MAXTEMP - 10); #endif #if ENABLED(EEPROM_SETTINGS) MENU_ITEM(function, MSG_STORE_EEPROM, lcd_store_settings); @@ -275,7 +283,7 @@ void menu_configuration() { // // Delta Calibration // - #if ENABLED(DELTA_CALIBRATION_MENU) || ENABLED(DELTA_AUTO_CALIBRATION) + #if EITHER(DELTA_CALIBRATION_MENU, DELTA_AUTO_CALIBRATION) MENU_ITEM(submenu, MSG_DELTA_CALIBRATE, menu_delta_calibrate); #endif @@ -299,7 +307,7 @@ void menu_configuration() { // Set Case light on/off/brightness // #if ENABLED(MENU_ITEM_CASE_LIGHT) - if (USEABLE_HARDWARE_PWM(CASE_LIGHT_PIN)) + if (PWM_PIN(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); diff --git a/Marlin/src/lcd/menu/menu_delta_calibrate.cpp b/Marlin/src/lcd/menu/menu_delta_calibrate.cpp index 086bb99812..6931f32726 100644 --- a/Marlin/src/lcd/menu/menu_delta_calibrate.cpp +++ b/Marlin/src/lcd/menu/menu_delta_calibrate.cpp @@ -26,7 +26,7 @@ #include "../../inc/MarlinConfigPre.h" -#if HAS_LCD_MENU && (ENABLED(DELTA_CALIBRATION_MENU) || ENABLED(DELTA_AUTO_CALIBRATION)) +#if HAS_LCD_MENU && EITHER(DELTA_CALIBRATION_MENU, DELTA_AUTO_CALIBRATION) #include "menu.h" #include "../../module/delta.h" @@ -50,7 +50,7 @@ void _man_probe_pt(const float &rx, const float &ry) { 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); + ui.defer_status_screen(); wait_for_user = true; #if ENABLED(HOST_PROMPT_SUPPORT) host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Delta Calibration in progress"), PSTR("Continue")); diff --git a/Marlin/src/lcd/menu/menu_filament.cpp b/Marlin/src/lcd/menu/menu_filament.cpp index 80395cda63..2e84a25d54 100644 --- a/Marlin/src/lcd/menu/menu_filament.cpp +++ b/Marlin/src/lcd/menu/menu_filament.cpp @@ -34,19 +34,20 @@ #if HAS_FILAMENT_SENSOR #include "../../feature/runout.h" #endif + // // Change Filament > Change/Unload/Load Filament // -static AdvancedPauseMode _change_filament_temp_mode; // =ADVANCED_PAUSE_MODE_PAUSE_PRINT +static PauseMode _change_filament_temp_mode; // =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: + case PAUSE_MODE_LOAD_FILAMENT: return PSTR("M701 T%d"); - case ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT: + case PAUSE_MODE_UNLOAD_FILAMENT: return _change_filament_temp_extruder >= 0 ? PSTR("M702 T%d") : PSTR("M702 ;%d"); - case ADVANCED_PAUSE_MODE_PAUSE_PRINT: + case PAUSE_MODE_PAUSE_PRINT: default: return PSTR("M600 B0 T%d"); } @@ -61,20 +62,20 @@ static void _change_filament_temp(const uint16_t temperature) { } inline void _lcd_change_filament_temp_1_func() { _change_filament_temp(ui.preheat_hotend_temp[0]); } inline void _lcd_change_filament_temp_2_func() { _change_filament_temp(ui.preheat_hotend_temp[1]); } -inline void _lcd_change_filament_temp_custom_cb() { _change_filament_temp(thermalManager.target_temperature[_change_filament_temp_extruder]); } +inline void _lcd_change_filament_temp_custom_cb() { _change_filament_temp(thermalManager.temp_hotend[_change_filament_temp_extruder].target); } -static PGM_P change_filament_header(const AdvancedPauseMode mode) { +static PGM_P change_filament_header(const PauseMode mode) { switch (mode) { - case ADVANCED_PAUSE_MODE_LOAD_FILAMENT: + case PAUSE_MODE_LOAD_FILAMENT: return PSTR(MSG_FILAMENTLOAD); - case ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT: + case 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) { +void _menu_temp_filament_op(const PauseMode mode, const int8_t extruder) { _change_filament_temp_mode = mode; _change_filament_temp_extruder = extruder; START_MENU(); @@ -101,32 +102,32 @@ void _menu_temp_filament_op(const AdvancedPauseMode mode, const int8_t extruder) #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); + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_PREHEAT_CUSTOM, &thermalManager.temp_hotend[_change_filament_temp_extruder].target, EXTRUDE_MINTEMP, max_temp - 15, _lcd_change_filament_temp_custom_cb); END_MENU(); } #if E_STEPPERS - 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); } + void menu_temp_e0_filament_change() { _menu_temp_filament_op(PAUSE_MODE_PAUSE_PRINT, 0); } + void menu_temp_e0_filament_load() { _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 0); } + void menu_temp_e0_filament_unload() { _menu_temp_filament_op(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); } + void menu_temp_e1_filament_change() { _menu_temp_filament_op(PAUSE_MODE_PAUSE_PRINT, 1); } + void menu_temp_e1_filament_load() { _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 1); } + void menu_temp_e1_filament_unload() { _menu_temp_filament_op(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); } + void menu_unload_filament_all_temp() { _menu_temp_filament_op(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); } + void menu_temp_e2_filament_change() { _menu_temp_filament_op(PAUSE_MODE_PAUSE_PRINT, 2); } + void menu_temp_e2_filament_load() { _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 2); } + void menu_temp_e2_filament_unload() { _menu_temp_filament_op(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); } + void menu_temp_e3_filament_change() { _menu_temp_filament_op(PAUSE_MODE_PAUSE_PRINT, 3); } + void menu_temp_e3_filament_load() { _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 3); } + void menu_temp_e3_filament_unload() { _menu_temp_filament_op(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); } + void menu_temp_e4_filament_change() { _menu_temp_filament_op(PAUSE_MODE_PAUSE_PRINT, 4); } + void menu_temp_e4_filament_load() { _menu_temp_filament_op(PAUSE_MODE_LOAD_FILAMENT, 4); } + void menu_temp_e4_filament_unload() { _menu_temp_filament_op(PAUSE_MODE_UNLOAD_FILAMENT, 4); } #endif // E_STEPPERS > 4 #endif // E_STEPPERS > 3 #endif // E_STEPPERS > 2 @@ -310,14 +311,13 @@ void _menu_temp_filament_op(const AdvancedPauseMode mode, const int8_t extruder) } #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: +static PGM_P pause_header() { + switch (pause_mode) { + case PAUSE_MODE_LOAD_FILAMENT: return PSTR(MSG_FILAMENT_CHANGE_HEADER_LOAD); - case ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT: + case PAUSE_MODE_UNLOAD_FILAMENT: return PSTR(MSG_FILAMENT_CHANGE_HEADER_UNLOAD); default: break; } @@ -340,26 +340,26 @@ static PGM_P advanced_pause_header() { ++_thisItemNr; \ }while(0) -void lcd_advanced_pause_resume_print() { - advanced_pause_menu_response = ADVANCED_PAUSE_RESPONSE_RESUME_PRINT; +void lcd_pause_resume_print() { + pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT; } -void lcd_advanced_pause_extrude_more() { - advanced_pause_menu_response = ADVANCED_PAUSE_RESPONSE_EXTRUDE_MORE; +void lcd_pause_extrude_more() { + pause_menu_response = PAUSE_RESPONSE_EXTRUDE_MORE; } -void menu_advanced_pause_option() { +void menu_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_PURGE, lcd_advanced_pause_extrude_more); + MENU_ITEM(function, MSG_FILAMENT_CHANGE_OPTION_PURGE, lcd_pause_extrude_more); #if HAS_FILAMENT_SENSOR if (runout.filament_ran_out) MENU_ITEM_EDIT_CALLBACK(bool, MSG_RUNOUT_SENSOR, &runout.enabled, runout.reset); else #endif - MENU_ITEM(function, MSG_FILAMENT_CHANGE_OPTION_RESUME, lcd_advanced_pause_resume_print); + MENU_ITEM(function, MSG_FILAMENT_CHANGE_OPTION_RESUME, lcd_pause_resume_print); END_MENU(); } @@ -367,9 +367,9 @@ void menu_advanced_pause_option() { // ADVANCED_PAUSE_FEATURE message screens // -void _lcd_advanced_pause_message(PGM_P const msg1, PGM_P const msg2=NULL, PGM_P const msg3=NULL) { +void _lcd_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(pause_header(), true, true); STATIC_ITEM_P(msg1); if (msg2) STATIC_ITEM_P(msg2); if (msg3) STATIC_ITEM_P(msg3); @@ -378,8 +378,19 @@ void _lcd_advanced_pause_message(PGM_P const msg1, PGM_P const msg2=NULL, PGM_P END_SCREEN(); } -void lcd_advanced_pause_init_message() { - _lcd_advanced_pause_message(PSTR(MSG_FILAMENT_CHANGE_INIT_1) +void lcd_pause_pausing_message() { + _lcd_pause_message(PSTR(MSG_PAUSE_PRINT_INIT_1) + #ifdef MSG_PAUSE_PRINT_INIT_2 + , PSTR(MSG_PAUSE_PRINT_INIT_2) + #ifdef MSG_PAUSE_PRINT_INIT_3 + , PSTR(MSG_PAUSE_PRINT_INIT_3) + #endif + #endif + ); +} + +void lcd_pause_changing_message() { + _lcd_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 @@ -389,8 +400,8 @@ void lcd_advanced_pause_init_message() { ); } -void lcd_advanced_pause_unload_message() { - _lcd_advanced_pause_message(PSTR(MSG_FILAMENT_CHANGE_UNLOAD_1) +void lcd_pause_unload_message() { + _lcd_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 @@ -400,8 +411,8 @@ void lcd_advanced_pause_unload_message() { ); } -void lcd_advanced_pause_heating_message() { - _lcd_advanced_pause_message(PSTR(MSG_FILAMENT_CHANGE_HEATING_1) +void lcd_pause_heating_message() { + _lcd_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 @@ -411,8 +422,8 @@ void lcd_advanced_pause_heating_message() { ); } -void lcd_advanced_pause_heat_message() { - _lcd_advanced_pause_message(PSTR(MSG_FILAMENT_CHANGE_HEAT_1) +void lcd_pause_heat_message() { + _lcd_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 @@ -422,8 +433,8 @@ void lcd_advanced_pause_heat_message() { ); } -void lcd_advanced_pause_insert_message() { - _lcd_advanced_pause_message(PSTR(MSG_FILAMENT_CHANGE_INSERT_1) +void lcd_pause_insert_message() { + _lcd_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 @@ -433,8 +444,8 @@ void lcd_advanced_pause_insert_message() { ); } -void lcd_advanced_pause_load_message() { - _lcd_advanced_pause_message(PSTR(MSG_FILAMENT_CHANGE_LOAD_1) +void lcd_pause_load_message() { + _lcd_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 @@ -444,8 +455,8 @@ void lcd_advanced_pause_load_message() { ); } -void lcd_advanced_pause_waiting_message() { - _lcd_advanced_pause_message(PSTR(MSG_ADVANCED_PAUSE_WAITING_1) +void lcd_pause_waiting_message() { + _lcd_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 @@ -455,8 +466,8 @@ void lcd_advanced_pause_waiting_message() { ); } -void lcd_advanced_pause_resume_message() { - _lcd_advanced_pause_message(PSTR(MSG_FILAMENT_CHANGE_RESUME_1) +void lcd_pause_resume_message() { + _lcd_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 @@ -466,8 +477,8 @@ void lcd_advanced_pause_resume_message() { ); } -void lcd_advanced_pause_purge_message() { - _lcd_advanced_pause_message( +void lcd_pause_purge_message() { + _lcd_pause_message( #if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE) PSTR(MSG_FILAMENT_CHANGE_CONT_PURGE_1) #ifdef MSG_FILAMENT_CHANGE_CONT_PURGE_2 @@ -488,35 +499,36 @@ void lcd_advanced_pause_purge_message() { ); } -FORCE_INLINE screenFunc_t ap_message_screen(const AdvancedPauseMessage message) { +FORCE_INLINE screenFunc_t ap_message_screen(const PauseMessage 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: + case PAUSE_MESSAGE_PAUSING: return lcd_pause_pausing_message; + case PAUSE_MESSAGE_CHANGING: return lcd_pause_changing_message; + case PAUSE_MESSAGE_UNLOAD: return lcd_pause_unload_message; + case PAUSE_MESSAGE_WAITING: return lcd_pause_waiting_message; + case PAUSE_MESSAGE_INSERT: return lcd_pause_insert_message; + case PAUSE_MESSAGE_LOAD: return lcd_pause_load_message; + case PAUSE_MESSAGE_PURGE: return lcd_pause_purge_message; + case PAUSE_MESSAGE_RESUME: return lcd_pause_resume_message; + case PAUSE_MESSAGE_HEAT: return lcd_pause_heat_message; + case PAUSE_MESSAGE_HEATING: return lcd_pause_heating_message; + case PAUSE_MESSAGE_OPTION: pause_menu_response = PAUSE_RESPONSE_WAIT_FOR; + return menu_pause_option; + case PAUSE_MESSAGE_STATUS: default: break; } return NULL; } -void lcd_advanced_pause_show_message( - const AdvancedPauseMessage message, - const AdvancedPauseMode mode/*=ADVANCED_PAUSE_MODE_SAME*/, +void lcd_pause_show_message( + const PauseMessage message, + const PauseMode mode/*=PAUSE_MODE_SAME*/, const uint8_t extruder/*=active_extruder*/ ) { - if (mode != ADVANCED_PAUSE_MODE_SAME) advanced_pause_mode = mode; + if (mode != PAUSE_MODE_SAME) 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.defer_status_screen(); ui.goto_screen(next_screen); } else diff --git a/Marlin/src/lcd/menu/menu_game.cpp b/Marlin/src/lcd/menu/menu_game.cpp new file mode 100644 index 0000000000..9e0af2c7f0 --- /dev/null +++ b/Marlin/src/lcd/menu/menu_game.cpp @@ -0,0 +1,48 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "../../inc/MarlinConfigPre.h" + +#if HAS_GAME_MENU + +#include "menu.h" +#include "game/game.h" + +void menu_game() { + START_MENU(); + MENU_BACK(MSG_MAIN); + #if ENABLED(MARLIN_BRICKOUT) + MENU_ITEM(submenu, MSG_BRICKOUT, brickout.enter_game); + #endif + #if ENABLED(MARLIN_INVADERS) + MENU_ITEM(submenu, MSG_INVADERS, invaders.enter_game); + #endif + #if ENABLED(MARLIN_SNAKE) + MENU_ITEM(submenu, MSG_SNAKE, snake.enter_game); + #endif + #if ENABLED(MARLIN_MAZE) + MENU_ITEM(submenu, MSG_MAZE, maze.enter_game); + #endif + END_MENU(); +} + +#endif // HAS_GAME_MENU diff --git a/Marlin/src/lcd/menu/menu_info.cpp b/Marlin/src/lcd/menu/menu_info.cpp index f5a84b093b..eb58b3a56b 100644 --- a/Marlin/src/lcd/menu/menu_info.cpp +++ b/Marlin/src/lcd/menu/menu_info.cpp @@ -143,6 +143,15 @@ void menu_info_thermistors() { STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_4_MAXTEMP), false); #endif + #if TEMP_SENSOR_5 != 0 + #undef THERMISTOR_ID + #define THERMISTOR_ID TEMP_SENSOR_5 + #include "../thermistornames.h" + STATIC_ITEM("T5: " THERMISTOR_NAME, false, true); + STATIC_ITEM(MSG_INFO_MIN_TEMP ": " STRINGIFY(HEATER_5_MINTEMP), false); + STATIC_ITEM(MSG_INFO_MAX_TEMP ": " STRINGIFY(HEATER_5_MAXTEMP), false); + #endif + #if HAS_HEATED_BED #undef THERMISTOR_ID #define THERMISTOR_ID TEMP_SENSOR_BED diff --git a/Marlin/src/lcd/menu/menu_job_recovery.cpp b/Marlin/src/lcd/menu/menu_job_recovery.cpp index ab84d69920..6d584948c4 100644 --- a/Marlin/src/lcd/menu/menu_job_recovery.cpp +++ b/Marlin/src/lcd/menu/menu_job_recovery.cpp @@ -45,7 +45,7 @@ static void lcd_power_loss_recovery_cancel() { } void menu_job_recovery() { - ui.defer_status_screen(true); + ui.defer_status_screen(); START_MENU(); STATIC_ITEM(MSG_OUTAGE_RECOVERY); MENU_ITEM(function, MSG_RESUME_PRINT, lcd_power_loss_recovery_resume); diff --git a/Marlin/src/lcd/menu/menu_led.cpp b/Marlin/src/lcd/menu/menu_led.cpp index 4ba6a05e61..ef693ccc41 100644 --- a/Marlin/src/lcd/menu/menu_led.cpp +++ b/Marlin/src/lcd/menu/menu_led.cpp @@ -58,7 +58,7 @@ void menu_led_custom() { MENU_ITEM_EDIT_CALLBACK(uint8, MSG_INTENSITY_R, &leds.color.r, 0, 255, leds.update, true); MENU_ITEM_EDIT_CALLBACK(uint8, MSG_INTENSITY_G, &leds.color.g, 0, 255, leds.update, true); MENU_ITEM_EDIT_CALLBACK(uint8, MSG_INTENSITY_B, &leds.color.b, 0, 255, leds.update, true); - #if ENABLED(RGBW_LED) || ENABLED(NEOPIXEL_LED) + #if EITHER(RGBW_LED, NEOPIXEL_LED) MENU_ITEM_EDIT_CALLBACK(uint8, MSG_INTENSITY_W, &leds.color.w, 0, 255, leds.update, true); #if ENABLED(NEOPIXEL_LED) MENU_ITEM_EDIT_CALLBACK(uint8, MSG_LED_BRIGHTNESS, &leds.color.i, 0, 255, leds.update, true); diff --git a/Marlin/src/lcd/menu/menu_main.cpp b/Marlin/src/lcd/menu/menu_main.cpp index ddf6f07466..ad7dc241a5 100644 --- a/Marlin/src/lcd/menu/menu_main.cpp +++ b/Marlin/src/lcd/menu/menu_main.cpp @@ -46,56 +46,71 @@ #include "../../feature/host_actions.h" #endif -void lcd_pause() { - #if ENABLED(POWER_LOSS_RECOVERY) - if (recovery.enabled) recovery.save(true, false); - #endif +#if HAS_GAMES + #include "game/game.h" +#endif - #if ENABLED(HOST_PROMPT_SUPPORT) - host_prompt_open(PROMPT_PAUSE_RESUME, PSTR("UI Pause"), PSTR("Resume")); - #endif +#define MACHINE_CAN_STOP (EITHER(SDSUPPORT, HOST_PROMPT_SUPPORT) || defined(ACTION_ON_CANCEL)) +#define MACHINE_CAN_PAUSE (ANY(SDSUPPORT, HOST_PROMPT_SUPPORT, PARK_HEAD_ON_PAUSE) || defined(ACTION_ON_PAUSE)) - #if ENABLED(PARK_HEAD_ON_PAUSE) - lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INIT, ADVANCED_PAUSE_MODE_PAUSE_PRINT); // Show message immediately to let user know about pause in progress - enqueue_and_echo_commands_P(PSTR("M25 P\nM24")); - #elif ENABLED(SDSUPPORT) - enqueue_and_echo_commands_P(PSTR("M25")); - #elif defined(ACTION_ON_PAUSE) - host_action_pause(); - #endif - planner.synchronize(); -} +#if MACHINE_CAN_PAUSE -void lcd_resume() { - #if ENABLED(SDSUPPORT) - if (card.isPaused()) enqueue_and_echo_commands_P(PSTR("M24")); - #endif - #ifdef ACTION_ON_RESUME - host_action_resume(); - #endif -} + void lcd_pause_job() { + #if ENABLED(POWER_LOSS_RECOVERY) + if (recovery.enabled) recovery.save(true, false); + #endif -void lcd_stop() { - #if ENABLED(SDSUPPORT) - wait_for_heatup = wait_for_user = false; - card.flag.abort_sd_printing = true; - #endif - #ifdef ACTION_ON_CANCEL - host_action_cancel(); - #endif - #if ENABLED(HOST_PROMPT_SUPPORT) - host_prompt_open(PROMPT_INFO, PSTR("UI Abort")); - #endif - ui.set_status_P(PSTR(MSG_PRINT_ABORTED), -1); - ui.return_to_status(); -} + #if ENABLED(HOST_PROMPT_SUPPORT) + host_prompt_open(PROMPT_PAUSE_RESUME, PSTR("UI Pause"), PSTR("Resume")); + #endif -void menu_abort_confirm() { - START_MENU(); - MENU_BACK(MSG_MAIN); - MENU_ITEM(function, MSG_STOP_PRINT, lcd_stop); - END_MENU(); -} + #if ENABLED(PARK_HEAD_ON_PAUSE) + lcd_pause_show_message(PAUSE_MESSAGE_PAUSING, PAUSE_MODE_PAUSE_PRINT); // Show message immediately to let user know about pause in progress + enqueue_and_echo_commands_P(PSTR("M25 P\nM24")); + #elif ENABLED(SDSUPPORT) + enqueue_and_echo_commands_P(PSTR("M25")); + #elif defined(ACTION_ON_PAUSE) + host_action_pause(); + #endif + planner.synchronize(); + } + + void lcd_resume() { + #if ENABLED(SDSUPPORT) + if (card.isPaused()) enqueue_and_echo_commands_P(PSTR("M24")); + #endif + #ifdef ACTION_ON_RESUME + host_action_resume(); + #endif + } + +#endif // MACHINE_CAN_PAUSE + +#if MACHINE_CAN_STOP + + void lcd_abort_job() { + #if ENABLED(SDSUPPORT) + wait_for_heatup = wait_for_user = false; + card.flag.abort_sd_printing = true; + #endif + #ifdef ACTION_ON_CANCEL + host_action_cancel(); + #endif + #if ENABLED(HOST_PROMPT_SUPPORT) + host_prompt_open(PROMPT_INFO, PSTR("UI Abort")); + #endif + ui.set_status_P(PSTR(MSG_PRINT_ABORTED), -1); + ui.return_to_status(); + } + + void menu_abort_confirm() { + START_MENU(); + MENU_BACK(MSG_MAIN); + MENU_ITEM(function, MSG_STOP_PRINT, lcd_abort_job); + END_MENU(); + } + +#endif // MACHINE_CAN_STOP #if ENABLED(PRUSA_MMU2) #include "../../lcd/menu/menu_mmu2.h" @@ -139,8 +154,10 @@ void menu_main() { ; if (busy) { - MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_pause); - #if ENABLED(SDSUPPORT) || defined(ACTION_ON_CANCEL) + #if MACHINE_CAN_PAUSE + MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_pause_job); + #endif + #if MACHINE_CAN_STOP MENU_ITEM(submenu, MSG_STOP_PRINT, menu_abort_confirm); #endif MENU_ITEM(submenu, MSG_TUNE, menu_tune); @@ -170,11 +187,13 @@ void menu_main() { } #endif // !HAS_ENCODER_WHEEL && SDSUPPORT - #if ENABLED(SDSUPPORT) || ENABLED(HOST_ACTION_COMMANDS) - #if DISABLED(HOST_ACTION_COMMANDS) - if (card_open && card.isPaused()) - #endif - MENU_ITEM(function, MSG_RESUME_PRINT, lcd_resume); + #if MACHINE_CAN_PAUSE + const bool paused = (print_job_timer.isPaused() + #if ENABLED(SDSUPPORT) + || card.isPaused() + #endif + ); + if (paused) MENU_ITEM(function, MSG_RESUME_PRINT, lcd_resume); #endif MENU_ITEM(submenu, MSG_MOTION, menu_motion); @@ -261,6 +280,22 @@ void menu_main() { #endif #endif + #if ANY(MARLIN_BRICKOUT, MARLIN_INVADERS, MARLIN_SNAKE, MARLIN_MAZE) + MENU_ITEM(submenu, "Game", ( + #if HAS_GAME_MENU + menu_game + #elif ENABLED(MARLIN_BRICKOUT) + brickout.enter_game + #elif ENABLED(MARLIN_INVADERS) + invaders.enter_game + #elif ENABLED(MARLIN_SNAKE) + snake.enter_game + #elif ENABLED(MARLIN_MAZE) + maze.enter_game + #endif + )); + #endif + END_MENU(); } diff --git a/Marlin/src/lcd/menu/menu_mixer.cpp b/Marlin/src/lcd/menu/menu_mixer.cpp index dc935d63e8..a99052ec11 100644 --- a/Marlin/src/lcd/menu/menu_mixer.cpp +++ b/Marlin/src/lcd/menu/menu_mixer.cpp @@ -40,7 +40,7 @@ #if ENABLED(GRADIENT_MIX) void lcd_mixer_gradient_z_start_edit() { - ui.defer_status_screen(true); + ui.defer_status_screen(); ui.encoder_direction_normal(); ENCODER_RATE_MULTIPLY(true); if (ui.encoderPosition != 0) { @@ -65,7 +65,7 @@ } void lcd_mixer_gradient_z_end_edit() { - ui.defer_status_screen(true); + ui.defer_status_screen(); ui.encoder_direction_normal(); ENCODER_RATE_MULTIPLY(true); if (ui.encoderPosition != 0) { diff --git a/Marlin/src/lcd/menu/menu_mmu2.cpp b/Marlin/src/lcd/menu/menu_mmu2.cpp index 4b4b4aa890..cebf996900 100644 --- a/Marlin/src/lcd/menu/menu_mmu2.cpp +++ b/Marlin/src/lcd/menu/menu_mmu2.cpp @@ -183,7 +183,7 @@ inline void action_mmu2_M600_loadCurrentFilamentToNozzle() { mmu2.loadFilamentTo inline void action_mmu2_M600_unloadFilament() { mmu2.unload(); } inline void action_mmu2_M600_resume() { mmuMenuWait = false; } -void menu_mmu2_advanced_pause() { +void menu_mmu2_pause() { currentTool = mmu2.getCurrentTool(); START_MENU(); #if LCD_HEIGHT > 2 @@ -197,14 +197,14 @@ void menu_mmu2_advanced_pause() { } void mmu2_M600() { - ui.defer_status_screen(true); - ui.goto_screen(menu_mmu2_advanced_pause); + ui.defer_status_screen(); + ui.goto_screen(menu_mmu2_pause); mmuMenuWait = true; while (mmuMenuWait) idle(); } uint8_t mmu2_chooseFilament() { - ui.defer_status_screen(true); + ui.defer_status_screen(); ui.goto_screen(menu_mmu2_chooseFilament); mmuMenuWait = true; while (mmuMenuWait) idle(); diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index 58edf0dd33..46670ccced 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -86,26 +86,26 @@ static void _lcd_move_xyz(PGM_P name, AxisEnum axis) { if (soft_endstops_enabled) switch (axis) { case X_AXIS: #if ENABLED(MIN_SOFTWARE_ENDSTOP_X) - min = soft_endstop_min[X_AXIS]; + min = soft_endstop[X_AXIS].min; #endif #if ENABLED(MAX_SOFTWARE_ENDSTOP_X) - max = soft_endstop_max[X_AXIS]; + max = soft_endstop[X_AXIS].max; #endif break; case Y_AXIS: #if ENABLED(MIN_SOFTWARE_ENDSTOP_Y) - min = soft_endstop_min[Y_AXIS]; + min = soft_endstop[Y_AXIS].min; #endif #if ENABLED(MAX_SOFTWARE_ENDSTOP_Y) - max = soft_endstop_max[Y_AXIS]; + max = soft_endstop[Y_AXIS].max; #endif break; case Z_AXIS: #if ENABLED(MIN_SOFTWARE_ENDSTOP_Z) - min = soft_endstop_min[Z_AXIS]; + min = soft_endstop[Z_AXIS].min; #endif #if ENABLED(MAX_SOFTWARE_ENDSTOP_Z) - max = soft_endstop_max[Z_AXIS]; + max = soft_endstop[Z_AXIS].max; #endif default: break; } @@ -235,7 +235,7 @@ inline void lcd_move_e() { _lcd_move_e(); } screenFunc_t _manual_move_func_ptr; void _goto_manual_move(const float scale) { - ui.defer_status_screen(true); + ui.defer_status_screen(); move_menu_scale = scale; ui.goto_screen(_manual_move_func_ptr); } @@ -335,7 +335,7 @@ void menu_move() { else MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28")); - #if ENABLED(SWITCHING_EXTRUDER) || ENABLED(SWITCHING_NOZZLE) + #if EITHER(SWITCHING_EXTRUDER, SWITCHING_NOZZLE) #if EXTRUDERS == 6 switch (active_extruder) { @@ -376,7 +376,7 @@ void menu_move() { #endif - #if ENABLED(SWITCHING_EXTRUDER) || ENABLED(SWITCHING_NOZZLE) + #if EITHER(SWITCHING_EXTRUDER, SWITCHING_NOZZLE) // Only the current... MENU_ITEM(submenu, MSG_MOVE_E, lcd_move_get_e_amount); diff --git a/Marlin/src/lcd/menu/menu_sdcard.cpp b/Marlin/src/lcd/menu/menu_sdcard.cpp index 630d2631b0..42ffc452a3 100644 --- a/Marlin/src/lcd/menu/menu_sdcard.cpp +++ b/Marlin/src/lcd/menu/menu_sdcard.cpp @@ -64,7 +64,7 @@ void lcd_sd_updir() { goto_screen(menu_sdcard, last_sdfile_encoderPosition); last_sdfile_encoderPosition = 0xFFFF; - defer_status_screen(true); + defer_status_screen(); //#if HAS_GRAPHICAL_LCD // update(); diff --git a/Marlin/src/lcd/menu/menu_temperature.cpp b/Marlin/src/lcd/menu/menu_temperature.cpp index 79ad3f0d61..012c0d574e 100644 --- a/Marlin/src/lcd/menu/menu_temperature.cpp +++ b/Marlin/src/lcd/menu/menu_temperature.cpp @@ -353,9 +353,9 @@ void menu_temperature() { // 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); + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE, &thermalManager.temp_hotend[0].target, 0, HEATER_0_MAXTEMP - 15, thermalManager.start_watching_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) + #define EDIT_TARGET(N) MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_LCD_N##N, &thermalManager.temp_hotend[N].target, 0, HEATER_##N##_MAXTEMP - 15, thermalManager.start_watching_E##N) EDIT_TARGET(0); EDIT_TARGET(1); #if HOTENDS > 2 @@ -380,7 +380,14 @@ void menu_temperature() { // 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); + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_BED, &thermalManager.temp_bed.target, 0, BED_MAXTEMP - 10, thermalManager.start_watching_bed); + #endif + + // + // Chamber: + // + #if HAS_HEATED_CHAMBER + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_CHAMBER, &thermalManager.temp_chamber.target, 0, CHAMBER_MAXTEMP - 5, thermalManager.start_watching_chamber); #endif // @@ -388,21 +395,21 @@ void menu_temperature() { // #if FAN_COUNT > 0 #if HAS_FAN0 - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(uint8, MSG_FAN_SPEED FAN_SPEED_1_SUFFIX, &thermalManager.lcd_tmpfan_speed[0], 0, 255, thermalManager.lcd_setFanSpeed0); + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(percent, MSG_FAN_SPEED FAN_SPEED_1_SUFFIX, &thermalManager.lcd_tmpfan_speed[0], 0, 255, thermalManager.lcd_setFanSpeed0); #if ENABLED(EXTRA_FAN_SPEED) - MENU_MULTIPLIER_ITEM_EDIT(uint8, MSG_EXTRA_FAN_SPEED FAN_SPEED_1_SUFFIX, &thermalManager.new_fan_speed[0], 3, 255); + MENU_MULTIPLIER_ITEM_EDIT(percent, MSG_EXTRA_FAN_SPEED FAN_SPEED_1_SUFFIX, &thermalManager.new_fan_speed[0], 3, 255); #endif #endif #if HAS_FAN1 || (ENABLED(SINGLENOZZLE) && EXTRUDERS > 1) - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(uint8, MSG_FAN_SPEED " 2", &thermalManager.lcd_tmpfan_speed[1], 0, 255, thermalManager.lcd_setFanSpeed1); + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(percent, MSG_FAN_SPEED " 2", &thermalManager.lcd_tmpfan_speed[1], 0, 255, thermalManager.lcd_setFanSpeed1); #if ENABLED(EXTRA_FAN_SPEED) - MENU_MULTIPLIER_ITEM_EDIT(uint8, MSG_EXTRA_FAN_SPEED " 2", &thermalManager.new_fan_speed[1], 3, 255); + MENU_MULTIPLIER_ITEM_EDIT(percent, MSG_EXTRA_FAN_SPEED " 2", &thermalManager.new_fan_speed[1], 3, 255); #endif #endif #if HAS_FAN2 || (ENABLED(SINGLENOZZLE) && EXTRUDERS > 2) - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(uint8, MSG_FAN_SPEED " 3", &thermalManager.lcd_tmpfan_speed[2], 0, 255, thermalManager.lcd_setFanSpeed2); + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(percent, MSG_FAN_SPEED " 3", &thermalManager.lcd_tmpfan_speed[2], 0, 255, thermalManager.lcd_setFanSpeed2); #if ENABLED(EXTRA_FAN_SPEED) - MENU_MULTIPLIER_ITEM_EDIT(uint8, MSG_EXTRA_FAN_SPEED " 3", &thermalManager.new_fan_speed[2], 3, 255); + MENU_MULTIPLIER_ITEM_EDIT(percent, MSG_EXTRA_FAN_SPEED " 3", &thermalManager.new_fan_speed[2], 3, 255); #endif #endif #endif // FAN_COUNT > 0 @@ -413,16 +420,16 @@ void menu_temperature() { // Cooldown // bool has_heat = false; - HOTEND_LOOP() if (thermalManager.target_temperature[HOTEND_INDEX]) { has_heat = true; break; } + HOTEND_LOOP() if (thermalManager.temp_hotend[HOTEND_INDEX].target) { has_heat = true; break; } #if HAS_TEMP_BED - if (thermalManager.target_temperature_bed) has_heat = true; + if (thermalManager.temp_bed.target) 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 + #if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_4 != 0 || TEMP_SENSOR_5 != 0 || HAS_HEATED_BED MENU_ITEM(submenu, MSG_PREHEAT_1, menu_preheat_m1); MENU_ITEM(submenu, MSG_PREHEAT_2, menu_preheat_m2); #else diff --git a/Marlin/src/lcd/menu/menu_tune.cpp b/Marlin/src/lcd/menu/menu_tune.cpp index e24d239c49..17d6634437 100644 --- a/Marlin/src/lcd/menu/menu_tune.cpp +++ b/Marlin/src/lcd/menu/menu_tune.cpp @@ -65,32 +65,60 @@ #if ENABLED(BABYSTEPPING) - long babysteps_done = 0; + #include "../../feature/babystep.h" + #include "../lcdprint.h" + #if HAS_GRAPHICAL_LCD + #include "../dogm/ultralcd_DOGM.h" + #endif - void _lcd_babystep(const AxisEnum axis, PGM_P msg) { + void _lcd_babystep(const AxisEnum axis, PGM_P const msg) { if (ui.use_click()) return ui.goto_previous_screen_no_defer(); ui.encoder_direction_normal(); if (ui.encoderPosition) { - const int16_t babystep_increment = (int32_t)ui.encoderPosition * (BABYSTEP_MULTIPLICATOR); + const int16_t steps = (int32_t)ui.encoderPosition * (BABYSTEP_MULTIPLICATOR); ui.encoderPosition = 0; ui.refresh(LCDVIEW_REDRAW_NOW); - thermalManager.babystep_axis(axis, babystep_increment); - babysteps_done += babystep_increment; + babystep.add_steps(axis, steps); } - if (ui.should_draw()) - draw_edit_screen(msg, ftostr43sign(planner.steps_to_mm[axis] * babysteps_done)); + if (ui.should_draw()) { + const float spm = planner.steps_to_mm[axis]; + draw_edit_screen(msg, ftostr54sign(spm * babystep.accum)); + #if ENABLED(BABYSTEP_DISPLAY_TOTAL) + const bool in_view = (true + #if HAS_GRAPHICAL_LCD + && PAGE_CONTAINS(LCD_PIXEL_HEIGHT - MENU_FONT_HEIGHT, LCD_PIXEL_HEIGHT - 1) + #endif + ); + if (in_view) { + #if HAS_GRAPHICAL_LCD + ui.set_font(FONT_MENU); + lcd_moveto(0, LCD_PIXEL_HEIGHT - MENU_FONT_DESCENT); + #else + lcd_moveto(0, LCD_HEIGHT - 1); + #endif + lcd_put_u8str_P(PSTR(MSG_BABYSTEP_TOTAL ":")); + lcd_put_u8str(ftostr54sign(spm * babystep.axis_total[BS_TOTAL_AXIS(axis)])); + } + #endif + } + } + + inline void _lcd_babystep_go(const screenFunc_t screen) { + ui.goto_screen(screen); + ui.defer_status_screen(); + babystep.accum = 0; } #if ENABLED(BABYSTEP_XY) void _lcd_babystep_x() { _lcd_babystep(X_AXIS, PSTR(MSG_BABYSTEP_X)); } void _lcd_babystep_y() { _lcd_babystep(Y_AXIS, PSTR(MSG_BABYSTEP_Y)); } - void lcd_babystep_x() { ui.goto_screen(_lcd_babystep_x); babysteps_done = 0; ui.defer_status_screen(true); } - void lcd_babystep_y() { ui.goto_screen(_lcd_babystep_y); babysteps_done = 0; ui.defer_status_screen(true); } + void lcd_babystep_x() { _lcd_babystep_go(_lcd_babystep_x); } + void lcd_babystep_y() { _lcd_babystep_go(_lcd_babystep_y); } #endif #if DISABLED(BABYSTEP_ZPROBE_OFFSET) void _lcd_babystep_z() { _lcd_babystep(Z_AXIS, PSTR(MSG_BABYSTEP_Z)); } - void lcd_babystep_z() { ui.goto_screen(_lcd_babystep_z); babysteps_done = 0; ui.defer_status_screen(true); } + void lcd_babystep_z() { _lcd_babystep_go(_lcd_babystep_z); } #endif #endif // BABYSTEPPING @@ -107,7 +135,7 @@ void menu_tune() { // // Manual bed leveling, Bed Z: // - #if ENABLED(MESH_BED_LEVELING) && ENABLED(LCD_BED_LEVELING) + #if BOTH(MESH_BED_LEVELING, LCD_BED_LEVELING) MENU_ITEM_EDIT(float43, MSG_BED_Z, &mbl.z_offset, -1, 1); #endif @@ -116,9 +144,9 @@ void menu_tune() { // 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); + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE, &thermalManager.temp_hotend[0].target, 0, HEATER_0_MAXTEMP - 15, thermalManager.start_watching_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) + #define EDIT_NOZZLE(N) MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_NOZZLE MSG_LCD_N##N, &thermalManager.temp_hotend[N].target, 0, HEATER_##N##_MAXTEMP - 15, thermalManager.start_watching_E##N) EDIT_NOZZLE(0); EDIT_NOZZLE(1); #if HOTENDS > 2 @@ -143,7 +171,7 @@ void menu_tune() { // 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); + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_BED, &thermalManager.temp_bed.target, 0, BED_MAXTEMP - 10, thermalManager.start_watching_bed); #endif // diff --git a/Marlin/src/lcd/menu/menu_ubl.cpp b/Marlin/src/lcd/menu/menu_ubl.cpp index 51a8a1948c..a7fa3cf641 100644 --- a/Marlin/src/lcd/menu/menu_ubl.cpp +++ b/Marlin/src/lcd/menu/menu_ubl.cpp @@ -51,7 +51,7 @@ float mesh_edit_value, mesh_edit_accumulator; // We round mesh_edit_value to 2.5 static int16_t ubl_encoderPosition = 0; static void _lcd_mesh_fine_tune(PGM_P msg) { - ui.defer_status_screen(true); + ui.defer_status_screen(); if (ubl.encoder_diff) { ubl_encoderPosition = (ubl.encoder_diff > 0) ? 1 : -1; ubl.encoder_diff = 0; @@ -74,7 +74,7 @@ static void _lcd_mesh_fine_tune(PGM_P msg) { } void _lcd_mesh_edit_NOP() { - ui.defer_status_screen(true); + ui.defer_status_screen(); } float lcd_mesh_edit() { @@ -131,7 +131,7 @@ void _lcd_ubl_custom_mesh() { 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)); + MENU_ITEM_EDIT(int3, MSG_UBL_BED_TEMP_CUSTOM, &custom_bed_temp, BED_MINTEMP, (BED_MAXTEMP - 10)); #endif MENU_ITEM(function, MSG_UBL_BUILD_CUSTOM_MESH, _lcd_ubl_build_custom_mesh); END_MENU(); @@ -408,7 +408,7 @@ void _lcd_ubl_storage_mesh() { void _lcd_ubl_output_map_lcd(); void _lcd_ubl_map_homing() { - ui.defer_status_screen(true); + ui.defer_status_screen(); _lcd_draw_homing(); if (all_axes_homed()) { ubl.lcd_map_control = true; // Return to the map screen @@ -431,9 +431,21 @@ void _lcd_ubl_map_lcd_edit_cmd() { * 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); + REMEMBER(fr, feedrate_mm_s, MMM_TO_MMS(XY_PROBE_SPEED)); + + set_destination_from_current(); // sync destination at the start + + #if ENABLED(DELTA) + if (current_position[Z_AXIS] > delta_clip_start_height) { + destination[Z_AXIS] = delta_clip_start_height; + prepare_move_to_destination(); + } + #endif + + destination[X_AXIS] = pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]); + destination[Y_AXIS] = pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]); + + prepare_move_to_destination(); } /** @@ -461,22 +473,33 @@ void _lcd_ubl_output_map_lcd() { 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; + #if IS_KINEMATIC + #define KEEP_LOOPING true // Loop until a valid point is found + #else + #define KEEP_LOOPING false + #endif - // 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; + do { + // 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; - // 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); + // Encoder to the left (--) + if (x_plot < 0) { x_plot = GRID_MAX_POINTS_X - 1; y_plot--; } + if (y_plot < 0) y_plot = GRID_MAX_POINTS_Y - 1; + + #if IS_KINEMATIC + const float x = pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]), + y = pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]); + if (position_is_reachable(x, y)) break; // Found a valid point + x_plot += (step_scaler < 0) ? -1 : 1; + #endif + + } while(KEEP_LOOPING); // Determine number of points to edit #if IS_KINEMATIC @@ -487,6 +510,9 @@ void _lcd_ubl_output_map_lcd() { n_edit_pts = yc ? (xc ? 9 : 6) : (xc ? 6 : 4); // Corners #endif + // Cleanup + if (ABS(step_scaler) >= ENCODER_STEPS_PER_MENU_ITEM) step_scaler = 0; + if (ui.should_draw()) { ui.ubl_plot(x_plot, y_plot); diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index 6995fa57d3..07a3910cd0 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -23,7 +23,7 @@ #include "../inc/MarlinConfigPre.h" // These displays all share the MarlinUI class -#if HAS_SPI_LCD || ENABLED(MALYAN_LCD) || ENABLED(EXTENSIBLE_UI) +#if HAS_SPI_LCD || EITHER(MALYAN_LCD, EXTENSIBLE_UI) #include "ultralcd.h" MarlinUI ui; #include "../sd/cardreader.h" @@ -106,7 +106,7 @@ uint8_t MarlinUI::lcd_status_update_delay = 1; // First update one loop delayed -#if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) +#if BOTH(FILAMENT_LCD_DISPLAY, SDSUPPORT) millis_t MarlinUI::next_filament_display; // = 0 #endif @@ -181,7 +181,7 @@ millis_t next_button_update_ms; return click; } - #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION) + #if EITHER(AUTO_BED_LEVELING_UBL, G26_MESH_VALIDATION) bool MarlinUI::external_control; // = false @@ -397,20 +397,6 @@ bool MarlinUI::get_blink() { #endif #endif -#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 @@ -463,7 +449,7 @@ void MarlinUI::status_screen() { #if HAS_LCD_MENU if (use_click()) { - #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) + #if BOTH(FILAMENT_LCD_DISPLAY, SDSUPPORT) next_filament_display = millis() + 5000UL; // Show status message for 5s #endif goto_screen(menu_main); @@ -652,7 +638,7 @@ 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) + #if EITHER(LCD_I2C_TYPE_MCP23017, LCD_I2C_TYPE_MCP23008) && defined(DETECT_DEVICE) lcd.LcdDetected() == 1 #else true @@ -823,10 +809,13 @@ void MarlinUI::update() { #if HAS_LCD_MENU && ENABLED(SCROLL_LONG_FILENAMES) // If scrolling of long file names is enabled and we are in the sd card menu, // cause a refresh to occur until all the text has scrolled into view. - if (currentScreen == menu_sdcard && filename_scroll_pos < filename_scroll_max && !lcd_status_update_delay--) { - lcd_status_update_delay = 6; + if (currentScreen == menu_sdcard && !lcd_status_update_delay--) { + lcd_status_update_delay = 4; + if (++filename_scroll_pos > filename_scroll_max) { + filename_scroll_pos = 0; + lcd_status_update_delay = 12; + } refresh(LCDVIEW_REDRAW_NOW); - filename_scroll_pos++; #if LCD_TIMEOUT_TO_STATUS return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS; #endif @@ -1022,7 +1011,7 @@ void MarlinUI::update() { #if HAS_DIGITAL_BUTTONS - #if BUTTON_EXISTS(EN1) || BUTTON_EXISTS(EN2) || BUTTON_EXISTS(ENC) || BUTTON_EXISTS(BACK) + #if ANY_BUTTON(EN1, EN2, ENC, BACK) uint8_t newbutton = 0; @@ -1048,7 +1037,7 @@ void MarlinUI::update() { // // Directional buttons // - #if BUTTON_EXISTS(UP) || BUTTON_EXISTS(DWN) || BUTTON_EXISTS(LFT) || BUTTON_EXISTS(RT) + #if ANY_BUTTON(UP, DWN, LFT, RT) const int8_t pulses = (ENCODER_PULSES_PER_STEP) * encoderDirection; @@ -1087,15 +1076,15 @@ void MarlinUI::update() { | slow_buttons #endif ; - #elif HAS_ADC_BUTTONS - buttons = 0; + #endif + + #if HAS_ADC_BUTTONS 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 @@ -1176,7 +1165,22 @@ void MarlinUI::update() { /////////////// Status Line //////////////// //////////////////////////////////////////// - void MarlinUI::finishstatus(const bool persist) { + #if ENABLED(STATUS_MESSAGE_SCROLLING) + void MarlinUI::advance_status_scroll() { + // Advance by one UTF8 code-word + if (status_scroll_offset < utf8_strlen(status_message)) + while (!START_OF_UTF8_CHAR(status_message[++status_scroll_offset])); + else + status_scroll_offset = 0; + } + char* MarlinUI::status_and_len(uint8_t &len) { + char *out = status_message + status_scroll_offset; + len = utf8_strlen(out); + return out; + } + #endif + + void MarlinUI::finish_status(const bool persist) { #if !(ENABLED(LCD_PROGRESS_BAR) && (PROGRESS_MSG_EXPIRE > 0)) UNUSED(persist); @@ -1189,11 +1193,11 @@ void MarlinUI::update() { #endif #endif - #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) + #if BOTH(FILAMENT_LCD_DISPLAY, SDSUPPORT) next_filament_display = millis() + 5000UL; // Show status message for 5s #endif - #if ENABLED(STATUS_MESSAGE_SCROLLING) + #if HAS_SPI_LCD && ENABLED(STATUS_MESSAGE_SCROLLING) status_scroll_offset = 0; #endif @@ -1228,7 +1232,7 @@ void MarlinUI::update() { strncpy(status_message, message, maxLen); status_message[maxLen] = '\0'; - finishstatus(persist); + finish_status(persist); } #include @@ -1240,7 +1244,7 @@ void MarlinUI::update() { va_start(args, fmt); vsnprintf_P(status_message, MAX_MESSAGE_LENGTH, fmt, args); va_end(args); - finishstatus(level > 0); + finish_status(level > 0); } void MarlinUI::set_status_P(PGM_P const message, int8_t level) { @@ -1267,7 +1271,7 @@ void MarlinUI::update() { strncpy_P(status_message, message, maxLen); status_message[maxLen] = '\0'; - finishstatus(level > 0); + finish_status(level > 0); } void MarlinUI::set_alert_status_P(PGM_P const message) { @@ -1321,4 +1325,18 @@ void MarlinUI::update() { set_status_P(msg, -1); } + #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 + #endif // HAS_SPI_LCD || EXTENSIBLE_UI diff --git a/Marlin/src/lcd/ultralcd.h b/Marlin/src/lcd/ultralcd.h index b50272ae9e..190e35fd43 100644 --- a/Marlin/src/lcd/ultralcd.h +++ b/Marlin/src/lcd/ultralcd.h @@ -27,8 +27,14 @@ #include "../libs/buzzer.h" #endif +#define HAS_DIGITAL_BUTTONS (!HAS_ADC_BUTTONS && ENABLED(NEWPANEL) || BUTTON_EXISTS(EN1, EN2) || ANY_BUTTON(ENC, BACK, UP, DWN, LFT, RT)) +#define HAS_SHIFT_ENCODER (!HAS_ADC_BUTTONS && (ENABLED(REPRAPWORLD_KEYPAD) || (HAS_SPI_LCD && DISABLED(NEWPANEL)))) +#define HAS_ENCODER_WHEEL ((!HAS_ADC_BUTTONS && ENABLED(NEWPANEL)) || BUTTON_EXISTS(EN1, EN2)) #define HAS_ENCODER_ACTION (HAS_LCD_MENU || ENABLED(ULTIPANEL_FEEDMULTIPLY)) +// I2C buttons must be read in the main thread +#define HAS_SLOW_BUTTONS EITHER(LCD_I2C_VIKI, LCD_I2C_PANELOLU2) + #if HAS_SPI_LCD #include "../Marlin.h" @@ -52,12 +58,12 @@ #if HAS_GRAPHICAL_LCD #define SETCURSOR(col, row) lcd_moveto(col * (MENU_FONT_WIDTH), (row + 1) * (MENU_FONT_HEIGHT)) - #define SETCURSOR_RJ(len, row) lcd_moveto(LCD_PIXEL_WIDTH - len * (MENU_FONT_WIDTH), (row + 1) * (MENU_FONT_HEIGHT)) + #define SETCURSOR_RJ(len, row) lcd_moveto(LCD_PIXEL_WIDTH - (len) * (MENU_FONT_WIDTH), (row + 1) * (MENU_FONT_HEIGHT)) #define LCDPRINT(p) u8g.print(p) #define LCDWRITE(c) u8g.print(c) #else #define SETCURSOR(col, row) lcd_moveto(col, row) - #define SETCURSOR_RJ(len, row) lcd_moveto(LCD_WIDTH - len, row) + #define SETCURSOR_RJ(len, row) lcd_moveto(LCD_WIDTH - (len), row) #define LCDPRINT(p) lcd_put_u8str(p) #define LCDWRITE(c) lcd_put_wchar(c) #endif @@ -78,8 +84,8 @@ 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_SAME, + void lcd_pause_show_message(const PauseMessage message, + const PauseMode mode=PAUSE_MODE_SAME, const uint8_t extruder=active_extruder); #endif @@ -133,7 +139,6 @@ #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) @@ -177,7 +182,8 @@ #else - #define BUTTON_EXISTS(BN) false + #undef BUTTON_EXISTS + #define BUTTON_EXISTS(...) false // Shift register bits correspond to buttons: #define BL_LE 7 // Left @@ -256,7 +262,7 @@ public: static void clear_lcd(); static void init_lcd(); - #if HAS_SPI_LCD || ENABLED(MALYAN_LCD) || ENABLED(EXTENSIBLE_UI) + #if HAS_SPI_LCD || EITHER(MALYAN_LCD, EXTENSIBLE_UI) static void init(); static void update(); static void set_alert_status_P(PGM_P message); @@ -271,10 +277,15 @@ public: 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 ENABLED(STATUS_MESSAGE_SCROLLING) + static uint8_t status_scroll_offset; + static void advance_status_scroll(); + static char* status_and_len(uint8_t &len); + #endif + #if HAS_PRINT_PROGRESS #if ENABLED(LCD_SET_PROGRESS_MANUALLY) static uint8_t progress_bar_percent; @@ -321,9 +332,6 @@ public: #endif - #if ENABLED(STATUS_MESSAGE_SCROLLING) - static uint8_t status_scroll_offset; - #endif static uint8_t lcd_status_update_delay; #if HAS_LCD_CONTRAST @@ -332,7 +340,7 @@ public: static inline void refresh_contrast() { set_contrast(contrast); } #endif - #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) + #if BOTH(FILAMENT_LCD_DISPLAY, SDSUPPORT) static millis_t next_filament_display; #endif @@ -411,7 +419,7 @@ public: static void synchronize(PGM_P const msg=NULL); static screenFunc_t currentScreen; - static void goto_screen(const screenFunc_t screen, const uint32_t encoder=0); + static void goto_screen(const screenFunc_t screen, const uint32_t encoder=0, const uint8_t top=0, const uint8_t items=0); static void save_previous_screen(); static void goto_previous_screen(); static void return_to_status(); @@ -422,7 +430,7 @@ public: static void lcd_in_status(const bool inStatus); #endif - static inline void defer_status_screen(const bool defer) { + static inline void defer_status_screen(const bool defer=true) { #if LCD_TIMEOUT_TO_STATUS defer_return_to_status = defer; #else @@ -455,13 +463,13 @@ public: #endif - #if ENABLED(LCD_BED_LEVELING) && (ENABLED(PROBE_MANUALLY) || ENABLED(MESH_BED_LEVELING)) + #if ENABLED(LCD_BED_LEVELING) && EITHER(PROBE_MANUALLY, 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)) + #if HAS_LCD_MENU && EITHER(AUTO_BED_LEVELING_UBL, G26_MESH_VALIDATION) static bool external_control; FORCE_INLINE static void capture() { external_control = true; } FORCE_INLINE static void release() { external_control = false; } @@ -482,7 +490,7 @@ public: #endif static void update_buttons(); static inline bool button_pressed() { return BUTTON_CLICK(); } - #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION) + #if EITHER(AUTO_BED_LEVELING_UBL, G26_MESH_VALIDATION) static void wait_for_release(); #endif @@ -514,7 +522,7 @@ private: static void _synchronize(); #if HAS_SPI_LCD || ENABLED(EXTENSIBLE_UI) - static void finishstatus(const bool persist); + static void finish_status(const bool persist); #endif #if HAS_SPI_LCD diff --git a/Marlin/src/libs/L6470/L6470_Marlin.cpp b/Marlin/src/libs/L6470/L6470_Marlin.cpp index 927063564b..9e1fd2ca69 100644 --- a/Marlin/src/libs/L6470/L6470_Marlin.cpp +++ b/Marlin/src/libs/L6470/L6470_Marlin.cpp @@ -36,6 +36,9 @@ L6470_Marlin L6470; #include "../../gcode/gcode.h" #include "../planner.h" +#define DEBUG_OUT ENABLED(L6470_CHITCHAT) +#include "../../core/debug_out.h" + uint8_t L6470_Marlin::dir_commands[MAX_L6470]; // array to hold direction command for each driver char L6470_Marlin::index_to_axis[MAX_L6470][3] = { "X ", "Y ", "Z ", "X2", "Y2", "Z2", "Z3", "E0", "E1", "E2", "E3", "E4", "E5" }; @@ -286,16 +289,16 @@ void L6470_Marlin::set_param(uint8_t axis, uint8_t param, uint32_t value) { } inline void echo_min_max(const char a, const float &min, const float &max) { - L6470_CHAR(' '); L6470_CHAR(a); - L6470_ECHOPAIR(" min = ", min); - L6470_ECHOLNPAIR(" max = ", max); + DEBUG_CHAR(' '); DEBUG_CHAR(a); + DEBUG_ECHOPAIR(" min = ", min); + DEBUG_ECHOLNPAIR(" max = ", max); } inline void echo_oct_used(const float &oct, const bool stall) { - L6470_ECHOPAIR("over_current_threshold used : ", oct); + DEBUG_ECHOPAIR("over_current_threshold used : ", oct); serialprintPGM(stall ? PSTR(" (Stall") : PSTR(" (OCD")); - L6470_ECHOLNPGM(" threshold)"); + DEBUG_ECHOLNPGM(" threshold)"); } -inline void err_out_of_bounds() { L6470_ECHOLNPGM("ERROR - motion out of bounds"); } +inline void err_out_of_bounds() { DEBUG_ECHOLNPGM("ERROR - motion out of bounds"); } bool L6470_Marlin::get_user_input(uint8_t &driver_count, uint8_t axis_index[3], char axis_mon[3][3], float &position_max, float &position_min, float &final_feedrate, uint8_t &kval_hold, @@ -307,7 +310,7 @@ bool L6470_Marlin::get_user_input(uint8_t &driver_count, uint8_t axis_index[3], uint8_t j; // general purpose counter if (!all_axes_homed()) { - L6470_ECHOLNPGM("ERROR - home all before running this command"); + DEBUG_ECHOLNPGM("ERROR - home all before running this command"); //return true; } @@ -424,12 +427,12 @@ bool L6470_Marlin::get_user_input(uint8_t &driver_count, uint8_t axis_index[3], } if (driver_count == 0) { - L6470_ECHOLNPGM("ERROR - not a L6470 axis"); + DEBUG_ECHOLNPGM("ERROR - not a L6470 axis"); return true; } - L6470_ECHOPGM("Monitoring:"); - for (j = 0; j < driver_count; j++) L6470_ECHOPAIR(" ", axis_mon[j]); + DEBUG_ECHOPGM("Monitoring:"); + for (j = 0; j < driver_count; j++) DEBUG_ECHOPAIR(" ", axis_mon[j]); L6470_EOL(); // now have a list of driver(s) to monitor @@ -440,14 +443,14 @@ bool L6470_Marlin::get_user_input(uint8_t &driver_count, uint8_t axis_index[3], kval_hold = parser.byteval('K'); if (kval_hold) { - L6470_ECHOLNPAIR("kval_hold = ", kval_hold); + DEBUG_ECHOLNPAIR("kval_hold = ", kval_hold); for (j = 0; j < driver_count; j++) set_param(axis_index[j], L6470_KVAL_HOLD, kval_hold); } else { // only print the KVAL_HOLD from one of the drivers kval_hold = get_param(axis_index[0], L6470_KVAL_HOLD); - L6470_ECHOLNPAIR("KVAL_HOLD = ", kval_hold); + DEBUG_ECHOLNPAIR("KVAL_HOLD = ", kval_hold); } // @@ -474,7 +477,7 @@ bool L6470_Marlin::get_user_input(uint8_t &driver_count, uint8_t axis_index[3], OCD_TH_actual = (OCD_TH_val_local + 1) * 375; } - L6470_ECHOLNPAIR("over_current_threshold specified: ", over_current_threshold); + DEBUG_ECHOLNPAIR("over_current_threshold specified: ", over_current_threshold); echo_oct_used(STALL_TH_actual, true); echo_oct_used(OCD_TH_actual, false); @@ -547,13 +550,13 @@ void L6470_Marlin::error_status_decode(const uint16_t status, const uint8_t axis char temp_buf[10]; say_axis(axis); sprintf_P(temp_buf, PSTR(" %4x "), status); - L6470_ECHO(temp_buf); + DEBUG_ECHO(temp_buf); print_bin(status); - L6470_ECHOPGM(" THERMAL: "); + DEBUG_ECHOPGM(" THERMAL: "); serialprintPGM((status & STATUS_TH_SD) ? PSTR("SHUTDOWN") : (status & STATUS_TH_WRN) ? PSTR("WARNING ") : PSTR("OK ")); - L6470_ECHOPGM(" OVERCURRENT: "); + DEBUG_ECHOPGM(" OVERCURRENT: "); echo_yes_no(status & STATUS_OCD); - L6470_ECHOPGM(" STALL: "); + DEBUG_ECHOPGM(" STALL: "); echo_yes_no(status & (STATUS_STEP_LOSS_A | STATUS_STEP_LOSS_B)); L6470_EOL(); #else @@ -642,14 +645,14 @@ void L6470_Marlin::error_status_decode(const uint16_t status, const uint8_t axis if (driver_L6470_data[j].com_counter == 0) { // warn user when it first happens driver_L6470_data[j].com_counter++; append_stepper_err(p, stepper_index, PSTR(" - communications lost\n")); - L6470_ECHO(temp_buf); + DEBUG_ECHO(temp_buf); } else { driver_L6470_data[j].com_counter++; if (driver_L6470_data[j].com_counter > 240) { // remind of com problem about every 2 minutes driver_L6470_data[j].com_counter = 1; append_stepper_err(p, stepper_index, PSTR(" - still no communications\n")); - L6470_ECHO(temp_buf); + DEBUG_ECHO(temp_buf); } } } @@ -657,7 +660,7 @@ void L6470_Marlin::error_status_decode(const uint16_t status, const uint8_t axis if (driver_L6470_data[j].com_counter) { // comms re-established driver_L6470_data[j].com_counter = 0; append_stepper_err(p, stepper_index, PSTR(" - communications re-established\n.. setting all drivers to default values\n")); - L6470_ECHO(temp_buf); + DEBUG_ECHO(temp_buf); init_to_defaults(); } else { @@ -718,7 +721,7 @@ void L6470_Marlin::error_status_decode(const uint16_t status, const uint8_t axis p += sprintf_P(p, PSTR("%c\n"), ' '); #endif - L6470_ECHOLN(temp_buf); // print the error message + DEBUG_ECHOLN(temp_buf); // print the error message } else { driver_L6470_data[j].is_ot = false; diff --git a/Marlin/src/libs/L6470/L6470_Marlin.h b/Marlin/src/libs/L6470/L6470_Marlin.h index a29e40739e..43ebd6ef08 100644 --- a/Marlin/src/libs/L6470/L6470_Marlin.h +++ b/Marlin/src/libs/L6470/L6470_Marlin.h @@ -25,26 +25,6 @@ #include -#if ENABLED(L6470_CHITCHAT) - #define L6470_EOL() SERIAL_EOL() - #define L6470_CHAR(C) SERIAL_CHAR(C) - #define L6470_ECHO(V) SERIAL_ECHO(V) - #define L6470_ECHOLN(V) SERIAL_ECHOLN(V) - #define L6470_ECHOPGM(S) SERIAL_ECHOPGM(S) - #define L6470_ECHOLNPGM(S) SERIAL_ECHOLNPGM(S) - #define L6470_ECHOPAIR(S,V) SERIAL_ECHOPAIR(S,V) - #define L6470_ECHOLNPAIR(S,V) SERIAL_ECHOLNPAIR(S,V) -#else - #define L6470_EOL() NOOP - #define L6470_CHAR(C) NOOP - #define L6470_ECHO(V) NOOP - #define L6470_ECHOLN(V) NOOP - #define L6470_ECHOPGM(S) NOOP - #define L6470_ECHOLNPGM(S) NOOP - #define L6470_ECHOPAIR(S,V) NOOP - #define L6470_ECHOLNPAIR(S,V) NOOP -#endif - #define L6470_GETPARAM(P,Q) stepper##Q.GetParam(P) #define MAX_L6470 (7 + MAX_EXTRUDERS) // Maximum number of axes in Marlin diff --git a/Marlin/src/libs/bresenham.h b/Marlin/src/libs/bresenham.h new file mode 100644 index 0000000000..139c3ba801 --- /dev/null +++ b/Marlin/src/libs/bresenham.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 . + * + */ +#pragma once + +#include "../core/serial.h" + +/** + * bresenham_t.h - Bresenham algorithm template + * + * An array of values / counters that tick together + */ + +#define FORCE_INLINE __attribute__((always_inline)) inline +#define _O3 __attribute__((optimize("O3"))) + +template +struct BresenhamCfg { static constexpr uint8_t UID = uid, SIZE = size; }; + +template +class Bresenham { +private: + + static constexpr T signtest = -1; + static_assert(signtest < 0, "Bresenham type must be signed!"); + +public: + + static T divisor, value[Cfg::SIZE], dir[Cfg::SIZE], dividend[Cfg::SIZE], counter[Cfg::SIZE]; + + // Default: Instantiate all items with the identical parameters + Bresenham(const T &inDivisor=1, const int8_t &inDir=1, const T &inDividend=1, const T &inValue=0) { + for (uint8_t i = 0; i < Cfg::SIZE; i++) init(i, inDivisor, inDir, inDividend, inValue); + } + + // Instantiate all items with the same divisor + Bresenham(const T &inDivisor, const int8_t (&inDir)[Cfg::SIZE], const T (&inDividend)[Cfg::SIZE], const T (&inValue)[Cfg::SIZE]={0}) { + init(inDivisor, inDir, inDividend, inValue); + } + + // Instantiate all items with the same divisor and direction + Bresenham(const T &inDivisor, const int8_t &inDir, const T (&inDividend)[Cfg::SIZE], const T (&inValue)[Cfg::SIZE]={0}) { + init(inDivisor, inDir, inDividend, inValue); + } + + // Init all items with the same parameters + FORCE_INLINE static void init(const uint8_t index, const T &inDivisor=1, const int8_t &inDir=1, const T &inDividend=1, const T &inValue=0) { + divisor = inDivisor; + dir[index] = inDir; + dividend[index] = inDividend; + value[index] = inValue; + prime(index); + } + + // Init all items with the same divisor + FORCE_INLINE static void init(const T &inDivisor, const int8_t (&inDir)[Cfg::SIZE], const T (&inDividend)[Cfg::SIZE], const T (&inValue)[Cfg::SIZE]={0}) { + divisor = inDivisor; + for (uint8_t i = 0; i < Cfg::SIZE; i++) { + dir[i] = inDir[i]; + dividend[i] = inDividend[i]; + value[i] = inValue[i]; + } + prime(); + } + + // Init all items with the same divisor and direction + FORCE_INLINE static void init(const T &inDivisor, const int8_t &inDir, const T (&inDividend)[Cfg::SIZE], const T (&inValue)[Cfg::SIZE]={0}) { + divisor = inDivisor; + for (uint8_t i = 0; i < Cfg::SIZE; i++) { + dir[i] = inDir; + dividend[i] = inDividend[i]; + value[i] = inValue[i]; + } + prime(); + } + + // Reinit item with new dir, dividend, value keeping the same divisor + FORCE_INLINE static void reinit(const uint8_t index, const int8_t &inDir=1, const T &inDividend=1, const T &inValue=0) { + dir[index] = inDir; + dividend[index] = inDividend; + value[index] = inValue; + prime(); + } + + FORCE_INLINE static void prime(const uint8_t index) { counter[index] = -(divisor / 2); } + FORCE_INLINE static void prime() { for (uint8_t i = 0; i < Cfg::SIZE; i++) prime(i); } + + FORCE_INLINE static void back(const uint8_t index) { counter[index] -= divisor; } + + FORCE_INLINE static bool tick1(const uint8_t index) { + counter[index] += dividend[index]; + return counter[index] > 0; + } + + FORCE_INLINE static void tick(const uint8_t index) { + if (tick1(index)) { value[index] += dir[index]; back(index); } + } + + FORCE_INLINE static void tick1() _O3 { for (uint8_t i = 0; i < Cfg::SIZE; i++) (void)tick1(i); } + + FORCE_INLINE static void tick() _O3 { for (uint8_t i = 0; i < Cfg::SIZE; i++) (void)tick(i); } + + static void report(const uint8_t index) { + if (index < Cfg::SIZE) { + SERIAL_ECHOPAIR("bresenham ", int(index), " : (", dividend[index], "/", divisor, ") "); + if (counter[index] >= 0) SERIAL_CHAR(' '); + if (labs(counter[index]) < 100) { SERIAL_CHAR(' '); if (labs(counter[index]) < 10) SERIAL_CHAR(' '); } + SERIAL_ECHO(counter[index]); + SERIAL_ECHOLNPAIR(" ... ", value[index]); + } + } + + static void report() { for (uint8_t i = 0; i < Cfg::SIZE; i++) report(i); } +}; diff --git a/Marlin/src/libs/hex_print_routines.cpp b/Marlin/src/libs/hex_print_routines.cpp index ad5fa3302e..a3f7492e18 100644 --- a/Marlin/src/libs/hex_print_routines.cpp +++ b/Marlin/src/libs/hex_print_routines.cpp @@ -23,7 +23,7 @@ #include "../inc/MarlinConfig.h" #include "../gcode/parser.h" -#if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(M100_FREE_MEMORY_WATCHER) || ENABLED(DEBUG_GCODE_PARSER) || ENABLED(TMC_DEBUG) +#if ANY(AUTO_BED_LEVELING_UBL, M100_FREE_MEMORY_WATCHER, DEBUG_GCODE_PARSER, TMC_DEBUG) #include "hex_print_routines.h" diff --git a/Marlin/src/libs/least_squares_fit.cpp b/Marlin/src/libs/least_squares_fit.cpp index d671333706..0f52db1938 100644 --- a/Marlin/src/libs/least_squares_fit.cpp +++ b/Marlin/src/libs/least_squares_fit.cpp @@ -34,7 +34,7 @@ #include "../inc/MarlinConfig.h" -#if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(AUTO_BED_LEVELING_LINEAR) +#if EITHER(AUTO_BED_LEVELING_UBL, AUTO_BED_LEVELING_LINEAR) #include "least_squares_fit.h" diff --git a/Marlin/src/libs/nozzle.cpp b/Marlin/src/libs/nozzle.cpp index e455a8efad..7038b2f2c3 100644 --- a/Marlin/src/libs/nozzle.cpp +++ b/Marlin/src/libs/nozzle.cpp @@ -22,7 +22,7 @@ #include "../inc/MarlinConfig.h" -#if ENABLED(NOZZLE_CLEAN_FEATURE) || ENABLED(NOZZLE_PARK_FEATURE) +#if EITHER(NOZZLE_CLEAN_FEATURE, NOZZLE_PARK_FEATURE) #include "nozzle.h" @@ -180,6 +180,8 @@ } do_blocking_move_to_xy(park.x, park.y, fr_xy); + + report_current_position(); } #endif // NOZZLE_PARK_FEATURE diff --git a/Marlin/src/module/configuration_store.cpp b/Marlin/src/module/configuration_store.cpp index 47f87281ee..0552f555a5 100644 --- a/Marlin/src/module/configuration_store.cpp +++ b/Marlin/src/module/configuration_store.cpp @@ -56,7 +56,7 @@ #include "../gcode/gcode.h" #include "../Marlin.h" -#if ENABLED(EEPROM_SETTINGS) || ENABLED(SD_FIRMWARE_UPDATE) +#if EITHER(EEPROM_SETTINGS, SD_FIRMWARE_UPDATE) #include "../HAL/shared/persistent_store_api.h" #endif @@ -86,6 +86,10 @@ #include "../feature/pause.h" +#if ENABLED(EXTRA_LIN_ADVANCE_K) +extern float saved_extruder_advance_K[EXTRUDERS]; +#endif + #if EXTRUDERS > 1 #include "tool_change.h" void M217_report(const bool eeprom); @@ -194,7 +198,7 @@ typedef struct SettingsDataStruct { delta_segments_per_second, // M665 S delta_calibration_radius, // M665 B delta_tower_angle_trim[ABC]; // M665 XYZ - #elif ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS + #elif EITHER(X_DUAL_ENDSTOPS, Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS float x2_endstop_adj, // M666 X y2_endstop_adj, // M666 Y z2_endstop_adj, // M666 Z (S2) @@ -340,7 +344,7 @@ void MarlinSettings::postprocess() { fwretract.refresh_autoretract(); #endif - #if ENABLED(JUNCTION_DEVIATION) && ENABLED(LIN_ADVANCE) + #if BOTH(JUNCTION_DEVIATION, LIN_ADVANCE) planner.recalculate_max_e_jerk(); #endif @@ -379,42 +383,40 @@ void MarlinSettings::postprocess() { #endif // SD_FIRMWARE_UPDATE -#if ENABLED(EEPROM_CHITCHAT) - #define CHITCHAT_ECHO(V) SERIAL_ECHO(V) - #define CHITCHAT_ECHOLNPGM(STR) SERIAL_ECHOLNPGM(STR) - #define CHITCHAT_ECHOPAIR(STR,V) SERIAL_ECHOPAIR(STR,V) - #define CHITCHAT_ECHOLNPAIR(STR,V) SERIAL_ECHOLNPAIR(STR,V) - #define CHITCHAT_ECHO_START() SERIAL_ECHO_START() - #define CHITCHAT_ERROR_START() SERIAL_ERROR_START() - #define CHITCHAT_ERROR_MSG(STR) SERIAL_ERROR_MSG(STR) - #define CHITCHAT_ECHOPGM(STR) SERIAL_ECHOPGM(STR) - #define CHITCHAT_EOL() SERIAL_EOL() -#else - #define CHITCHAT_ECHO(V) NOOP - #define CHITCHAT_ECHOLNPGM(STR) NOOP - #define CHITCHAT_ECHOPAIR(STR,V) NOOP - #define CHITCHAT_ECHOLNPAIR(STR,V) NOOP - #define CHITCHAT_ECHO_START() NOOP - #define CHITCHAT_ERROR_START() NOOP - #define CHITCHAT_ERROR_MSG(STR) NOOP - #define CHITCHAT_ECHOPGM(STR) NOOP - #define CHITCHAT_EOL() NOOP -#endif +#define DEBUG_OUT ENABLED(EEPROM_CHITCHAT) +#include "../core/debug_out.h" #if ENABLED(EEPROM_SETTINGS) - #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) do{ if (!(TST)) { SERIAL_ERROR_MSG(ERR); eeprom_error = true; } }while(0) + #define WORD_PADDED_EEPROM ENABLED(__STM32F1__, FLASH_EEPROM_EMULATION) + + #if WORD_PADDED_EEPROM && ENABLED(DEBUG_EEPROM_READWRITE) + #define UPDATE_TEST_INDEX(VAR) (text_index += sizeof(VAR)) + #else + #define UPDATE_TEST_INDEX(VAR) NOOP + #endif + #if WORD_PADDED_EEPROM + #define EEPROM_SKIP(VAR) do{ eeprom_index += sizeof(VAR) + (sizeof(VAR) & 1); UPDATE_TEST_INDEX(sizeof(VAR)); }while(0) + #else + #define EEPROM_SKIP(VAR) (eeprom_index += sizeof(VAR)) + #endif + + #define EEPROM_START() int eeprom_index = EEPROM_OFFSET; persistentStore.access_start() + #define EEPROM_FINISH() persistentStore.access_finish() + #define EEPROM_WRITE(VAR) do{ persistentStore.write_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc); UPDATE_TEST_INDEX(VAR); }while(0) + #define EEPROM_READ(VAR) do{ persistentStore.read_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc, !validating); UPDATE_TEST_INDEX(VAR); }while(0) + #define EEPROM_READ_ALWAYS(VAR) do{ persistentStore.read_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc); UPDATE_TEST_INDEX(VAR); }while(0) + #define EEPROM_ASSERT(TST,ERR) do{ if (!(TST)) { SERIAL_ERROR_MSG(ERR); eeprom_error = true; } }while(0) #if ENABLED(DEBUG_EEPROM_READWRITE) + #if WORD_PADDED_EEPROM + int test_index; + #else + #define test_index eeprom_index + #endif #define _FIELD_TEST(FIELD) \ EEPROM_ASSERT( \ - eeprom_error || eeprom_index == offsetof(SettingsData, FIELD) + EEPROM_OFFSET, \ + eeprom_error || test_index == offsetof(SettingsData, FIELD) + EEPROM_OFFSET, \ "Field " STRINGIFY(FIELD) " mismatch." \ ) #else @@ -427,7 +429,7 @@ void MarlinSettings::postprocess() { bool MarlinSettings::size_error(const uint16_t size) { if (size != datasize()) { - CHITCHAT_ERROR_MSG("EEPROM datasize error."); + DEBUG_ERROR_MSG("EEPROM datasize error."); return true; } return false; @@ -467,7 +469,7 @@ void MarlinSettings::postprocess() { #if HAS_CLASSIC_JERK EEPROM_WRITE(planner.max_jerk); - #if ENABLED(JUNCTION_DEVIATION) && ENABLED(LIN_ADVANCE) + #if BOTH(JUNCTION_DEVIATION, LIN_ADVANCE) dummy = float(DEFAULT_EJERK); EEPROM_WRITE(dummy); #endif @@ -643,7 +645,7 @@ void MarlinSettings::postprocess() { EEPROM_WRITE(delta_calibration_radius); // 1 float EEPROM_WRITE(delta_tower_angle_trim); // 3 floats - #elif ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS + #elif EITHER(X_DUAL_ENDSTOPS, Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS _FIELD_TEST(x2_endstop_adj); @@ -728,7 +730,7 @@ void MarlinSettings::postprocess() { const PID_t bed_pid = { DUMMY_PID_VALUE, DUMMY_PID_VALUE, DUMMY_PID_VALUE }; EEPROM_WRITE(bed_pid); #else - EEPROM_WRITE(thermalManager.bed_pid); + EEPROM_WRITE(thermalManager.temp_bed.pid); #endif } @@ -776,7 +778,7 @@ void MarlinSettings::postprocess() { 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) + #if BOTH(FWRETRACT, FWRETRACT_AUTORETRACT) EEPROM_WRITE(fwretract.autoretract_enabled); #else const bool autoretract_enabled = false; @@ -1103,10 +1105,8 @@ void MarlinSettings::postprocess() { EEPROM_WRITE(final_crc); // Report storage size - CHITCHAT_ECHO_START(); - CHITCHAT_ECHOPAIR("Settings Stored (", eeprom_size); - CHITCHAT_ECHOPAIR(" bytes; crc ", (uint32_t)final_crc); - CHITCHAT_ECHOLNPGM(")"); + DEBUG_ECHO_START(); + DEBUG_ECHOLNPAIR("Settings Stored (", eeprom_size, " bytes; crc ", (uint32_t)final_crc, ")"); eeprom_error |= size_error(eeprom_size); } @@ -1143,10 +1143,8 @@ void MarlinSettings::postprocess() { stored_ver[0] = '?'; stored_ver[1] = '\0'; } - CHITCHAT_ECHO_START(); - CHITCHAT_ECHOPGM("EEPROM version mismatch "); - CHITCHAT_ECHOPAIR("(EEPROM=", stored_ver); - CHITCHAT_ECHOLNPGM(" Marlin=" EEPROM_VERSION ")"); + DEBUG_ECHO_START(); + DEBUG_ECHOLNPAIR("EEPROM version mismatch (EEPROM=", stored_ver, " Marlin=" EEPROM_VERSION ")"); eeprom_error = true; } else { @@ -1190,7 +1188,7 @@ void MarlinSettings::postprocess() { #if HAS_CLASSIC_JERK EEPROM_READ(planner.max_jerk); - #if ENABLED(JUNCTION_DEVIATION) && ENABLED(LIN_ADVANCE) + #if BOTH(JUNCTION_DEVIATION, LIN_ADVANCE) EEPROM_READ(dummy); #endif #else @@ -1363,7 +1361,7 @@ void MarlinSettings::postprocess() { 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 EITHER(X_DUAL_ENDSTOPS, Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS _FIELD_TEST(x2_endstop_adj); @@ -1452,7 +1450,7 @@ void MarlinSettings::postprocess() { EEPROM_READ(pid); #if ENABLED(PIDTEMPBED) if (!validating && pid.Kp != DUMMY_PID_VALUE) - memcpy(&thermalManager.bed_pid, &pid, sizeof(pid)); + memcpy(&thermalManager.temp_bed.pid, &pid, sizeof(pid)); #endif } @@ -1495,7 +1493,7 @@ void MarlinSettings::postprocess() { fwretract_settings_t fwretract_settings; EEPROM_READ(fwretract_settings); #endif - #if ENABLED(FWRETRACT) && ENABLED(FWRETRACT_AUTORETRACT) + #if BOTH(FWRETRACT, FWRETRACT_AUTORETRACT) EEPROM_READ(fwretract.autoretract_enabled); #else bool autoretract_enabled; @@ -1811,25 +1809,18 @@ void MarlinSettings::postprocess() { eeprom_error = size_error(eeprom_index - (EEPROM_OFFSET)); if (eeprom_error) { - CHITCHAT_ECHO_START(); - CHITCHAT_ECHOPAIR("Index: ", int(eeprom_index - (EEPROM_OFFSET))); - CHITCHAT_ECHOLNPAIR(" Size: ", datasize()); + DEBUG_ECHO_START(); + DEBUG_ECHOLNPAIR("Index: ", int(eeprom_index - (EEPROM_OFFSET)), " Size: ", datasize()); } else if (working_crc != stored_crc) { eeprom_error = true; - CHITCHAT_ERROR_START(); - CHITCHAT_ECHOPGM("EEPROM CRC mismatch - (stored) "); - CHITCHAT_ECHO(stored_crc); - CHITCHAT_ECHOPGM(" != "); - CHITCHAT_ECHO(working_crc); - CHITCHAT_ECHOLNPGM(" (calculated)!"); + DEBUG_ERROR_START(); + DEBUG_ECHOLNPAIR("EEPROM CRC mismatch - (stored) ", stored_crc, " != ", working_crc, " (calculated)!"); } else if (!validating) { - CHITCHAT_ECHO_START(); - CHITCHAT_ECHO(version); - CHITCHAT_ECHOPAIR(" stored settings retrieved (", eeprom_index - (EEPROM_OFFSET)); - CHITCHAT_ECHOPAIR(" bytes; crc ", (uint32_t)working_crc); - CHITCHAT_ECHOLNPGM(")"); + DEBUG_ECHO_START(); + DEBUG_ECHO(version); + DEBUG_ECHOLNPAIR(" stored settings retrieved (", eeprom_index - (EEPROM_OFFSET), " bytes; crc ", (uint32_t)working_crc, ")"); } if (!validating && !eeprom_error) postprocess(); @@ -1842,27 +1833,26 @@ void MarlinSettings::postprocess() { SERIAL_EOL(); #if ENABLED(EEPROM_CHITCHAT) ubl.echo_name(); - CHITCHAT_ECHOLNPGM(" initialized.\n"); + DEBUG_ECHOLNPGM(" initialized.\n"); #endif } else { eeprom_error = true; #if ENABLED(EEPROM_CHITCHAT) - CHITCHAT_ECHOPGM("?Can't enable "); + DEBUG_ECHOPGM("?Can't enable "); ubl.echo_name(); - CHITCHAT_ECHOLNPGM("."); + DEBUG_ECHOLNPGM("."); #endif ubl.reset(); } if (ubl.storage_slot >= 0) { load_mesh(ubl.storage_slot); - CHITCHAT_ECHOPAIR("Mesh ", ubl.storage_slot); - CHITCHAT_ECHOLNPGM(" loaded from storage."); + DEBUG_ECHOLNPAIR("Mesh ", ubl.storage_slot, " loaded from storage."); } else { ubl.reset(); - CHITCHAT_ECHOLNPGM("UBL System reset()"); + DEBUG_ECHOLNPGM("UBL System reset()"); } } #endif @@ -1893,9 +1883,9 @@ void MarlinSettings::postprocess() { inline void ubl_invalid_slot(const int s) { #if ENABLED(EEPROM_CHITCHAT) - CHITCHAT_ECHOLNPGM("?Invalid slot."); - CHITCHAT_ECHO(s); - CHITCHAT_ECHOLNPGM(" mesh slots available."); + DEBUG_ECHOLNPGM("?Invalid slot."); + DEBUG_ECHO(s); + DEBUG_ECHOLNPGM(" mesh slots available."); #else UNUSED(s); #endif @@ -1924,10 +1914,8 @@ void MarlinSettings::postprocess() { const int16_t a = calc_num_meshes(); if (!WITHIN(slot, 0, a - 1)) { ubl_invalid_slot(a); - CHITCHAT_ECHOPAIR("E2END=", persistentStore.capacity() - 1); - CHITCHAT_ECHOPAIR(" meshes_end=", meshes_end); - CHITCHAT_ECHOLNPAIR(" slot=", slot); - CHITCHAT_EOL(); + DEBUG_ECHOLNPAIR("E2END=", persistentStore.capacity() - 1, " meshes_end=", meshes_end, " slot=", slot); + DEBUG_EOL(); return; } @@ -1940,7 +1928,7 @@ void MarlinSettings::postprocess() { persistentStore.access_finish(); if (status) SERIAL_ECHOLNPGM("?Unable to save mesh data."); - else CHITCHAT_ECHOLNPAIR("Mesh saved in slot ", slot); + else DEBUG_ECHOLNPAIR("Mesh saved in slot ", slot); #else @@ -1969,7 +1957,7 @@ void MarlinSettings::postprocess() { persistentStore.access_finish(); if (status) SERIAL_ECHOLNPGM("?Unable to load mesh data."); - else CHITCHAT_ECHOLNPAIR("Mesh loaded from slot ", slot); + else DEBUG_ECHOLNPAIR("Mesh loaded from slot ", slot); EEPROM_FINISH(); @@ -1988,7 +1976,7 @@ void MarlinSettings::postprocess() { #else // !EEPROM_SETTINGS bool MarlinSettings::save() { - CHITCHAT_ERROR_MSG("EEPROM disabled"); + DEBUG_ERROR_MSG("EEPROM disabled"); return false; } @@ -2042,15 +2030,7 @@ void MarlinSettings::reset() { #endif #if HAS_HOTEND_OFFSET - constexpr float tmp4[XYZ][HOTENDS] = { HOTEND_OFFSET_X, HOTEND_OFFSET_Y, HOTEND_OFFSET_Z }; - static_assert( - tmp4[X_AXIS][0] == 0 && tmp4[Y_AXIS][0] == 0 && tmp4[Z_AXIS][0] == 0, - "Offsets for the first hotend must be 0.0." - ); - LOOP_XYZ(i) HOTEND_LOOP() hotend_offset[i][e] = tmp4[i][e]; - #if ENABLED(DUAL_X_CARRIAGE) - hotend_offset[X_AXIS][1] = MAX(X2_HOME_POS, X2_MAX_POS); - #endif + reset_hotend_offsets(); #endif #if EXTRUDERS > 1 @@ -2107,7 +2087,7 @@ void MarlinSettings::reset() { delta_calibration_radius = DELTA_CALIBRATION_RADIUS; COPY(delta_tower_angle_trim, dta); - #elif ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS + #elif EITHER(X_DUAL_ENDSTOPS, Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS #if ENABLED(X_DUAL_ENDSTOPS) endstops.x2_endstop_adj = ( @@ -2195,9 +2175,9 @@ void MarlinSettings::reset() { // #if ENABLED(PIDTEMPBED) - thermalManager.bed_pid.Kp = DEFAULT_bedKp; - thermalManager.bed_pid.Ki = scalePID_i(DEFAULT_bedKi); - thermalManager.bed_pid.Kd = scalePID_d(DEFAULT_bedKd); + thermalManager.temp_bed.pid.Kp = DEFAULT_bedKp; + thermalManager.temp_bed.pid.Ki = scalePID_i(DEFAULT_bedKi); + thermalManager.temp_bed.pid.Kd = scalePID_d(DEFAULT_bedKd); #endif // @@ -2257,7 +2237,12 @@ void MarlinSettings::reset() { // #if ENABLED(LIN_ADVANCE) - LOOP_L_N(i, EXTRUDERS) planner.extruder_advance_K[i] = LIN_ADVANCE_K; + LOOP_L_N(i, EXTRUDERS) { + planner.extruder_advance_K[i] = LIN_ADVANCE_K; + #if ENABLED(EXTRA_LIN_ADVANCE_K) + saved_extruder_advance_K[i] = LIN_ADVANCE_K; + #endif + } #endif // @@ -2303,8 +2288,8 @@ void MarlinSettings::reset() { postprocess(); - CHITCHAT_ECHO_START(); - CHITCHAT_ECHOLNPGM("Hardcoded Default Settings Loaded"); + DEBUG_ECHO_START(); + DEBUG_ECHOLNPGM("Hardcoded Default Settings Loaded"); } #if DISABLED(DISABLE_M503) @@ -2314,7 +2299,7 @@ void MarlinSettings::reset() { #define CONFIG_ECHO_HEADING(STR) do{ if (!forReplay) { CONFIG_ECHO_START(); SERIAL_ECHOLNPGM(STR); } }while(0) #if HAS_TRINAMIC - void say_M906() { SERIAL_ECHOPGM(" M906"); } + inline void say_M906(const bool forReplay) { CONFIG_ECHO_START(); SERIAL_ECHOPGM(" M906"); } #if HAS_STEALTHCHOP void say_M569(const char * const etc=NULL) { SERIAL_ECHOPGM(" M569 S1"); @@ -2326,15 +2311,15 @@ void MarlinSettings::reset() { } #endif #if ENABLED(HYBRID_THRESHOLD) - void say_M913() { SERIAL_ECHOPGM(" M913"); } + inline void say_M913() { SERIAL_ECHOPGM(" M913"); } #endif #if USE_SENSORLESS - void say_M914() { SERIAL_ECHOPGM(" M914"); } + inline void say_M914() { SERIAL_ECHOPGM(" M914"); } #endif #endif #if ENABLED(ADVANCED_PAUSE_FEATURE) - void say_M603() { SERIAL_ECHOPGM(" M603 "); } + inline void say_M603(const bool forReplay) { CONFIG_ECHO_START(); SERIAL_ECHOPGM(" M603 "); } #endif inline void say_units(const bool colon) { @@ -2403,28 +2388,22 @@ void MarlinSettings::reset() { } CONFIG_ECHO_START(); - SERIAL_ECHOPAIR(" M200 D", LINEAR_UNIT(planner.filament_size[0])); - SERIAL_EOL(); + SERIAL_ECHOLNPAIR(" M200 D", LINEAR_UNIT(planner.filament_size[0])); #if EXTRUDERS > 1 CONFIG_ECHO_START(); - SERIAL_ECHOPAIR(" M200 T1 D", LINEAR_UNIT(planner.filament_size[1])); - SERIAL_EOL(); + SERIAL_ECHOLNPAIR(" M200 T1 D", LINEAR_UNIT(planner.filament_size[1])); #if EXTRUDERS > 2 CONFIG_ECHO_START(); - SERIAL_ECHOPAIR(" M200 T2 D", LINEAR_UNIT(planner.filament_size[2])); - SERIAL_EOL(); + SERIAL_ECHOLNPAIR(" M200 T2 D", LINEAR_UNIT(planner.filament_size[2])); #if EXTRUDERS > 3 CONFIG_ECHO_START(); - SERIAL_ECHOPAIR(" M200 T3 D", LINEAR_UNIT(planner.filament_size[3])); - SERIAL_EOL(); + SERIAL_ECHOLNPAIR(" M200 T3 D", LINEAR_UNIT(planner.filament_size[3])); #if EXTRUDERS > 4 CONFIG_ECHO_START(); - SERIAL_ECHOPAIR(" M200 T4 D", LINEAR_UNIT(planner.filament_size[4])); - SERIAL_EOL(); + SERIAL_ECHOLNPAIR(" M200 T4 D", LINEAR_UNIT(planner.filament_size[4])); #if EXTRUDERS > 5 CONFIG_ECHO_START(); - SERIAL_ECHOPAIR(" M200 T5 D", LINEAR_UNIT(planner.filament_size[5])); - SERIAL_EOL(); + SERIAL_ECHOLNPAIR(" M200 T5 D", LINEAR_UNIT(planner.filament_size[5])); #endif // EXTRUDERS > 5 #endif // EXTRUDERS > 4 #endif // EXTRUDERS > 3 @@ -2441,43 +2420,50 @@ void MarlinSettings::reset() { CONFIG_ECHO_HEADING("Maximum feedrates (units/s):"); CONFIG_ECHO_START(); - SERIAL_ECHOPAIR(" M203 X", LINEAR_UNIT(planner.settings.max_feedrate_mm_s[X_AXIS])); - SERIAL_ECHOPAIR(" Y", LINEAR_UNIT(planner.settings.max_feedrate_mm_s[Y_AXIS])); - SERIAL_ECHOPAIR(" Z", LINEAR_UNIT(planner.settings.max_feedrate_mm_s[Z_AXIS])); - #if DISABLED(DISTINCT_E_FACTORS) - SERIAL_ECHOPAIR(" E", VOLUMETRIC_UNIT(planner.settings.max_feedrate_mm_s[E_AXIS])); - #endif - SERIAL_EOL(); + SERIAL_ECHOLNPAIR( + " M203 X", LINEAR_UNIT(planner.settings.max_feedrate_mm_s[X_AXIS]) + , " Y", LINEAR_UNIT(planner.settings.max_feedrate_mm_s[Y_AXIS]) + , " Z", LINEAR_UNIT(planner.settings.max_feedrate_mm_s[Z_AXIS]) + #if DISABLED(DISTINCT_E_FACTORS) + , " E", VOLUMETRIC_UNIT(planner.settings.max_feedrate_mm_s[E_AXIS]) + #endif + ); #if ENABLED(DISTINCT_E_FACTORS) CONFIG_ECHO_START(); for (uint8_t i = 0; i < E_STEPPERS; i++) { - SERIAL_ECHOPAIR(" M203 T", (int)i); - SERIAL_ECHOLNPAIR(" E", VOLUMETRIC_UNIT(planner.settings.max_feedrate_mm_s[E_AXIS_N(i)])); + SERIAL_ECHOLNPAIR( + " M203 T", (int)i + , " E", VOLUMETRIC_UNIT(planner.settings.max_feedrate_mm_s[E_AXIS_N(i)]) + ); } #endif CONFIG_ECHO_HEADING("Maximum Acceleration (units/s2):"); CONFIG_ECHO_START(); - SERIAL_ECHOPAIR(" M201 X", LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[X_AXIS])); - SERIAL_ECHOPAIR(" Y", LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[Y_AXIS])); - SERIAL_ECHOPAIR(" Z", LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[Z_AXIS])); - #if DISABLED(DISTINCT_E_FACTORS) - SERIAL_ECHOPAIR(" E", VOLUMETRIC_UNIT(planner.settings.max_acceleration_mm_per_s2[E_AXIS])); - #endif - SERIAL_EOL(); + SERIAL_ECHOLNPAIR( + " M201 X", LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[X_AXIS]) + , " Y", LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[Y_AXIS]) + , " Z", LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[Z_AXIS]) + #if DISABLED(DISTINCT_E_FACTORS) + , " E", VOLUMETRIC_UNIT(planner.settings.max_acceleration_mm_per_s2[E_AXIS]) + #endif + ); #if ENABLED(DISTINCT_E_FACTORS) CONFIG_ECHO_START(); - for (uint8_t i = 0; i < E_STEPPERS; i++) { - SERIAL_ECHOPAIR(" M201 T", (int)i); - SERIAL_ECHOLNPAIR(" E", VOLUMETRIC_UNIT(planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(i)])); - } + for (uint8_t i = 0; i < E_STEPPERS; i++) + SERIAL_ECHOLNPAIR( + " M201 T", (int)i + , " E", VOLUMETRIC_UNIT(planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(i)]) + ); #endif CONFIG_ECHO_HEADING("Acceleration (units/s2): P R T"); CONFIG_ECHO_START(); - SERIAL_ECHOPAIR(" M204 P", LINEAR_UNIT(planner.settings.acceleration)); - SERIAL_ECHOPAIR(" R", LINEAR_UNIT(planner.settings.retract_acceleration)); - SERIAL_ECHOLNPAIR(" T", LINEAR_UNIT(planner.settings.travel_acceleration)); + SERIAL_ECHOLNPAIR( + " M204 P", LINEAR_UNIT(planner.settings.acceleration) + , " R", LINEAR_UNIT(planner.settings.retract_acceleration) + , " T", LINEAR_UNIT(planner.settings.travel_acceleration) + ); if (!forReplay) { CONFIG_ECHO_START(); @@ -2494,39 +2480,44 @@ void MarlinSettings::reset() { SERIAL_EOL(); } CONFIG_ECHO_START(); - SERIAL_ECHOPAIR(" M205 B", LINEAR_UNIT(planner.settings.min_segment_time_us)); - SERIAL_ECHOPAIR(" S", LINEAR_UNIT(planner.settings.min_feedrate_mm_s)); - SERIAL_ECHOPAIR(" T", LINEAR_UNIT(planner.settings.min_travel_feedrate_mm_s)); - - #if ENABLED(JUNCTION_DEVIATION) - SERIAL_ECHOPAIR(" J", LINEAR_UNIT(planner.junction_deviation_mm)); - #endif - #if HAS_CLASSIC_JERK - SERIAL_ECHOPAIR(" X", LINEAR_UNIT(planner.max_jerk[X_AXIS])); - SERIAL_ECHOPAIR(" Y", LINEAR_UNIT(planner.max_jerk[Y_AXIS])); - SERIAL_ECHOPAIR(" Z", LINEAR_UNIT(planner.max_jerk[Z_AXIS])); - #if DISABLED(JUNCTION_DEVIATION) || DISABLED(LIN_ADVANCE) - SERIAL_ECHOPAIR(" E", LINEAR_UNIT(planner.max_jerk[E_AXIS])); + SERIAL_ECHOLNPAIR( + " M205 B", LINEAR_UNIT(planner.settings.min_segment_time_us) + , " S", LINEAR_UNIT(planner.settings.min_feedrate_mm_s) + , " T", LINEAR_UNIT(planner.settings.min_travel_feedrate_mm_s) + #if ENABLED(JUNCTION_DEVIATION) + , " J", LINEAR_UNIT(planner.junction_deviation_mm) #endif - #endif - - SERIAL_EOL(); + #if HAS_CLASSIC_JERK + , " X", LINEAR_UNIT(planner.max_jerk[X_AXIS]) + , " Y", LINEAR_UNIT(planner.max_jerk[Y_AXIS]) + , " Z", LINEAR_UNIT(planner.max_jerk[Z_AXIS]) + #if DISABLED(JUNCTION_DEVIATION) || DISABLED(LIN_ADVANCE) + , " E", LINEAR_UNIT(planner.max_jerk[E_AXIS]) + #endif + #endif + ); #if HAS_M206_COMMAND CONFIG_ECHO_HEADING("Home offset:"); CONFIG_ECHO_START(); - SERIAL_ECHOPAIR(" M206 X", LINEAR_UNIT(home_offset[X_AXIS])); - SERIAL_ECHOPAIR(" Y", LINEAR_UNIT(home_offset[Y_AXIS])); - SERIAL_ECHOLNPAIR(" Z", LINEAR_UNIT(home_offset[Z_AXIS])); + SERIAL_ECHOLNPAIR(" M206" + #if IS_CARTESIAN + " X", LINEAR_UNIT(home_offset[X_AXIS]), + " Y", LINEAR_UNIT(home_offset[Y_AXIS]), + #endif + " Z", LINEAR_UNIT(home_offset[Z_AXIS]) + ); #endif #if HAS_HOTEND_OFFSET CONFIG_ECHO_HEADING("Hotend offsets:"); CONFIG_ECHO_START(); for (uint8_t e = 1; e < HOTENDS; e++) { - SERIAL_ECHOPAIR(" M218 T", (int)e); - SERIAL_ECHOPAIR(" X", LINEAR_UNIT(hotend_offset[X_AXIS][e])); - SERIAL_ECHOPAIR(" Y", LINEAR_UNIT(hotend_offset[Y_AXIS][e])); + SERIAL_ECHOPAIR( + " M218 T", (int)e + , " X", LINEAR_UNIT(hotend_offset[X_AXIS][e]) + , " Y", LINEAR_UNIT(hotend_offset[Y_AXIS][e]) + ); SERIAL_ECHOLNPAIR_F(" Z", LINEAR_UNIT(hotend_offset[Z_AXIS][e]), 3); } #endif @@ -2555,11 +2546,12 @@ void MarlinSettings::reset() { #endif CONFIG_ECHO_START(); - SERIAL_ECHOPAIR(" M420 S", planner.leveling_active ? 1 : 0); - #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) - SERIAL_ECHOPAIR(" Z", LINEAR_UNIT(planner.z_fade_height)); - #endif - SERIAL_EOL(); + SERIAL_ECHOLNPAIR( + " M420 S", planner.leveling_active ? 1 : 0 + #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) + , " Z", LINEAR_UNIT(planner.z_fade_height) + #endif + ); #if ENABLED(MESH_BED_LEVELING) @@ -2567,8 +2559,7 @@ void MarlinSettings::reset() { for (uint8_t py = 0; py < GRID_MAX_POINTS_Y; py++) { for (uint8_t px = 0; px < GRID_MAX_POINTS_X; px++) { CONFIG_ECHO_START(); - SERIAL_ECHOPAIR(" G29 S3 X", (int)px + 1); - SERIAL_ECHOPAIR(" Y", (int)py + 1); + SERIAL_ECHOPAIR(" G29 S3 X", (int)px + 1, " Y", (int)py + 1); SERIAL_ECHOLNPAIR_F(" Z", LINEAR_UNIT(mbl.z_values[px][py]), 5); } } @@ -2580,8 +2571,7 @@ void MarlinSettings::reset() { SERIAL_EOL(); ubl.report_state(); SERIAL_ECHOLNPAIR("\nActive Mesh Slot: ", ubl.storage_slot); - SERIAL_ECHOPAIR("EEPROM can hold ", calc_num_meshes()); - SERIAL_ECHOLNPGM(" meshes.\n"); + SERIAL_ECHOLNPAIR("EEPROM can hold ", calc_num_meshes(), " meshes.\n"); } //ubl.report_current_mesh(); // This is too verbose for large meshes. A better (more terse) @@ -2592,8 +2582,7 @@ void MarlinSettings::reset() { for (uint8_t py = 0; py < GRID_MAX_POINTS_Y; py++) { for (uint8_t px = 0; px < GRID_MAX_POINTS_X; px++) { CONFIG_ECHO_START(); - SERIAL_ECHOPAIR(" G29 W I", (int)px); - SERIAL_ECHOPAIR(" J", (int)py); + SERIAL_ECHOPAIR(" G29 W I", (int)px, " J", (int)py); SERIAL_ECHOLNPAIR_F(" Z", LINEAR_UNIT(z_values[px][py]), 5); } } @@ -2615,14 +2604,11 @@ void MarlinSettings::reset() { #endif #elif ENABLED(SWITCHING_NOZZLE) case SWITCHING_NOZZLE_SERVO_NR: - #elif defined(Z_SERVO_ANGLES) && defined(Z_PROBE_SERVO_NR) + #elif (ENABLED(BLTOUCH) && defined(BLTOUCH_ANGLES)) || (defined(Z_SERVO_ANGLES) && defined(Z_PROBE_SERVO_NR)) case Z_PROBE_SERVO_NR: #endif CONFIG_ECHO_START(); - SERIAL_ECHOPAIR(" M281 P", int(i)); - SERIAL_ECHOPAIR(" L", servo_angles[i][0]); - SERIAL_ECHOPAIR(" U", servo_angles[i][1]); - SERIAL_EOL(); + SERIAL_ECHOLNPAIR(" M281 P", int(i), " L", servo_angles[i][0], " U", servo_angles[i][1]); default: break; } } @@ -2633,33 +2619,37 @@ void MarlinSettings::reset() { CONFIG_ECHO_HEADING("SCARA settings: S P T"); CONFIG_ECHO_START(); - SERIAL_ECHOPAIR(" M665 S", delta_segments_per_second); - SERIAL_ECHOPAIR(" P", scara_home_offset[A_AXIS]); - SERIAL_ECHOPAIR(" T", scara_home_offset[B_AXIS]); - SERIAL_ECHOPAIR(" Z", LINEAR_UNIT(scara_home_offset[Z_AXIS])); - SERIAL_EOL(); + SERIAL_ECHOLNPAIR( + " M665 S", delta_segments_per_second + , " P", scara_home_offset[A_AXIS] + , " T", scara_home_offset[B_AXIS] + , " Z", LINEAR_UNIT(scara_home_offset[Z_AXIS]) + ); #elif ENABLED(DELTA) CONFIG_ECHO_HEADING("Endstop adjustment:"); CONFIG_ECHO_START(); - SERIAL_ECHOPAIR(" M666 X", LINEAR_UNIT(delta_endstop_adj[X_AXIS])); - SERIAL_ECHOPAIR(" Y", LINEAR_UNIT(delta_endstop_adj[Y_AXIS])); - SERIAL_ECHOLNPAIR(" Z", LINEAR_UNIT(delta_endstop_adj[Z_AXIS])); + SERIAL_ECHOLNPAIR( + " M666 X", LINEAR_UNIT(delta_endstop_adj[X_AXIS]) + , " Y", LINEAR_UNIT(delta_endstop_adj[Y_AXIS]) + , " Z", LINEAR_UNIT(delta_endstop_adj[Z_AXIS]) + ); CONFIG_ECHO_HEADING("Delta settings: L R H S B XYZ"); CONFIG_ECHO_START(); - SERIAL_ECHOPAIR(" M665 L", LINEAR_UNIT(delta_diagonal_rod)); - SERIAL_ECHOPAIR(" R", LINEAR_UNIT(delta_radius)); - SERIAL_ECHOPAIR(" H", LINEAR_UNIT(delta_height)); - SERIAL_ECHOPAIR(" S", delta_segments_per_second); - SERIAL_ECHOPAIR(" B", LINEAR_UNIT(delta_calibration_radius)); - SERIAL_ECHOPAIR(" X", LINEAR_UNIT(delta_tower_angle_trim[A_AXIS])); - SERIAL_ECHOPAIR(" Y", LINEAR_UNIT(delta_tower_angle_trim[B_AXIS])); - SERIAL_ECHOPAIR(" Z", LINEAR_UNIT(delta_tower_angle_trim[C_AXIS])); - SERIAL_EOL(); + SERIAL_ECHOLNPAIR( + " M665 L", LINEAR_UNIT(delta_diagonal_rod) + , " R", LINEAR_UNIT(delta_radius) + , " H", LINEAR_UNIT(delta_height) + , " S", delta_segments_per_second + , " B", LINEAR_UNIT(delta_calibration_radius) + , " X", LINEAR_UNIT(delta_tower_angle_trim[A_AXIS]) + , " Y", LINEAR_UNIT(delta_tower_angle_trim[B_AXIS]) + , " Z", LINEAR_UNIT(delta_tower_angle_trim[C_AXIS]) + ); - #elif ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS) + #elif EITHER(X_DUAL_ENDSTOPS, Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS CONFIG_ECHO_HEADING("Endstop adjustment:"); CONFIG_ECHO_START(); @@ -2686,10 +2676,12 @@ void MarlinSettings::reset() { CONFIG_ECHO_HEADING("Material heatup parameters:"); for (uint8_t i = 0; i < COUNT(ui.preheat_hotend_temp); i++) { CONFIG_ECHO_START(); - SERIAL_ECHOPAIR(" M145 S", (int)i); - SERIAL_ECHOPAIR(" H", TEMP_UNIT(ui.preheat_hotend_temp[i])); - SERIAL_ECHOPAIR(" B", TEMP_UNIT(ui.preheat_bed_temp[i])); - SERIAL_ECHOLNPAIR(" F", int(ui.preheat_fan_speed[i])); + SERIAL_ECHOLNPAIR( + " M145 S", (int)i + , " H", TEMP_UNIT(ui.preheat_hotend_temp[i]) + , " B", TEMP_UNIT(ui.preheat_bed_temp[i]) + , " F", int(ui.preheat_fan_speed[i]) + ); } #endif @@ -2702,10 +2694,12 @@ void MarlinSettings::reset() { if (forReplay) { HOTEND_LOOP() { CONFIG_ECHO_START(); - SERIAL_ECHOPAIR(" M301 E", e); - SERIAL_ECHOPAIR(" P", PID_PARAM(Kp, e)); - SERIAL_ECHOPAIR(" I", unscalePID_i(PID_PARAM(Ki, e))); - SERIAL_ECHOPAIR(" D", unscalePID_d(PID_PARAM(Kd, e))); + SERIAL_ECHOPAIR( + " M301 E", e + , " P", PID_PARAM(Kp, e) + , " I", unscalePID_i(PID_PARAM(Ki, e)) + , " D", unscalePID_d(PID_PARAM(Kd, e)) + ); #if ENABLED(PID_EXTRUSION_SCALING) SERIAL_ECHOPAIR(" C", PID_PARAM(Kc, e)); if (e == 0) SERIAL_ECHOPAIR(" L", thermalManager.lpq_len); @@ -2718,23 +2712,25 @@ void MarlinSettings::reset() { // !forReplay || HOTENDS == 1 { CONFIG_ECHO_START(); - SERIAL_ECHOPAIR(" M301 P", PID_PARAM(Kp, 0)); // for compatibility with hosts, only echo values for E0 - SERIAL_ECHOPAIR(" I", unscalePID_i(PID_PARAM(Ki, 0))); - SERIAL_ECHOPAIR(" D", unscalePID_d(PID_PARAM(Kd, 0))); - #if ENABLED(PID_EXTRUSION_SCALING) - SERIAL_ECHOPAIR(" C", PID_PARAM(Kc, 0)); - SERIAL_ECHOPAIR(" L", thermalManager.lpq_len); - #endif - SERIAL_EOL(); + SERIAL_ECHOLNPAIR( + " M301 P", PID_PARAM(Kp, 0) // for compatibility with hosts, only echo values for E0 + , " I", unscalePID_i(PID_PARAM(Ki, 0)) + , " D", unscalePID_d(PID_PARAM(Kd, 0)) + #if ENABLED(PID_EXTRUSION_SCALING) + , " C", PID_PARAM(Kc, 0) + , " L", thermalManager.lpq_len + #endif + ); } #endif // PIDTEMP #if ENABLED(PIDTEMPBED) CONFIG_ECHO_START(); - SERIAL_ECHOPAIR(" M304 P", thermalManager.bed_pid.Kp); - SERIAL_ECHOPAIR(" I", unscalePID_i(thermalManager.bed_pid.Ki)); - SERIAL_ECHOPAIR(" D", unscalePID_d(thermalManager.bed_pid.Kd)); - SERIAL_EOL(); + SERIAL_ECHOLNPAIR( + " M304 P", thermalManager.temp_bed.pid.Kp + , " I", unscalePID_i(thermalManager.temp_bed.pid.Ki) + , " D", unscalePID_d(thermalManager.temp_bed.pid.Kd) + ); #endif #endif // PIDTEMP || PIDTEMPBED @@ -2755,16 +2751,20 @@ void MarlinSettings::reset() { CONFIG_ECHO_HEADING("Retract: S F Z"); CONFIG_ECHO_START(); - SERIAL_ECHOPAIR(" M207 S", LINEAR_UNIT(fwretract.settings.retract_length)); - SERIAL_ECHOPAIR(" W", LINEAR_UNIT(fwretract.settings.swap_retract_length)); - SERIAL_ECHOPAIR(" F", MMS_TO_MMM(LINEAR_UNIT(fwretract.settings.retract_feedrate_mm_s))); - SERIAL_ECHOLNPAIR(" Z", LINEAR_UNIT(fwretract.settings.retract_zraise)); + SERIAL_ECHOLNPAIR( + " M207 S", LINEAR_UNIT(fwretract.settings.retract_length) + , " W", LINEAR_UNIT(fwretract.settings.swap_retract_length) + , " F", MMS_TO_MMM(LINEAR_UNIT(fwretract.settings.retract_feedrate_mm_s)) + , " Z", LINEAR_UNIT(fwretract.settings.retract_zraise) + ); CONFIG_ECHO_HEADING("Recover: S F"); CONFIG_ECHO_START(); - SERIAL_ECHOPAIR(" M208 S", LINEAR_UNIT(fwretract.settings.retract_recover_length)); - SERIAL_ECHOPAIR(" W", LINEAR_UNIT(fwretract.settings.swap_retract_recover_length)); - SERIAL_ECHOLNPAIR(" F", MMS_TO_MMM(LINEAR_UNIT(fwretract.settings.retract_recover_feedrate_mm_s))); + SERIAL_ECHOLNPAIR( + " M208 S", LINEAR_UNIT(fwretract.settings.retract_recover_extra) + , " W", LINEAR_UNIT(fwretract.settings.swap_retract_recover_extra) + , " F", MMS_TO_MMM(LINEAR_UNIT(fwretract.settings.retract_recover_feedrate_mm_s)) + ); #if ENABLED(FWRETRACT_AUTORETRACT) @@ -2810,67 +2810,65 @@ void MarlinSettings::reset() { * TMC stepper driver current */ CONFIG_ECHO_HEADING("Stepper driver current:"); - CONFIG_ECHO_START(); + #if AXIS_IS_TMC(X) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Z) - say_M906(); - #endif - #if AXIS_IS_TMC(X) - SERIAL_ECHOPAIR(" X", stepperX.getMilliamps()); - #endif - #if AXIS_IS_TMC(Y) - SERIAL_ECHOPAIR(" Y", stepperY.getMilliamps()); - #endif - #if AXIS_IS_TMC(Z) - SERIAL_ECHOPAIR(" Z", stepperZ.getMilliamps()); - #endif - #if AXIS_IS_TMC(X) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Z) - SERIAL_EOL(); + say_M906(forReplay); + SERIAL_ECHOLNPAIR( + #if AXIS_IS_TMC(X) + " X", stepperX.getMilliamps(), + #endif + #if AXIS_IS_TMC(Y) + " Y", stepperY.getMilliamps(), + #endif + #if AXIS_IS_TMC(Z) + " Z", stepperZ.getMilliamps() + #endif + ); #endif #if AXIS_IS_TMC(X2) || AXIS_IS_TMC(Y2) || AXIS_IS_TMC(Z2) - say_M906(); + say_M906(forReplay); SERIAL_ECHOPGM(" I1"); - #endif - #if AXIS_IS_TMC(X2) - SERIAL_ECHOPAIR(" X", stepperX2.getMilliamps()); - #endif - #if AXIS_IS_TMC(Y2) - SERIAL_ECHOPAIR(" Y", stepperY2.getMilliamps()); - #endif - #if AXIS_IS_TMC(Z2) - SERIAL_ECHOPAIR(" Z", stepperZ2.getMilliamps()); - #endif - #if AXIS_IS_TMC(X2) || AXIS_IS_TMC(Y2) || AXIS_IS_TMC(Z2) - SERIAL_EOL(); + SERIAL_ECHOLNPAIR( + #if AXIS_IS_TMC(X2) + " X", stepperX2.getMilliamps(), + #endif + #if AXIS_IS_TMC(Y2) + " Y", stepperY2.getMilliamps(), + #endif + #if AXIS_IS_TMC(Z2) + " Z", stepperZ2.getMilliamps() + #endif + ); #endif #if AXIS_IS_TMC(Z3) - say_M906(); + say_M906(forReplay); SERIAL_ECHOLNPAIR(" I2 Z", stepperZ3.getMilliamps()); #endif #if AXIS_IS_TMC(E0) - say_M906(); + say_M906(forReplay); SERIAL_ECHOLNPAIR(" T0 E", stepperE0.getMilliamps()); #endif #if AXIS_IS_TMC(E1) - say_M906(); + say_M906(forReplay); SERIAL_ECHOLNPAIR(" T1 E", stepperE1.getMilliamps()); #endif #if AXIS_IS_TMC(E2) - say_M906(); + say_M906(forReplay); SERIAL_ECHOLNPAIR(" T2 E", stepperE2.getMilliamps()); #endif #if AXIS_IS_TMC(E3) - say_M906(); + say_M906(forReplay); SERIAL_ECHOLNPAIR(" T3 E", stepperE3.getMilliamps()); #endif #if AXIS_IS_TMC(E4) - say_M906(); + say_M906(forReplay); SERIAL_ECHOLNPAIR(" T4 E", stepperE4.getMilliamps()); #endif #if AXIS_IS_TMC(E5) - say_M906(); + say_M906(forReplay); SERIAL_ECHOLNPAIR(" T5 E", stepperE5.getMilliamps()); #endif SERIAL_EOL(); @@ -2916,8 +2914,7 @@ void MarlinSettings::reset() { #if AXIS_HAS_STEALTHCHOP(Z3) say_M913(); - SERIAL_ECHOPGM(" I2"); - SERIAL_ECHOLNPAIR(" Z", TMC_GET_PWMTHRS(Z, Z3)); + SERIAL_ECHOLNPAIR(" I2 Z", TMC_GET_PWMTHRS(Z, Z3)); #endif #if AXIS_HAS_STEALTHCHOP(E0) @@ -2988,8 +2985,7 @@ void MarlinSettings::reset() { #if HAS_Z3_SENSORLESS say_M914(); - SERIAL_ECHOPGM(" I2"); - SERIAL_ECHOLNPAIR(" Z", stepperZ3.sgt()); + SERIAL_ECHOLNPAIR(" I2 Z", stepperZ3.sgt()); #endif #endif // USE_SENSORLESS @@ -3080,20 +3076,19 @@ void MarlinSettings::reset() { #if EXTRUDERS < 2 SERIAL_ECHOLNPAIR(" M900 K", planner.extruder_advance_K[0]); #else - LOOP_L_N(i, EXTRUDERS) { - SERIAL_ECHOPAIR(" M900 T", int(i)); - SERIAL_ECHOLNPAIR(" K", planner.extruder_advance_K[i]); - } + LOOP_L_N(i, EXTRUDERS) + SERIAL_ECHOLNPAIR(" M900 T", int(i), " K", planner.extruder_advance_K[i]); #endif #endif #if HAS_MOTOR_CURRENT_PWM CONFIG_ECHO_HEADING("Stepper motor currents:"); CONFIG_ECHO_START(); - SERIAL_ECHOPAIR(" M907 X", stepper.motor_current_setting[0]); - SERIAL_ECHOPAIR(" Z", stepper.motor_current_setting[1]); - SERIAL_ECHOPAIR(" E", stepper.motor_current_setting[2]); - SERIAL_EOL(); + SERIAL_ECHOLNPAIR( + " M907 X", stepper.motor_current_setting[0] + , " Z", stepper.motor_current_setting[1] + , " E", stepper.motor_current_setting[2] + ); #endif /** @@ -3101,39 +3096,21 @@ void MarlinSettings::reset() { */ #if ENABLED(ADVANCED_PAUSE_FEATURE) CONFIG_ECHO_HEADING("Filament load/unload lengths:"); - CONFIG_ECHO_START(); #if EXTRUDERS == 1 - say_M603(); - SERIAL_ECHOPAIR("L", LINEAR_UNIT(fc_settings[0].load_length)); - SERIAL_ECHOLNPAIR(" U", LINEAR_UNIT(fc_settings[0].unload_length)); + say_M603(forReplay); + SERIAL_ECHOLNPAIR("L", LINEAR_UNIT(fc_settings[0].load_length), " U", LINEAR_UNIT(fc_settings[0].unload_length)); #else - say_M603(); - SERIAL_ECHOPAIR("T0 L", LINEAR_UNIT(fc_settings[0].load_length)); - SERIAL_ECHOLNPAIR(" U", LINEAR_UNIT(fc_settings[0].unload_length)); - CONFIG_ECHO_START(); - say_M603(); - SERIAL_ECHOPAIR("T1 L", LINEAR_UNIT(fc_settings[1].load_length)); - SERIAL_ECHOLNPAIR(" U", LINEAR_UNIT(fc_settings[1].unload_length)); + #define _ECHO_603(N) do{ say_M603(forReplay); SERIAL_ECHOLNPAIR("T" STRINGIFY(N) " L", LINEAR_UNIT(fc_settings[N].load_length), " U", LINEAR_UNIT(fc_settings[N].unload_length)); }while(0) + _ECHO_603(0); + _ECHO_603(1); #if EXTRUDERS > 2 - CONFIG_ECHO_START(); - say_M603(); - SERIAL_ECHOPAIR("T2 L", LINEAR_UNIT(fc_settings[2].load_length)); - SERIAL_ECHOLNPAIR(" U", LINEAR_UNIT(fc_settings[2].unload_length)); + _ECHO_603(2); #if EXTRUDERS > 3 - CONFIG_ECHO_START(); - say_M603(); - SERIAL_ECHOPAIR("T3 L", LINEAR_UNIT(fc_settings[3].load_length)); - SERIAL_ECHOLNPAIR(" U", LINEAR_UNIT(fc_settings[3].unload_length)); + _ECHO_603(3); #if EXTRUDERS > 4 - CONFIG_ECHO_START(); - say_M603(); - SERIAL_ECHOPAIR("T4 L", LINEAR_UNIT(fc_settings[4].load_length)); - SERIAL_ECHOLNPAIR(" U", LINEAR_UNIT(fc_settings[4].unload_length)); + _ECHO_603(4); #if EXTRUDERS > 5 - CONFIG_ECHO_START(); - say_M603(); - SERIAL_ECHOPAIR("T5 L", LINEAR_UNIT(fc_settings[5].load_length)); - SERIAL_ECHOLNPAIR(" U", LINEAR_UNIT(fc_settings[5].unload_length)); + _ECHO_603(5); #endif // EXTRUDERS > 5 #endif // EXTRUDERS > 4 #endif // EXTRUDERS > 3 diff --git a/Marlin/src/module/delta.cpp b/Marlin/src/module/delta.cpp index a202d4f45b..fbe474d85e 100644 --- a/Marlin/src/module/delta.cpp +++ b/Marlin/src/module/delta.cpp @@ -46,6 +46,9 @@ #include "stepper_indirection.h" #endif +#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) +#include "../core/debug_out.h" + // Initialized by settings.load() float delta_height, delta_endstop_adj[ABC] = { 0 }, @@ -216,9 +219,7 @@ void forward_kinematics_DELTA(const float &z1, const float &z2, const float &z3) * This is like quick_home_xy() but for 3 towers. */ void home_delta() { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS(">>> home_delta", current_position); - #endif + if (DEBUGGING(LEVELING)) DEBUG_POS(">>> home_delta", current_position); // Init the current position of all carriages to 0,0,0 ZERO(current_position); ZERO(destination); @@ -264,9 +265,7 @@ void home_delta() { sync_plan_position(); - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("<<< home_delta", current_position); - #endif + if (DEBUGGING(LEVELING)) DEBUG_POS("<<< home_delta", current_position); } #endif // DELTA diff --git a/Marlin/src/module/endstops.cpp b/Marlin/src/module/endstops.cpp index d79c63c77d..e077045ef5 100644 --- a/Marlin/src/module/endstops.cpp +++ b/Marlin/src/module/endstops.cpp @@ -36,7 +36,7 @@ #include HAL_PATH(../HAL, endstop_interrupts.h) #endif -#if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) && ENABLED(SDSUPPORT) +#if BOTH(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED, SDSUPPORT) #include "printcounter.h" // for print_job_timer #endif @@ -361,7 +361,7 @@ void Endstops::event_handler() { 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 BOTH(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED, SDSUPPORT) if (planner.abort_on_endstop_hit) { card.stopSDPrint(); quickstop_stepper(); @@ -453,7 +453,7 @@ void _O2 Endstops::M119() { } SERIAL_ECHOPGM(MSG_FILAMENT_RUNOUT_SENSOR); if (i > 1) { SERIAL_CHAR(' '); SERIAL_CHAR('0' + i); } - print_es_state(digitalRead(pin) != FIL_RUNOUT_INVERTING); + print_es_state(extDigitalRead(pin) != FIL_RUNOUT_INVERTING); } #endif #endif @@ -672,14 +672,17 @@ void Endstops::update() { }while(0) #if ENABLED(G38_PROBE_TARGET) && PIN_EXISTS(Z_MIN_PROBE) && !(CORE_IS_XY || CORE_IS_XZ) + #if ENABLED(G38_PROBE_AWAY) + #define _G38_OPEN_STATE (G38_move >= 4) + #else + #define _G38_OPEN_STATE LOW + #endif // If G38 command is active check Z_MIN_PROBE for ALL movement - if (G38_move) { - if (TEST_ENDSTOP(_ENDSTOP(Z, MIN_PROBE))) { - if (stepper.axis_is_moving(X_AXIS)) { _ENDSTOP_HIT(X, MIN); planner.endstop_triggered(X_AXIS); } - else if (stepper.axis_is_moving(Y_AXIS)) { _ENDSTOP_HIT(Y, MIN); planner.endstop_triggered(Y_AXIS); } - else if (stepper.axis_is_moving(Z_AXIS)) { _ENDSTOP_HIT(Z, MIN); planner.endstop_triggered(Z_AXIS); } - G38_endstop_hit = true; - } + if (G38_move && TEST_ENDSTOP(_ENDSTOP(Z, MIN_PROBE)) != _G38_OPEN_STATE) { + if (stepper.axis_is_moving(X_AXIS)) { _ENDSTOP_HIT(X, MIN); planner.endstop_triggered(X_AXIS); } + else if (stepper.axis_is_moving(Y_AXIS)) { _ENDSTOP_HIT(Y, MIN); planner.endstop_triggered(Y_AXIS); } + else if (stepper.axis_is_moving(Z_AXIS)) { _ENDSTOP_HIT(Z, MIN); planner.endstop_triggered(Z_AXIS); } + G38_did_trigger = true; } #endif diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index 891947558f..30f63ebed5 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -47,7 +47,11 @@ #include "../feature/bedlevel/bedlevel.h" #endif -#if HAS_AXIS_UNHOMED_ERR && (ENABLED(ULTRA_LCD) || ENABLED(EXTENSIBLE_UI)) +#if ENABLED(BLTOUCH) + #include "../feature/bltouch.h" +#endif + +#if EITHER(ULTRA_LCD, EXTENSIBLE_UI) #include "../lcd/ultralcd.h" #endif @@ -59,6 +63,13 @@ #include "../feature/fwretract.h" #endif +#if ENABLED(BABYSTEP_DISPLAY_TOTAL) + #include "../feature/babystep.h" +#endif + +#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) +#include "../core/debug_out.h" + #define XYZ_CONSTS(type, array, CONFIG) const PROGMEM type array##_P[XYZ] = { X_##CONFIG, Y_##CONFIG, Z_##CONFIG } XYZ_CONSTS(float, base_min_pos, MIN_POS); @@ -85,7 +96,7 @@ bool relative_mode; // = false; /** * Cartesian Current Position * Used to track the native machine position as moves are queued. - * Used by 'buffer_line_to_current_position' to do a move after changing it. + * Used by 'line_to_current_position' to do a move after changing it. * Used by 'sync_plan_position' to update 'planner.position'. */ float current_position[XYZE] = { X_HOME_POS, Y_HOME_POS, Z_HOME_POS }; @@ -106,6 +117,17 @@ float destination[XYZE]; // = { 0 } // Extruder offsets #if HAS_HOTEND_OFFSET float hotend_offset[XYZ][HOTENDS]; // Initialized by settings.load() + void reset_hotend_offsets() { + constexpr float tmp[XYZ][HOTENDS] = { HOTEND_OFFSET_X, HOTEND_OFFSET_Y, HOTEND_OFFSET_Z }; + static_assert( + tmp[X_AXIS][0] == 0 && tmp[Y_AXIS][0] == 0 && tmp[Z_AXIS][0] == 0, + "Offsets for the first hotend must be 0.0." + ); + LOOP_XYZ(i) HOTEND_LOOP() hotend_offset[i][e] = tmp[i][e]; + #if ENABLED(DUAL_X_CARRIAGE) + hotend_offset[X_AXIS][1] = MAX(X2_HOME_POS, X2_MAX_POS); + #endif + } #endif // The feedrate for the current move, often used as the default if @@ -130,11 +152,23 @@ const float homing_feedrate_mm_s[XYZ] PROGMEM = { float cartes[XYZ]; #if IS_KINEMATIC - float delta[ABC]; -#endif -#if HAS_SCARA_OFFSET - float scara_home_offset[ABC]; + float delta[ABC]; + + #if HAS_SCARA_OFFSET + float scara_home_offset[ABC]; + #endif + + #if HAS_SOFTWARE_ENDSTOPS + float delta_max_radius, delta_max_radius_2; + #elif IS_SCARA + constexpr float delta_max_radius = SCARA_PRINTABLE_RADIUS, + delta_max_radius_2 = sq(SCARA_PRINTABLE_RADIUS); + #else // DELTA + constexpr float delta_max_radius = DELTA_PRINTABLE_RADIUS, + delta_max_radius_2 = sq(DELTA_PRINTABLE_RADIUS); + #endif + #endif /** @@ -182,9 +216,7 @@ void report_current_position() { * no kinematic translation. Used for homing axes and cartesian/core syncing. */ void sync_plan_position() { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("sync_plan_position", current_position); - #endif + if (DEBUGGING(LEVELING)) DEBUG_POS("sync_plan_position", current_position); planner.set_position_mm(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); } @@ -271,9 +303,7 @@ void buffer_line_to_destination(const float fr_mm_s) { * Calculate delta, start a line, and set current_position to destination */ void prepare_uninterpolated_move_to_destination(const float &fr_mm_s/*=0.0*/) { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("prepare_uninterpolated_move_to_destination", destination); - #endif + if (DEBUGGING(LEVELING)) DEBUG_POS("prepare_uninterpolated_move_to_destination", destination); #if UBL_SEGMENTED // ubl segmented line will do z-only moves in single segment @@ -297,9 +327,7 @@ void buffer_line_to_destination(const float fr_mm_s) { * Plan a move to (X, Y, Z) and set the current_position */ void do_blocking_move_to(const float rx, const float ry, const float rz, const float &fr_mm_s/*=0.0*/) { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) print_xyz(PSTR(">>> do_blocking_move_to"), NULL, rx, ry, rz); - #endif + if (DEBUGGING(LEVELING)) DEBUG_XYZ(">>> do_blocking_move_to", rx, ry, rz); const float z_feedrate = fr_mm_s ? fr_mm_s : homing_feedrate(Z_AXIS), xy_feedrate = fr_mm_s ? fr_mm_s : XY_PROBE_FEEDRATE_MM_S; @@ -312,9 +340,7 @@ void do_blocking_move_to(const float rx, const float ry, const float rz, const f set_destination_from_current(); // sync destination at the start - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("set_destination_from_current", destination); - #endif + if (DEBUGGING(LEVELING)) DEBUG_POS("set_destination_from_current", destination); // when in the danger zone if (current_position[Z_AXIS] > delta_clip_start_height) { @@ -323,39 +349,29 @@ void do_blocking_move_to(const float rx, const float ry, const float rz, const f destination[Y_AXIS] = ry; destination[Z_AXIS] = rz; prepare_uninterpolated_move_to_destination(); // set_current_from_destination() - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("danger zone move", current_position); - #endif + if (DEBUGGING(LEVELING)) DEBUG_POS("danger zone move", current_position); return; } destination[Z_AXIS] = delta_clip_start_height; prepare_uninterpolated_move_to_destination(); // set_current_from_destination() - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("zone border move", current_position); - #endif + if (DEBUGGING(LEVELING)) DEBUG_POS("zone border move", current_position); } if (rz > current_position[Z_AXIS]) { // raising? destination[Z_AXIS] = rz; prepare_uninterpolated_move_to_destination(z_feedrate); // set_current_from_destination() - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("z raise move", current_position); - #endif + if (DEBUGGING(LEVELING)) DEBUG_POS("z raise move", current_position); } destination[X_AXIS] = rx; destination[Y_AXIS] = ry; prepare_move_to_destination(); // set_current_from_destination() - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("xy move", current_position); - #endif + if (DEBUGGING(LEVELING)) DEBUG_POS("xy move", current_position); if (rz < current_position[Z_AXIS]) { // lowering? destination[Z_AXIS] = rz; prepare_uninterpolated_move_to_destination(z_feedrate); // set_current_from_destination() - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("z lower move", current_position); - #endif + if (DEBUGGING(LEVELING)) DEBUG_POS("z lower move", current_position); } #elif IS_SCARA @@ -400,9 +416,7 @@ void do_blocking_move_to(const float rx, const float ry, const float rz, const f #endif - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("<<< do_blocking_move_to"); - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< do_blocking_move_to"); planner.synchronize(); } @@ -437,49 +451,7 @@ void clean_up_after_endstop_or_probe_move() { 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 - - /** - * Constrain the given coordinates to the software endstops. - * - * For DELTA/SCARA the XY constraint is based on the smallest - * radius within the set software endstops. - */ - void clamp_to_software_endstops(float target[XYZ]) { - if (!soft_endstops_enabled) return; - #if IS_KINEMATIC - const float dist_2 = HYPOT2(target[X_AXIS], target[Y_AXIS]); - if (dist_2 > soft_endstop_radius_2) { - const float ratio = soft_endstop_radius / SQRT(dist_2); // 200 / 300 = 0.66 - target[X_AXIS] *= ratio; - target[Y_AXIS] *= ratio; - } - #else - #if ENABLED(MIN_SOFTWARE_ENDSTOP_X) - NOLESS(target[X_AXIS], soft_endstop_min[X_AXIS]); - #endif - #if ENABLED(MIN_SOFTWARE_ENDSTOP_Y) - NOLESS(target[Y_AXIS], soft_endstop_min[Y_AXIS]); - #endif - #if ENABLED(MAX_SOFTWARE_ENDSTOP_X) - NOMORE(target[X_AXIS], soft_endstop_max[X_AXIS]); - #endif - #if ENABLED(MAX_SOFTWARE_ENDSTOP_Y) - NOMORE(target[Y_AXIS], soft_endstop_max[Y_AXIS]); - #endif - #endif - #if ENABLED(MIN_SOFTWARE_ENDSTOP_Z) - NOLESS(target[Z_AXIS], soft_endstop_min[Z_AXIS]); - #endif - #if ENABLED(MAX_SOFTWARE_ENDSTOP_Z) - NOMORE(target[Z_AXIS], soft_endstop_max[Z_AXIS]); - #endif - } + axis_limits_t soft_endstop[XYZ] = { { X_MIN_BED, X_MAX_BED }, { Y_MIN_BED, Y_MAX_BED }, { Z_MIN_POS, Z_MAX_POS } }; /** * Software endstops can be used to monitor the open end of @@ -490,7 +462,11 @@ void clean_up_after_endstop_or_probe_move() { * the software endstop positions must be refreshed to remain * at the same positions relative to the machine. */ - void update_software_endstops(const AxisEnum axis) { + void update_software_endstops(const AxisEnum axis + #if HAS_HOTEND_OFFSET + , const uint8_t old_tool_index/*=0*/, const uint8_t new_tool_index/*=0*/ + #endif + ) { #if ENABLED(DUAL_X_CARRIAGE) @@ -499,28 +475,29 @@ void clean_up_after_endstop_or_probe_move() { // 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) { + if (new_tool_index != 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; + soft_endstop[X_AXIS].min = X2_MIN_POS; + soft_endstop[X_AXIS].max = 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); + soft_endstop[X_AXIS].min = X1_MIN_POS; + soft_endstop[X_AXIS].max = 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; + soft_endstop[X_AXIS].min = X1_MIN_POS; + soft_endstop[X_AXIS].max = X1_MAX_POS; } + } #elif ENABLED(DELTA) - soft_endstop_min[axis] = base_min_pos(axis); - soft_endstop_max[axis] = (axis == Z_AXIS ? delta_height + soft_endstop[axis].min = base_min_pos(axis); + soft_endstop[axis].max = (axis == Z_AXIS ? delta_height #if HAS_BED_PROBE - zprobe_zoffset #endif @@ -530,31 +507,96 @@ void clean_up_after_endstop_or_probe_move() { 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); + delta_max_radius = MIN(ABS(MAX(soft_endstop[X_AXIS].min, soft_endstop[Y_AXIS].min)), soft_endstop[X_AXIS].max, soft_endstop[Y_AXIS].max); + delta_max_radius_2 = sq(delta_max_radius); break; case Z_AXIS: - delta_clip_start_height = soft_endstop_max[axis] - delta_safe_distance_from_top(); + delta_clip_start_height = soft_endstop[axis].max - delta_safe_distance_from_top(); default: break; } + #elif HAS_HOTEND_OFFSET + + // Software endstops are relative to the tool 0 workspace, so + // the movement limits must be shifted by the tool offset to + // retain the same physical limit when other tools are selected. + if (old_tool_index != new_tool_index) { + const float offs = hotend_offset[axis][new_tool_index] - hotend_offset[axis][old_tool_index]; + soft_endstop[axis].min += offs; + soft_endstop[axis].max += offs; + } + else { + const float offs = hotend_offset[axis][active_extruder]; + soft_endstop[axis].min = base_min_pos(axis) + offs; + soft_endstop[axis].max = base_max_pos(axis) + offs; + } + #else - soft_endstop_min[axis] = base_min_pos(axis); - soft_endstop_max[axis] = base_max_pos(axis); + soft_endstop[axis].min = base_min_pos(axis); + soft_endstop[axis].max = 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]); + #if ENABLED(DEBUG_LEVELING_FEATURE) + if (DEBUGGING(LEVELING)) + SERIAL_ECHOLNPAIR("Axis ", axis_codes[axis], " min:", soft_endstop[axis].min, " max:", soft_endstop[axis].max); + #endif +} + + /** + * Constrain the given coordinates to the software endstops. + * + * For DELTA/SCARA the XY constraint is based on the smallest + * radius within the set software endstops. + */ + void apply_motion_limits(float target[XYZ]) { + + if (!soft_endstops_enabled) return; + + #if IS_KINEMATIC + + #if HAS_HOTEND_OFFSET && ENABLED(DELTA) + // The effector center position will be the target minus the hotend offset. + const float offx = hotend_offset[X_AXIS][active_extruder], offy = hotend_offset[Y_AXIS][active_extruder]; + #else + // SCARA needs to consider the angle of the arm through the entire move, so for now use no tool offset. + constexpr float offx = 0, offy = 0; + #endif + + const float dist_2 = HYPOT2(target[X_AXIS] - offx, target[Y_AXIS] - offy); + if (dist_2 > delta_max_radius_2) { + const float ratio = (delta_max_radius) / SQRT(dist_2); // 200 / 300 = 0.66 + target[X_AXIS] *= ratio; + target[Y_AXIS] *= ratio; } + + #else + + #if !HAS_SOFTWARE_ENDSTOPS || ENABLED(MIN_SOFTWARE_ENDSTOP_X) + NOLESS(target[X_AXIS], soft_endstop[X_AXIS].min); + #endif + #if !HAS_SOFTWARE_ENDSTOPS || ENABLED(MAX_SOFTWARE_ENDSTOP_X) + NOMORE(target[X_AXIS], soft_endstop[X_AXIS].max); + #endif + #if !HAS_SOFTWARE_ENDSTOPS || ENABLED(MIN_SOFTWARE_ENDSTOP_Y) + NOLESS(target[Y_AXIS], soft_endstop[Y_AXIS].min); + #endif + #if !HAS_SOFTWARE_ENDSTOPS || ENABLED(MAX_SOFTWARE_ENDSTOP_Y) + NOMORE(target[Y_AXIS], soft_endstop[Y_AXIS].max); + #endif + + #endif + + #if !HAS_SOFTWARE_ENDSTOPS || ENABLED(MIN_SOFTWARE_ENDSTOP_Z) + NOLESS(target[Z_AXIS], soft_endstop[Z_AXIS].min); + #endif + #if !HAS_SOFTWARE_ENDSTOPS || ENABLED(MAX_SOFTWARE_ENDSTOP_Z) + NOMORE(target[Z_AXIS], soft_endstop[Z_AXIS].max); #endif } -#endif +#endif // HAS_SOFTWARE_ENDSTOPS #if !UBL_SEGMENTED #if IS_KINEMATIC @@ -818,9 +860,12 @@ void clean_up_after_endstop_or_probe_move() { #endif // !IS_KINEMATIC #endif // !UBL_SEGMENTED -#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE) - bool extruder_duplication_enabled = false, // Used in Dual X mode 2 & 3 - scaled_duplication_mode = false; // Used in Dual X mode 2 & 3 +#if HAS_DUPLICATION_MODE + bool extruder_duplication_enabled, + mirrored_duplication_mode; + #if ENABLED(MULTI_NOZZLE_DUPLICATION) + uint8_t duplication_e_mask; // = 0 + #endif #endif #if ENABLED(DUAL_X_CARRIAGE) @@ -883,19 +928,12 @@ void clean_up_after_endstop_or_probe_move() { 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) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("Clear active_extruder_parked"); - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Clear active_extruder_parked"); break; - case DXC_SCALED_DUPLICATION_MODE: + case DXC_MIRRORED_MODE: case DXC_DUPLICATION_MODE: if (active_extruder == 0) { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR("Set planner X", inactive_extruder_x_pos); - SERIAL_ECHOLNPAIR(" ... Line to X", current_position[X_AXIS] + duplicate_extruder_x_offset); - } - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Set planner X", inactive_extruder_x_pos, " ... Line to X", current_position[X_AXIS] + duplicate_extruder_x_offset); // move duplicate extruder into correct duplication position. planner.set_position_mm(inactive_extruder_x_pos, current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]); @@ -909,15 +947,9 @@ void clean_up_after_endstop_or_probe_move() { sync_plan_position(); extruder_duplication_enabled = true; active_extruder_parked = false; - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("Set extruder_duplication_enabled\nClear active_extruder_parked"); - #endif - } - else { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("Active extruder not 0"); - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Set extruder_duplication_enabled\nClear active_extruder_parked"); } + else if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Active extruder not 0"); break; } } @@ -937,9 +969,9 @@ void clean_up_after_endstop_or_probe_move() { * before calling or cold/lengthy extrusion may get missed. */ void prepare_move_to_destination() { - clamp_to_software_endstops(destination); + apply_motion_limits(destination); - #if ENABLED(PREVENT_COLD_EXTRUSION) || ENABLED(PREVENT_LENGTHY_EXTRUDE) + #if EITHER(PREVENT_COLD_EXTRUSION, PREVENT_LENGTHY_EXTRUDE) if (!DEBUGGING(DRYRUN)) { if (destination[E_AXIS] != current_position[E_AXIS]) { @@ -982,35 +1014,31 @@ void prepare_move_to_destination() { set_current_from_destination(); } -#if HAS_AXIS_UNHOMED_ERR +bool axis_unhomed_error(const bool x/*=true*/, const bool y/*=true*/, const bool z/*=true*/) { + #if ENABLED(HOME_AFTER_DEACTIVATE) + const bool xx = x && !TEST(axis_known_position, X_AXIS), + yy = y && !TEST(axis_known_position, Y_AXIS), + zz = z && !TEST(axis_known_position, Z_AXIS); + #else + const bool xx = x && !TEST(axis_homed, X_AXIS), + yy = y && !TEST(axis_homed, Y_AXIS), + zz = z && !TEST(axis_homed, Z_AXIS); + #endif + if (xx || yy || zz) { + SERIAL_ECHO_START(); + SERIAL_ECHOPGM(MSG_HOME " "); + if (xx) SERIAL_CHAR('X'); + if (yy) SERIAL_CHAR('Y'); + if (zz) SERIAL_CHAR('Z'); + SERIAL_ECHOLNPGM(" " MSG_FIRST); - bool axis_unhomed_error(const bool x/*=true*/, const bool y/*=true*/, const bool z/*=true*/) { - #if ENABLED(HOME_AFTER_DEACTIVATE) - const bool xx = x && !TEST(axis_known_position, X_AXIS), - yy = y && !TEST(axis_known_position, Y_AXIS), - zz = z && !TEST(axis_known_position, Z_AXIS); - #else - const bool xx = x && !TEST(axis_homed, X_AXIS), - yy = y && !TEST(axis_homed, Y_AXIS), - zz = z && !TEST(axis_homed, Z_AXIS); + #if EITHER(ULTRA_LCD, EXTENSIBLE_UI) + ui.status_printf_P(0, PSTR(MSG_HOME " %s%s%s " MSG_FIRST), xx ? MSG_X : "", yy ? MSG_Y : "", zz ? MSG_Z : ""); #endif - if (xx || yy || zz) { - SERIAL_ECHO_START(); - SERIAL_ECHOPGM(MSG_HOME " "); - if (xx) SERIAL_ECHOPGM(MSG_X); - if (yy) SERIAL_ECHOPGM(MSG_Y); - if (zz) SERIAL_ECHOPGM(MSG_Z); - SERIAL_ECHOLNPGM(" " MSG_FIRST); - - #if ENABLED(ULTRA_LCD) || ENABLED(EXTENSIBLE_UI) - 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; - } - return false; + return true; } - -#endif // HAS_AXIS_UNHOMED_ERR + return false; +} /** * Homing bump feedrate (mm/s) @@ -1138,20 +1166,14 @@ float get_homing_bump_feedrate(const AxisEnum axis) { */ void do_homing_move(const AxisEnum axis, const float distance, const float fr_mm_s=0.0) { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR(">>> do_homing_move(", axis_codes[axis]); - SERIAL_ECHOPAIR(", ", distance); - SERIAL_ECHOPGM(", "); - if (fr_mm_s) - SERIAL_ECHO(fr_mm_s); - else { - SERIAL_ECHOPAIR("[", homing_feedrate(axis)); - SERIAL_CHAR(']'); - } - SERIAL_ECHOLNPGM(")"); - } - #endif + if (DEBUGGING(LEVELING)) { + DEBUG_ECHOPAIR(">>> do_homing_move(", axis_codes[axis], ", ", distance, ", "); + if (fr_mm_s) + DEBUG_ECHO(fr_mm_s); + else + DEBUG_ECHOPAIR("[", homing_feedrate(axis), "]"); + DEBUG_ECHOLNPGM(")"); + } #if HOMING_Z_WITH_PROBE && HAS_HEATED_BED && ENABLED(WAIT_FOR_BED_HEATER) // Wait for bed to heat back up between probing points @@ -1228,13 +1250,7 @@ void do_homing_move(const AxisEnum axis, const float distance, const float fr_mm #endif } - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR("<<< do_homing_move(", axis_codes[axis]); - SERIAL_CHAR(')'); - SERIAL_EOL(); - } - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("<<< do_homing_move(", axis_codes[axis], ")"); } /** @@ -1256,13 +1272,7 @@ void do_homing_move(const AxisEnum axis, const float distance, const float fr_mm * Callers must sync the planner position after calling this! */ void set_axis_is_at_home(const AxisEnum axis) { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR(">>> set_axis_is_at_home(", axis_codes[axis]); - SERIAL_CHAR(')'); - SERIAL_EOL(); - } - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR(">>> set_axis_is_at_home(", axis_codes[axis], ")"); SBI(axis_known_position, axis); SBI(axis_homed, axis); @@ -1300,61 +1310,43 @@ void set_axis_is_at_home(const AxisEnum axis) { current_position[Z_AXIS] -= zprobe_zoffset; - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOLNPGM("*** Z HOMED WITH PROBE (Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) ***"); - SERIAL_ECHOLNPAIR("> zprobe_zoffset = ", zprobe_zoffset); - } - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("*** Z HOMED WITH PROBE (Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) ***\n> zprobe_zoffset = ", zprobe_zoffset); - #elif ENABLED(DEBUG_LEVELING_FEATURE) + #else - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("*** Z HOMED TO ENDSTOP ***"); + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("*** Z HOMED TO ENDSTOP ***"); #endif } #endif - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - #if HAS_HOME_OFFSET - SERIAL_ECHOPAIR("> home_offset[", axis_codes[axis]); - SERIAL_ECHOLNPAIR("] = ", home_offset[axis]); - #endif - DEBUG_POS("", current_position); - SERIAL_ECHOPAIR("<<< set_axis_is_at_home(", axis_codes[axis]); - SERIAL_CHAR(')'); - SERIAL_EOL(); - } - #endif - #if ENABLED(I2C_POSITION_ENCODERS) I2CPEM.homed(axis); #endif + + #if ENABLED(BABYSTEP_DISPLAY_TOTAL) + babystep.reset_total(axis); + #endif + + if (DEBUGGING(LEVELING)) { + #if HAS_HOME_OFFSET + DEBUG_ECHOLNPAIR("> home_offset[", axis_codes[axis], "] = ", home_offset[axis]); + #endif + DEBUG_POS("", current_position); + DEBUG_ECHOLNPAIR("<<< set_axis_is_at_home(", axis_codes[axis], ")"); + } } /** * 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 + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR(">>> set_axis_is_not_at_home(", axis_codes[axis], ")"); 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 (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("<<< set_axis_is_not_at_home(", axis_codes[axis], ")"); #if ENABLED(I2C_POSITION_ENCODERS) I2CPEM.unhomed(axis); @@ -1383,13 +1375,7 @@ void homeaxis(const AxisEnum axis) { if (!CAN_HOME(X) && !CAN_HOME(Y) && !CAN_HOME(Z)) return; #endif - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR(">>> homeaxis(", axis_codes[axis]); - SERIAL_CHAR(')'); - SERIAL_EOL(); - } - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR(">>> homeaxis(", axis_codes[axis], ")"); const int axis_home_dir = ( #if ENABLED(DUAL_X_CARRIAGE) @@ -1421,13 +1407,11 @@ void homeaxis(const AxisEnum axis) { #endif // Fast move towards endstop until triggered - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("Home 1 Fast:"); - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Home 1 Fast:"); #if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH) // BLTOUCH needs to be deployed every time - if (axis == Z_AXIS && set_bltouch_deployed(true)) return; + if (axis == Z_AXIS && bltouch.deploy()) return; #endif do_homing_move(axis, 1.5f * max_length( @@ -1441,7 +1425,7 @@ void homeaxis(const AxisEnum axis) { #if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH) // BLTOUCH needs to be stowed after trigger to rearm itself - if (axis == Z_AXIS) set_bltouch_deployed(false); + if (axis == Z_AXIS) bltouch.stow(); #endif // When homing Z with probe respect probe clearance @@ -1455,9 +1439,7 @@ void homeaxis(const AxisEnum axis) { // If a second homing move is configured... if (bump) { // Move away from the endstop by the axis HOME_BUMP_MM - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("Move Away:"); - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Move Away:"); do_homing_move(axis, -bump #if HOMING_Z_WITH_PROBE , axis == Z_AXIS ? MMM_TO_MMS(Z_PROBE_SPEED_FAST) : 0.0 @@ -1465,20 +1447,18 @@ void homeaxis(const AxisEnum axis) { ); // Slow move towards endstop until triggered - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("Home 2 Slow:"); - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Home 2 Slow:"); #if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH) // BLTOUCH needs to be deployed every time - if (axis == Z_AXIS && set_bltouch_deployed(true)) return; + if (axis == Z_AXIS && bltouch.deploy()) return; #endif do_homing_move(axis, 2 * bump, get_homing_bump_feedrate(axis)); #if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH) // BLTOUCH needs to be stowed after trigger to rearm itself - if (axis == Z_AXIS) set_bltouch_deployed(false); + if (axis == Z_AXIS) bltouch.stow(); #endif } @@ -1593,9 +1573,7 @@ void homeaxis(const AxisEnum axis) { // retrace by the amount specified in delta_endstop_adj + additional dist in order to have minimum steps if (delta_endstop_adj[axis] * Z_HOME_DIR <= 0) { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("delta_endstop_adj:"); - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("delta_endstop_adj:"); do_homing_move(axis, delta_endstop_adj[axis] - (MIN_STEPS_PER_SEGMENT + 1) * planner.steps_to_mm[axis] * Z_HOME_DIR); } @@ -1606,9 +1584,7 @@ void homeaxis(const AxisEnum axis) { destination[axis] = current_position[axis]; - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("> AFTER set_axis_is_at_home", current_position); - #endif + if (DEBUGGING(LEVELING)) DEBUG_POS("> AFTER set_axis_is_at_home", current_position); #endif @@ -1622,25 +1598,14 @@ void homeaxis(const AxisEnum axis) { if (axis == Z_AXIS) fwretract.current_hop = 0.0; #endif - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR("<<< homeaxis(", axis_codes[axis]); - SERIAL_CHAR(')'); - SERIAL_EOL(); - } - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("<<< homeaxis(", axis_codes[axis], ")"); + } // homeaxis() #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]); - SERIAL_ECHOPAIR(" axis:\n home_offset = ", home_offset[axis]); - SERIAL_ECHOLNPAIR("\n position_shift = ", position_shift[axis]); - } - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Axis ", axis_codes[axis], " home_offset = ", home_offset[axis], " position_shift = ", position_shift[axis]); } #endif diff --git a/Marlin/src/module/motion.h b/Marlin/src/module/motion.h index 275fafe74e..2252f4cac9 100644 --- a/Marlin/src/module/motion.h +++ b/Marlin/src/module/motion.h @@ -90,10 +90,6 @@ extern int16_t feedrate_percentage; constexpr uint8_t active_extruder = 0; #endif -#if HAS_HOTEND_OFFSET - extern float hotend_offset[XYZ][HOTENDS]; -#endif - 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); } @@ -115,17 +111,28 @@ XYZ_DEFS(signed char, home_dir, HOME_DIR); #define update_workspace_offset(x) NOOP #endif +#if HAS_HOTEND_OFFSET + extern float hotend_offset[XYZ][HOTENDS]; + void reset_hotend_offsets(); +#else + constexpr float hotend_offset[XYZ][HOTENDS] = { { 0 }, { 0 }, { 0 } }; +#endif + +typedef struct { float min, max; } axis_limits_t; #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); + extern axis_limits_t soft_endstop[XYZ]; + void apply_motion_limits(float target[XYZ]); + void update_software_endstops(const AxisEnum axis + #if HAS_HOTEND_OFFSET + , const uint8_t old_tool_index=0, const uint8_t new_tool_index=0 + #endif + ); #else 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 + //constexpr axis_limits_t soft_endstop[XYZ] = { { X_MIN_POS, X_MAX_POS }, { Y_MIN_POS, Y_MAX_POS }, { Z_MIN_POS, Z_MAX_POS } }; + #define apply_motion_limits(V) NOOP + #define update_software_endstops(...) NOOP #endif void report_current_position(); @@ -186,20 +193,7 @@ void clean_up_after_endstop_or_probe_move(); // Homing // -#define HAS_AXIS_UNHOMED_ERR ( \ - ENABLED(Z_PROBE_ALLEN_KEY) \ - || ENABLED(Z_PROBE_SLED) \ - || HAS_PROBING_PROCEDURE \ - || HOTENDS > 1 \ - || ENABLED(NOZZLE_CLEAN_FEATURE) \ - || ENABLED(NOZZLE_PARK_FEATURE) \ - || (ENABLED(ADVANCED_PAUSE_FEATURE) && ENABLED(HOME_BEFORE_FILAMENT_CHANGE)) \ - || HAS_M206_COMMAND \ - ) || ENABLED(NO_MOTION_BEFORE_HOMING) - -#if HAS_AXIS_UNHOMED_ERR - bool axis_unhomed_error(const bool x=true, const bool y=true, const bool z=true); -#endif +bool axis_unhomed_error(const bool x=true, const bool y=true, const bool z=true); #if ENABLED(NO_MOTION_BEFORE_HOMING) #define MOTION_CONDITIONS (IsRunning() && !axis_unhomed_error()) @@ -319,11 +313,14 @@ void homeaxis(const AxisEnum axis); #endif /** - * Dual X Carriage / Dual Nozzle + * Duplication mode */ -#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE) +#if HAS_DUPLICATION_MODE extern bool extruder_duplication_enabled, // Used in Dual X mode 2 - scaled_duplication_mode; // Used in Dual X mode 3 + mirrored_duplication_mode; // Used in Dual X mode 3 + #if ENABLED(MULTI_NOZZLE_DUPLICATION) + extern uint8_t duplication_e_mask; + #endif #endif /** @@ -335,16 +332,16 @@ void homeaxis(const AxisEnum axis); DXC_FULL_CONTROL_MODE, DXC_AUTO_PARK_MODE, DXC_DUPLICATION_MODE, - DXC_SCALED_DUPLICATION_MODE + DXC_MIRRORED_MODE }; extern DualXMode dual_x_carriage_mode; - extern float inactive_extruder_x_pos, // used in mode 0 & 1 - raised_parked_position[XYZE], // used in mode 1 - duplicate_extruder_x_offset; // used in mode 2 & 3 - extern bool active_extruder_parked; // used in mode 1, 2 & 3 - extern millis_t delayed_move_time; // used in mode 1 - extern int16_t duplicate_extruder_temp_offset; // used in mode 2 & 3 + extern float inactive_extruder_x_pos, // Used in mode 0 & 1 + raised_parked_position[XYZE], // Used in mode 1 + duplicate_extruder_x_offset; // Used in mode 2 & 3 + extern bool active_extruder_parked; // Used in mode 1, 2 & 3 + extern millis_t delayed_move_time; // Used in mode 1 + extern int16_t duplicate_extruder_temp_offset; // Used in mode 2 & 3 FORCE_INLINE bool dxc_is_duplicating() { return dual_x_carriage_mode >= DXC_DUPLICATION_MODE; } @@ -352,7 +349,7 @@ void homeaxis(const AxisEnum axis); FORCE_INLINE int x_home_dir(const uint8_t extruder) { return extruder ? X2_HOME_DIR : X_HOME_DIR; } -#elif ENABLED(DUAL_NOZZLE_DUPLICATION_MODE) +#elif ENABLED(MULTI_NOZZLE_DUPLICATION) enum DualXMode : char { DXC_DUPLICATION_MODE = 2 diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index f6d581a6b9..ff4f13e1d7 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -128,7 +128,7 @@ float Planner::steps_to_mm[XYZE_N]; // (mm) Millimeters per step #endif #endif #if HAS_CLASSIC_JERK - #if ENABLED(JUNCTION_DEVIATION) && ENABLED(LIN_ADVANCE) + #if BOTH(JUNCTION_DEVIATION, LIN_ADVANCE) float Planner::max_jerk[XYZ]; // (mm/s^2) M205 XYZ - The largest speed change requiring no acceleration. #else float Planner::max_jerk[XYZE]; // (mm/s^2) M205 XYZE - The largest speed change requiring no acceleration. @@ -1264,6 +1264,7 @@ void Planner::check_axes_activity() { #endif #if ENABLED(FAN_SOFT_PWM) + #if HAS_FAN0 thermalManager.soft_pwm_amount_fan[0] = CALC_FAN_SPEED(0); #endif @@ -1273,7 +1274,21 @@ void Planner::check_axes_activity() { #if HAS_FAN2 thermalManager.soft_pwm_amount_fan[2] = CALC_FAN_SPEED(2); #endif + + #elif ENABLED(FAST_PWM_FAN) + + #if HAS_FAN0 + set_pwm_duty(FAN_PIN, CALC_FAN_SPEED(0)); + #endif + #if HAS_FAN1 + set_pwm_duty(FAN1_PIN, CALC_FAN_SPEED(1)); + #endif + #if HAS_FAN2 + set_pwm_duty(FAN2_PIN, CALC_FAN_SPEED(2)); + #endif + #else + #if HAS_FAN0 analogWrite(FAN_PIN, CALC_FAN_SPEED(0)); #endif @@ -1557,13 +1572,14 @@ void Planner::synchronize() { */ #if ENABLED(BACKLASH_COMPENSATION) #if ENABLED(BACKLASH_GCODE) - extern float backlash_distance_mm[], backlash_correction; + extern float backlash_distance_mm[]; + extern uint8_t backlash_correction; #ifdef BACKLASH_SMOOTHING_MM extern float backlash_smoothing_mm; #endif #else constexpr float backlash_distance_mm[XYZ] = BACKLASH_DISTANCE_MM, - backlash_correction = BACKLASH_CORRECTION; + constexpr uint8_t backlash_correction = BACKLASH_CORRECTION * 255; #ifdef BACKLASH_SMOOTHING_MM constexpr float backlash_smoothing_mm = BACKLASH_SMOOTHING_MM; #endif @@ -1597,13 +1613,15 @@ void Planner::synchronize() { if (!changed_dir) return; #endif + const float f_corr = float(backlash_correction) / 255.0f; + LOOP_XYZ(axis) { if (backlash_distance_mm[axis]) { const bool reversing = TEST(dm,axis); // When an axis changes direction, add axis backlash to the residual error if (TEST(changed_dir, axis)) - residual_error[axis] += backlash_correction * (reversing ? -1.0f : 1.0f) * backlash_distance_mm[axis] * planner.settings.axis_steps_per_mm[axis]; + residual_error[axis] += (reversing ? -f_corr : f_corr) * backlash_distance_mm[axis] * planner.settings.axis_steps_per_mm[axis]; // Decide how much of the residual error to correct in this segment int32_t error_correction = residual_error[axis]; @@ -1614,7 +1632,7 @@ void Planner::synchronize() { if (reversing == (error_correction < 0)) { if (segment_proportion == 0) segment_proportion = MIN(1.0f, block->millimeters / backlash_smoothing_mm); - error_correction *= segment_proportion; + error_correction = ceil(segment_proportion * error_correction); } else error_correction = 0; // Don't take up any backlash in this segment, as it would subtract steps @@ -1736,7 +1754,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, SERIAL_ECHOLNPGM(" steps)"); //*/ - #if ENABLED(PREVENT_COLD_EXTRUSION) || ENABLED(PREVENT_LENGTHY_EXTRUDE) + #if EITHER(PREVENT_COLD_EXTRUSION, PREVENT_LENGTHY_EXTRUDE) if (de) { #if ENABLED(PREVENT_COLD_EXTRUSION) if (thermalManager.tooColdToExtrude(extruder)) { @@ -1981,7 +1999,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, #endif // EXTRUDERS > 1 enable_E0(); g_uc_extruder_last_move[0] = (BLOCK_BUFFER_SIZE) * 2; - #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE) + #if HAS_DUPLICATION_MODE if (extruder_duplication_enabled) { enable_E1(); g_uc_extruder_last_move[1] = (BLOCK_BUFFER_SIZE) * 2; @@ -2089,7 +2107,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, const uint8_t moves_queued = nonbusy_movesplanned(); // Slow down when the buffer starts to empty, rather than wait at the corner for a buffer refill - #if ENABLED(SLOWDOWN) || ENABLED(ULTRA_LCD) || defined(XY_FREQUENCY_LIMIT) + #if EITHER(SLOWDOWN, ULTRA_LCD) || defined(XY_FREQUENCY_LIMIT) // Segment time im micro seconds uint32_t segment_time_us = LROUND(1000000.0f / inverse_secs); #endif @@ -2157,7 +2175,7 @@ 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) { - #if ENABLED(MIXING_EXTRUDER) && ENABLED(RETRACT_SYNC_MIXING) + #if BOTH(MIXING_EXTRUDER, 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; @@ -2470,7 +2488,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, float safe_speed = nominal_speed; uint8_t limited = 0; - #if ENABLED(JUNCTION_DEVIATION) && ENABLED(LIN_ADVANCE) + #if BOTH(JUNCTION_DEVIATION, LIN_ADVANCE) LOOP_XYZ(i) #else LOOP_XYZE(i) @@ -2507,7 +2525,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, // Now limit the jerk in all axes. const float smaller_speed_factor = vmax_junction / previous_nominal_speed; - #if ENABLED(JUNCTION_DEVIATION) && ENABLED(LIN_ADVANCE) + #if BOTH(JUNCTION_DEVIATION, LIN_ADVANCE) LOOP_XYZ(axis) #else LOOP_XYZE(axis) @@ -2878,7 +2896,7 @@ void Planner::reset_acceleration_rates() { if (AXIS_CONDITION) NOLESS(highest_rate, max_acceleration_steps_per_s2[i]); } cutoff_long = 4294967295UL / highest_rate; // 0xFFFFFFFFUL - #if ENABLED(JUNCTION_DEVIATION) && ENABLED(LIN_ADVANCE) + #if BOTH(JUNCTION_DEVIATION, LIN_ADVANCE) recalculate_max_e_jerk(); #endif } diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index 44be1413cc..a95c3f2605 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -159,7 +159,7 @@ typedef struct block_t { } block_t; -#define HAS_POSITION_FLOAT (ENABLED(LIN_ADVANCE) || ENABLED(SCARA_FEEDRATE_SCALING) || ENABLED(GRADIENT_MIX)) +#define HAS_POSITION_FLOAT ANY(LIN_ADVANCE, SCARA_FEEDRATE_SCALING, GRADIENT_MIX) #define BLOCK_MOD(n) ((n)&(BLOCK_BUFFER_SIZE-1)) @@ -253,7 +253,7 @@ class Planner { #if HAS_CLASSIC_JERK static float max_jerk[ - #if ENABLED(JUNCTION_DEVIATION) && ENABLED(LIN_ADVANCE) + #if BOTH(JUNCTION_DEVIATION, LIN_ADVANCE) XYZ // (mm/s^2) M205 XYZ - The largest speed change requiring no acceleration. #else XYZE // (mm/s^2) M205 XYZE - The largest speed change requiring no acceleration. @@ -861,7 +861,7 @@ class Planner { static void autotemp_M104_M109(); #endif - #if ENABLED(JUNCTION_DEVIATION) && ENABLED(LIN_ADVANCE) + #if BOTH(JUNCTION_DEVIATION, LIN_ADVANCE) FORCE_INLINE static void recalculate_max_e_jerk() { #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) diff --git a/Marlin/src/module/planner_bezier.cpp b/Marlin/src/module/planner_bezier.cpp index 56bcb2d2d4..e27c87ee7d 100644 --- a/Marlin/src/module/planner_bezier.cpp +++ b/Marlin/src/module/planner_bezier.cpp @@ -188,7 +188,7 @@ void cubic_b_spline(const float position[NUM_AXIS], const float target[NUM_AXIS] // not linear in the distance. bez_target[Z_AXIS] = interp(position[Z_AXIS], target[Z_AXIS], t); bez_target[E_AXIS] = interp(position[E_AXIS], target[E_AXIS], t); - clamp_to_software_endstops(bez_target); + apply_motion_limits(bez_target); #if HAS_LEVELING && !PLANNER_LEVELING float pos[XYZE] = { bez_target[X_AXIS], bez_target[Y_AXIS], bez_target[Z_AXIS], bez_target[E_AXIS] }; diff --git a/Marlin/src/module/printcounter.cpp b/Marlin/src/module/printcounter.cpp index 0dc6aead36..4fa3e501f3 100644 --- a/Marlin/src/module/printcounter.cpp +++ b/Marlin/src/module/printcounter.cpp @@ -185,51 +185,32 @@ void PrintCounter::showStats() { char buffer[21]; SERIAL_ECHOPGM(MSG_STATS); + SERIAL_ECHOLNPAIR( + "Prints: ", data.totalPrints, + ", Finished: ", data.finishedPrints, + ", Failed: ", data.totalPrints - data.finishedPrints + - ((isRunning() || isPaused()) ? 1 : 0) // Remove 1 from failures with an active counter + ); - SERIAL_ECHOPGM("Prints: "); - SERIAL_ECHO(data.totalPrints); - - SERIAL_ECHOPGM(", Finished: "); - SERIAL_ECHO(data.finishedPrints); - - SERIAL_ECHOPGM(", Failed: "); // Note: Removes 1 from failures with an active counter - SERIAL_ECHO(data.totalPrints - data.finishedPrints - - ((isRunning() || isPaused()) ? 1 : 0)); - - SERIAL_EOL(); SERIAL_ECHOPGM(MSG_STATS); - duration_t elapsed = data.printTime; elapsed.toString(buffer); - - SERIAL_ECHOPGM("Total time: "); - SERIAL_ECHO(buffer); - + SERIAL_ECHOPAIR("Total time: ", buffer); #if ENABLED(DEBUG_PRINTCOUNTER) - SERIAL_ECHOPGM(" ("); - SERIAL_ECHO(data.printTime); + SERIAL_ECHOPAIR(" (", data.printTime); SERIAL_CHAR(')'); #endif elapsed = data.longestPrint; elapsed.toString(buffer); - - SERIAL_ECHOPGM(", Longest job: "); - SERIAL_ECHO(buffer); - + SERIAL_ECHOPAIR(", Longest job: ", buffer); #if ENABLED(DEBUG_PRINTCOUNTER) - SERIAL_ECHOPGM(" ("); - SERIAL_ECHO(data.longestPrint); + SERIAL_ECHOPAIR(" (", data.longestPrint); SERIAL_CHAR(')'); #endif - SERIAL_EOL(); - SERIAL_ECHOPGM(MSG_STATS); - - SERIAL_ECHOPGM("Filament used: "); - SERIAL_ECHO(data.filamentUsed / 1000); + SERIAL_ECHOPAIR("\n" MSG_STATS "Filament used: ", data.filamentUsed / 1000); SERIAL_CHAR('m'); - SERIAL_EOL(); #if SERVICE_INTERVAL_1 > 0 diff --git a/Marlin/src/module/printcounter.h b/Marlin/src/module/printcounter.h index cd947f1092..089c385e33 100644 --- a/Marlin/src/module/printcounter.h +++ b/Marlin/src/module/printcounter.h @@ -28,7 +28,7 @@ // Print debug messages with M111 S2 //#define DEBUG_PRINTCOUNTER -#if ENABLED(I2C_EEPROM) || ENABLED(SPI_EEPROM) +#if EITHER(I2C_EEPROM, SPI_EEPROM) // round up address to next page boundary (assuming 32 byte pages) #define STATS_EEPROM_ADDRESS 0x40 #else @@ -57,7 +57,7 @@ class PrintCounter: public Stopwatch { private: typedef Stopwatch super; - #if ENABLED(I2C_EEPROM) || ENABLED(SPI_EEPROM) || defined(CPU_32_BIT) + #if EITHER(I2C_EEPROM, SPI_EEPROM) || defined(CPU_32_BIT) typedef uint32_t eeprom_address_t; #else typedef uint16_t eeprom_address_t; diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index ee6bff24ca..f32b5ae4d0 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -38,7 +38,7 @@ #include "../gcode/gcode.h" #include "../lcd/ultralcd.h" -#if ENABLED(BLTOUCH) || ENABLED(Z_PROBE_SLED) || ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(PROBE_TRIGGERED_WHEN_STOWED_TEST) || (QUIET_PROBING && ENABLED(PROBING_STEPPERS_OFF)) +#if ANY(Z_PROBE_SLED, Z_PROBE_ALLEN_KEY, PROBE_TRIGGERED_WHEN_STOWED_TEST) || (QUIET_PROBING && ENABLED(PROBING_STEPPERS_OFF)) #include "../Marlin.h" // for stop(), disable_e_steppers #endif @@ -56,6 +56,10 @@ float zprobe_zoffset; // Initialized by settings.load() +#if ENABLED(BLTOUCH) + #include "../feature/bltouch.h" +#endif + #if HAS_Z_SERVO_PROBE #include "servo.h" #endif @@ -69,6 +73,9 @@ float zprobe_zoffset; // Initialized by settings.load() #include "stepper_indirection.h" #endif +#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) +#include "../core/debug_out.h" + #if ENABLED(Z_PROBE_SLED) #ifndef SLED_DOCKING_OFFSET @@ -82,13 +89,7 @@ float zprobe_zoffset; // Initialized by settings.load() * If true, move to MAX_X and release the solenoid */ static void dock_sled(bool stow) { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR("dock_sled(", stow); - SERIAL_CHAR(')'); - SERIAL_EOL(); - } - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("dock_sled(", stow, ")"); // Dock sled a bit closer to ensure proper capturing do_blocking_move_to_x(X_MAX_POS + SLED_DOCKING_OFFSET - ((stow) ? 1 : 0)); @@ -292,54 +293,11 @@ float zprobe_zoffset; // Initialized by settings.load() } #endif // QUIET_PROBING -#if ENABLED(BLTOUCH) - - void bltouch_command(const int angle) { - MOVE_SERVO(Z_PROBE_SERVO_NR, angle); // Give the BL-Touch the command and wait - safe_delay(BLTOUCH_DELAY); - } - - bool set_bltouch_deployed(const bool deploy) { - if (deploy && TEST_BLTOUCH()) { // If BL-Touch says it's triggered - bltouch_command(BLTOUCH_RESET); // try to reset it. - bltouch_command(BLTOUCH_DEPLOY); // Also needs to deploy and stow to - bltouch_command(BLTOUCH_STOW); // clear the triggered condition. - safe_delay(1500); // Wait for internal self-test to complete. - // (Measured completion time was 0.65 seconds - // after reset, deploy, and stow sequence) - if (TEST_BLTOUCH()) { // If it still claims to be triggered... - SERIAL_ERROR_MSG(MSG_STOP_BLTOUCH); - stop(); // punt! - return true; - } - } - - bltouch_command(deploy ? BLTOUCH_DEPLOY : BLTOUCH_STOW); - - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR("set_bltouch_deployed(", deploy); - SERIAL_CHAR(')'); - SERIAL_EOL(); - } - #endif - - return false; - } - -#endif // BLTOUCH - /** * Raise Z to a minimum height to make room for a probe to move */ inline void do_probe_raise(const float z_raise) { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR("do_probe_raise(", z_raise); - SERIAL_CHAR(')'); - SERIAL_EOL(); - } - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("do_probe_raise(", z_raise, ")"); float z_dest = z_raise; if (zprobe_zoffset < 0) z_dest -= zprobe_zoffset; @@ -405,12 +363,10 @@ FORCE_INLINE void probe_specific_action(const bool deploy) { // returns false for ok and true for failure bool set_probe_deployed(const bool deploy) { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - DEBUG_POS("set_probe_deployed", current_position); - SERIAL_ECHOLNPAIR("deploy: ", deploy); - } - #endif + if (DEBUGGING(LEVELING)) { + DEBUG_POS("set_probe_deployed", current_position); + DEBUG_ECHOLNPAIR("deploy: ", deploy); + } if (endstops.z_probe_enabled == deploy) return false; @@ -433,7 +389,7 @@ bool set_probe_deployed(const bool deploy) { if (deploy_stow_condition && unknown_condition) do_probe_raise(MAX(Z_CLEARANCE_BETWEEN_PROBES, Z_CLEARANCE_DEPLOY_PROBE)); - #if ENABLED(Z_PROBE_SLED) || ENABLED(Z_PROBE_ALLEN_KEY) + #if EITHER(Z_PROBE_SLED, Z_PROBE_ALLEN_KEY) #if ENABLED(Z_PROBE_SLED) #define _AUE_ARGS true, false, false #else @@ -533,9 +489,7 @@ bool set_probe_deployed(const bool deploy) { #endif static bool do_probe_move(const float z, const float fr_mm_s) { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS(">>> do_probe_move", current_position); - #endif + if (DEBUGGING(LEVELING)) DEBUG_POS(">>> do_probe_move", current_position); #if HAS_HEATED_BED && ENABLED(WAIT_FOR_BED_HEATER) // Wait for bed to heat back up between probing points @@ -549,7 +503,7 @@ static bool do_probe_move(const float z, const float fr_mm_s) { // Deploy BLTouch at the start of any probe #if ENABLED(BLTOUCH) - if (set_bltouch_deployed(true)) return true; + if (bltouch.deploy()) return true; #endif // Disable stealthChop if used. Enable diag1 pin on driver. @@ -572,7 +526,7 @@ static bool do_probe_move(const float z, const float fr_mm_s) { // Check to see if the probe was triggered const bool probe_triggered = - #if ENABLED(DELTA) && ENABLED(SENSORLESS_PROBING) + #if BOTH(DELTA, SENSORLESS_PROBING) endstops.trigger_state() & (_BV(X_MIN) | _BV(Y_MIN) | _BV(Z_MIN)) #else TEST(endstops.trigger_state(), @@ -601,7 +555,7 @@ static bool do_probe_move(const float z, const float fr_mm_s) { // Retract BLTouch immediately after a probe if it was triggered #if ENABLED(BLTOUCH) - if (probe_triggered && set_bltouch_deployed(false)) return true; + if (probe_triggered && bltouch.stow()) return true; #endif // Clear endstop flags @@ -613,9 +567,7 @@ static bool do_probe_move(const float z, const float fr_mm_s) { // Tell the planner where we actually are sync_plan_position(); - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("<<< do_probe_move", current_position); - #endif + if (DEBUGGING(LEVELING)) DEBUG_POS("<<< do_probe_move", current_position); return !probe_triggered; } @@ -628,9 +580,7 @@ static bool do_probe_move(const float z, const float fr_mm_s) { */ static float run_z_probe() { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS(">>> run_z_probe", current_position); - #endif + if (DEBUGGING(LEVELING)) DEBUG_POS(">>> run_z_probe", current_position); // Stop the probe before it goes too low to prevent damage. // If Z isn't known then probe to -10mm. @@ -641,20 +591,16 @@ static float run_z_probe() { // Do a first probe at the fast speed if (do_probe_move(z_probe_low_point, MMM_TO_MMS(Z_PROBE_SPEED_FAST))) { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOLNPGM("FAST Probe fail!"); - DEBUG_POS("<<< run_z_probe", current_position); - } - #endif + if (DEBUGGING(LEVELING)) { + DEBUG_ECHOLNPGM("FAST Probe fail!"); + DEBUG_POS("<<< run_z_probe", current_position); + } return NAN; } float first_probe_z = current_position[Z_AXIS]; - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPAIR("1st Probe Z:", first_probe_z); - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("1st Probe Z:", first_probe_z); // 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)); @@ -678,12 +624,10 @@ static float run_z_probe() { // move down slowly to find bed if (do_probe_move(z_probe_low_point, MMM_TO_MMS(Z_PROBE_SPEED_SLOW))) { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOLNPGM("SLOW Probe fail!"); - DEBUG_POS("<<< run_z_probe", current_position); - } - #endif + if (DEBUGGING(LEVELING)) { + DEBUG_ECHOLNPGM("SLOW Probe fail!"); + DEBUG_POS("<<< run_z_probe", current_position); + } return NAN; } @@ -706,12 +650,7 @@ static float run_z_probe() { const float z2 = current_position[Z_AXIS]; - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR("2nd Probe Z:", z2); - SERIAL_ECHOLNPAIR(" Discrepancy:", first_probe_z - z2); - } - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("2nd Probe Z:", z2, " Discrepancy:", first_probe_z - z2); // Return a weighted average of the fast and slow probes const float measured_z = (z2 * 3.0 + first_probe_z * 2.0) * 0.2; @@ -723,9 +662,7 @@ static float run_z_probe() { #endif - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("<<< run_z_probe", current_position); - #endif + if (DEBUGGING(LEVELING)) DEBUG_POS("<<< run_z_probe", current_position); return measured_z; } @@ -740,17 +677,15 @@ static float run_z_probe() { * - Return the probed Z position */ float probe_pt(const float &rx, const float &ry, const ProbePtRaise raise_after/*=PROBE_PT_NONE*/, const uint8_t verbose_level/*=0*/, const bool probe_relative/*=true*/) { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR(">>> probe_pt(", LOGICAL_X_POSITION(rx)); - SERIAL_ECHOPAIR(", ", LOGICAL_Y_POSITION(ry)); - SERIAL_ECHOPAIR(", ", raise_after == PROBE_PT_RAISE ? "raise" : raise_after == PROBE_PT_STOW ? "stow" : "none"); - SERIAL_ECHOPAIR(", ", int(verbose_level)); - SERIAL_ECHOPAIR(", ", probe_relative ? "probe" : "nozzle"); - SERIAL_ECHOLNPGM("_relative)"); - DEBUG_POS("", current_position); - } - #endif + if (DEBUGGING(LEVELING)) { + DEBUG_ECHOLNPAIR( + ">>> probe_pt(", LOGICAL_X_POSITION(rx), ", ", LOGICAL_Y_POSITION(ry), + ", ", raise_after == PROBE_PT_RAISE ? "raise" : raise_after == PROBE_PT_STOW ? "stow" : "none", + ", ", int(verbose_level), + ", ", probe_relative ? "probe" : "nozzle", "_relative)" + ); + DEBUG_POS("", current_position); + } // TODO: Adapt for SCARA, where the offset rotates float nx = rx, ny = ry; @@ -801,9 +736,7 @@ float probe_pt(const float &rx, const float &ry, const ProbePtRaise raise_after/ SERIAL_ERROR_MSG(MSG_ERR_PROBING_FAILED); } - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("<<< probe_pt"); - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< probe_pt"); return measured_z; } diff --git a/Marlin/src/module/probe.h b/Marlin/src/module/probe.h index 8167fdd65d..4bf6941719 100644 --- a/Marlin/src/module/probe.h +++ b/Marlin/src/module/probe.h @@ -57,13 +57,3 @@ #if QUIET_PROBING void probing_pause(const bool p); #endif - -#if ENABLED(BLTOUCH) - void bltouch_command(int angle); - bool set_bltouch_deployed(const bool deploy); - FORCE_INLINE void bltouch_init() { - // Make sure any BLTouch error condition is cleared - bltouch_command(BLTOUCH_RESET); - set_bltouch_deployed(false); - } -#endif diff --git a/Marlin/src/module/scara.cpp b/Marlin/src/module/scara.cpp index 75c6f97eb8..19b9c7343c 100644 --- a/Marlin/src/module/scara.cpp +++ b/Marlin/src/module/scara.cpp @@ -45,8 +45,7 @@ void scara_set_axis_is_at_home(const AxisEnum axis) { float homeposition[XYZ]; LOOP_XYZ(i) homeposition[i] = base_home_pos((AxisEnum)i); - // SERIAL_ECHOPAIR("homeposition X:", homeposition[X_AXIS]); - // SERIAL_ECHOLNPAIR(" Y:", homeposition[Y_AXIS]); + // SERIAL_ECHOLNPAIR("homeposition X:", homeposition[X_AXIS], " Y:", homeposition[Y_AXIS]); /** * Get Home position SCARA arm angles using inverse kinematics, @@ -55,8 +54,7 @@ void scara_set_axis_is_at_home(const AxisEnum axis) { inverse_kinematics(homeposition); forward_kinematics_SCARA(delta[A_AXIS], delta[B_AXIS]); - // SERIAL_ECHOPAIR("Cartesian X:", cartes[X_AXIS]); - // SERIAL_ECHOLNPAIR(" Y:", cartes[Y_AXIS]); + // SERIAL_ECHOLNPAIR("Cartesian X:", cartes[X_AXIS], " Y:", cartes[Y_AXIS]); current_position[axis] = cartes[axis]; @@ -80,14 +78,15 @@ void forward_kinematics_SCARA(const float &a, const float &b) { cartes[Y_AXIS] = a_sin + b_sin + SCARA_OFFSET_Y; //theta+phi /* - SERIAL_ECHOPAIR("SCARA FK Angle a=", a); - SERIAL_ECHOPAIR(" b=", b); - SERIAL_ECHOPAIR(" a_sin=", a_sin); - SERIAL_ECHOPAIR(" a_cos=", a_cos); - SERIAL_ECHOPAIR(" b_sin=", b_sin); - SERIAL_ECHOLNPAIR(" b_cos=", b_cos); - SERIAL_ECHOPAIR(" cartes[X_AXIS]=", cartes[X_AXIS]); - SERIAL_ECHOLNPAIR(" cartes[Y_AXIS]=", cartes[Y_AXIS]); + SERIAL_ECHOLNPAIR( + "SCARA FK Angle a=", a, + " b=", b, + " a_sin=", a_sin, + " a_cos=", a_cos, + " b_sin=", b_sin, + " b_cos=", b_cos + ); + SERIAL_ECHOLNPAIR(" cartes (X,Y) = "(cartes[X_AXIS], ", ", cartes[Y_AXIS], ")"); //*/ } @@ -132,18 +131,12 @@ void inverse_kinematics(const float (&raw)[XYZ]) { /* DEBUG_POS("SCARA IK", raw); DEBUG_POS("SCARA IK", delta); - SERIAL_ECHOPAIR(" SCARA (x,y) ", sx); - SERIAL_ECHOPAIR(",", sy); - SERIAL_ECHOPAIR(" C2=", C2); - SERIAL_ECHOPAIR(" S2=", S2); - SERIAL_ECHOPAIR(" Theta=", THETA); - SERIAL_ECHOLNPAIR(" Phi=", PHI); + SERIAL_ECHOLNPAIR(" SCARA (x,y) ", sx, ",", sy, " C2=", C2, " S2=", S2, " Theta=", THETA, " Phi=", PHI); //*/ } void scara_report_positions() { - SERIAL_ECHOPAIR("SCARA Theta:", planner.get_axis_position_degrees(A_AXIS)); - SERIAL_ECHOLNPAIR(" Psi+Theta:", planner.get_axis_position_degrees(B_AXIS)); + SERIAL_ECHOLNPAIR("SCARA Theta:", planner.get_axis_position_degrees(A_AXIS), " Psi+Theta:", planner.get_axis_position_degrees(B_AXIS)); SERIAL_EOL(); } diff --git a/Marlin/src/module/servo.h b/Marlin/src/module/servo.h index c3bd05b0a1..d417cc877f 100644 --- a/Marlin/src/module/servo.h +++ b/Marlin/src/module/servo.h @@ -44,9 +44,18 @@ #elif ENABLED(SWITCHING_NOZZLE) #define SADATA SWITCHING_NOZZLE_SERVO_ANGLES #define ASRC(N,E) (SWITCHING_NOZZLE_SERVO_NR == N ? asrc[E] : 0) - #elif defined(Z_SERVO_ANGLES) && defined(Z_PROBE_SERVO_NR) - #define SADATA Z_SERVO_ANGLES + #elif defined(Z_PROBE_SERVO_NR) #define ASRC(N,E) (Z_PROBE_SERVO_NR == N ? asrc[E] : 0) + #if ENABLED(BLTOUCH) + #include "../feature/bltouch.h" + #endif + #ifdef BLTOUCH_ANGLES + #define SADATA BLTOUCH_ANGLES + #elif defined(Z_SERVO_ANGLES) + #define SADATA Z_SERVO_ANGLES + #else + #error "Servo angles are needed!" + #endif #endif #if ENABLED(EDITABLE_SERVO_ANGLES) diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 666c9a9c6d..ce3141c12f 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -153,7 +153,7 @@ bool Stepper::abort_current_block; #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) || (ENABLED(Z_STEPPER_AUTO_ALIGN) && ENABLED(Z_TRIPLE_STEPPER_DRIVERS)) +#if ENABLED(Z_TRIPLE_ENDSTOPS) || BOTH(Z_STEPPER_AUTO_ALIGN, Z_TRIPLE_STEPPER_DRIVERS) bool Stepper::locked_Z3_motor = false; #endif @@ -284,22 +284,14 @@ int8_t Stepper::count_direction[NUM_AXIS] = { 0, 0, 0, 0 }; #define X_APPLY_STEP(v,Q) do{ X_STEP_WRITE(v); X2_STEP_WRITE(v); }while(0) #endif #elif ENABLED(DUAL_X_CARRIAGE) - #define X_APPLY_DIR(v,ALWAYS) \ - if (extruder_duplication_enabled || ALWAYS) { \ - X_DIR_WRITE(v); \ - X2_DIR_WRITE(v); \ - } \ - else { \ - if (movement_extruder()) X2_DIR_WRITE(v); else X_DIR_WRITE(v); \ - } - #define X_APPLY_STEP(v,ALWAYS) \ - if (extruder_duplication_enabled || ALWAYS) { \ - X_STEP_WRITE(v); \ - X2_STEP_WRITE(v); \ - } \ - else { \ - if (movement_extruder()) X2_STEP_WRITE(v); else X_STEP_WRITE(v); \ - } + #define X_APPLY_DIR(v,ALWAYS) do{ \ + if (extruder_duplication_enabled || ALWAYS) { X_DIR_WRITE(v); X2_DIR_WRITE(mirrored_duplication_mode ? !(v) : v); } \ + else if (movement_extruder()) X2_DIR_WRITE(v); else X_DIR_WRITE(v); \ + }while(0) + #define X_APPLY_STEP(v,ALWAYS) do{ \ + if (extruder_duplication_enabled || ALWAYS) { X_STEP_WRITE(v); X2_STEP_WRITE(v); } \ + else if (movement_extruder()) X2_STEP_WRITE(v); else X_STEP_WRITE(v); \ + }while(0) #else #define X_APPLY_DIR(v,Q) X_DIR_WRITE(v) #define X_APPLY_STEP(v,Q) X_STEP_WRITE(v) @@ -1246,7 +1238,7 @@ void Stepper::set_directions() { * Directly pulses the stepper motors at high frequency. */ -HAL_STEP_TIMER_ISR { +HAL_STEP_TIMER_ISR() { HAL_timer_isr_prologue(STEP_TIMER_NUM); Stepper::isr(); @@ -1458,7 +1450,7 @@ void Stepper::stepper_pulse_phase_isr() { // Pulse Extruders // Tick the E axis, correct error term and update position - #if ENABLED(LIN_ADVANCE) || ENABLED(MIXING_EXTRUDER) + #if EITHER(LIN_ADVANCE, MIXING_EXTRUDER) delta_error[E_AXIS] += advance_dividend[E_AXIS]; if (delta_error[E_AXIS] >= 0) { count_position[E_AXIS] += count_direction[E_AXIS]; @@ -1687,7 +1679,7 @@ uint32_t Stepper::stepper_block_phase_isr() { * If DeltaA == -DeltaB, the movement is only in the 2nd axis (Y or Z, handled below) * If DeltaA == DeltaB, the movement is only in the 1st axis (X) */ - #if ENABLED(COREXY) || ENABLED(COREXZ) + #if EITHER(COREXY, COREXZ) #define X_CMP == #else #define X_CMP != @@ -1705,7 +1697,7 @@ uint32_t Stepper::stepper_block_phase_isr() { * If DeltaA == DeltaB, the movement is only in the 1st axis (X or Y) * If DeltaA == -DeltaB, the movement is only in the 2nd axis (Y or Z) */ - #if ENABLED(COREYX) || ENABLED(COREYZ) + #if EITHER(COREYX, COREYZ) #define Y_CMP == #else #define Y_CMP != @@ -1723,7 +1715,7 @@ uint32_t Stepper::stepper_block_phase_isr() { * If DeltaA == DeltaB, the movement is only in the 1st axis (X or Y, already handled above) * If DeltaA == -DeltaB, the movement is only in the 2nd axis (Z) */ - #if ENABLED(COREZX) || ENABLED(COREZY) + #if EITHER(COREZX, COREZY) #define Z_CMP == #else #define Z_CMP != @@ -1979,11 +1971,6 @@ bool Stepper::is_block_busy(const block_t* const block) { void Stepper::init() { - // Init Digipot Motor Current - #if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM - digipot_init(); - #endif - #if MB(ALLIGATOR) const float motor_current[] = MOTOR_CURRENT; unsigned int digipot_motor = 0; @@ -2043,7 +2030,7 @@ void Stepper::init() { #if HAS_X_ENABLE X_ENABLE_INIT; if (!X_ENABLE_ON) X_ENABLE_WRITE(HIGH); - #if (ENABLED(DUAL_X_CARRIAGE) || ENABLED(X_DUAL_STEPPER_DRIVERS)) && HAS_X2_ENABLE + #if EITHER(DUAL_X_CARRIAGE, X_DUAL_STEPPER_DRIVERS) && HAS_X2_ENABLE X2_ENABLE_INIT; if (!X_ENABLE_ON) X2_ENABLE_WRITE(HIGH); #endif @@ -2106,7 +2093,7 @@ void Stepper::init() { // Init Step Pins #if HAS_X_STEP - #if ENABLED(X_DUAL_STEPPER_DRIVERS) || ENABLED(DUAL_X_CARRIAGE) + #if EITHER(X_DUAL_STEPPER_DRIVERS, DUAL_X_CARRIAGE) X2_STEP_INIT; X2_STEP_WRITE(INVERT_X_STEP_PIN); #endif @@ -2165,8 +2152,12 @@ void Stepper::init() { | (INVERT_Z_DIR ? _BV(Z_AXIS) : 0); set_directions(); - #if HAS_MOTOR_CURRENT_PWM - initialized = true; + + #if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM + #if HAS_MOTOR_CURRENT_PWM + initialized = true; + #endif + digipot_init(); #endif } @@ -2476,13 +2467,13 @@ void Stepper::report_positions() { if (!initialized) return; LOOP_L_N(i, COUNT(motor_current_setting)) { switch (i) { - #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) || PIN_EXISTS(MOTOR_CURRENT_PWM_X) || PIN_EXISTS(MOTOR_CURRENT_PWM_Y) + #if ANY_PIN(MOTOR_CURRENT_PWM_XY, MOTOR_CURRENT_PWM_X, MOTOR_CURRENT_PWM_Y) case 0: #endif #if PIN_EXISTS(MOTOR_CURRENT_PWM_Z) case 1: #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_E) || PIN_EXISTS(MOTOR_CURRENT_PWM_E0) || PIN_EXISTS(MOTOR_CURRENT_PWM_E1) + #if ANY_PIN(MOTOR_CURRENT_PWM_E, MOTOR_CURRENT_PWM_E0, MOTOR_CURRENT_PWM_E1) case 2: #endif digipot_current(i, motor_current_setting[i]); @@ -2561,25 +2552,25 @@ void Stepper::report_positions() { #elif HAS_MOTOR_CURRENT_PWM #if PIN_EXISTS(MOTOR_CURRENT_PWM_X) - SET_OUTPUT(MOTOR_CURRENT_PWM_X_PIN); + SET_PWM(MOTOR_CURRENT_PWM_X_PIN); #endif #if PIN_EXISTS(MOTOR_CURRENT_PWM_Y) - SET_OUTPUT(MOTOR_CURRENT_PWM_Y_PIN); + SET_PWM(MOTOR_CURRENT_PWM_Y_PIN); #endif #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) - SET_OUTPUT(MOTOR_CURRENT_PWM_XY_PIN); + SET_PWM(MOTOR_CURRENT_PWM_XY_PIN); #endif #if PIN_EXISTS(MOTOR_CURRENT_PWM_Z) - SET_OUTPUT(MOTOR_CURRENT_PWM_Z_PIN); + SET_PWM(MOTOR_CURRENT_PWM_Z_PIN); #endif #if PIN_EXISTS(MOTOR_CURRENT_PWM_E) - SET_OUTPUT(MOTOR_CURRENT_PWM_E_PIN); + SET_PWM(MOTOR_CURRENT_PWM_E_PIN); #endif #if PIN_EXISTS(MOTOR_CURRENT_PWM_E0) - SET_OUTPUT(MOTOR_CURRENT_PWM_E0_PIN); + SET_PWM(MOTOR_CURRENT_PWM_E0_PIN); #endif #if PIN_EXISTS(MOTOR_CURRENT_PWM_E1) - SET_OUTPUT(MOTOR_CURRENT_PWM_E1_PIN); + SET_PWM(MOTOR_CURRENT_PWM_E1_PIN); #endif refresh_motor_power(); diff --git a/Marlin/src/module/stepper.h b/Marlin/src/module/stepper.h index 38f17f498c..46bc9d706a 100644 --- a/Marlin/src/module/stepper.h +++ b/Marlin/src/module/stepper.h @@ -267,7 +267,7 @@ class Stepper { #if Z_MULTI_ENDSTOPS || ENABLED(Z_STEPPER_AUTO_ALIGN) static bool locked_Z_motor, locked_Z2_motor; #endif - #if ENABLED(Z_TRIPLE_ENDSTOPS) || (ENABLED(Z_STEPPER_AUTO_ALIGN) && ENABLED(Z_TRIPLE_STEPPER_DRIVERS)) + #if ENABLED(Z_TRIPLE_ENDSTOPS) || BOTH(Z_STEPPER_AUTO_ALIGN, Z_TRIPLE_STEPPER_DRIVERS) static bool locked_Z3_motor; #endif @@ -423,7 +423,7 @@ class Stepper { 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) || (ENABLED(Z_STEPPER_AUTO_ALIGN) && ENABLED(Z_TRIPLE_STEPPER_DRIVERS)) + #if ENABLED(Z_TRIPLE_ENDSTOPS) || BOTH(Z_STEPPER_AUTO_ALIGN, Z_TRIPLE_STEPPER_DRIVERS) FORCE_INLINE static void set_z3_lock(const bool state) { locked_Z3_motor = state; } #endif diff --git a/Marlin/src/module/stepper_indirection.h b/Marlin/src/module/stepper_indirection.h index eafb0c6eef..39d4fceacb 100644 --- a/Marlin/src/module/stepper_indirection.h +++ b/Marlin/src/module/stepper_indirection.h @@ -593,47 +593,84 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #define E_STEP_WRITE(E,V) E0_STEP_WRITE(V) #define NORM_E_DIR(E) do{ E0_DIR_WRITE(TEST(E, 0) ? !INVERT_E0_DIR: INVERT_E0_DIR); }while(0) #define REV_E_DIR(E) do{ E0_DIR_WRITE(TEST(E, 0) ? INVERT_E0_DIR: !INVERT_E0_DIR); }while(0) -#elif E_STEPPERS > 5 - #define E_STEP_WRITE(E,V) do{ switch (E) { case 0: E0_STEP_WRITE(V); break; case 1: E1_STEP_WRITE(V); break; case 2: E2_STEP_WRITE(V); break; case 3: E3_STEP_WRITE(V); break; case 4: E4_STEP_WRITE(V); case 5: E5_STEP_WRITE(V); } }while(0) - #define NORM_E_DIR(E) do{ switch (E) { case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 2: E2_DIR_WRITE(!INVERT_E2_DIR); break; case 3: E3_DIR_WRITE(!INVERT_E3_DIR); break; case 4: E4_DIR_WRITE(!INVERT_E4_DIR); case 5: E5_DIR_WRITE(!INVERT_E5_DIR); } }while(0) - #define REV_E_DIR(E) do{ switch (E) { case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E1_DIR_WRITE( INVERT_E1_DIR); break; case 2: E2_DIR_WRITE( INVERT_E2_DIR); break; case 3: E3_DIR_WRITE( INVERT_E3_DIR); break; case 4: E4_DIR_WRITE( INVERT_E4_DIR); case 5: E5_DIR_WRITE( INVERT_E5_DIR); } }while(0) -#elif E_STEPPERS > 4 - #define E_STEP_WRITE(E,V) do{ switch (E) { case 0: E0_STEP_WRITE(V); break; case 1: E1_STEP_WRITE(V); break; case 2: E2_STEP_WRITE(V); break; case 3: E3_STEP_WRITE(V); break; case 4: E4_STEP_WRITE(V); } }while(0) - #define NORM_E_DIR(E) do{ switch (E) { case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 2: E2_DIR_WRITE(!INVERT_E2_DIR); break; case 3: E3_DIR_WRITE(!INVERT_E3_DIR); break; case 4: E4_DIR_WRITE(!INVERT_E4_DIR); } }while(0) - #define REV_E_DIR(E) do{ switch (E) { case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E1_DIR_WRITE( INVERT_E1_DIR); break; case 2: E2_DIR_WRITE( INVERT_E2_DIR); break; case 3: E3_DIR_WRITE( INVERT_E3_DIR); break; case 4: E4_DIR_WRITE( INVERT_E4_DIR); } }while(0) -#elif E_STEPPERS > 3 - #define E_STEP_WRITE(E,V) do{ switch (E) { case 0: E0_STEP_WRITE(V); break; case 1: E1_STEP_WRITE(V); break; case 2: E2_STEP_WRITE(V); break; case 3: E3_STEP_WRITE(V); } }while(0) - #define NORM_E_DIR(E) do{ switch (E) { case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 2: E2_DIR_WRITE(!INVERT_E2_DIR); break; case 3: E3_DIR_WRITE(!INVERT_E3_DIR); } }while(0) - #define REV_E_DIR(E) do{ switch (E) { case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E1_DIR_WRITE( INVERT_E1_DIR); break; case 2: E2_DIR_WRITE( INVERT_E2_DIR); break; case 3: E3_DIR_WRITE( INVERT_E3_DIR); } }while(0) -#elif E_STEPPERS > 2 - #define E_STEP_WRITE(E,V) do{ switch (E) { case 0: E0_STEP_WRITE(V); break; case 1: E1_STEP_WRITE(V); break; case 2: E2_STEP_WRITE(V); } }while(0) - #define NORM_E_DIR(E) do{ switch (E) { case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 2: E2_DIR_WRITE(!INVERT_E2_DIR); } }while(0) - #define REV_E_DIR(E) do{ switch (E) { case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E1_DIR_WRITE( INVERT_E1_DIR); break; case 2: E2_DIR_WRITE( INVERT_E2_DIR); } }while(0) + #elif E_STEPPERS > 1 - #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE) - #define E_STEP_WRITE(E,V) do{ if (extruder_duplication_enabled) { E0_STEP_WRITE(V); E1_STEP_WRITE(V); } \ - else if ((E) == 0) { E0_STEP_WRITE(V); } \ - else { E1_STEP_WRITE(V); } }while(0) - - #define NORM_E_DIR(E) do{ if (extruder_duplication_enabled) { E0_DIR_WRITE(!INVERT_E0_DIR); E1_DIR_WRITE(!INVERT_E1_DIR); } \ - else if ((E) == 0) { E0_DIR_WRITE(!INVERT_E0_DIR); } \ - else { E1_DIR_WRITE(!INVERT_E1_DIR); } }while(0) - - #define REV_E_DIR(E) do{ if (extruder_duplication_enabled) { E0_DIR_WRITE( INVERT_E0_DIR); E1_DIR_WRITE( INVERT_E1_DIR); } \ - else if ((E) == 0) { E0_DIR_WRITE( INVERT_E0_DIR); } \ - else { E1_DIR_WRITE( INVERT_E1_DIR); } }while(0) + #if E_STEPPERS > 5 + #define _E_STEP_WRITE(E,V) do{ switch (E) { case 0: E0_STEP_WRITE(V); break; case 1: E1_STEP_WRITE(V); break; case 2: E2_STEP_WRITE(V); break; case 3: E3_STEP_WRITE(V); break; case 4: E4_STEP_WRITE(V); case 5: E5_STEP_WRITE(V); } }while(0) + #define _NORM_E_DIR(E) do{ switch (E) { case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 2: E2_DIR_WRITE(!INVERT_E2_DIR); break; case 3: E3_DIR_WRITE(!INVERT_E3_DIR); break; case 4: E4_DIR_WRITE(!INVERT_E4_DIR); case 5: E5_DIR_WRITE(!INVERT_E5_DIR); } }while(0) + #define _REV_E_DIR(E) do{ switch (E) { case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E1_DIR_WRITE( INVERT_E1_DIR); break; case 2: E2_DIR_WRITE( INVERT_E2_DIR); break; case 3: E3_DIR_WRITE( INVERT_E3_DIR); break; case 4: E4_DIR_WRITE( INVERT_E4_DIR); case 5: E5_DIR_WRITE( INVERT_E5_DIR); } }while(0) + #elif E_STEPPERS > 4 + #define _E_STEP_WRITE(E,V) do{ switch (E) { case 0: E0_STEP_WRITE(V); break; case 1: E1_STEP_WRITE(V); break; case 2: E2_STEP_WRITE(V); break; case 3: E3_STEP_WRITE(V); break; case 4: E4_STEP_WRITE(V); } }while(0) + #define _NORM_E_DIR(E) do{ switch (E) { case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 2: E2_DIR_WRITE(!INVERT_E2_DIR); break; case 3: E3_DIR_WRITE(!INVERT_E3_DIR); break; case 4: E4_DIR_WRITE(!INVERT_E4_DIR); } }while(0) + #define _REV_E_DIR(E) do{ switch (E) { case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E1_DIR_WRITE( INVERT_E1_DIR); break; case 2: E2_DIR_WRITE( INVERT_E2_DIR); break; case 3: E3_DIR_WRITE( INVERT_E3_DIR); break; case 4: E4_DIR_WRITE( INVERT_E4_DIR); } }while(0) + #elif E_STEPPERS > 3 + #define _E_STEP_WRITE(E,V) do{ switch (E) { case 0: E0_STEP_WRITE(V); break; case 1: E1_STEP_WRITE(V); break; case 2: E2_STEP_WRITE(V); break; case 3: E3_STEP_WRITE(V); } }while(0) + #define _NORM_E_DIR(E) do{ switch (E) { case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 2: E2_DIR_WRITE(!INVERT_E2_DIR); break; case 3: E3_DIR_WRITE(!INVERT_E3_DIR); } }while(0) + #define _REV_E_DIR(E) do{ switch (E) { case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E1_DIR_WRITE( INVERT_E1_DIR); break; case 2: E2_DIR_WRITE( INVERT_E2_DIR); break; case 3: E3_DIR_WRITE( INVERT_E3_DIR); } }while(0) + #elif E_STEPPERS > 2 + #define _E_STEP_WRITE(E,V) do{ switch (E) { case 0: E0_STEP_WRITE(V); break; case 1: E1_STEP_WRITE(V); break; case 2: E2_STEP_WRITE(V); } }while(0) + #define _NORM_E_DIR(E) do{ switch (E) { case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 2: E2_DIR_WRITE(!INVERT_E2_DIR); } }while(0) + #define _REV_E_DIR(E) do{ switch (E) { case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E1_DIR_WRITE( INVERT_E1_DIR); break; case 2: E2_DIR_WRITE( INVERT_E2_DIR); } }while(0) #else - #define E_STEP_WRITE(E,V) do{ if (E == 0) { E0_STEP_WRITE(V); } else { E1_STEP_WRITE(V); } }while(0) - #define NORM_E_DIR(E) do{ if (E == 0) { E0_DIR_WRITE(!INVERT_E0_DIR); } else { E1_DIR_WRITE(!INVERT_E1_DIR); } }while(0) - #define REV_E_DIR(E) do{ if (E == 0) { E0_DIR_WRITE( INVERT_E0_DIR); } else { E1_DIR_WRITE( INVERT_E1_DIR); } }while(0) + #define _E_STEP_WRITE(E,V) do{ if (E == 0) { E0_STEP_WRITE(V); } else { E1_STEP_WRITE(V); } }while(0) + #define _NORM_E_DIR(E) do{ if (E == 0) { E0_DIR_WRITE(!INVERT_E0_DIR); } else { E1_DIR_WRITE(!INVERT_E1_DIR); } }while(0) + #define _REV_E_DIR(E) do{ if (E == 0) { E0_DIR_WRITE( INVERT_E0_DIR); } else { E1_DIR_WRITE( INVERT_E1_DIR); } }while(0) #endif + + #if HAS_DUPLICATION_MODE + + #if ENABLED(MULTI_NOZZLE_DUPLICATION) + #define _DUPE(N,T,V) do{ if (TEST(duplication_e_mask, N)) E##N##_##T##_WRITE(V); }while(0) + #else + #define _DUPE(N,T,V) E##N##_##T##_WRITE(V) + #endif + + #define NDIR(N) _DUPE(N,DIR,!INVERT_E##N##_DIR) + #define RDIR(N) _DUPE(N,DIR, INVERT_E##N##_DIR) + + #define E_STEP_WRITE(E,V) do{ if (extruder_duplication_enabled) { DUPE(STEP,V); } else _E_STEP_WRITE(E,V); }while(0) + + #if E_STEPPERS > 2 + #if E_STEPPERS > 5 + #define DUPE(T,V) do{ _DUPE(0,T,V); _DUPE(1,T,V); _DUPE(2,T,V); _DUPE(3,T,V); _DUPE(4,T,V); _DUPE(5,T,V); }while(0) + #define NORM_E_DIR(E) do{ if (extruder_duplication_enabled) { NDIR(0); NDIR(1); NDIR(2); NDIR(3); NDIR(4); NDIR(5); } else _NORM_E_DIR(E); }while(0) + #define REV_E_DIR(E) do{ if (extruder_duplication_enabled) { RDIR(0); RDIR(1); RDIR(2); RDIR(3); RDIR(4); RDIR(5); } else _REV_E_DIR(E); }while(0) + #elif E_STEPPERS > 4 + #define DUPE(T,V) do{ _DUPE(0,T,V); _DUPE(1,T,V); _DUPE(2,T,V); _DUPE(3,T,V); _DUPE(4,T,V); }while(0) + #define NORM_E_DIR(E) do{ if (extruder_duplication_enabled) { NDIR(0); NDIR(1); NDIR(2); NDIR(3); NDIR(4); } else _NORM_E_DIR(E); }while(0) + #define REV_E_DIR(E) do{ if (extruder_duplication_enabled) { RDIR(0); RDIR(1); RDIR(2); RDIR(3); RDIR(4); } else _REV_E_DIR(E); }while(0) + #elif E_STEPPERS > 3 + #define DUPE(T,V) do{ _DUPE(0,T,V); _DUPE(1,T,V); _DUPE(2,T,V); _DUPE(3,T,V); }while(0) + #define NORM_E_DIR(E) do{ if (extruder_duplication_enabled) { NDIR(0); NDIR(1); NDIR(2); NDIR(3); } else _NORM_E_DIR(E); }while(0) + #define REV_E_DIR(E) do{ if (extruder_duplication_enabled) { RDIR(0); RDIR(1); RDIR(2); RDIR(3); } else _REV_E_DIR(E); }while(0) + #else + #define DUPE(T,V) do{ _DUPE(0,T,V); _DUPE(1,T,V); _DUPE(2,T,V); }while(0) + #define NORM_E_DIR(E) do{ if (extruder_duplication_enabled) { NDIR(0); NDIR(1); NDIR(2); } else _NORM_E_DIR(E); }while(0) + #define REV_E_DIR(E) do{ if (extruder_duplication_enabled) { RDIR(0); RDIR(1); RDIR(2); } else _REV_E_DIR(E); }while(0) + #endif + #else + #define DUPE(T,V) do{ _DUPE(0,T,V); _DUPE(1,T,V); } while(0) + #define NORM_E_DIR(E) do{ if (extruder_duplication_enabled) { NDIR(0); NDIR(1); } else _NORM_E_DIR(E); }while(0) + #define REV_E_DIR(E) do{ if (extruder_duplication_enabled) { RDIR(0); RDIR(1); } else _REV_E_DIR(E); }while(0) + #endif + + #else + + #define E_STEP_WRITE(E,V) _E_STEP_WRITE(E,V) + #define NORM_E_DIR(E) _NORM_E_DIR(E) + #define REV_E_DIR(E) _REV_E_DIR(E) + + #endif + #elif E_STEPPERS #define E_STEP_WRITE(E,V) E0_STEP_WRITE(V) #define NORM_E_DIR(E) E0_DIR_WRITE(!INVERT_E0_DIR) #define REV_E_DIR(E) E0_DIR_WRITE( INVERT_E0_DIR) + #else #define E_STEP_WRITE(E,V) NOOP #define NORM_E_DIR(E) NOOP #define REV_E_DIR(E) NOOP + #endif diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 69a8c835fa..d8bf25747e 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -33,18 +33,18 @@ #include "../core/language.h" #include "../HAL/shared/Delay.h" -#define MAX6675_SEPARATE_SPI (ENABLED(HEATER_0_USES_MAX6675) || ENABLED(HEATER_1_USES_MAX6675)) && PIN_EXISTS(MAX6675_SCK) && PIN_EXISTS(MAX6675_DO) +#define MAX6675_SEPARATE_SPI EITHER(HEATER_0_USES_MAX6675, HEATER_1_USES_MAX6675) && PIN_EXISTS(MAX6675_SCK, MAX6675_DO) #if MAX6675_SEPARATE_SPI #include "../libs/private_spi.h" #endif -#if ENABLED(BABYSTEPPING) || ENABLED(PID_EXTRUSION_SCALING) +#if EITHER(BABYSTEPPING, PID_EXTRUSION_SCALING) #include "stepper.h" #endif #if ENABLED(BABYSTEPPING) - #include "../module/motion.h" + #include "../feature/babystep.h" #if ENABLED(BABYSTEP_ALWAYS_AVAILABLE) #include "../gcode/gcode.h" #endif @@ -73,8 +73,8 @@ static void* heater_ttbl_map[2] = { (void*)HEATER_0_TEMPTABLE, (void*)HEATER_1_TEMPTABLE }; static constexpr uint8_t heater_ttbllen_map[2] = { HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN }; #else - static void* heater_ttbl_map[HOTENDS] = ARRAY_BY_HOTENDS((void*)HEATER_0_TEMPTABLE, (void*)HEATER_1_TEMPTABLE, (void*)HEATER_2_TEMPTABLE, (void*)HEATER_3_TEMPTABLE, (void*)HEATER_4_TEMPTABLE); - static constexpr uint8_t heater_ttbllen_map[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN, HEATER_2_TEMPTABLE_LEN, HEATER_3_TEMPTABLE_LEN, HEATER_4_TEMPTABLE_LEN); + static void* heater_ttbl_map[HOTENDS] = ARRAY_BY_HOTENDS((void*)HEATER_0_TEMPTABLE, (void*)HEATER_1_TEMPTABLE, (void*)HEATER_2_TEMPTABLE, (void*)HEATER_3_TEMPTABLE, (void*)HEATER_4_TEMPTABLE, (void*)HEATER_5_TEMPTABLE); + static constexpr uint8_t heater_ttbllen_map[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN, HEATER_2_TEMPTABLE_LEN, HEATER_3_TEMPTABLE_LEN, HEATER_4_TEMPTABLE_LEN, HEATER_5_TEMPTABLE_LEN); #endif #endif @@ -84,24 +84,19 @@ Temperature thermalManager; * Macros to include the heater id in temp errors. The compiler's dead-code * elimination should (hopefully) optimize out the unused strings. */ + #if HAS_HEATED_BED - #define TEMP_ERR_PSTR(MSG, E) \ - (E) == -1 ? PSTR(MSG ## _BED) : \ - (HOTENDS > 1 && (E) == 1) ? PSTR(MSG_E2 " " MSG) : \ - (HOTENDS > 2 && (E) == 2) ? PSTR(MSG_E3 " " MSG) : \ - (HOTENDS > 3 && (E) == 3) ? PSTR(MSG_E4 " " MSG) : \ - (HOTENDS > 4 && (E) == 4) ? PSTR(MSG_E5 " " MSG) : \ - (HOTENDS > 5 && (E) == 5) ? PSTR(MSG_E6 " " MSG) : \ - PSTR(MSG_E1 " " MSG) + #define _BED_PSTR(E) (E) == -1 ? PSTR(MSG ## _BED) : #else - #define TEMP_ERR_PSTR(MSG, E) \ - (HOTENDS > 1 && (E) == 1) ? PSTR(MSG_E2 " " MSG) : \ - (HOTENDS > 2 && (E) == 2) ? PSTR(MSG_E3 " " MSG) : \ - (HOTENDS > 3 && (E) == 3) ? PSTR(MSG_E4 " " MSG) : \ - (HOTENDS > 4 && (E) == 4) ? PSTR(MSG_E5 " " MSG) : \ - (HOTENDS > 5 && (E) == 5) ? PSTR(MSG_E6 " " MSG) : \ - PSTR(MSG_E1 " " MSG) + #define _BED_PSTR(E) #endif +#if HAS_HEATED_CHAMBER + #define _CHAMBER_PSTR(E) (E) == -2 ? PSTR(MSG ## _CHAMBER) : +#else + #define _CHAMBER_PSTR(E) +#endif +#define _E_PSTR(M,E,N) (HOTENDS >= (N) && (E) == (N)-1) ? PSTR(MSG_E##N " " M) : +#define TEMP_ERR_PSTR(M,E) _BED_PSTR(E) _CHAMBER_PSTR(E) _E_PSTR(M,E,2) _E_PSTR(M,E,3) _E_PSTR(M,E,4) _E_PSTR(M,E,5) _E_PSTR(M,E,6) PSTR(MSG_E1 " " M) // public: @@ -109,9 +104,7 @@ Temperature thermalManager; bool Temperature::adaptive_fan_slowing = true; #endif -float Temperature::current_temperature[HOTENDS]; // = { 0.0 }; -int16_t Temperature::current_temperature_raw[HOTENDS], // = { 0 } - Temperature::target_temperature[HOTENDS]; // = { 0 } +hotend_info_t Temperature::temp_hotend[HOTENDS]; // = { 0 } #if ENABLED(AUTO_POWER_E_FANS) uint8_t Temperature::autofan_speed[HOTENDS]; // = { 0 } @@ -188,13 +181,9 @@ int16_t Temperature::current_temperature_raw[HOTENDS], // = { 0 } if (p != fans_paused) { fans_paused = p; if (p) - for (uint8_t x = 0; x < FAN_COUNT; x++) { - paused_fan_speed[x] = fan_speed[x]; - fan_speed[x] = 0; - } + FANS_LOOP(x) { paused_fan_speed[x] = fan_speed[x]; fan_speed[x] = 0; } else - for (uint8_t x = 0; x < FAN_COUNT; x++) - fan_speed[x] = paused_fan_speed[x]; + FANS_LOOP(x) fan_speed[x] = paused_fan_speed[x]; } } @@ -202,51 +191,52 @@ int16_t Temperature::current_temperature_raw[HOTENDS], // = { 0 } #endif // FAN_COUNT > 0 +#if WATCH_HOTENDS + heater_watch_t Temperature::watch_hotend[HOTENDS]; // = { { 0 } } +#endif +#if HEATER_IDLE_HANDLER + heater_idle_t Temperature::hotend_idle[HOTENDS]; // = { { 0 } } +#endif + #if HAS_HEATED_BED - float Temperature::current_temperature_bed = 0.0; - int16_t Temperature::current_temperature_bed_raw = 0, - Temperature::target_temperature_bed = 0; - uint8_t Temperature::soft_pwm_amount_bed; + bed_info_t Temperature::temp_bed; // = { 0 } + // Init min and max temp with extreme values to prevent false errors during startup #ifdef BED_MINTEMP - int16_t Temperature::bed_minttemp_raw = HEATER_BED_RAW_LO_TEMP; + int16_t Temperature::mintemp_raw_BED = HEATER_BED_RAW_LO_TEMP; #endif #ifdef BED_MAXTEMP - int16_t Temperature::bed_maxttemp_raw = HEATER_BED_RAW_HI_TEMP; + int16_t Temperature::maxtemp_raw_BED = HEATER_BED_RAW_HI_TEMP; #endif - #if WATCH_THE_BED - uint16_t Temperature::watch_target_bed_temp = 0; - millis_t Temperature::watch_bed_next_ms = 0; + #if WATCH_BED + heater_watch_t Temperature::watch_bed; // = { 0 } #endif - #if ENABLED(PIDTEMPBED) - PID_t Temperature::bed_pid; // Initialized by settings.load() - #else + #if DISABLED(PIDTEMPBED) millis_t Temperature::next_bed_check_ms; #endif - uint16_t Temperature::raw_temp_bed_value = 0; #if HEATER_IDLE_HANDLER - millis_t Temperature::bed_idle_timeout_ms = 0; - bool Temperature::bed_idle_timeout_exceeded = false; + heater_idle_t Temperature::bed_idle; // = { 0 } #endif #endif // HAS_HEATED_BED #if HAS_TEMP_CHAMBER - float Temperature::current_temperature_chamber = 0.0; - int16_t Temperature::current_temperature_chamber_raw = 0; - uint16_t Temperature::raw_temp_chamber_value = 0; -#endif + chamber_info_t Temperature::temp_chamber; // = { 0 } + #if HAS_HEATED_CHAMBER + #ifdef CHAMBER_MINTEMP + int16_t Temperature::mintemp_raw_CHAMBER = HEATER_CHAMBER_RAW_LO_TEMP; + #endif + #ifdef CHAMBER_MAXTEMP + int16_t Temperature::maxtemp_raw_CHAMBER = HEATER_CHAMBER_RAW_HI_TEMP; + #endif + #if WATCH_CHAMBER + heater_watch_t Temperature::watch_chamber = { 0 }; + millis_t Temperature::next_chamber_check_ms; + #endif + #endif // HAS_HEATED_CHAMBER +#endif // HAS_TEMP_CHAMBER // Initialized by settings.load() #if ENABLED(PIDTEMP) - hotend_pid_t Temperature::pid[HOTENDS]; -#endif - -#if ENABLED(BABYSTEPPING) - volatile int16_t Temperature::babystepsTodo[XYZ] = { 0 }; -#endif - -#if WATCH_HOTENDS - uint16_t Temperature::watch_target_temp[HOTENDS] = { 0 }; - millis_t Temperature::watch_heater_next_ms[HOTENDS] = { 0 }; + //hotend_pid_t Temperature::pid[HOTENDS]; #endif #if ENABLED(PREVENT_COLD_EXTRUSION) @@ -268,18 +258,21 @@ int16_t Temperature::current_temperature_raw[HOTENDS], // = { 0 } volatile bool Temperature::temp_meas_ready = false; #if ENABLED(PID_EXTRUSION_SCALING) - long Temperature::last_e_position; - long Temperature::lpq[LPQ_MAX_LEN]; - int Temperature::lpq_ptr = 0; + int32_t Temperature::last_e_position, Temperature::lpq[LPQ_MAX_LEN]; + lpq_ptr_t Temperature::lpq_ptr = 0; #endif -uint16_t Temperature::raw_temp_value[MAX_EXTRUDERS] = { 0 }; +#define TEMPDIR(N) ((HEATER_##N##_RAW_LO_TEMP) < (HEATER_##N##_RAW_HI_TEMP) ? 1 : -1) -// Init min and max temp with extreme values to prevent false errors during startup -int16_t Temperature::minttemp_raw[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_RAW_LO_TEMP , HEATER_1_RAW_LO_TEMP , HEATER_2_RAW_LO_TEMP, HEATER_3_RAW_LO_TEMP, HEATER_4_RAW_LO_TEMP), - Temperature::maxttemp_raw[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_RAW_HI_TEMP , HEATER_1_RAW_HI_TEMP , HEATER_2_RAW_HI_TEMP, HEATER_3_RAW_HI_TEMP, HEATER_4_RAW_HI_TEMP), - Temperature::minttemp[HOTENDS] = { 0 }, - Temperature::maxttemp[HOTENDS] = ARRAY_BY_HOTENDS1(16383); +// Init mintemp and maxtemp with extreme values to prevent false errors during startup +constexpr temp_range_t sensor_heater_0 { HEATER_0_RAW_LO_TEMP, HEATER_0_RAW_HI_TEMP, 0, 16383 }, + sensor_heater_1 { HEATER_1_RAW_LO_TEMP, HEATER_1_RAW_HI_TEMP, 0, 16383 }, + sensor_heater_2 { HEATER_2_RAW_LO_TEMP, HEATER_2_RAW_HI_TEMP, 0, 16383 }, + sensor_heater_3 { HEATER_3_RAW_LO_TEMP, HEATER_3_RAW_HI_TEMP, 0, 16383 }, + sensor_heater_4 { HEATER_4_RAW_LO_TEMP, HEATER_4_RAW_HI_TEMP, 0, 16383 }, + sensor_heater_5 { HEATER_5_RAW_LO_TEMP, HEATER_5_RAW_HI_TEMP, 0, 16383 }; + +temp_range_t Temperature::temp_range[HOTENDS] = ARRAY_BY_HOTENDS(sensor_heater_0, sensor_heater_1, sensor_heater_2, sensor_heater_3, sensor_heater_4, sensor_heater_5); #ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED uint8_t Temperature::consecutive_low_temperature_error[HOTENDS] = { 0 }; @@ -297,8 +290,6 @@ int16_t Temperature::minttemp_raw[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_RAW_LO_TE millis_t Temperature::next_auto_fan_check_ms = 0; #endif -uint8_t Temperature::soft_pwm_amount[HOTENDS]; - #if ENABLED(FAN_SOFT_PWM) uint8_t Temperature::soft_pwm_amount_fan[FAN_COUNT], Temperature::soft_pwm_count_fan[FAN_COUNT]; @@ -312,11 +303,6 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS]; bool Temperature::paused; #endif -#if HEATER_IDLE_HANDLER - millis_t Temperature::heater_idle_timeout_ms[HOTENDS] = { 0 }; - bool Temperature::heater_idle_timeout_exceeded[HOTENDS] = { false }; -#endif - // public: #if HAS_ADC_BUTTONS @@ -354,24 +340,24 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS]; #if HAS_PID_FOR_BOTH #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 SHV(B,H) do{ if (heater < 0) temp_bed.soft_pwm_amount = B; else temp_hotend[heater].soft_pwm_amount = 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 SHV(B,H) (temp_bed.soft_pwm_amount = 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 [heater] = H) + #define SHV(B,H) (temp_hotend[heater].soft_pwm_amount = 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) + #if WATCH_BED || WATCH_HOTENDS + #define HAS_TP_BED BOTH(THERMAL_PROTECTION_BED, PIDTEMPBED) + #if HAS_TP_BED && BOTH(THERMAL_PROTECTION_HOTENDS, PIDTEMP) #define GTV(B,H) (heater < 0 ? (B) : (H)) #elif HAS_TP_BED #define GTV(B,H) (B) @@ -390,7 +376,7 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS]; next_auto_fan_check_ms = next_temp_ms + 2500UL; #endif - if (target > GHV(BED_MAXTEMP, maxttemp[heater]) - 15) { + if (target > GHV(BED_MAXTEMP, temp_range[heater].maxtemp) - 15) { SERIAL_ECHOLNPGM(MSG_PID_TEMP_TOO_HIGH); return; } @@ -399,11 +385,11 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS]; disable_all_heaters(); - SHV(soft_pwm_amount, bias = d = (MAX_BED_POWER) >> 1, bias = d = (PID_MAX) >> 1); + SHV(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]); + const float start_temp = GHV(temp_bed.current, temp_hotend[heater].current); LEDColor color = ONHEATINGSTART(); #endif @@ -420,7 +406,7 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS]; updateTemperaturesFromRawValues(); // Get the current temperature and constrain it - current = GHV(current_temperature_bed, current_temperature[heater]); + current = GHV(temp_bed.current, temp_hotend[heater].current); NOLESS(max, current); NOMORE(min, current); @@ -438,7 +424,7 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS]; if (heating && current > target) { if (ELAPSED(ms, t2 + 5000UL)) { heating = false; - SHV(soft_pwm_amount, (bias - d) >> 1, (bias - d) >> 1); + SHV((bias - d) >> 1, (bias - d) >> 1); t1 = ms; t_high = t1 - t2; max = target; @@ -456,41 +442,30 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS]; bias = constrain(bias, 20, max_pow - 20); d = (bias > max_pow >> 1) ? max_pow - 1 - bias : bias; - SERIAL_ECHOPAIR(MSG_BIAS, bias); - SERIAL_ECHOPAIR(MSG_D, d); - SERIAL_ECHOPAIR(MSG_T_MIN, min); - SERIAL_ECHOPAIR(MSG_T_MAX, max); + SERIAL_ECHOPAIR(MSG_BIAS, bias, MSG_D, d, MSG_T_MIN, min, MSG_T_MAX, max); if (cycles > 2) { float Ku = (4.0f * d) / (float(M_PI) * (max - min) * 0.5f), Tu = ((float)(t_low + t_high) * 0.001f); - SERIAL_ECHOPAIR(MSG_KU, Ku); - SERIAL_ECHOPAIR(MSG_TU, Tu); tune_pid.Kp = 0.6f * Ku; tune_pid.Ki = 2 * tune_pid.Kp / Tu; tune_pid.Kd = tune_pid.Kp * Tu * 0.125f; + SERIAL_ECHOPAIR(MSG_KU, Ku, MSG_TU, Tu); SERIAL_ECHOLNPGM("\n" MSG_CLASSIC_PID); - SERIAL_ECHOPAIR(MSG_KP, tune_pid.Kp); - SERIAL_ECHOPAIR(MSG_KI, tune_pid.Ki); - SERIAL_ECHOLNPAIR(MSG_KD, tune_pid.Kd); + SERIAL_ECHOLNPAIR(MSG_KP, tune_pid.Kp, MSG_KI, tune_pid.Ki, MSG_KD, tune_pid.Kd); /** tune_pid.Kp = 0.33*Ku; tune_pid.Ki = tune_pid.Kp/Tu; tune_pid.Kd = tune_pid.Kp*Tu/3; SERIAL_ECHOLNPGM(" Some overshoot"); - SERIAL_ECHOPAIR(" Kp: ", tune_pid.Kp); - SERIAL_ECHOPAIR(" Ki: ", tune_pid.Ki); - SERIAL_ECHOPAIR(" Kd: ", tune_pid.Kd); + SERIAL_ECHOLNPAIR(" Kp: ", tune_pid.Kp, " Ki: ", tune_pid.Ki, " Kd: ", tune_pid.Kd, " No overshoot"); tune_pid.Kp = 0.2*Ku; tune_pid.Ki = 2*tune_pid.Kp/Tu; tune_pid.Kd = tune_pid.Kp*Tu/3; - SERIAL_ECHOLNPGM(" No overshoot"); - SERIAL_ECHOPAIR(" Kp: ", tune_pid.Kp); - SERIAL_ECHOPAIR(" Ki: ", tune_pid.Ki); - SERIAL_ECHOPAIR(" Kd: ", tune_pid.Kd); + SERIAL_ECHOPAIR(" Kp: ", tune_pid.Kp, " Ki: ", tune_pid.Ki, " Kd: ", tune_pid.Kd); */ } } - SHV(soft_pwm_amount, (bias + d) >> 1, (bias + d) >> 1); + SHV((bias + d) >> 1, (bias + d) >> 1); cycles++; min = target; } @@ -515,9 +490,9 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS]; next_temp_ms = ms + 2000UL; // Make sure heating is actually working - #if WATCH_THE_BED || WATCH_HOTENDS + #if WATCH_BED || WATCH_HOTENDS if ( - #if WATCH_THE_BED && WATCH_HOTENDS + #if WATCH_BED && WATCH_HOTENDS true #elif WATCH_HOTENDS heater >= 0 @@ -568,9 +543,9 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS]; #endif #define _SET_BED_PID() do { \ - bed_pid.Kp = tune_pid.Kp; \ - bed_pid.Ki = scalePID_i(tune_pid.Ki); \ - bed_pid.Kd = scalePID_d(tune_pid.Kd); \ + temp_bed.pid.Kp = tune_pid.Kp; \ + temp_bed.pid.Ki = scalePID_i(tune_pid.Ki); \ + temp_bed.pid.Kd = scalePID_d(tune_pid.Kd); \ }while(0) #define _SET_EXTRUDER_PID() do { \ @@ -623,56 +598,100 @@ Temperature::Temperature() { } int Temperature::getHeaterPower(const int heater) { return ( #if HAS_HEATED_BED - heater < 0 ? soft_pwm_amount_bed : + heater < 0 ? temp_bed.soft_pwm_amount : #endif - soft_pwm_amount[heater] + temp_hotend[heater].soft_pwm_amount ); } #if HAS_AUTO_FAN + #define AUTO_1_IS_0 (E1_AUTO_FAN_PIN == E0_AUTO_FAN_PIN) + #define AUTO_2_IS_0 (E2_AUTO_FAN_PIN == E0_AUTO_FAN_PIN) + #define AUTO_2_IS_1 (E2_AUTO_FAN_PIN == E1_AUTO_FAN_PIN) + #define AUTO_3_IS_0 (E3_AUTO_FAN_PIN == E0_AUTO_FAN_PIN) + #define AUTO_3_IS_1 (E3_AUTO_FAN_PIN == E1_AUTO_FAN_PIN) + #define AUTO_3_IS_2 (E3_AUTO_FAN_PIN == E2_AUTO_FAN_PIN) + #define AUTO_4_IS_0 (E4_AUTO_FAN_PIN == E0_AUTO_FAN_PIN) + #define AUTO_4_IS_1 (E4_AUTO_FAN_PIN == E1_AUTO_FAN_PIN) + #define AUTO_4_IS_2 (E4_AUTO_FAN_PIN == E2_AUTO_FAN_PIN) + #define AUTO_4_IS_3 (E4_AUTO_FAN_PIN == E3_AUTO_FAN_PIN) + #define AUTO_5_IS_0 (E5_AUTO_FAN_PIN == E0_AUTO_FAN_PIN) + #define AUTO_5_IS_1 (E5_AUTO_FAN_PIN == E1_AUTO_FAN_PIN) + #define AUTO_5_IS_2 (E5_AUTO_FAN_PIN == E2_AUTO_FAN_PIN) + #define AUTO_5_IS_3 (E5_AUTO_FAN_PIN == E3_AUTO_FAN_PIN) + #define AUTO_5_IS_4 (E5_AUTO_FAN_PIN == E4_AUTO_FAN_PIN) + #define AUTO_CHAMBER_IS_0 (CHAMBER_AUTO_FAN_PIN == E0_AUTO_FAN_PIN) + #define AUTO_CHAMBER_IS_1 (CHAMBER_AUTO_FAN_PIN == E1_AUTO_FAN_PIN) + #define AUTO_CHAMBER_IS_2 (CHAMBER_AUTO_FAN_PIN == E2_AUTO_FAN_PIN) + #define AUTO_CHAMBER_IS_3 (CHAMBER_AUTO_FAN_PIN == E3_AUTO_FAN_PIN) + #define AUTO_CHAMBER_IS_4 (CHAMBER_AUTO_FAN_PIN == E4_AUTO_FAN_PIN) + #define AUTO_CHAMBER_IS_5 (CHAMBER_AUTO_FAN_PIN == E5_AUTO_FAN_PIN) + void Temperature::checkExtruderAutoFans() { - static const pin_t fanPin[] PROGMEM = { E0_AUTO_FAN_PIN, E1_AUTO_FAN_PIN, E2_AUTO_FAN_PIN, E3_AUTO_FAN_PIN, E4_AUTO_FAN_PIN, E5_AUTO_FAN_PIN, CHAMBER_AUTO_FAN_PIN }; static const uint8_t fanBit[] PROGMEM = { 0, AUTO_1_IS_0 ? 0 : 1, AUTO_2_IS_0 ? 0 : AUTO_2_IS_1 ? 1 : 2, AUTO_3_IS_0 ? 0 : AUTO_3_IS_1 ? 1 : AUTO_3_IS_2 ? 2 : 3, - AUTO_4_IS_0 ? 0 : AUTO_4_IS_1 ? 1 : AUTO_4_IS_2 ? 2 : AUTO_4_IS_3 ? 3 : 4, - AUTO_5_IS_0 ? 0 : AUTO_5_IS_1 ? 1 : AUTO_5_IS_2 ? 2 : AUTO_5_IS_3 ? 3 : AUTO_5_IS_4 ? 4 : 5, - AUTO_CHAMBER_IS_0 ? 0 : AUTO_CHAMBER_IS_1 ? 1 : AUTO_CHAMBER_IS_2 ? 2 : AUTO_CHAMBER_IS_3 ? 3 : AUTO_CHAMBER_IS_4 ? 4 : 5 + AUTO_4_IS_0 ? 0 : AUTO_4_IS_1 ? 1 : AUTO_4_IS_2 ? 2 : AUTO_4_IS_3 ? 3 : 4, + AUTO_5_IS_0 ? 0 : AUTO_5_IS_1 ? 1 : AUTO_5_IS_2 ? 2 : AUTO_5_IS_3 ? 3 : AUTO_5_IS_4 ? 4 : 5 + #if HAS_TEMP_CHAMBER + , AUTO_CHAMBER_IS_0 ? 0 : AUTO_CHAMBER_IS_1 ? 1 : AUTO_CHAMBER_IS_2 ? 2 : AUTO_CHAMBER_IS_3 ? 3 : AUTO_CHAMBER_IS_4 ? 4 : AUTO_CHAMBER_IS_5 ? 5 : 6 + #endif }; uint8_t fanState = 0; HOTEND_LOOP() - if (current_temperature[e] > EXTRUDER_AUTO_FAN_TEMPERATURE) + if (temp_hotend[e].current > EXTRUDER_AUTO_FAN_TEMPERATURE) SBI(fanState, pgm_read_byte(&fanBit[e])); #if HAS_TEMP_CHAMBER - if (current_temperature_chamber > EXTRUDER_AUTO_FAN_TEMPERATURE) - SBI(fanState, pgm_read_byte(&fanBit[5])); + if (temp_chamber.current > EXTRUDER_AUTO_FAN_TEMPERATURE) + SBI(fanState, pgm_read_byte(&fanBit[6])); #endif + #define _UPDATE_AUTO_FAN(P,D,A) do{ \ + if (PWM_PIN(P##_AUTO_FAN_PIN) && EXTRUDER_AUTO_FAN_SPEED < 255) \ + analogWrite(P##_AUTO_FAN_PIN, A); \ + else \ + WRITE(P##_AUTO_FAN_PIN, D); \ + }while(0) + uint8_t fanDone = 0; - for (uint8_t f = 0; f < COUNT(fanPin); f++) { - const pin_t pin = - #ifdef ARDUINO - pgm_read_byte(&fanPin[f]) - #else - fanPin[f] - #endif - ; + for (uint8_t f = 0; f < COUNT(fanBit); f++) { const uint8_t bit = pgm_read_byte(&fanBit[f]); - if (pin >= 0 && !TEST(fanDone, bit)) { - uint8_t newFanSpeed = TEST(fanState, bit) ? EXTRUDER_AUTO_FAN_SPEED : 0; - #if ENABLED(AUTO_POWER_E_FANS) - autofan_speed[f] = newFanSpeed; + if (TEST(fanDone, bit)) continue; + const bool fan_on = TEST(fanState, bit); + const uint8_t speed = fan_on ? EXTRUDER_AUTO_FAN_SPEED : 0; + #if ENABLED(AUTO_POWER_E_FANS) + autofan_speed[f] = speed; + #endif + switch (f) { + #if HAS_AUTO_FAN_0 + case 0: _UPDATE_AUTO_FAN(E0, fan_on, speed); break; + #endif + #if HAS_AUTO_FAN_1 + case 1: _UPDATE_AUTO_FAN(E1, fan_on, speed); break; + #endif + #if HAS_AUTO_FAN_2 + case 2: _UPDATE_AUTO_FAN(E2, fan_on, speed); break; + #endif + #if HAS_AUTO_FAN_3 + case 3: _UPDATE_AUTO_FAN(E3, fan_on, speed); break; + #endif + #if HAS_AUTO_FAN_4 + case 4: _UPDATE_AUTO_FAN(E4, fan_on, speed); break; + #endif + #if HAS_AUTO_FAN_5 + case 5: _UPDATE_AUTO_FAN(E5, fan_on, speed); break; + #endif + #if HAS_AUTO_CHAMBER_FAN + case 6: _UPDATE_AUTO_FAN(CHAMBER, fan_on, speed); break; #endif - // this idiom allows both digital and PWM fan outputs (see M42 handling). - digitalWrite(pin, newFanSpeed); - analogWrite(pin, newFanSpeed); - SBI(fanDone, bit); } + SBI(fanDone, bit); + UNUSED(fan_on); UNUSED(speed); } } @@ -687,7 +706,12 @@ void Temperature::_temp_error(const int8_t heater, PGM_P const serial_msg, PGM_P SERIAL_ERROR_START(); serialprintPGM(serial_msg); SERIAL_ECHOPGM(MSG_STOPPED_HEATER); - if (heater >= 0) SERIAL_ECHOLN((int)heater); else SERIAL_ECHOLNPGM(MSG_HEATER_BED); + if (heater >= 0) SERIAL_ECHO((int)heater); + #if HAS_HEATED_CHAMBER + else if (heater == -2) SERIAL_ECHOPGM(MSG_HEATER_CHAMBER); + #endif + else SERIAL_ECHOPGM(MSG_HEATER_BED); + SERIAL_EOL(); } #if DISABLED(BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE) if (!killed) { @@ -710,11 +734,11 @@ void Temperature::min_temp_error(const int8_t heater) { float Temperature::get_pid_output(const int8_t e) { #if HOTENDS == 1 - UNUSED(e); #define _HOTEND_TEST true #else #define _HOTEND_TEST (e == active_extruder) #endif + E_UNUSED(); float pid_output; #if ENABLED(PIDTEMP) #if DISABLED(PID_OPENLOOP) @@ -722,95 +746,95 @@ float Temperature::get_pid_output(const int8_t e) { static float temp_iState[HOTENDS] = { 0 }, temp_dState[HOTENDS] = { 0 }; static bool pid_reset[HOTENDS] = { false }; - float 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]) { - pid_output = 0; - pid_reset[HOTEND_INDEX] = true; + float pid_error = temp_hotend[HOTEND_INDEX].target - temp_hotend[HOTEND_INDEX].current; + work_pid[HOTEND_INDEX].Kd = PID_K2 * PID_PARAM(Kd, HOTEND_INDEX) * (temp_hotend[HOTEND_INDEX].current - temp_dState[HOTEND_INDEX]) + float(PID_K1) * work_pid[HOTEND_INDEX].Kd; + temp_dState[HOTEND_INDEX] = temp_hotend[HOTEND_INDEX].current; + + if (temp_hotend[HOTEND_INDEX].target == 0 + || pid_error < -(PID_FUNCTIONAL_RANGE) + #if HEATER_IDLE_HANDLER + || hotend_idle[HOTEND_INDEX].timed_out + #endif + ) { + pid_output = 0; + pid_reset[HOTEND_INDEX] = true; + } + else if (pid_error > PID_FUNCTIONAL_RANGE) { + pid_output = BANG_MAX; + pid_reset[HOTEND_INDEX] = true; + } + else { + if (pid_reset[HOTEND_INDEX]) { + temp_iState[HOTEND_INDEX] = 0.0; + pid_reset[HOTEND_INDEX] = false; } - else - #endif - if (pid_error > PID_FUNCTIONAL_RANGE) { - pid_output = BANG_MAX; - pid_reset[HOTEND_INDEX] = true; - } - 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; } - 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]; + else + lpq[lpq_ptr] = 0; - 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; - } + 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); + const float pid_output = constrain(temp_hotend[HOTEND_INDEX].target, 0, PID_MAX); #endif // PID_OPENLOOP #if ENABLED(PID_DEBUG) SERIAL_ECHO_START(); - 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, HOTEND_INDEX, + MSG_PID_DEBUG_INPUT, temp_hotend[HOTEND_INDEX].current, + MSG_PID_DEBUG_OUTPUT, pid_output + ); #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 + SERIAL_ECHOPAIR( + MSG_PID_DEBUG_PTERM, work_pid[HOTEND_INDEX].Kp, + MSG_PID_DEBUG_ITERM, work_pid[HOTEND_INDEX].Ki, + MSG_PID_DEBUG_DTERM, work_pid[HOTEND_INDEX].Kd + #if ENABLED(PID_EXTRUSION_SCALING) + , MSG_PID_DEBUG_CTERM, work_pid[HOTEND_INDEX].Kc + #endif + ); #endif SERIAL_EOL(); #endif // PID_DEBUG #else /* PID off */ #if HEATER_IDLE_HANDLER - if (heater_idle_timeout_exceeded[HOTEND_INDEX]) - pid_output = 0; - else + #define _TIMED_OUT_TEST hotend_idle[HOTEND_INDEX].timed_out + #else + #define _TIMED_OUT_TEST false #endif - pid_output = (current_temperature[HOTEND_INDEX] < target_temperature[HOTEND_INDEX]) ? BANG_MAX : 0; + pid_output = (!_TIMED_OUT_TEST && temp_hotend[HOTEND_INDEX].current < temp_hotend[HOTEND_INDEX].target) ? BANG_MAX : 0; + #undef _TIMED_OUT_TEST #endif return pid_output; @@ -825,13 +849,13 @@ float Temperature::get_pid_output(const int8_t e) { static PID_t work_pid = { 0 }; static float temp_iState = 0, temp_dState = 0; - float pid_error = target_temperature_bed - current_temperature_bed; + float pid_error = temp_bed.target - temp_bed.current; 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; + work_pid.Kp = temp_bed.pid.Kp * pid_error; + work_pid.Ki = temp_bed.pid.Ki * temp_iState; + work_pid.Kd = PID_K2 * temp_bed.pid.Kd * (temp_bed.current - temp_dState) + PID_K1 * work_pid.Kd; - temp_dState = current_temperature_bed; + temp_dState = temp_bed.current; float pid_output = work_pid.Kp + work_pid.Ki - work_pid.Kd; if (pid_output > MAX_BED_POWER) { @@ -845,19 +869,20 @@ float Temperature::get_pid_output(const int8_t e) { #else // PID_OPENLOOP - const float pid_output = constrain(target_temperature_bed, 0, MAX_BED_POWER); + const float pid_output = constrain(temp_bed.target, 0, MAX_BED_POWER); #endif // PID_OPENLOOP #if ENABLED(PID_BED_DEBUG) SERIAL_ECHO_START(); - 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 + SERIAL_ECHOLNPAIR( + " PID_BED_DEBUG : Input ", temp_bed.current, " Output ", pid_output, + #if DISABLED(PID_OPENLOOP) + MSG_PID_DEBUG_PTERM, work_pid.Kp, + MSG_PID_DEBUG_ITERM, work_pid.Ki, + MSG_PID_DEBUG_DTERM, work_pid.Kd, + #endif + ); #endif return pid_output; @@ -884,7 +909,7 @@ void Temperature::manage_heater() { } #endif - #if ENABLED(PROBING_HEATERS_OFF) && ENABLED(BED_LIMIT_SWITCHING) + #if BOTH(PROBING_HEATERS_OFF, BED_LIMIT_SWITCHING) static bool last_pause_state; #endif @@ -897,37 +922,36 @@ void Temperature::manage_heater() { updateTemperaturesFromRawValues(); // also resets the watchdog #if ENABLED(HEATER_0_USES_MAX6675) - 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); + if (temp_hotend[0].current > MIN(HEATER_0_MAXTEMP, HEATER_0_MAX6675_TMAX - 1.0)) max_temp_error(0); + if (temp_hotend[0].current < 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); + if (temp_hotend[1].current > MIN(HEATER_1_MAXTEMP, HEATER_1_MAX6675_TMAX - 1.0)) max_temp_error(1); + if (temp_hotend[1].current < 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 + #if WATCH_HOTENDS || WATCH_BED || DISABLED(PIDTEMPBED) || HAS_AUTO_FAN || HEATER_IDLE_HANDLER || WATCH_CHAMBER millis_t ms = millis(); #endif HOTEND_LOOP() { #if HEATER_IDLE_HANDLER - if (!heater_idle_timeout_exceeded[e] && heater_idle_timeout_ms[e] && ELAPSED(ms, heater_idle_timeout_ms[e])) - heater_idle_timeout_exceeded[e] = true; + hotend_idle[e].update(ms); #endif #if ENABLED(THERMAL_PROTECTION_HOTENDS) // Check for thermal runaway - thermal_runaway_protection(&thermal_runaway_state_machine[e], &thermal_runaway_timer[e], current_temperature[e], target_temperature[e], e, THERMAL_PROTECTION_PERIOD, THERMAL_PROTECTION_HYSTERESIS); + thermal_runaway_protection(tr_state_machine[e], temp_hotend[e].current, temp_hotend[e].target, e, THERMAL_PROTECTION_PERIOD, THERMAL_PROTECTION_HYSTERESIS); #endif - soft_pwm_amount[e] = (current_temperature[e] > minttemp[e] || is_preheating(e)) && current_temperature[e] < maxttemp[e] ? (int)get_pid_output(e) >> 1 : 0; + temp_hotend[e].soft_pwm_amount = (temp_hotend[e].current > temp_range[e].mintemp || is_preheating(e)) && temp_hotend[e].current < temp_range[e].maxtemp ? (int)get_pid_output(e) >> 1 : 0; #if WATCH_HOTENDS // Make sure temperature is increasing - if (watch_heater_next_ms[e] && ELAPSED(ms, watch_heater_next_ms[e])) { // Time to check this extruder? - if (degHotend(e) < watch_target_temp[e]) // Failed to increase enough? + if (watch_hotend[e].next_ms && ELAPSED(ms, watch_hotend[e].next_ms)) { // Time to check this extruder? + if (degHotend(e) < watch_hotend[e].target) // Failed to increase enough? _temp_error(e, PSTR(MSG_T_HEATING_FAILED), TEMP_ERR_PSTR(MSG_HEATING_FAILED_LCD, e)); else // Start again if the target is still far off start_watching_heater(e); @@ -936,7 +960,7 @@ void Temperature::manage_heater() { #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) // Make sure measured temperatures are close together - if (ABS(current_temperature[0] - redundant_temperature) > MAX_REDUNDANT_TEMP_SENSOR_DIFF) + if (ABS(temp_hotend[0].current - redundant_temperature) > MAX_REDUNDANT_TEMP_SENSOR_DIFF) _temp_error(0, PSTR(MSG_REDUNDANCY), PSTR(MSG_ERR_REDUNDANT_TEMP)); #endif @@ -964,40 +988,39 @@ void Temperature::manage_heater() { #if HAS_HEATED_BED - #if WATCH_THE_BED + #if WATCH_BED // Make sure temperature is increasing - if (watch_bed_next_ms && ELAPSED(ms, watch_bed_next_ms)) { // Time to check the bed? - if (degBed() < watch_target_bed_temp) // Failed to increase enough? + if (watch_bed.elapsed(ms)) { // Time to check the bed? + if (degBed() < watch_bed.target) // Failed to increase enough? _temp_error(-1, PSTR(MSG_T_HEATING_FAILED), TEMP_ERR_PSTR(MSG_HEATING_FAILED_LCD, -1)); else // Start again if the target is still far off start_watching_bed(); } - #endif // WATCH_THE_BED + #endif // WATCH_BED #if DISABLED(PIDTEMPBED) if (PENDING(ms, next_bed_check_ms) - #if ENABLED(PROBING_HEATERS_OFF) && ENABLED(BED_LIMIT_SWITCHING) + #if BOTH(PROBING_HEATERS_OFF, BED_LIMIT_SWITCHING) && paused == last_pause_state #endif ) return; next_bed_check_ms = ms + BED_CHECK_INTERVAL; - #if ENABLED(PROBING_HEATERS_OFF) && ENABLED(BED_LIMIT_SWITCHING) + #if BOTH(PROBING_HEATERS_OFF, BED_LIMIT_SWITCHING) last_pause_state = paused; #endif #endif #if HEATER_IDLE_HANDLER - if (!bed_idle_timeout_exceeded && bed_idle_timeout_ms && ELAPSED(ms, bed_idle_timeout_ms)) - bed_idle_timeout_exceeded = true; + bed_idle.update(ms); #endif #if HAS_THERMALLY_PROTECTED_BED - thermal_runaway_protection(&thermal_runaway_bed_state_machine, &thermal_runaway_bed_timer, current_temperature_bed, target_temperature_bed, -1, THERMAL_PROTECTION_BED_PERIOD, THERMAL_PROTECTION_BED_HYSTERESIS); + thermal_runaway_protection(tr_state_machine_bed, temp_bed.current, temp_bed.target, -1, THERMAL_PROTECTION_BED_PERIOD, THERMAL_PROTECTION_BED_HYSTERESIS); #endif #if HEATER_IDLE_HANDLER - if (bed_idle_timeout_exceeded) { - soft_pwm_amount_bed = 0; + if (bed_idle.timed_out) { + temp_bed.soft_pwm_amount = 0; #if DISABLED(PIDTEMPBED) WRITE_HEATER_BED(LOW); #endif @@ -1006,26 +1029,73 @@ void Temperature::manage_heater() { #endif { #if ENABLED(PIDTEMPBED) - soft_pwm_amount_bed = WITHIN(current_temperature_bed, BED_MINTEMP, BED_MAXTEMP) ? (int)get_pid_output_bed() >> 1 : 0; + temp_bed.soft_pwm_amount = WITHIN(temp_bed.current, BED_MINTEMP, BED_MAXTEMP) ? (int)get_pid_output_bed() >> 1 : 0; #else // Check if temperature is within the correct band - if (WITHIN(current_temperature_bed, BED_MINTEMP, BED_MAXTEMP)) { + if (WITHIN(temp_bed.current, BED_MINTEMP, BED_MAXTEMP)) { #if ENABLED(BED_LIMIT_SWITCHING) - if (current_temperature_bed >= target_temperature_bed + BED_HYSTERESIS) - soft_pwm_amount_bed = 0; - else if (current_temperature_bed <= target_temperature_bed - (BED_HYSTERESIS)) - soft_pwm_amount_bed = MAX_BED_POWER >> 1; + if (temp_bed.current >= temp_bed.target + BED_HYSTERESIS) + temp_bed.soft_pwm_amount = 0; + else if (temp_bed.current <= temp_bed.target - (BED_HYSTERESIS)) + temp_bed.soft_pwm_amount = MAX_BED_POWER >> 1; #else // !PIDTEMPBED && !BED_LIMIT_SWITCHING - soft_pwm_amount_bed = current_temperature_bed < target_temperature_bed ? MAX_BED_POWER >> 1 : 0; + temp_bed.soft_pwm_amount = temp_bed.current < temp_bed.target ? MAX_BED_POWER >> 1 : 0; #endif } else { - soft_pwm_amount_bed = 0; + temp_bed.soft_pwm_amount = 0; WRITE_HEATER_BED(LOW); } #endif } #endif // HAS_HEATED_BED + + #if HAS_TEMP_CHAMBER + + #ifndef CHAMBER_CHECK_INTERVAL + #define CHAMBER_CHECK_INTERVAL 1000UL + #endif + + #if HAS_HEATED_CHAMBER + + #if WATCH_CHAMBER + // Make sure temperature is increasing + if (watch_chamber.elapsed(ms)) { // Time to check the chamber? + if (degChamber() < watch_chamber.target) // Failed to increase enough? + _temp_error(-2, PSTR(MSG_T_HEATING_FAILED), TEMP_ERR_PSTR(MSG_HEATING_FAILED_LCD, -2)); + else + start_watching_chamber(); // Start again if the target is still far off + } + #endif // WATCH_CHAMBER + + if (PENDING(ms, next_chamber_check_ms)) return; + next_chamber_check_ms = ms + CHAMBER_CHECK_INTERVAL; + + if (WITHIN(temp_chamber.current, CHAMBER_MINTEMP, CHAMBER_MAXTEMP)) { + #if ENABLED(CHAMBER_LIMIT_SWITCHING) + if (temp_chamber.current >= temp_chamber.target + CHAMBER_HYSTERESIS) + temp_chamber.soft_pwm_amount = 0; + else if (temp_chamber.current <= temp_chamber.target - (CHAMBER_HYSTERESIS)) + temp_chamber.soft_pwm_amount = MAX_CHAMBER_POWER >> 1; + #else // !PIDTEMPCHAMBER && !CHAMBER_LIMIT_SWITCHING + temp_chamber.soft_pwm_amount = temp_chamber.current < temp_chamber.target ? MAX_CHAMBER_POWER >> 1 : 0; + #endif + } + else { + temp_chamber.soft_pwm_amount = 0; + WRITE_HEATER_CHAMBER(LOW); + } + + #if ENABLED(THERMAL_PROTECTION_CHAMBER) + thermal_runaway_protection(tr_state_machine_chamber, temp_chamber.current, temp_chamber.target, -2, THERMAL_PROTECTION_CHAMBER_PERIOD, THERMAL_PROTECTION_CHAMBER_HYSTERESIS); + #endif + + // TODO: Implement true PID pwm + //temp_bed.soft_pwm_amount = WITHIN(temp_chamber.current, CHAMBER_MINTEMP, CHAMBER_MAXTEMP) ? (int)get_pid_output_chamber() >> 1 : 0; + + #endif // HAS_HEATED_CHAMBER + + #endif // HAS_TEMP_CHAMBER } #define TEMP_AD595(RAW) ((RAW) * 5.0 * 100.0 / 1024.0 / (OVERSAMPLENR) * (TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET) @@ -1113,6 +1183,14 @@ float Temperature::analog_to_celsius_hotend(const int raw, const uint8_t e) { #else break; #endif + case 5: + #if ENABLED(HEATER_5_USES_AD595) + return TEMP_AD595(raw); + #elif ENABLED(HEATER_5_USES_AD8495) + return TEMP_AD8495(raw); + #else + break; + #endif default: break; } @@ -1144,7 +1222,7 @@ float Temperature::analog_to_celsius_hotend(const int raw, const uint8_t e) { #if HAS_TEMP_CHAMBER // Derived from RepRap FiveD extruder::getTemperature() // For chamber temperature measurement. - float Temperature::analog_to_celsiusChamber(const int raw) { + float Temperature::analog_to_celsius_chamber(const int raw) { #if ENABLED(HEATER_CHAMBER_USES_THERMISTOR) SCAN_THERMISTOR_TABLE(CHAMBERTEMPTABLE, CHAMBERTEMPTABLE_LEN); #elif ENABLED(HEATER_CHAMBER_USES_AD595) @@ -1165,17 +1243,17 @@ float Temperature::analog_to_celsius_hotend(const int raw, const uint8_t e) { */ void Temperature::updateTemperaturesFromRawValues() { #if ENABLED(HEATER_0_USES_MAX6675) - current_temperature_raw[0] = READ_MAX6675(0); + temp_hotend[0].raw = READ_MAX6675(0); #endif #if ENABLED(HEATER_1_USES_MAX6675) - current_temperature_raw[1] = READ_MAX6675(1); + temp_hotend[1].raw = READ_MAX6675(1); #endif - HOTEND_LOOP() current_temperature[e] = analog_to_celsius_hotend(current_temperature_raw[e], e); + HOTEND_LOOP() temp_hotend[e].current = analog_to_celsius_hotend(temp_hotend[e].raw, e); #if HAS_HEATED_BED - current_temperature_bed = analog_to_celsius_bed(current_temperature_bed_raw); + temp_bed.current = analog_to_celsius_bed(temp_bed.raw); #endif #if HAS_TEMP_CHAMBER - current_temperature_chamber = analog_to_celsiusChamber(current_temperature_chamber_raw); + temp_chamber.current = analog_to_celsius_chamber(temp_chamber.raw); #endif #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) redundant_temperature = analog_to_celsius_hotend(redundant_temperature_raw, 1); @@ -1220,6 +1298,25 @@ void Temperature::updateTemperaturesFromRawValues() { SPIclass max6675_spi; #endif +// Init fans according to whether they're native PWM or Software PWM +#define _INIT_SOFT_FAN(P) OUT_WRITE(P, FAN_INVERTING ? LOW : HIGH) +#if ENABLED(FAN_SOFT_PWM) + #define _INIT_FAN_PIN(P) _INIT_SOFT_FAN(P) +#else + #define _INIT_FAN_PIN(P) do{ if (PWM_PIN(P)) SET_PWM(P); else _INIT_SOFT_FAN(P); }while(0) +#endif +#if ENABLED(FAST_PWM_FAN) + #define SET_FAST_PWM_FREQ(P) set_pwm_frequency(P, FAST_PWM_FAN_FREQUENCY) +#else + #define SET_FAST_PWM_FREQ(P) NOOP +#endif +#define INIT_FAN_PIN(P) do{ _INIT_FAN_PIN(P); SET_FAST_PWM_FREQ(P); }while(0) +#if EXTRUDER_AUTO_FAN_SPEED != 255 + #define INIT_AUTO_FAN_PIN(P) do{ if (P == FAN1_PIN || P == FAN2_PIN) { SET_PWM(P); SET_FAST_PWM_FREQ(FAST_PWM_FAN_FREQUENCY); } else SET_OUTPUT(P); }while(0) +#else + #define INIT_AUTO_FAN_PIN(P) SET_OUTPUT(P) +#endif + /** * Initialize the temperature manager * The manager is implemented by periodic calls to manage_heater() @@ -1232,18 +1329,16 @@ void Temperature::init() { inited = true; #endif - #if MB(RUMBA) && ( \ - ENABLED(HEATER_0_USES_AD595) || ENABLED(HEATER_1_USES_AD595) || ENABLED(HEATER_2_USES_AD595) || ENABLED(HEATER_3_USES_AD595) || ENABLED(HEATER_4_USES_AD595) || ENABLED(HEATER_BED_USES_AD595) || ENABLED(HEATER_CHAMBER_USES_AD595) \ - || ENABLED(HEATER_0_USES_AD8495) || ENABLED(HEATER_1_USES_AD8495) || ENABLED(HEATER_2_USES_AD8495) || ENABLED(HEATER_3_USES_AD8495) || ENABLED(HEATER_4_USES_AD8495) || ENABLED(HEATER_BED_USES_AD8495) || ENABLED(HEATER_CHAMBER_USES_AD8495)) - // Disable RUMBA JTAG in case the thermocouple extension is plugged on top of JTAG connector - MCUCR = _BV(JTD); - MCUCR = _BV(JTD); + #if MB(RUMBA) + #define _AD(N) (ANY(HEATER_##N##_USES_AD595, HEATER_##N##_USES_AD8495)) + #if _AD(0) || _AD(1) || _AD(2) || _AD(3) || _AD(4) || _AD(5) || _AD(BED) || _AD(CHAMBER) + // Disable RUMBA JTAG in case the thermocouple extension is plugged on top of JTAG connector + MCUCR = _BV(JTD); + MCUCR = _BV(JTD); + #endif #endif - // Finish init of mult hotend arrays - HOTEND_LOOP() maxttemp[e] = maxttemp[0]; - - #if ENABLED(PIDTEMP) && ENABLED(PID_EXTRUSION_SCALING) + #if BOTH(PIDTEMP, PID_EXTRUSION_SCALING) last_e_position = 0; #endif @@ -1262,36 +1357,27 @@ void Temperature::init() { #if HAS_HEATER_4 OUT_WRITE(HEATER_4_PIN, HEATER_4_INVERTING); #endif + #if HAS_HEATER_5 + OUT_WRITE(HEATER_5_PIN, HEATER_5_INVERTING); + #endif #if HAS_HEATED_BED OUT_WRITE(HEATER_BED_PIN, HEATER_BED_INVERTING); #endif + #if HAS_HEATED_CHAMBER + OUT_WRITE(HEATER_CHAMBER_PIN, HEATER_CHAMBER_INVERTING); + #endif #if HAS_FAN0 - SET_OUTPUT(FAN_PIN); - #if ENABLED(FAST_PWM_FAN) - setPwmFrequency(FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 - #endif + INIT_FAN_PIN(FAN_PIN); #endif - #if HAS_FAN1 - SET_OUTPUT(FAN1_PIN); - #if ENABLED(FAST_PWM_FAN) - setPwmFrequency(FAN1_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 - #endif + INIT_FAN_PIN(FAN1_PIN); #endif - #if HAS_FAN2 - SET_OUTPUT(FAN2_PIN); - #if ENABLED(FAST_PWM_FAN) - setPwmFrequency(FAN2_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 - #endif + INIT_FAN_PIN(FAN2_PIN); #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 + INIT_FAN_PIN(CONTROLLER_FAN_PIN); #endif #if MAX6675_SEPARATE_SPI @@ -1345,210 +1431,115 @@ void Temperature::init() { ENABLE_TEMPERATURE_INTERRUPT(); #if HAS_AUTO_FAN_0 - #if E0_AUTO_FAN_PIN == FAN1_PIN - SET_OUTPUT(E0_AUTO_FAN_PIN); - #if ENABLED(FAST_PWM_FAN) - setPwmFrequency(E0_AUTO_FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 - #endif - #else - SET_OUTPUT(E0_AUTO_FAN_PIN); - #endif + INIT_AUTO_FAN_PIN(E0_AUTO_FAN_PIN); #endif #if HAS_AUTO_FAN_1 && !AUTO_1_IS_0 - #if E1_AUTO_FAN_PIN == FAN1_PIN - SET_OUTPUT(E1_AUTO_FAN_PIN); - #if ENABLED(FAST_PWM_FAN) - setPwmFrequency(E1_AUTO_FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 - #endif - #else - SET_OUTPUT(E1_AUTO_FAN_PIN); - #endif + INIT_AUTO_FAN_PIN(E1_AUTO_FAN_PIN); #endif #if HAS_AUTO_FAN_2 && !(AUTO_2_IS_0 || AUTO_2_IS_1) - #if E2_AUTO_FAN_PIN == FAN1_PIN - SET_OUTPUT(E2_AUTO_FAN_PIN); - #if ENABLED(FAST_PWM_FAN) - setPwmFrequency(E2_AUTO_FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 - #endif - #else - SET_OUTPUT(E2_AUTO_FAN_PIN); - #endif + INIT_AUTO_FAN_PIN(E2_AUTO_FAN_PIN); #endif #if HAS_AUTO_FAN_3 && !(AUTO_3_IS_0 || AUTO_3_IS_1 || AUTO_3_IS_2) - #if E3_AUTO_FAN_PIN == FAN1_PIN - SET_OUTPUT(E3_AUTO_FAN_PIN); - #if ENABLED(FAST_PWM_FAN) - setPwmFrequency(E3_AUTO_FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 - #endif - #else - SET_OUTPUT(E3_AUTO_FAN_PIN); - #endif + INIT_AUTO_FAN_PIN(E3_AUTO_FAN_PIN); #endif #if HAS_AUTO_FAN_4 && !(AUTO_4_IS_0 || AUTO_4_IS_1 || AUTO_4_IS_2 || AUTO_4_IS_3) - #if E4_AUTO_FAN_PIN == FAN1_PIN - SET_OUTPUT(E4_AUTO_FAN_PIN); - #if ENABLED(FAST_PWM_FAN) - setPwmFrequency(E4_AUTO_FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 - #endif - #else - SET_OUTPUT(E4_AUTO_FAN_PIN); - #endif + INIT_AUTO_FAN_PIN(E4_AUTO_FAN_PIN); #endif #if HAS_AUTO_FAN_5 && !(AUTO_5_IS_0 || AUTO_5_IS_1 || AUTO_5_IS_2 || AUTO_5_IS_3 || AUTO_5_IS_4) - #if E5_AUTO_FAN_PIN == FAN1_PIN - SET_OUTPUT(E5_AUTO_FAN_PIN); - #if ENABLED(FAST_PWM_FAN) - setPwmFrequency(E5_AUTO_FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 - #endif - #else - SET_OUTPUT(E5_AUTO_FAN_PIN); - #endif + INIT_AUTO_FAN_PIN(E5_AUTO_FAN_PIN); #endif #if HAS_AUTO_CHAMBER_FAN && !(AUTO_CHAMBER_IS_0 || AUTO_CHAMBER_IS_1 || AUTO_CHAMBER_IS_2 || AUTO_CHAMBER_IS_3 || AUTO_CHAMBER_IS_4 || AUTO_CHAMBER_IS_5) - #if CHAMBER_AUTO_FAN_PIN == FAN1_PIN - SET_OUTPUT(CHAMBER_AUTO_FAN_PIN); - #if ENABLED(FAST_PWM_FAN) - setPwmFrequency(CHAMBER_AUTO_FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8 - #endif - #else - SET_OUTPUT(CHAMBER_AUTO_FAN_PIN); - #endif + INIT_AUTO_FAN_PIN(CHAMBER_AUTO_FAN_PIN); #endif // Wait for temperature measurement to settle delay(250); - #define TEMP_MIN_ROUTINE(NR) \ - minttemp[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 \ - minttemp_raw[NR] -= OVERSAMPLENR; \ - } - #define TEMP_MAX_ROUTINE(NR) \ - maxttemp[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 \ - maxttemp_raw[NR] += OVERSAMPLENR; \ - } + #if HOTENDS - #ifdef HEATER_0_MINTEMP - TEMP_MIN_ROUTINE(0); - #endif - #ifdef HEATER_0_MAXTEMP - TEMP_MAX_ROUTINE(0); - #endif - #if HOTENDS > 1 - #ifdef HEATER_1_MINTEMP - TEMP_MIN_ROUTINE(1); + #define _TEMP_MIN_E(NR) do{ \ + temp_range[NR].mintemp = HEATER_ ##NR## _MINTEMP; \ + while (analog_to_celsius_hotend(temp_range[NR].raw_min, NR) < HEATER_ ##NR## _MINTEMP) \ + temp_range[NR].raw_min += TEMPDIR(NR) * (OVERSAMPLENR); \ + }while(0) + #define _TEMP_MAX_E(NR) do{ \ + temp_range[NR].maxtemp = HEATER_ ##NR## _MAXTEMP; \ + while (analog_to_celsius_hotend(temp_range[NR].raw_min, NR) > HEATER_ ##NR## _MAXTEMP) \ + temp_range[NR].raw_max -= TEMPDIR(NR) * (OVERSAMPLENR); \ + }while(0) + + #ifdef HEATER_0_MINTEMP + _TEMP_MIN_E(0); #endif - #ifdef HEATER_1_MAXTEMP - TEMP_MAX_ROUTINE(1); + #ifdef HEATER_0_MAXTEMP + _TEMP_MAX_E(0); #endif - #if HOTENDS > 2 - #ifdef HEATER_2_MINTEMP - TEMP_MIN_ROUTINE(2); + #if HOTENDS > 1 + #ifdef HEATER_1_MINTEMP + _TEMP_MIN_E(1); #endif - #ifdef HEATER_2_MAXTEMP - TEMP_MAX_ROUTINE(2); + #ifdef HEATER_1_MAXTEMP + _TEMP_MAX_E(1); #endif - #if HOTENDS > 3 - #ifdef HEATER_3_MINTEMP - TEMP_MIN_ROUTINE(3); + #if HOTENDS > 2 + #ifdef HEATER_2_MINTEMP + _TEMP_MIN_E(2); #endif - #ifdef HEATER_3_MAXTEMP - TEMP_MAX_ROUTINE(3); + #ifdef HEATER_2_MAXTEMP + _TEMP_MAX_E(2); #endif - #if HOTENDS > 4 - #ifdef HEATER_4_MINTEMP - TEMP_MIN_ROUTINE(4); + #if HOTENDS > 3 + #ifdef HEATER_3_MINTEMP + _TEMP_MIN_E(3); #endif - #ifdef HEATER_4_MAXTEMP - TEMP_MAX_ROUTINE(4); + #ifdef HEATER_3_MAXTEMP + _TEMP_MAX_E(3); #endif - #if HOTENDS > 5 - #ifdef HEATER_5_MINTEMP - TEMP_MIN_ROUTINE(5); + #if HOTENDS > 4 + #ifdef HEATER_4_MINTEMP + _TEMP_MIN_E(4); #endif - #ifdef HEATER_5_MAXTEMP - TEMP_MAX_ROUTINE(5); + #ifdef HEATER_4_MAXTEMP + _TEMP_MAX_E(4); #endif - #endif // HOTENDS > 5 - #endif // HOTENDS > 4 - #endif // HOTENDS > 3 - #endif // HOTENDS > 2 + #if HOTENDS > 5 + #ifdef HEATER_5_MINTEMP + _TEMP_MIN_E(5); + #endif + #ifdef HEATER_5_MAXTEMP + _TEMP_MAX_E(5); + #endif + #endif // HOTENDS > 5 + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 + #endif // HOTENDS > 1 + #endif // HOTENDS > 1 #if HAS_HEATED_BED #ifdef 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 - bed_minttemp_raw -= OVERSAMPLENR; - #endif - } - #endif // BED_MINTEMP + while (analog_to_celsius_bed(mintemp_raw_BED) < BED_MINTEMP) mintemp_raw_BED += TEMPDIR(BED) * (OVERSAMPLENR); + #endif #ifdef 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 - bed_maxttemp_raw += OVERSAMPLENR; - #endif - } - #endif // BED_MAXTEMP + while (analog_to_celsius_bed(maxtemp_raw_BED) > BED_MAXTEMP) mintemp_raw_BED -= TEMPDIR(BED) * (OVERSAMPLENR); + #endif #endif // HAS_HEATED_BED + #if HAS_HEATED_CHAMBER + #ifdef CHAMBER_MINTEMP + while (analog_to_celsius_chamber(mintemp_raw_CHAMBER) < CHAMBER_MINTEMP) mintemp_raw_CHAMBER += TEMPDIR(CHAMBER) * (OVERSAMPLENR); + #endif + #ifdef CHAMBER_MAXTEMP + while (analog_to_celsius_chamber(maxtemp_raw_CHAMBER) > CHAMBER_MAXTEMP) mintemp_raw_CHAMBER -= TEMPDIR(CHAMBER) * (OVERSAMPLENR); + #endif + #endif + #if ENABLED(PROBING_HEATERS_OFF) paused = false; #endif } -#if ENABLED(FAST_PWM_FAN) - - void Temperature::setPwmFrequency(const pin_t pin, int val) { - #if defined(ARDUINO) && !defined(ARDUINO_ARCH_SAM) - val &= 0x07; - switch (digitalPinToTimer(pin)) { - #ifdef TCCR0A - #if !AVR_AT90USB1286_FAMILY - case TIMER0A: - #endif - case TIMER0B: //_SET_CS(0, val); - break; - #endif - #ifdef TCCR1A - case TIMER1A: case TIMER1B: //_SET_CS(1, val); - break; - #endif - #if defined(TCCR2) || defined(TCCR2A) - #ifdef TCCR2 - case TIMER2: - #endif - #ifdef TCCR2A - case TIMER2A: case TIMER2B: - #endif - _SET_CS(2, val); break; - #endif - #ifdef TCCR3A - case TIMER3A: case TIMER3B: case TIMER3C: _SET_CS(3, val); break; - #endif - #ifdef TCCR4A - case TIMER4A: case TIMER4B: case TIMER4C: _SET_CS(4, val); break; - #endif - #ifdef TCCR5A - case TIMER5A: case TIMER5B: case TIMER5C: _SET_CS(5, val); break; - #endif - } - #endif - } - -#endif // FAST_PWM_FAN - #if WATCH_HOTENDS /** * Start Heating Sanity Check for hotends that are below @@ -1556,19 +1547,17 @@ void Temperature::init() { * This is called when the temperature is set. (M104, M109) */ void Temperature::start_watching_heater(const uint8_t e) { - #if HOTENDS == 1 - UNUSED(e); - #endif + E_UNUSED(); 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; + watch_hotend[HOTEND_INDEX].target = degHotend(HOTEND_INDEX) + WATCH_TEMP_INCREASE; + watch_hotend[HOTEND_INDEX].next_ms = millis() + (WATCH_TEMP_PERIOD) * 1000UL; } else - watch_heater_next_ms[HOTEND_INDEX] = 0; + watch_hotend[HOTEND_INDEX].next_ms = 0; } #endif -#if WATCH_THE_BED +#if WATCH_BED /** * Start Heating Sanity Check for hotends that are below * their target temperature by a configurable margin. @@ -1576,42 +1565,56 @@ void Temperature::init() { */ void Temperature::start_watching_bed() { 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; + watch_bed.target = degBed() + WATCH_BED_TEMP_INCREASE; + watch_bed.next_ms = millis() + (WATCH_BED_TEMP_PERIOD) * 1000UL; } else - watch_bed_next_ms = 0; + watch_bed.next_ms = 0; } #endif -#if ENABLED(THERMAL_PROTECTION_HOTENDS) || HAS_THERMALLY_PROTECTED_BED +#if WATCH_CHAMBER + /** + * Start Heating Sanity Check for hotends that are below + * their target temperature by a configurable margin. + * This is called when the temperature is set. (M141, M191) + */ + void Temperature::start_watching_chamber() { + if (degChamber() < degTargetChamber() - (WATCH_CHAMBER_TEMP_INCREASE + TEMP_CHAMBER_HYSTERESIS + 1)) { + watch_chamber.target = degChamber() + WATCH_CHAMBER_TEMP_INCREASE; + watch_chamber.next_ms = millis() + (WATCH_CHAMBER_TEMP_PERIOD) * 1000UL; + } + else + watch_chamber.next_ms = 0; + } +#endif + +#if ENABLED(THERMAL_PROTECTION_HOTENDS) || HAS_THERMALLY_PROTECTED_BED || ENABLED(THERMAL_PROTECTION_CHAMBER) #if ENABLED(THERMAL_PROTECTION_HOTENDS) - Temperature::TRState Temperature::thermal_runaway_state_machine[HOTENDS] = { TRInactive }; - millis_t Temperature::thermal_runaway_timer[HOTENDS] = { 0 }; + Temperature::tr_state_machine_t Temperature::tr_state_machine[HOTENDS]; // = { { TRInactive, 0 } }; #endif - #if HAS_THERMALLY_PROTECTED_BED - Temperature::TRState Temperature::thermal_runaway_bed_state_machine = TRInactive; - millis_t Temperature::thermal_runaway_bed_timer; + Temperature::tr_state_machine_t Temperature::tr_state_machine_bed; // = { TRInactive, 0 }; + #endif + #if ENABLED(THERMAL_PROTECTION_CHAMBER) + Temperature::tr_state_machine_t Temperature::tr_state_machine_chamber; // = { TRInactive, 0 }; #endif - void Temperature::thermal_runaway_protection(Temperature::TRState * const state, millis_t * const timer, const float ¤t, const float &target, const int8_t heater_id, const uint16_t period_seconds, const uint16_t hysteresis_degc) { + void Temperature::thermal_runaway_protection(Temperature::tr_state_machine_t &sm, const float ¤t, const float &target, const int8_t heater_id, const uint16_t period_seconds, const uint16_t hysteresis_degc) { static float tr_target_temperature[HOTENDS + 1] = { 0.0 }; /** SERIAL_ECHO_START(); SERIAL_ECHOPGM("Thermal Thermal Runaway Running. Heater ID: "); + if (heater_id == -2) SERIAL_ECHOPGM("chamber"); if (heater_id < 0) SERIAL_ECHOPGM("bed"); else SERIAL_ECHO(heater_id); - SERIAL_ECHOPAIR(" ; State:", *state); - SERIAL_ECHOPAIR(" ; Timer:", *timer); - SERIAL_ECHOPAIR(" ; Temperature:", current); - SERIAL_ECHOPAIR(" ; Target Temp:", target); + SERIAL_ECHOPAIR(" ; State:", sm.state, " ; Timer:", sm.timer, " ; Temperature:", current, " ; Target Temp:", target); if (heater_id >= 0) - SERIAL_ECHOPAIR(" ; Idle Timeout:", heater_idle_timeout_exceeded[heater_id]); + SERIAL_ECHOPAIR(" ; Idle Timeout:", hotend_idle[heater_id].timed_out); else - SERIAL_ECHOPAIR(" ; Idle Timeout:", bed_idle_timeout_exceeded); + SERIAL_ECHOPAIR(" ; Idle Timeout:", bed_idle.timed_out); SERIAL_EOL(); */ @@ -1619,12 +1622,12 @@ void Temperature::init() { #if HEATER_IDLE_HANDLER // If the heater idle timeout expires, restart - if ((heater_id >= 0 && heater_idle_timeout_exceeded[heater_id]) + if ((heater_id >= 0 && hotend_idle[heater_id].timed_out) #if HAS_HEATED_BED - || (heater_id < 0 && bed_idle_timeout_exceeded) + || (heater_id < 0 && bed_idle.timed_out) #endif ) { - *state = TRInactive; + sm.state = TRInactive; tr_target_temperature[heater_index] = 0; } else @@ -1633,18 +1636,18 @@ void Temperature::init() { // If the target temperature changes, restart if (tr_target_temperature[heater_index] != target) { tr_target_temperature[heater_index] = target; - *state = target > 0 ? TRFirstHeating : TRInactive; + sm.state = target > 0 ? TRFirstHeating : TRInactive; } } - switch (*state) { + switch (sm.state) { // Inactive state waits for a target temperature to be set case TRInactive: break; // When first heating, wait for the temperature to be reached then go to Stable state case TRFirstHeating: if (current < tr_target_temperature[heater_index]) break; - *state = TRStable; + sm.state = TRStable; // While the temperature is stable watch for a bad temperature case TRStable: @@ -1666,18 +1669,18 @@ void Temperature::init() { #endif if (current >= tr_target_temperature[heater_index] - hysteresis_degc) { - *timer = millis() + period_seconds * 1000UL; + sm.timer = millis() + period_seconds * 1000UL; break; } - else if (PENDING(millis(), *timer)) break; - *state = TRRunaway; + else if (PENDING(millis(), sm.timer)) break; + sm.state = TRRunaway; case TRRunaway: _temp_error(heater_id, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, heater_id)); } } -#endif // THERMAL_PROTECTION_HOTENDS || THERMAL_PROTECTION_BED +#endif // THERMAL_PROTECTION_HOTENDS || THERMAL_PROTECTION_BED || ENABLED(THERMAL_PROTECTION_CHAMBER) void Temperature::disable_all_heaters() { @@ -1691,6 +1694,10 @@ void Temperature::disable_all_heaters() { setTargetBed(0); #endif + #if HAS_HEATED_CHAMBER + setTargetChamber(0); + #endif + // Unpause and reset everything #if ENABLED(PROBING_HEATERS_OFF) pause(false); @@ -1698,7 +1705,7 @@ void Temperature::disable_all_heaters() { #define DISABLE_HEATER(NR) { \ setTargetHotend(0, NR); \ - soft_pwm_amount[NR] = 0; \ + temp_hotend[NR].soft_pwm_amount = 0; \ WRITE_HEATER_ ##NR (LOW); \ } @@ -1722,12 +1729,20 @@ void Temperature::disable_all_heaters() { #endif #if HAS_HEATED_BED - target_temperature_bed = 0; - soft_pwm_amount_bed = 0; + temp_bed.target = 0; + temp_bed.soft_pwm_amount = 0; #if HAS_HEATED_BED WRITE_HEATER_BED(LOW); #endif #endif + + #if HAS_HEATED_CHAMBER + temp_chamber.target = 0; + temp_chamber.soft_pwm_amount = 0; + #if HAS_HEATED_CHAMBER + WRITE_HEATER_CHAMBER(LOW); + #endif + #endif } #if ENABLED(PROBING_HEATERS_OFF) @@ -1736,9 +1751,9 @@ void Temperature::disable_all_heaters() { if (p != paused) { paused = p; if (p) { - HOTEND_LOOP() start_heater_idle_timer(e, 0); // timeout immediately + HOTEND_LOOP() hotend_idle[e].expire(); // timeout immediately #if HAS_HEATED_BED - start_bed_idle_timer(0); // timeout immediately + bed_idle.expire(); // timeout immediately #endif } else { @@ -1797,19 +1812,23 @@ void Temperature::disable_all_heaters() { // // TODO: spiBegin, spiRec and spiInit doesn't work when soft spi is used. // - #if MAX6675_SEPARATE_SPI + #if !MAX6675_SEPARATE_SPI spiBegin(); spiInit(MAX6675_SPEED_BITS); #endif #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) + #define SET_OUTPUT_MAX6675() do{ switch (hindex) { case 1: SET_OUTPUT(MAX6675_SS2_PIN); break; default: SET_OUTPUT(MAX6675_SS_PIN); } }while(0) #elif ENABLED(HEATER_1_USES_MAX6675) #define WRITE_MAX6675(V) WRITE(MAX6675_SS2_PIN, V) + #define SET_OUTPUT_MAX6675() SET_OUTPUT(MAX6675_SS2_PIN) #else #define WRITE_MAX6675(V) WRITE(MAX6675_SS_PIN, V) + #define SET_OUTPUT_MAX6675() SET_OUTPUT(MAX6675_SS_PIN) #endif + SET_OUTPUT_MAX6675(); WRITE_MAX6675(LOW); // enable TT_MAX6675 DELAY_NS(100); // Ensure 100ns delay @@ -1877,38 +1896,37 @@ void Temperature::disable_all_heaters() { void Temperature::set_current_temp_raw() { #if HAS_TEMP_ADC_0 && DISABLED(HEATER_0_USES_MAX6675) - current_temperature_raw[0] = raw_temp_value[0]; + temp_hotend[0].raw = temp_hotend[0].acc; #endif #if HAS_TEMP_ADC_1 - #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) - redundant_temperature_raw = raw_temp_value[1]; + redundant_temperature_raw = temp_hotend[1].acc; #elif DISABLED(HEATER_1_USES_MAX6675) - current_temperature_raw[1] = raw_temp_value[1]; + temp_hotend[1].raw = temp_hotend[1].acc; #endif - #if HAS_TEMP_ADC_2 - current_temperature_raw[2] = raw_temp_value[2]; + temp_hotend[2].raw = temp_hotend[2].acc; #if HAS_TEMP_ADC_3 - current_temperature_raw[3] = raw_temp_value[3]; + temp_hotend[3].raw = temp_hotend[3].acc; #if HAS_TEMP_ADC_4 - current_temperature_raw[4] = raw_temp_value[4]; + temp_hotend[4].raw = temp_hotend[4].acc; #if HAS_TEMP_ADC_5 - current_temperature_raw[5] = raw_temp_value[5]; + temp_hotend[5].raw = temp_hotend[5].acc; #endif // HAS_TEMP_ADC_5 #endif // HAS_TEMP_ADC_4 #endif // HAS_TEMP_ADC_3 #endif // HAS_TEMP_ADC_2 - #endif // HAS_TEMP_ADC_1 #if HAS_HEATED_BED - current_temperature_bed_raw = raw_temp_bed_value; + temp_bed.raw = temp_bed.acc; #endif + #if HAS_TEMP_CHAMBER - current_temperature_chamber_raw = raw_temp_chamber_value; + temp_chamber.raw = temp_chamber.acc; #endif + temp_meas_ready = true; } @@ -1925,18 +1943,16 @@ void Temperature::readings_ready() { current_raw_filwidth = raw_filwidth_value >> 10; // Divide to get to 0-16384 range since we used 1/128 IIR filter approach #endif - ZERO(raw_temp_value); + HOTEND_LOOP() temp_hotend[e].acc = 0; #if HAS_HEATED_BED - raw_temp_bed_value = 0; + temp_bed.acc = 0; #endif #if HAS_TEMP_CHAMBER - raw_temp_chamber_value = 0; + temp_chamber.acc = 0; #endif - #define TEMPDIR(N) ((HEATER_##N##_RAW_LO_TEMP) > (HEATER_##N##_RAW_HI_TEMP) ? -1 : 1) - int constexpr temp_dir[] = { #if ENABLED(HEATER_0_USES_MAX6675) 0 @@ -1961,14 +1977,14 @@ void Temperature::readings_ready() { }; for (uint8_t e = 0; e < COUNT(temp_dir); e++) { - const int16_t tdir = temp_dir[e], rawtemp = current_temperature_raw[e] * tdir; - const bool heater_on = (target_temperature[e] > 0) + const int16_t tdir = temp_dir[e], rawtemp = temp_hotend[e].raw * tdir; + const bool heater_on = (temp_hotend[e].target > 0) #if ENABLED(PIDTEMP) - || (soft_pwm_amount[e] > 0) + || (temp_hotend[e].soft_pwm_amount > 0) #endif ; - if (rawtemp > maxttemp_raw[e] * tdir) max_temp_error(e); - if (rawtemp < minttemp_raw[e] * tdir && !is_preheating(e) && heater_on) { + if (rawtemp > temp_range[e].raw_max * tdir) max_temp_error(e); + if (heater_on && rawtemp < temp_range[e].raw_min * tdir && !is_preheating(e)) { #ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED if (++consecutive_low_temperature_error[e] >= MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED) #endif @@ -1981,18 +1997,33 @@ void Temperature::readings_ready() { } #if HAS_HEATED_BED - #if HEATER_BED_RAW_LO_TEMP > HEATER_BED_RAW_HI_TEMP + #if TEMPDIR(BED) < 0 #define BEDCMP(A,B) ((A)<=(B)) #else #define BEDCMP(A,B) ((A)>=(B)) #endif - const bool bed_on = (target_temperature_bed > 0) + const bool bed_on = (temp_bed.target > 0) #if ENABLED(PIDTEMPBED) - || (soft_pwm_amount_bed > 0) + || (temp_bed.soft_pwm_amount > 0) #endif ; - 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); + if (BEDCMP(temp_bed.raw, maxtemp_raw_BED)) max_temp_error(-1); + if (bed_on && BEDCMP(mintemp_raw_BED, temp_bed.raw)) min_temp_error(-1); + #endif + + #if HAS_HEATED_CHAMBER + #if TEMPDIR(CHAMBER) < 0 + #define CHAMBERCMP(A,B) ((A)<=(B)) + #else + #define CHAMBERCMP(A,B) ((A)>=(B)) + #endif + const bool chamber_on = (temp_chamber.target > 0) + #if ENABLED(PIDTEMPCHAMBER) + || (temp_chamber.soft_pwm_amount > 0) + #endif + ; + if (CHAMBERCMP(temp_chamber.raw, maxtemp_raw_CHAMBER)) max_temp_error(-2); + if (chamber_on && CHAMBERCMP(mintemp_raw_CHAMBER, temp_chamber.raw)) min_temp_error(-2); #endif } @@ -2011,7 +2042,7 @@ void Temperature::readings_ready() { * - For ENDSTOP_INTERRUPTS_FEATURE check endstops if flagged * - Call planner.tick to count down its "ignore" time */ -HAL_TEMP_TIMER_ISR { +HAL_TEMP_TIMER_ISR() { HAL_timer_isr_prologue(TEMP_TIMER_NUM); Temperature::isr(); @@ -2019,6 +2050,31 @@ HAL_TEMP_TIMER_ISR { HAL_timer_isr_epilogue(TEMP_TIMER_NUM); } +#if ENABLED(SLOW_PWM_HEATERS) && !defined(MIN_STATE_TIME) + #define MIN_STATE_TIME 16 // MIN_STATE_TIME * 65.5 = time in milliseconds +#endif + +class SoftPWM { +public: + uint8_t count; + inline bool add(const uint8_t mask, const uint8_t amount) { + count = (count & mask) + amount; return (count > mask); + } + #if ENABLED(SLOW_PWM_HEATERS) + bool state_heater; + uint8_t state_timer_heater; + inline void dec() { if (state_timer_heater > 0) state_timer_heater--; } + inline bool ready(const bool v) { + const bool rdy = !state_timer_heater; + if (rdy && state_heater != v) { + state_heater = v; + state_timer_heater = MIN_STATE_TIME; + } + return rdy; + } + #endif +}; + void Temperature::isr() { static int8_t temp_count = -1; @@ -2031,36 +2087,18 @@ void Temperature::isr() { static unsigned int raw_ADCKey_value = 0; #endif - // Static members for each heater #if ENABLED(SLOW_PWM_HEATERS) static uint8_t slow_pwm_count = 0; - #define ISR_STATICS(n) \ - static uint8_t soft_pwm_count_ ## n, \ - state_heater_ ## n = 0, \ - state_timer_heater_ ## n = 0 - #else - #define ISR_STATICS(n) static uint8_t soft_pwm_count_ ## n = 0 #endif - // Statics per heater - ISR_STATICS(0); - #if HOTENDS > 1 - ISR_STATICS(1); - #if HOTENDS > 2 - ISR_STATICS(2); - #if HOTENDS > 3 - ISR_STATICS(3); - #if HOTENDS > 4 - ISR_STATICS(4); - #if HOTENDS > 5 - ISR_STATICS(5); - #endif // HOTENDS > 5 - #endif // HOTENDS > 4 - #endif // HOTENDS > 3 - #endif // HOTENDS > 2 - #endif // HOTENDS > 1 + static SoftPWM soft_pwm_hotend[HOTENDS]; + #if HAS_HEATED_BED - ISR_STATICS(BED); + static SoftPWM soft_pwm_bed; + #endif + + #if HAS_HEATED_CHAMBER + static SoftPWM soft_pwm_chamber; #endif #if DISABLED(SLOW_PWM_HEATERS) @@ -2077,23 +2115,22 @@ void Temperature::isr() { */ if (pwm_count_tmp >= 127) { pwm_count_tmp -= 127; - soft_pwm_count_0 = (soft_pwm_count_0 & pwm_mask) + soft_pwm_amount[0]; - WRITE_HEATER_0(soft_pwm_count_0 > pwm_mask ? HIGH : LOW); + #define _PWM_MOD(N,S,T) do{ \ + const bool on = S.add(pwm_mask, T.soft_pwm_amount); \ + WRITE_HEATER_##N(on); \ + }while(0) + #define _PWM_MOD_E(N) _PWM_MOD(N,soft_pwm_hotend[N],temp_hotend[N]) + _PWM_MOD_E(0); #if HOTENDS > 1 - soft_pwm_count_1 = (soft_pwm_count_1 & pwm_mask) + soft_pwm_amount[1]; - WRITE_HEATER_1(soft_pwm_count_1 > pwm_mask ? HIGH : LOW); + _PWM_MOD_E(1); #if HOTENDS > 2 - soft_pwm_count_2 = (soft_pwm_count_2 & pwm_mask) + soft_pwm_amount[2]; - WRITE_HEATER_2(soft_pwm_count_2 > pwm_mask ? HIGH : LOW); + _PWM_MOD_E(2); #if HOTENDS > 3 - soft_pwm_count_3 = (soft_pwm_count_3 & pwm_mask) + soft_pwm_amount[3]; - WRITE_HEATER_3(soft_pwm_count_3 > pwm_mask ? HIGH : LOW); + _PWM_MOD_E(3); #if HOTENDS > 4 - soft_pwm_count_4 = (soft_pwm_count_4 & pwm_mask) + soft_pwm_amount[4]; - WRITE_HEATER_4(soft_pwm_count_4 > pwm_mask ? HIGH : LOW); + _PWM_MOD_E(4); #if HOTENDS > 5 - soft_pwm_count_5 = (soft_pwm_count_5 & pwm_mask) + soft_pwm_amount[5]; - WRITE_HEATER_5(soft_pwm_count_5 > pwm_mask ? HIGH : LOW); + _PWM_MOD_E(5); #endif // HOTENDS > 5 #endif // HOTENDS > 4 #endif // HOTENDS > 3 @@ -2101,45 +2138,57 @@ void Temperature::isr() { #endif // HOTENDS > 1 #if HAS_HEATED_BED - soft_pwm_count_BED = (soft_pwm_count_BED & pwm_mask) + soft_pwm_amount_bed; - WRITE_HEATER_BED(soft_pwm_count_BED > pwm_mask ? HIGH : LOW); + _PWM_MOD(BED,soft_pwm_bed,temp_bed); + #endif + + #if HAS_HEATED_CHAMBER + _PWM_MOD(CHAMBER,soft_pwm_chamber,temp_chamber); #endif #if ENABLED(FAN_SOFT_PWM) + #define _FAN_PWM(N) do{ \ + soft_pwm_count_fan[N] = (soft_pwm_count_fan[N] & pwm_mask) + (soft_pwm_amount_fan[N] >> 1); \ + WRITE_FAN_N(N, soft_pwm_count_fan[N] > pwm_mask ? HIGH : LOW); \ + }while(0) #if HAS_FAN0 - soft_pwm_count_fan[0] = (soft_pwm_count_fan[0] & pwm_mask) + (soft_pwm_amount_fan[0] >> 1); - WRITE_FAN(soft_pwm_count_fan[0] > pwm_mask ? HIGH : LOW); + _FAN_PWM(0); #endif #if HAS_FAN1 - soft_pwm_count_fan[1] = (soft_pwm_count_fan[1] & pwm_mask) + (soft_pwm_amount_fan[1] >> 1); - WRITE_FAN1(soft_pwm_count_fan[1] > pwm_mask ? HIGH : LOW); + _FAN_PWM(1); #endif #if HAS_FAN2 - soft_pwm_count_fan[2] = (soft_pwm_count_fan[2] & pwm_mask) + (soft_pwm_amount_fan[2] >> 1); - WRITE_FAN2(soft_pwm_count_fan[2] > pwm_mask ? HIGH : LOW); + _FAN_PWM(2); #endif #endif } else { - if (soft_pwm_count_0 <= pwm_count_tmp) WRITE_HEATER_0(LOW); - #if HOTENDS > 1 - if (soft_pwm_count_1 <= pwm_count_tmp) WRITE_HEATER_1(LOW); - #if HOTENDS > 2 - if (soft_pwm_count_2 <= pwm_count_tmp) WRITE_HEATER_2(LOW); - #if HOTENDS > 3 - if (soft_pwm_count_3 <= pwm_count_tmp) WRITE_HEATER_3(LOW); - #if HOTENDS > 4 - if (soft_pwm_count_4 <= pwm_count_tmp) WRITE_HEATER_4(LOW); - #if HOTENDS > 5 - if (soft_pwm_count_5 <= pwm_count_tmp) WRITE_HEATER_5(LOW); - #endif // HOTENDS > 5 - #endif // HOTENDS > 4 - #endif // HOTENDS > 3 - #endif // HOTENDS > 2 - #endif // HOTENDS > 1 + #define _PWM_LOW(N,S) do{ if (S.count <= pwm_count_tmp) WRITE_HEATER_##N(LOW); }while(0) + #if HOTENDS + #define _PWM_LOW_E(N) _PWM_LOW(N, soft_pwm_hotend[N]) + _PWM_LOW_E(0); + #if HOTENDS > 1 + _PWM_LOW_E(1); + #if HOTENDS > 2 + _PWM_LOW_E(2); + #if HOTENDS > 3 + _PWM_LOW_E(3); + #if HOTENDS > 4 + _PWM_LOW_E(4); + #if HOTENDS > 5 + _PWM_LOW_E(5); + #endif // HOTENDS > 5 + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 + #endif // HOTENDS > 1 + #endif // HOTENDS #if HAS_HEATED_BED - if (soft_pwm_count_BED <= pwm_count_tmp) WRITE_HEATER_BED(LOW); + _PWM_LOW(BED, soft_pwm_bed); + #endif + + #if HAS_HEATED_CHAMBER + _PWM_LOW(CHAMBER, soft_pwm_chamber); #endif #if ENABLED(FAN_SOFT_PWM) @@ -2172,96 +2221,77 @@ void Temperature::isr() { * * For relay-driven heaters */ - #ifndef MIN_STATE_TIME - #define MIN_STATE_TIME 16 // MIN_STATE_TIME * 65.5 = time in milliseconds - #endif - - // Macros for Slow PWM timer logic - #define _SLOW_PWM_ROUTINE(NR, src) \ - soft_pwm_count_ ##NR = src; \ - if (soft_pwm_count_ ##NR > 0) { \ - if (state_timer_heater_ ##NR == 0) { \ - if (state_heater_ ##NR == 0) state_timer_heater_ ##NR = MIN_STATE_TIME; \ - state_heater_ ##NR = 1; \ - WRITE_HEATER_ ##NR(1); \ - } \ - } \ - else { \ - if (state_timer_heater_ ##NR == 0) { \ - if (state_heater_ ##NR == 1) state_timer_heater_ ##NR = MIN_STATE_TIME; \ - state_heater_ ##NR = 0; \ - WRITE_HEATER_ ##NR(0); \ - } \ - } - #define SLOW_PWM_ROUTINE(n) _SLOW_PWM_ROUTINE(n, soft_pwm_amount[n]) - - #define PWM_OFF_ROUTINE(NR) \ - if (soft_pwm_count_ ##NR < slow_pwm_count) { \ - if (state_timer_heater_ ##NR == 0) { \ - if (state_heater_ ##NR == 1) state_timer_heater_ ##NR = MIN_STATE_TIME; \ - state_heater_ ##NR = 0; \ - WRITE_HEATER_ ##NR (0); \ - } \ - } + #define _SLOW_SET(NR,PWM,V) do{ if (PWM.ready(V)) WRITE_HEATER_##NR(V); }while(0) + #define _SLOW_PWM(NR,PWM,SRC) do{ PWM.count = SRC.soft_pwm_amount; _SLOW_SET(NR,PWM,(PWM.count > 0)); }while(0) + #define _PWM_OFF(NR,PWM) do{ if (PWM.count < slow_pwm_count) _SLOW_SET(NR,PWM,0); }while(0) if (slow_pwm_count == 0) { - SLOW_PWM_ROUTINE(0); + #if HOTENDS + #define _SLOW_PWM_E(N) _SLOW_PWM(N, soft_pwm_hotend[N], temp_hotend[N]) + _SLOW_PWM_E(0); + #if HOTENDS > 1 + _SLOW_PWM_E(1); + #if HOTENDS > 2 + _SLOW_PWM_E(2); + #if HOTENDS > 3 + _SLOW_PWM_E(3); + #if HOTENDS > 4 + _SLOW_PWM_E(4); + #if HOTENDS > 5 + _SLOW_PWM_E(5); + #endif // HOTENDS > 5 + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 + #endif // HOTENDS > 1 + #endif // HOTENDS + + #if HAS_HEATED_BED + _SLOW_PWM(BED, soft_pwm_bed, temp_bed); + #endif + + } // slow_pwm_count == 0 + + #if HOTENDS + #define _PWM_OFF_E(N) _PWM_OFF(N, soft_pwm_hotend[N]); + _PWM_OFF_E(0); #if HOTENDS > 1 - SLOW_PWM_ROUTINE(1); + _PWM_OFF_E(1); #if HOTENDS > 2 - SLOW_PWM_ROUTINE(2); + _PWM_OFF_E(2); #if HOTENDS > 3 - SLOW_PWM_ROUTINE(3); + _PWM_OFF_E(3); #if HOTENDS > 4 - SLOW_PWM_ROUTINE(4); + _PWM_OFF_E(4); #if HOTENDS > 5 - SLOW_PWM_ROUTINE(5); + _PWM_OFF_E(5); #endif // HOTENDS > 5 #endif // HOTENDS > 4 #endif // HOTENDS > 3 #endif // HOTENDS > 2 #endif // HOTENDS > 1 - #if HAS_HEATED_BED - _SLOW_PWM_ROUTINE(BED, soft_pwm_amount_bed); // BED - #endif + #endif // HOTENDS - } // slow_pwm_count == 0 - - PWM_OFF_ROUTINE(0); - #if HOTENDS > 1 - PWM_OFF_ROUTINE(1); - #if HOTENDS > 2 - PWM_OFF_ROUTINE(2); - #if HOTENDS > 3 - PWM_OFF_ROUTINE(3); - #if HOTENDS > 4 - PWM_OFF_ROUTINE(4); - #if HOTENDS > 5 - PWM_OFF_ROUTINE(5); - #endif // HOTENDS > 5 - #endif // HOTENDS > 4 - #endif // HOTENDS > 3 - #endif // HOTENDS > 2 - #endif // HOTENDS > 1 #if HAS_HEATED_BED - PWM_OFF_ROUTINE(BED); // BED + _PWM_OFF(BED, soft_pwm_bed); #endif #if ENABLED(FAN_SOFT_PWM) if (pwm_count_tmp >= 127) { pwm_count_tmp = 0; + #define _PWM_FAN(N,I) do{ \ + soft_pwm_count_fan[I] = soft_pwm_amount_fan[I] >> 1; \ + WRITE_FAN##N(soft_pwm_count_fan[I] > 0 ? HIGH : LOW); \ + }while(0) #if HAS_FAN0 - soft_pwm_count_fan[0] = soft_pwm_amount_fan[0] >> 1; - WRITE_FAN(soft_pwm_count_fan[0] > 0 ? HIGH : LOW); + _PWM_FAN(,0); #endif #if HAS_FAN1 - soft_pwm_count_fan[1] = soft_pwm_amount_fan[1] >> 1; - WRITE_FAN1(soft_pwm_count_fan[1] > 0 ? HIGH : LOW); + _PWM_FAN(1,1); #endif #if HAS_FAN2 - soft_pwm_count_fan[2] = soft_pwm_amount_fan[2] >> 1; - WRITE_FAN2(soft_pwm_count_fan[2] > 0 ? HIGH : LOW); + _PWM_FAN(2,2); #endif } #if HAS_FAN0 @@ -2291,24 +2321,24 @@ void Temperature::isr() { slow_pwm_count++; slow_pwm_count &= 0x7F; - if (state_timer_heater_0 > 0) state_timer_heater_0--; + soft_pwm_hotend[0].dec(); #if HOTENDS > 1 - if (state_timer_heater_1 > 0) state_timer_heater_1--; + soft_pwm_hotend[1].dec(); #if HOTENDS > 2 - if (state_timer_heater_2 > 0) state_timer_heater_2--; + soft_pwm_hotend[2].dec(); #if HOTENDS > 3 - if (state_timer_heater_3 > 0) state_timer_heater_3--; + soft_pwm_hotend[3].dec(); #if HOTENDS > 4 - if (state_timer_heater_4 > 0) state_timer_heater_4--; + soft_pwm_hotend[4].dec(); #if HOTENDS > 5 - if (state_timer_heater_5 > 0) state_timer_heater_5--; + soft_pwm_hotend[5].dec(); #endif // HOTENDS > 5 #endif // HOTENDS > 4 #endif // HOTENDS > 3 #endif // HOTENDS > 2 #endif // HOTENDS > 1 #if HAS_HEATED_BED - if (state_timer_heater_BED > 0) state_timer_heater_BED--; + soft_pwm_bed.dec(); #endif } // ((pwm_count >> SOFT_PWM_SCALE) & 0x3F) == 0 @@ -2329,9 +2359,9 @@ void Temperature::isr() { * * This gives each ADC 0.9765ms to charge up. */ - #define ACCUMULATE_ADC(var) do{ \ + #define ACCUMULATE_ADC(obj) do{ \ if (!HAL_ADC_READY()) next_sensor_state = adc_sensor_state; \ - else var += HAL_READ_ADC(); \ + else obj.acc += HAL_READ_ADC(); \ }while(0) ADCSensorState next_sensor_state = adc_sensor_state < SensorsReady ? (ADCSensorState)(int(adc_sensor_state) + 1) : StartSampling; @@ -2367,7 +2397,7 @@ void Temperature::isr() { HAL_START_ADC(TEMP_0_PIN); break; case MeasureTemp_0: - ACCUMULATE_ADC(raw_temp_value[0]); + ACCUMULATE_ADC(temp_hotend[0]); break; #endif @@ -2376,7 +2406,7 @@ void Temperature::isr() { HAL_START_ADC(TEMP_BED_PIN); break; case MeasureTemp_BED: - ACCUMULATE_ADC(raw_temp_bed_value); + ACCUMULATE_ADC(temp_bed); break; #endif @@ -2385,7 +2415,7 @@ void Temperature::isr() { HAL_START_ADC(TEMP_CHAMBER_PIN); break; case MeasureTemp_CHAMBER: - ACCUMULATE_ADC(raw_temp_chamber_value); + ACCUMULATE_ADC(temp_chamber); break; #endif @@ -2394,7 +2424,7 @@ void Temperature::isr() { HAL_START_ADC(TEMP_1_PIN); break; case MeasureTemp_1: - ACCUMULATE_ADC(raw_temp_value[1]); + ACCUMULATE_ADC(temp_hotend[1]); break; #endif @@ -2403,7 +2433,7 @@ void Temperature::isr() { HAL_START_ADC(TEMP_2_PIN); break; case MeasureTemp_2: - ACCUMULATE_ADC(raw_temp_value[2]); + ACCUMULATE_ADC(temp_hotend[2]); break; #endif @@ -2412,7 +2442,7 @@ void Temperature::isr() { HAL_START_ADC(TEMP_3_PIN); break; case MeasureTemp_3: - ACCUMULATE_ADC(raw_temp_value[3]); + ACCUMULATE_ADC(temp_hotend[3]); break; #endif @@ -2421,7 +2451,7 @@ void Temperature::isr() { HAL_START_ADC(TEMP_4_PIN); break; case MeasureTemp_4: - ACCUMULATE_ADC(raw_temp_value[4]); + ACCUMULATE_ADC(temp_hotend[4]); break; #endif @@ -2430,7 +2460,7 @@ void Temperature::isr() { HAL_START_ADC(TEMP_5_PIN); break; case MeasureTemp_5: - ACCUMULATE_ADC(raw_temp_value[5]); + ACCUMULATE_ADC(temp_hotend[5]); break; #endif @@ -2482,21 +2512,7 @@ void Temperature::isr() { // #if ENABLED(BABYSTEPPING) - #if ENABLED(BABYSTEP_XY) || ENABLED(I2C_POSITION_ENCODERS) - LOOP_XYZ(axis) { - const int16_t curTodo = babystepsTodo[axis]; // get rid of volatile for performance - if (curTodo) { - stepper.babystep((AxisEnum)axis, curTodo > 0); - if (curTodo > 0) babystepsTodo[axis]--; else babystepsTodo[axis]++; - } - } - #else - const int16_t curTodo = babystepsTodo[Z_AXIS]; - if (curTodo) { - stepper.babystep(Z_AXIS, curTodo > 0); - if (curTodo > 0) babystepsTodo[Z_AXIS]--; else babystepsTodo[Z_AXIS]++; - } - #endif + babystep.task(); #endif // Poll endstops state, if required @@ -2506,70 +2522,6 @@ void Temperature::isr() { planner.tick(); } -#if ENABLED(BABYSTEPPING) - - #if ENABLED(BABYSTEP_ALWAYS_AVAILABLE) - #define BSA_ENABLE(AXIS) do{ switch (AXIS) { case X_AXIS: enable_X(); break; case Y_AXIS: enable_Y(); break; case Z_AXIS: enable_Z(); } }while(0) - #else - #define BSA_ENABLE(AXIS) NOOP - #endif - - #if ENABLED(BABYSTEP_WITHOUT_HOMING) - #define CAN_BABYSTEP(AXIS) true - #else - #define CAN_BABYSTEP(AXIS) TEST(axis_known_position, AXIS) - #endif - - extern uint8_t axis_known_position; - - void Temperature::babystep_axis(const AxisEnum axis, const int16_t distance) { - if (!CAN_BABYSTEP(axis)) return; - #if IS_CORE - #if ENABLED(BABYSTEP_XY) - switch (axis) { - case CORE_AXIS_1: // X on CoreXY and CoreXZ, Y on CoreYZ - BSA_ENABLE(CORE_AXIS_1); - BSA_ENABLE(CORE_AXIS_2); - babystepsTodo[CORE_AXIS_1] += distance * 2; - babystepsTodo[CORE_AXIS_2] += distance * 2; - break; - case CORE_AXIS_2: // Y on CoreXY, Z on CoreXZ and CoreYZ - BSA_ENABLE(CORE_AXIS_1); - BSA_ENABLE(CORE_AXIS_2); - babystepsTodo[CORE_AXIS_1] += CORESIGN(distance * 2); - babystepsTodo[CORE_AXIS_2] -= CORESIGN(distance * 2); - break; - case NORMAL_AXIS: // Z on CoreXY, Y on CoreXZ, X on CoreYZ - default: - BSA_ENABLE(NORMAL_AXIS); - babystepsTodo[NORMAL_AXIS] += distance; - break; - } - #elif CORE_IS_XZ || CORE_IS_YZ - // Only Z stepping needs to be handled here - BSA_ENABLE(CORE_AXIS_1); - BSA_ENABLE(CORE_AXIS_2); - babystepsTodo[CORE_AXIS_1] += CORESIGN(distance * 2); - babystepsTodo[CORE_AXIS_2] -= CORESIGN(distance * 2); - #else - BSA_ENABLE(Z_AXIS); - babystepsTodo[Z_AXIS] += distance; - #endif - #else - #if ENABLED(BABYSTEP_XY) - BSA_ENABLE(axis); - #else - BSA_ENABLE(Z_AXIS); - #endif - babystepsTodo[axis] += distance; - #endif - #if ENABLED(BABYSTEP_ALWAYS_AVAILABLE) - gcode.reset_stepper_timeout(); - #endif - } - -#endif // BABYSTEPPING - #if HAS_TEMP_SENSOR #include "../gcode/gcode.h" @@ -2626,12 +2578,21 @@ void Temperature::isr() { ); #endif #if HAS_TEMP_CHAMBER - print_heater_state(degChamber(), 0 - #if ENABLED(SHOW_TEMP_ADC_VALUES) - , rawChamberTemp() - #endif + #if HAS_HEATED_CHAMBER + print_heater_state(degChamber(), degTargetChamber() + #if ENABLED(SHOW_TEMP_ADC_VALUES) + , rawChamberTemp() + #endif , -2 // CHAMBER ); + #else + print_heater_state(degChamber(), 0 + #if ENABLED(SHOW_TEMP_ADC_VALUES) + , rawChamberTemp() + #endif + , -2 // CHAMBER + ); + #endif // HAS_HEATED_CHAMBER #endif #if HOTENDS > 1 HOTEND_LOOP() print_heater_state(degHotend(e), degTargetHotend(e) @@ -2664,6 +2625,7 @@ 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; + PORT_REDIRECT(SERIAL_BOTH); print_heater_states(active_extruder); SERIAL_EOL(); } @@ -2671,7 +2633,7 @@ void Temperature::isr() { #endif // AUTO_REPORT_TEMPERATURES - #if ENABLED(ULTRA_LCD) || ENABLED(EXTENSIBLE_UI) + #if EITHER(ULTRA_LCD, EXTENSIBLE_UI) void Temperature::set_heating_message(const uint8_t e) { const bool heating = isHeatingHotend(e); #if HOTENDS > 1 diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index fd0706e20e..a8cfad34b3 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -36,10 +36,12 @@ #define SOFT_PWM_SCALE 0 #endif -#if HOTENDS == 1 +#if HOTENDS <= 1 #define HOTEND_INDEX 0 + #define E_UNUSED() UNUSED(e) #else #define HOTEND_INDEX e + #define E_UNUSED() #endif // PID storage @@ -47,6 +49,11 @@ 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; + #if LPQ_MAX_LEN > 255 + typedef uint16_t lpq_ptr_t; + #else + typedef uint8_t lpq_ptr_t; + #endif #else typedef PID_t hotend_pid_t; #endif @@ -54,11 +61,11 @@ typedef struct { float Kp, Ki, Kd, Kc; } PIDC_t; #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 + #define _PID_Kp(H) Temperature::temp_hotend[H].pid.Kp + #define _PID_Ki(H) Temperature::temp_hotend[H].pid.Ki + #define _PID_Kd(H) Temperature::temp_hotend[H].pid.Kd #if ENABLED(PID_EXTRUSION_SCALING) - #define _PID_Kc(H) Temperature::pid[H].Kc + #define _PID_Kc(H) Temperature::temp_hotend[H].pid.Kc #else #define _PID_Kc(H) 1 #endif @@ -80,6 +87,14 @@ enum ADCSensorState : char { PrepareTemp_0, MeasureTemp_0, #endif + #if HAS_HEATED_BED + PrepareTemp_BED, + MeasureTemp_BED, + #endif + #if HAS_TEMP_CHAMBER + PrepareTemp_CHAMBER, + MeasureTemp_CHAMBER, + #endif #if HAS_TEMP_ADC_1 PrepareTemp_1, MeasureTemp_1, @@ -96,13 +111,9 @@ enum ADCSensorState : char { PrepareTemp_4, MeasureTemp_4, #endif - #if HAS_HEATED_BED - PrepareTemp_BED, - MeasureTemp_BED, - #endif - #if HAS_TEMP_CHAMBER - PrepareTemp_CHAMBER, - MeasureTemp_CHAMBER, + #if HAS_TEMP_ADC_5 + PrepareTemp_5, + MeasureTemp_5, #endif #if ENABLED(FILAMENT_WIDTH_SENSOR) Prepare_FILWIDTH, @@ -136,16 +147,115 @@ enum ADCSensorState : char { #define G26_CLICK_CAN_CANCEL (HAS_LCD_MENU && ENABLED(G26_MESH_VALIDATION)) +enum TempIndex : uint8_t { + #if HOTENDS > 0 + TEMP_E0, + #if HOTENDS > 1 + TEMP_E1, + #if HOTENDS > 2 + TEMP_E2, + #if HOTENDS > 3 + TEMP_E3, + #if HOTENDS > 4 + TEMP_E4, + #if HOTENDS > 5 + TEMP_E5, + #endif + #endif + #endif + #endif + #endif + #endif + #if HAS_HEATED_BED + TEMP_BED, + #endif + #if HAS_HEATED_CHAMBER + TEMP_CHAMBER, + #endif + tempCOUNT +}; + +// A temperature sensor +typedef struct TempInfo { + uint16_t acc; + int16_t raw; + float current; +} temp_info_t; + +// A PWM heater with temperature sensor +typedef struct HeaterInfo : public TempInfo { + int16_t target; + uint8_t soft_pwm_amount; +} heater_info_t; + +// A heater with PID stabilization +template +struct PIDHeaterInfo : public HeaterInfo { + T pid; // Initialized by settings.load() +}; + +#if ENABLED(PIDTEMP) + typedef struct PIDHeaterInfo hotend_info_t; +#else + typedef heater_info_t hotend_info_t; +#endif +#if HAS_HEATED_BED + #if ENABLED(PIDTEMPBED) + typedef struct PIDHeaterInfo bed_info_t; + #else + typedef heater_info_t bed_info_t; + #endif +#endif +#if HAS_TEMP_CHAMBER + #if HAS_HEATED_CHAMBER + #if ENABLED(PIDTEMPCHAMBER) + typedef struct PIDHeaterInfo chamber_info_t; + #else + typedef heater_info_t chamber_info_t; + #endif + #else + typedef temp_info_t chamber_info_t; + #endif +#endif + +// Heater idle handling +typedef struct { + millis_t timeout_ms; + bool timed_out; + inline void update(const millis_t &ms) { if (!timed_out && timeout_ms && ELAPSED(ms, timeout_ms)) timed_out = true; } + inline void start(const millis_t &ms) { timeout_ms = millis() + ms; timed_out = false; } + inline void reset() { timeout_ms = 0; timed_out = false; } + inline void expire() { start(0); } +} heater_idle_t; + +// Heater watch handling +typedef struct { + uint16_t target; + millis_t next_ms; + inline bool elapsed(const millis_t &ms) { return next_ms && ELAPSED(ms, next_ms); } + inline bool elapsed() { return elapsed(millis()); } +} heater_watch_t; + +// Temperature sensor read value ranges +typedef struct { int16_t raw_min, raw_max; } raw_range_t; +typedef struct { int16_t mintemp, maxtemp; } celsius_range_t; +typedef struct { int16_t raw_min, raw_max, mintemp, maxtemp; } temp_range_t; + class Temperature { public: static volatile bool in_temp_isr; - static float current_temperature[HOTENDS]; - static int16_t current_temperature_raw[HOTENDS], - target_temperature[HOTENDS]; - static uint8_t soft_pwm_amount[HOTENDS]; + static hotend_info_t temp_hotend[HOTENDS]; + + #if HAS_HEATED_BED + static bed_info_t temp_bed; + #endif + + #if HAS_TEMP_CHAMBER + static chamber_info_t temp_chamber; + #endif #if ENABLED(AUTO_POWER_E_FANS) static uint8_t autofan_speed[HOTENDS]; @@ -156,37 +266,16 @@ class Temperature { soft_pwm_count_fan[FAN_COUNT]; #endif - #if ENABLED(PIDTEMP) - static hotend_pid_t pid[HOTENDS]; - #endif - - #if HAS_HEATED_BED - static float current_temperature_bed; - static int16_t current_temperature_bed_raw, target_temperature_bed; - static uint8_t soft_pwm_amount_bed; - #if ENABLED(PIDTEMPBED) - static PID_t bed_pid; - #endif - #endif - - #if ENABLED(BABYSTEPPING) - static volatile int16_t babystepsTodo[3]; - #endif - #if ENABLED(PREVENT_COLD_EXTRUSION) static bool allow_cold_extrude; static int16_t extrude_min_temp; FORCE_INLINE static bool tooCold(const int16_t temp) { return allow_cold_extrude ? false : temp < extrude_min_temp; } FORCE_INLINE static bool tooColdToExtrude(const uint8_t e) { - #if HOTENDS == 1 - UNUSED(e); - #endif + E_UNUSED(); return tooCold(degHotend(HOTEND_INDEX)); } FORCE_INLINE static bool targetTooColdToExtrude(const uint8_t e) { - #if HOTENDS == 1 - UNUSED(e); - #endif + E_UNUSED(); return tooCold(degTargetHotend(HOTEND_INDEX)); } #else @@ -197,6 +286,16 @@ class Temperature { FORCE_INLINE static bool hotEnoughToExtrude(const uint8_t e) { return !tooColdToExtrude(e); } FORCE_INLINE static bool targetHotEnoughToExtrude(const uint8_t e) { return !targetTooColdToExtrude(e); } + #if HEATER_IDLE_HANDLER + static heater_idle_t hotend_idle[HOTENDS]; + #if HAS_HEATED_BED + static heater_idle_t bed_idle; + #endif + #if HAS_HEATED_CHAMBER + static heater_idle_t chamber_idle; + #endif + #endif + private: #if EARLY_WATCHDOG @@ -204,11 +303,9 @@ class Temperature { #endif static volatile bool temp_meas_ready; - static uint16_t raw_temp_value[MAX_EXTRUDERS]; #if WATCH_HOTENDS - static uint16_t watch_target_temp[HOTENDS]; - static millis_t watch_heater_next_ms[HOTENDS]; + static heater_watch_t watch_hotend[HOTENDS]; #endif #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) @@ -217,42 +314,40 @@ class Temperature { #endif #if ENABLED(PID_EXTRUSION_SCALING) - static long last_e_position; - static long lpq[LPQ_MAX_LEN]; - static int lpq_ptr; + static int32_t last_e_position, lpq[LPQ_MAX_LEN]; + static lpq_ptr_t lpq_ptr; #endif - // Init min and max temp with extreme values to prevent false errors during startup - static int16_t minttemp_raw[HOTENDS], - maxttemp_raw[HOTENDS], - minttemp[HOTENDS], - maxttemp[HOTENDS]; + static temp_range_t temp_range[HOTENDS]; #if HAS_HEATED_BED - static uint16_t raw_temp_bed_value; - #if WATCH_THE_BED - static uint16_t watch_target_bed_temp; - static millis_t watch_bed_next_ms; + #if WATCH_BED + static heater_watch_t watch_bed; #endif #if DISABLED(PIDTEMPBED) static millis_t next_bed_check_ms; #endif - #if HEATER_IDLE_HANDLER - static millis_t bed_idle_timeout_ms; - static bool bed_idle_timeout_exceeded; - #endif #ifdef BED_MINTEMP - static int16_t bed_minttemp_raw; + static int16_t mintemp_raw_BED; #endif #ifdef BED_MAXTEMP - static int16_t bed_maxttemp_raw; + static int16_t maxtemp_raw_BED; #endif #endif - #if HAS_TEMP_CHAMBER - static uint16_t raw_temp_chamber_value; - static float current_temperature_chamber; - static int16_t current_temperature_chamber_raw; + #if HAS_HEATED_CHAMBER + #if WATCH_CHAMBER + static heater_watch_t watch_chamber; + #endif + #if DISABLED(PIDTEMPCHAMBER) + static millis_t next_chamber_check_ms; + #endif + #ifdef CHAMBER_MINTEMP + static int16_t mintemp_raw_CHAMBER; + #endif + #ifdef CHAMBER_MAXTEMP + static int16_t maxtemp_raw_CHAMBER; + #endif #endif #ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED @@ -279,11 +374,6 @@ class Temperature { static bool paused; #endif - #if HEATER_IDLE_HANDLER - static millis_t heater_idle_timeout_ms[HOTENDS]; - static bool heater_idle_timeout_exceeded[HOTENDS]; - #endif - public: #if HAS_ADC_BUTTONS static uint32_t current_ADCKey_raw; @@ -311,7 +401,7 @@ class Temperature { static float analog_to_celsius_bed(const int raw); #endif #if HAS_TEMP_CHAMBER - static float analog_to_celsiusChamber(const int raw); + static float analog_to_celsius_chamber(const int raw); #endif #if FAN_COUNT > 0 @@ -326,7 +416,7 @@ class Temperature { static uint8_t paused_fan_speed[FAN_COUNT]; #endif - static constexpr inline uint8_t fanPercent(const uint8_t speed) { return (int(speed) * 100 + 127) / 255; } + static constexpr inline uint8_t fanPercent(const uint8_t speed) { return ui8_to_percent(speed); } #if ENABLED(ADAPTIVE_FAN_SLOWING) static uint8_t fan_speed_scaler[FAN_COUNT]; @@ -395,21 +485,15 @@ class Temperature { */ #ifdef MILLISECONDS_PREHEAT_TIME static bool is_preheating(const uint8_t e) { - #if HOTENDS == 1 - UNUSED(e); - #endif + E_UNUSED(); return preheat_end_time[HOTEND_INDEX] && PENDING(millis(), preheat_end_time[HOTEND_INDEX]); } static void start_preheat_time(const uint8_t e) { - #if HOTENDS == 1 - UNUSED(e); - #endif + E_UNUSED(); preheat_end_time[HOTEND_INDEX] = millis() + MILLISECONDS_PREHEAT_TIME; } static void reset_preheat_time(const uint8_t e) { - #if HOTENDS == 1 - UNUSED(e); - #endif + E_UNUSED(); preheat_end_time[HOTEND_INDEX] = 0; } #else @@ -427,63 +511,81 @@ class Temperature { //deg=degreeCelsius FORCE_INLINE static float degHotend(const uint8_t e) { - #if HOTENDS == 1 - UNUSED(e); - #endif - return current_temperature[HOTEND_INDEX]; + E_UNUSED(); + return temp_hotend[HOTEND_INDEX].current; } #if ENABLED(SHOW_TEMP_ADC_VALUES) FORCE_INLINE static int16_t rawHotendTemp(const uint8_t e) { - #if HOTENDS == 1 - UNUSED(e); - #endif - return current_temperature_raw[HOTEND_INDEX]; + E_UNUSED(); + return temp_hotend[HOTEND_INDEX].raw; } #endif FORCE_INLINE static int16_t degTargetHotend(const uint8_t e) { - #if HOTENDS == 1 - UNUSED(e); - #endif - return target_temperature[HOTEND_INDEX]; + E_UNUSED(); + return temp_hotend[HOTEND_INDEX].target; } #if WATCH_HOTENDS - static void start_watching_heater(const uint8_t e = 0); + static void start_watching_heater(const uint8_t e=0); + #else + static inline void start_watching_heater(const uint8_t e=0) { UNUSED(e); } + #endif + + #if HAS_LCD_MENU + static inline void start_watching_E0() { start_watching_heater(0); } + static inline void start_watching_E1() { start_watching_heater(1); } + static inline void start_watching_E2() { start_watching_heater(2); } + static inline void start_watching_E3() { start_watching_heater(3); } + static inline void start_watching_E4() { start_watching_heater(4); } + static inline void start_watching_E5() { start_watching_heater(5); } #endif static void setTargetHotend(const int16_t celsius, const uint8_t e) { - #if HOTENDS == 1 - UNUSED(e); - #endif + E_UNUSED(); #ifdef MILLISECONDS_PREHEAT_TIME if (celsius == 0) reset_preheat_time(HOTEND_INDEX); - else if (target_temperature[HOTEND_INDEX] == 0) + else if (temp_hotend[HOTEND_INDEX].target == 0) start_preheat_time(HOTEND_INDEX); #endif #if ENABLED(AUTO_POWER_CONTROL) powerManager.power_on(); #endif - target_temperature[HOTEND_INDEX] = MIN(celsius, maxttemp[HOTEND_INDEX] - 15); - #if WATCH_HOTENDS - start_watching_heater(HOTEND_INDEX); - #endif + temp_hotend[HOTEND_INDEX].target = MIN(celsius, temp_range[HOTEND_INDEX].maxtemp - 15); + start_watching_heater(HOTEND_INDEX); } + #if WATCH_CHAMBER + static void start_watching_chamber(); + #else + static inline void start_watching_chamber() {} + #endif + + #if HAS_TEMP_CHAMBER + static void setTargetChamber(const int16_t celsius) { + #if HAS_HEATED_CHAMBER + temp_chamber.target = + #ifdef CHAMBER_MAXTEMP + MIN(celsius, CHAMBER_MAXTEMP) + #else + celsius + #endif + ; + start_watching_chamber(); + #endif // HAS_HEATED_CHAMBER + } + #endif // HAS_TEMP_CHAMBER + FORCE_INLINE static bool isHeatingHotend(const uint8_t e) { - #if HOTENDS == 1 - UNUSED(e); - #endif - return target_temperature[HOTEND_INDEX] > current_temperature[HOTEND_INDEX]; + E_UNUSED(); + return temp_hotend[HOTEND_INDEX].target > temp_hotend[HOTEND_INDEX].current; } FORCE_INLINE static bool isCoolingHotend(const uint8_t e) { - #if HOTENDS == 1 - UNUSED(e); - #endif - return target_temperature[HOTEND_INDEX] < current_temperature[HOTEND_INDEX]; + E_UNUSED(); + return temp_hotend[HOTEND_INDEX].target < temp_hotend[HOTEND_INDEX].current; } #if HAS_TEMP_HOTEND @@ -497,33 +599,33 @@ class Temperature { #if HAS_HEATED_BED #if ENABLED(SHOW_TEMP_ADC_VALUES) - FORCE_INLINE static int16_t rawBedTemp() { return current_temperature_bed_raw; } + FORCE_INLINE static int16_t rawBedTemp() { return temp_bed.raw; } + #endif + FORCE_INLINE static float degBed() { return temp_bed.current; } + FORCE_INLINE static int16_t degTargetBed() { return temp_bed.target; } + FORCE_INLINE static bool isHeatingBed() { return temp_bed.target > temp_bed.current; } + FORCE_INLINE static bool isCoolingBed() { return temp_bed.target < temp_bed.current; } + + #if WATCH_BED + static void start_watching_bed(); + #else + static inline void start_watching_bed() {} #endif - FORCE_INLINE static float degBed() { return current_temperature_bed; } - FORCE_INLINE static int16_t degTargetBed() { return target_temperature_bed; } - FORCE_INLINE static bool isHeatingBed() { return target_temperature_bed > current_temperature_bed; } - FORCE_INLINE static bool isCoolingBed() { return target_temperature_bed < current_temperature_bed; } static void setTargetBed(const int16_t celsius) { #if ENABLED(AUTO_POWER_CONTROL) powerManager.power_on(); #endif - target_temperature_bed = + temp_bed.target = #ifdef BED_MAXTEMP - MIN(celsius, BED_MAXTEMP - 15) + MIN(celsius, BED_MAXTEMP - 10) #else celsius #endif ; - #if WATCH_THE_BED - start_watching_bed(); - #endif + start_watching_bed(); } - #if WATCH_THE_BED - static void start_watching_bed(); - #endif - static bool wait_for_bed(const bool no_wait_for_cooling=true #if G26_CLICK_CAN_CANCEL , const bool click_to_cancel=false @@ -534,10 +636,15 @@ class Temperature { #if HAS_TEMP_CHAMBER #if ENABLED(SHOW_TEMP_ADC_VALUES) - FORCE_INLINE static int16_t rawChamberTemp() { return current_temperature_chamber_raw; } + FORCE_INLINE static int16_t rawChamberTemp() { return temp_chamber.raw; } #endif - FORCE_INLINE static float degChamber() { return current_temperature_chamber; } - #endif + FORCE_INLINE static float degChamber() { return temp_chamber.current; } + #if HAS_HEATED_CHAMBER + FORCE_INLINE static bool isHeatingChamber() { return temp_chamber.target > temp_chamber.current; } + FORCE_INLINE static bool isCoolingChamber() { return temp_chamber.target < temp_chamber.current; } + FORCE_INLINE static int16_t degTargetChamber() {return temp_chamber.target; } + #endif + #endif // HAS_TEMP_CHAMBER FORCE_INLINE static bool still_heating(const uint8_t e) { return degTargetHotend(e) > TEMP_HYSTERESIS && ABS(degHotend(e) - degTargetHotend(e)) > TEMP_HYSTERESIS; @@ -562,7 +669,7 @@ class Temperature { #if ENABLED(NO_FAN_SLOWING_IN_PID_TUNING) static bool adaptive_fan_slowing; #elif ENABLED(ADAPTIVE_FAN_SLOWING) - constexpr static bool adaptive_fan_slowing = true; + static constexpr bool adaptive_fan_slowing = true; #endif /** @@ -578,10 +685,6 @@ class Temperature { #endif - #if ENABLED(BABYSTEPPING) - static void babystep_axis(const AxisEnum axis, const int16_t distance); - #endif - #if ENABLED(PROBING_HEATERS_OFF) static void pause(const bool p); FORCE_INLINE static bool is_paused() { return paused; } @@ -589,47 +692,17 @@ class Temperature { #if HEATER_IDLE_HANDLER - static void start_heater_idle_timer(const uint8_t e, const millis_t timeout_ms) { - #if HOTENDS == 1 - UNUSED(e); - #endif - heater_idle_timeout_ms[HOTEND_INDEX] = millis() + timeout_ms; - heater_idle_timeout_exceeded[HOTEND_INDEX] = false; - } - static void reset_heater_idle_timer(const uint8_t e) { - #if HOTENDS == 1 - UNUSED(e); - #endif - heater_idle_timeout_ms[HOTEND_INDEX] = 0; - heater_idle_timeout_exceeded[HOTEND_INDEX] = false; - #if WATCH_HOTENDS - start_watching_heater(HOTEND_INDEX); - #endif - } - - FORCE_INLINE static bool is_heater_idle(const uint8_t e) { - #if HOTENDS == 1 - UNUSED(e); - #endif - return heater_idle_timeout_exceeded[HOTEND_INDEX]; + E_UNUSED(); + hotend_idle[HOTEND_INDEX].reset(); + start_watching_heater(HOTEND_INDEX); } #if HAS_HEATED_BED - static void start_bed_idle_timer(const millis_t timeout_ms) { - bed_idle_timeout_ms = millis() + timeout_ms; - bed_idle_timeout_exceeded = false; - } - static void reset_bed_idle_timer() { - bed_idle_timeout_ms = 0; - bed_idle_timeout_exceeded = false; - #if WATCH_THE_BED - start_watching_bed(); - #endif + bed_idle.reset(); + start_watching_bed(); } - - FORCE_INLINE static bool is_bed_idle() { return bed_idle_timeout_exceeded; } #endif #endif // HEATER_IDLE_HANDLER @@ -648,23 +721,17 @@ class Temperature { #endif #endif - #if ENABLED(ULTRA_LCD) || ENABLED(EXTENSIBLE_UI) + #if EITHER(ULTRA_LCD, EXTENSIBLE_UI) static void set_heating_message(const uint8_t e); #endif private: - - #if ENABLED(FAST_PWM_FAN) - static void setPwmFrequency(const pin_t pin, int val); - #endif - static void set_current_temp_raw(); - static void updateTemperaturesFromRawValues(); - #define HAS_MAX6675 (ENABLED(HEATER_0_USES_MAX6675) || ENABLED(HEATER_1_USES_MAX6675)) + #define HAS_MAX6675 EITHER(HEATER_0_USES_MAX6675, HEATER_1_USES_MAX6675) #if HAS_MAX6675 - #if ENABLED(HEATER_0_USES_MAX6675) && ENABLED(HEATER_1_USES_MAX6675) + #if BOTH(HEATER_0_USES_MAX6675, HEATER_1_USES_MAX6675) #define COUNT_6675 2 #else #define COUNT_6675 1 @@ -689,25 +756,37 @@ class Temperature { static float get_pid_output_bed(); #endif + #if HAS_HEATED_CHAMBER + static float get_pid_output_chamber(); + #endif + 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); + #if HAS_TEMP_CHAMBER + static void chamber_temp_error(const bool max); + #endif - #if ENABLED(THERMAL_PROTECTION_HOTENDS) || HAS_THERMALLY_PROTECTED_BED + #if ENABLED(THERMAL_PROTECTION_HOTENDS) || HAS_THERMALLY_PROTECTED_BED || ENABLED(THERMAL_PROTECTION_CHAMBER) enum TRState : char { TRInactive, TRFirstHeating, TRStable, TRRunaway }; - static void thermal_runaway_protection(TRState * const state, millis_t * const timer, const float ¤t, const float &target, const int8_t heater_id, const uint16_t period_seconds, const uint16_t hysteresis_degc); + typedef struct { + millis_t timer = 0; + TRState state = TRInactive; + } tr_state_machine_t; #if ENABLED(THERMAL_PROTECTION_HOTENDS) - static TRState thermal_runaway_state_machine[HOTENDS]; - static millis_t thermal_runaway_timer[HOTENDS]; + static tr_state_machine_t tr_state_machine[HOTENDS]; + #endif + #if HAS_THERMALLY_PROTECTED_BED + static tr_state_machine_t tr_state_machine_bed; + #endif + #if ENABLED(THERMAL_PROTECTION_CHAMBER) + static tr_state_machine_t tr_state_machine_chamber; #endif - #if HAS_THERMALLY_PROTECTED_BED - static TRState thermal_runaway_bed_state_machine; - static millis_t thermal_runaway_bed_timer; - #endif + static void thermal_runaway_protection(tr_state_machine_t &state, const float ¤t, const float &target, const int8_t heater_id, const uint16_t period_seconds, const uint16_t hysteresis_degc); #endif // THERMAL_PROTECTION }; diff --git a/Marlin/src/module/thermistor/thermistor_20.h b/Marlin/src/module/thermistor/thermistor_20.h index b5b12e87fa..46d89b84d2 100644 --- a/Marlin/src/module/thermistor/thermistor_20.h +++ b/Marlin/src/module/thermistor/thermistor_20.h @@ -43,6 +43,10 @@ #define HEATER_4_RAW_HI_TEMP 16383 #define HEATER_4_RAW_LO_TEMP 0 #endif +#if THERMISTORHEATER_5 == 20 + #define HEATER_5_RAW_HI_TEMP 16383 + #define HEATER_5_RAW_LO_TEMP 0 +#endif #if THERMISTORBED == 20 #define HEATER_BED_RAW_HI_TEMP 16383 #define HEATER_BED_RAW_LO_TEMP 0 diff --git a/Marlin/src/module/thermistor/thermistors.h b/Marlin/src/module/thermistor/thermistors.h index 7f9357233b..ab82f2603d 100644 --- a/Marlin/src/module/thermistor/thermistors.h +++ b/Marlin/src/module/thermistor/thermistors.h @@ -26,7 +26,7 @@ #define OVERSAMPLENR 16 #define OV(N) int16_t((N) * (OVERSAMPLENR)) -#define ANY_THERMISTOR_IS(n) (THERMISTORHEATER_0 == n || THERMISTORHEATER_1 == n || THERMISTORHEATER_2 == n || THERMISTORHEATER_3 == n || THERMISTORHEATER_4 == n || THERMISTORBED == n || THERMISTORCHAMBER == n) +#define ANY_THERMISTOR_IS(n) (THERMISTORHEATER_0 == n || THERMISTORHEATER_1 == n || THERMISTORHEATER_2 == n || THERMISTORHEATER_3 == n || THERMISTORHEATER_4 == n || THERMISTORHEATER_5 == n || THERMISTORBED == n || THERMISTORCHAMBER == n) // Pt1000 and Pt100 handling // @@ -191,6 +191,16 @@ #define HEATER_4_TEMPTABLE_LEN 0 #endif +#if THERMISTORHEATER_5 + #define HEATER_5_TEMPTABLE TT_NAME(THERMISTORHEATER_5) + #define HEATER_5_TEMPTABLE_LEN COUNT(HEATER_5_TEMPTABLE) +#elif defined(HEATER_5_USES_THERMISTOR) + #error "No heater 5 thermistor table specified" +#else + #define HEATER_5_TEMPTABLE NULL + #define HEATER_5_TEMPTABLE_LEN 0 +#endif + #ifdef THERMISTORBED #define BEDTEMPTABLE TT_NAME(THERMISTORBED) #define BEDTEMPTABLE_LEN COUNT(BEDTEMPTABLE) @@ -262,6 +272,15 @@ static_assert(HEATER_0_TEMPTABLE_LEN < 256 && HEATER_1_TEMPTABLE_LEN < 256 && HE #define HEATER_4_RAW_LO_TEMP 0 #endif #endif +#ifndef HEATER_5_RAW_HI_TEMP + #ifdef HEATER_5_USES_THERMISTOR + #define HEATER_5_RAW_HI_TEMP 0 + #define HEATER_5_RAW_LO_TEMP 16383 + #else + #define HEATER_5_RAW_HI_TEMP 16383 + #define HEATER_5_RAW_LO_TEMP 0 + #endif +#endif #ifndef HEATER_BED_RAW_HI_TEMP #ifdef HEATER_BED_USES_THERMISTOR #define HEATER_BED_RAW_HI_TEMP 0 diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index 322b6b7c06..0de0fcfafc 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -31,6 +31,9 @@ #include "../Marlin.h" +#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) +#include "../core/debug_out.h" + #if EXTRUDERS > 1 toolchange_settings_t toolchange_settings; // Initialized by settings.load() #endif @@ -46,7 +49,7 @@ #include "../gcode/gcode.h" // for dwell() #endif -#if ENABLED(SWITCHING_EXTRUDER) || ENABLED(SWITCHING_NOZZLE) || ENABLED(SWITCHING_TOOLHEAD) +#if ANY(SWITCHING_EXTRUDER, SWITCHING_NOZZLE, SWITCHING_TOOLHEAD) #include "servo.h" #endif @@ -126,6 +129,10 @@ #endif // SWITCHING_NOZZLE +inline void fast_line_to_current(const AxisEnum fr_axis) { + planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[fr_axis], active_extruder); +} + #if ENABLED(MAGNETIC_PARKING_EXTRUDER) float parkingposx[2] , // M951 R L @@ -165,12 +172,10 @@ current_position[X_AXIS] = mpe_settings.parking_xpos[tmp_extruder] + offsetcompensation; - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR("(1) Move extruder ", int(tmp_extruder)); - DEBUG_POS(" to new extruder ParkPos", current_position); - } - #endif + if (DEBUGGING(LEVELING)) { + DEBUG_ECHOPAIR("(1) Move extruder ", int(tmp_extruder)); + DEBUG_POS(" to new extruder ParkPos", current_position); + } planner.buffer_line(current_position, mpe_settings.fast_feedrate, tmp_extruder); planner.synchronize(); @@ -179,12 +184,10 @@ current_position[X_AXIS] = grabpos + offsetcompensation; - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR("(2) Couple extruder ", int(tmp_extruder)); - DEBUG_POS(" to new extruder GrabPos", current_position); - } - #endif + if (DEBUGGING(LEVELING)) { + DEBUG_ECHOPAIR("(2) Couple extruder ", int(tmp_extruder)); + DEBUG_POS(" to new extruder GrabPos", current_position); + } planner.buffer_line(current_position, mpe_settings.slow_feedrate, tmp_extruder); planner.synchronize(); @@ -195,12 +198,10 @@ // STEP 3 current_position[X_AXIS] = mpe_settings.parking_xpos[tmp_extruder] + offsetcompensation; - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR("(3) Move extruder ", int(tmp_extruder)); - DEBUG_POS(" back to new extruder ParkPos", current_position); - } - #endif + if (DEBUGGING(LEVELING)) { + DEBUG_ECHOPAIR("(3) Move extruder ", int(tmp_extruder)); + DEBUG_POS(" back to new extruder ParkPos", current_position); + } planner.buffer_line(current_position, mpe_settings.slow_feedrate, tmp_extruder); planner.synchronize(); @@ -208,12 +209,10 @@ // STEP 4 current_position[X_AXIS] = mpe_settings.parking_xpos[active_extruder] + (active_extruder == 0 ? MPE_TRAVEL_DISTANCE : -MPE_TRAVEL_DISTANCE) + offsetcompensation; - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR("(4) Move extruder ", int(tmp_extruder)); - DEBUG_POS(" close to old extruder ParkPos", current_position); - } - #endif + if (DEBUGGING(LEVELING)) { + DEBUG_ECHOPAIR("(4) Move extruder ", int(tmp_extruder)); + DEBUG_POS(" close to old extruder ParkPos", current_position); + } planner.buffer_line(current_position, mpe_settings.fast_feedrate, tmp_extruder); planner.synchronize(); @@ -222,12 +221,10 @@ current_position[X_AXIS] = mpe_settings.parking_xpos[active_extruder] + offsetcompensation; - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR("(5) Park extruder ", int(tmp_extruder)); - DEBUG_POS(" at old extruder ParkPos", current_position); - } - #endif + if (DEBUGGING(LEVELING)) { + DEBUG_ECHOPAIR("(5) Park extruder ", int(tmp_extruder)); + DEBUG_POS(" at old extruder ParkPos", current_position); + } planner.buffer_line(current_position, mpe_settings.slow_feedrate, tmp_extruder); planner.synchronize(); @@ -236,19 +233,15 @@ current_position[X_AXIS] = oldx; - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPAIR("(6) Move extruder ", int(tmp_extruder)); - DEBUG_POS(" to starting position", current_position); - } - #endif + if (DEBUGGING(LEVELING)) { + DEBUG_ECHOPAIR("(6) Move extruder ", int(tmp_extruder)); + DEBUG_POS(" to starting position", current_position); + } planner.buffer_line(current_position, mpe_settings.fast_feedrate, tmp_extruder); planner.synchronize(); - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("Autopark done."); - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Autopark done."); } #elif ENABLED(PARKING_EXTRUDER) @@ -298,60 +291,46 @@ // STEP 1 - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("Start Autopark", current_position); - #endif + if (DEBUGGING(LEVELING)) DEBUG_POS("Start Autopark", current_position); 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 + if (DEBUGGING(LEVELING)) DEBUG_POS("(1) Raise Z-Axis", current_position); - planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Z_AXIS], active_extruder); + fast_line_to_current(Z_AXIS); planner.synchronize(); // STEP 2 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 + if (DEBUGGING(LEVELING)) { + DEBUG_ECHOLNPAIR("(2) Park extruder ", int(active_extruder)); + DEBUG_POS("Moving ParkPos", current_position); + } - planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS], active_extruder); + fast_line_to_current(X_AXIS); planner.synchronize(); // STEP 3 - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(3) Disengage magnet "); - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(3) Disengage magnet "); pe_deactivate_solenoid(active_extruder); // STEP 4 - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(4) Move to position near new extruder"); - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(4) Move to position near new extruder"); 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 + if (DEBUGGING(LEVELING)) DEBUG_POS("Move away from parked extruder", current_position); - planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS], active_extruder); + fast_line_to_current(X_AXIS); planner.synchronize(); // STEP 5 - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(5) Engage magnetic field"); - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(5) Engage magnetic field"); #if ENABLED(PARKING_EXTRUDER_SOLENOIDS_INVERT) pe_activate_solenoid(active_extruder); //just save power for inverted magnets @@ -362,12 +341,10 @@ // STEP 6 current_position[X_AXIS] = grabpos + (tmp_extruder ? -10 : 10); - planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS], active_extruder); + fast_line_to_current(X_AXIS); 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.settings.max_feedrate_mm_s[X_AXIS]/2, active_extruder); + if (DEBUGGING(LEVELING)) DEBUG_POS("(6) Unpark extruder", current_position); + planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS] * 0.5, active_extruder); planner.synchronize(); // STEP 7 @@ -378,16 +355,12 @@ #endif ; - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("(7) Move midway between hotends", current_position); - #endif + if (DEBUGGING(LEVELING)) DEBUG_POS("(7) Move midway between hotends", current_position); - planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS], active_extruder); + fast_line_to_current(X_AXIS); planner.synchronize(); - #if ENABLED(DEBUG_LEVELING_FEATURE) - SERIAL_ECHOLNPGM("Autopark done."); - #endif + DEBUG_ECHOLNPGM("Autopark done."); } else { // nomove == true // Only engage magnetic field for new extruder @@ -396,14 +369,6 @@ pe_activate_solenoid(active_extruder); // Just save power for inverted magnets #endif } - - #if HAS_HOTEND_OFFSET - current_position[Z_AXIS] += hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder]; - #endif - - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("Applying Z-offset", current_position); - #endif } #endif // PARKING_EXTRUDER @@ -425,108 +390,83 @@ * 3. Unlock tool and drop it in the dock * 4. Move to the new toolhead * 5. Grab and lock the new toolhead - * 6. Apply the z-offset of the new toolhead */ - // STEP 1 + // 1. Raise Z to give enough clearance - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("Starting Toolhead change", current_position); - #endif + if (DEBUGGING(LEVELING)) DEBUG_POS("Starting Toolhead change", current_position); 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 + if (DEBUGGING(LEVELING)) DEBUG_POS("(1) Raise Z-Axis", current_position); - planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Z_AXIS], active_extruder); + fast_line_to_current(Z_AXIS); planner.synchronize(); - // STEP 2 + // 2. Move to switch position of current toolhead 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 + if (DEBUGGING(LEVELING)) { + DEBUG_ECHOLNPAIR("(2) Place old tool ", int(active_extruder)); + DEBUG_POS("Move X SwitchPos", current_position); + } - planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS], active_extruder); + fast_line_to_current(X_AXIS); 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 + if (DEBUGGING(LEVELING)) DEBUG_POS("Move Y SwitchPos + Security", current_position); - planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Y_AXIS], active_extruder); + fast_line_to_current(Y_AXIS); planner.synchronize(); - // STEP 3 + // 3. Unlock tool and drop it in the dock - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(3) Unlock and Place Toolhead"); - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(3) Unlock and Place Toolhead"); 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 + if (DEBUGGING(LEVELING)) DEBUG_POS("Move Y SwitchPos", current_position); 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 + if (DEBUGGING(LEVELING)) DEBUG_POS("Move back Y clear", current_position); - planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Y_AXIS], active_extruder); // move away from docked toolhead + fast_line_to_current(Y_AXIS); // move away from docked toolhead planner.synchronize(); - // STEP 4 + // 4. Move to the new toolhead - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(4) Move to new toolhead position"); - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(4) Move to new toolhead position"); current_position[X_AXIS] = grabxpos; - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("Move to new toolhead X", current_position); - #endif + if (DEBUGGING(LEVELING)) DEBUG_POS("Move to new toolhead X", current_position); - planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS], active_extruder); + fast_line_to_current(X_AXIS); 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 + if (DEBUGGING(LEVELING)) DEBUG_POS("Move Y SwitchPos + Security", current_position); - planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Y_AXIS], active_extruder); + fast_line_to_current(Y_AXIS); planner.synchronize(); - // STEP 5 + // 5. Grab and lock the new toolhead - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(5) Grab and lock new toolhead "); - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(5) Grab and lock new toolhead "); current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS; - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("Move Y SwitchPos", current_position); - #endif + if (DEBUGGING(LEVELING)) DEBUG_POS("Move Y SwitchPos", current_position); planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Y_AXIS] * 0.5, active_extruder); planner.synchronize(); @@ -537,26 +477,12 @@ 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 + if (DEBUGGING(LEVELING)) DEBUG_POS("Move back Y clear", current_position); - planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Y_AXIS], active_extruder); // move away from docked toolhead + fast_line_to_current(Y_AXIS); // move away from docked toolhead planner.synchronize(); - // STEP 6 - - #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); - #endif - - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("Toolhead change done."); - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Toolhead change done."); } #endif // SWITCHING_TOOLHEAD @@ -570,17 +496,15 @@ inline void invalid_extruder_error(const uint8_t e) { #if ENABLED(DUAL_X_CARRIAGE) inline void dualx_tool_change(const uint8_t tmp_extruder, bool &no_move) { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPGM("Dual X Carriage Mode "); - switch (dual_x_carriage_mode) { - case DXC_FULL_CONTROL_MODE: SERIAL_ECHOLNPGM("DXC_FULL_CONTROL_MODE"); break; - case DXC_AUTO_PARK_MODE: SERIAL_ECHOLNPGM("DXC_AUTO_PARK_MODE"); break; - case DXC_DUPLICATION_MODE: SERIAL_ECHOLNPGM("DXC_DUPLICATION_MODE"); break; - case DXC_SCALED_DUPLICATION_MODE: SERIAL_ECHOLNPGM("DXC_SCALED_DUPLICATION_MODE"); break; - } + if (DEBUGGING(LEVELING)) { + DEBUG_ECHOPGM("Dual X Carriage Mode "); + switch (dual_x_carriage_mode) { + case DXC_FULL_CONTROL_MODE: DEBUG_ECHOLNPGM("FULL_CONTROL"); break; + case DXC_AUTO_PARK_MODE: DEBUG_ECHOLNPGM("AUTO_PARK"); break; + case DXC_DUPLICATION_MODE: DEBUG_ECHOLNPGM("DUPLICATION"); break; + case DXC_MIRRORED_MODE: DEBUG_ECHOLNPGM("MIRRORED"); break; } - #endif + } const float xhome = x_home_pos(active_extruder); if (dual_x_carriage_mode == DXC_AUTO_PARK_MODE @@ -588,11 +512,8 @@ inline void invalid_extruder_error(const uint8_t e) { && (delayed_move_time || current_position[X_AXIS] != xhome) && ! no_move ) { - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOLNPAIR("MoveX to ", xhome); - } - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("MoveX to ", xhome); + // 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(); @@ -608,9 +529,7 @@ inline void invalid_extruder_error(const uint8_t e) { // This function resets the max/min values - the current position may be overwritten below. set_axis_is_at_home(X_AXIS); - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("New Extruder", current_position); - #endif + if (DEBUGGING(LEVELING)) DEBUG_POS("New Extruder", current_position); switch (dual_x_carriage_mode) { case DXC_FULL_CONTROL_MODE: @@ -629,12 +548,10 @@ inline void invalid_extruder_error(const uint8_t e) { break; } - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOLNPAIR("Active extruder parked: ", active_extruder_parked ? "yes" : "no"); - DEBUG_POS("New extruder (parked)", current_position); - } - #endif + if (DEBUGGING(LEVELING)) { + DEBUG_ECHOLNPAIR("Active extruder parked: ", active_extruder_parked ? "yes" : "no"); + DEBUG_POS("New extruder (parked)", current_position); + } } #endif // DUAL_X_CARRIAGE @@ -673,7 +590,7 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n planner.synchronize(); - #if ENABLED(DUAL_X_CARRIAGE) // Only T0 allowed if the Printer is in DXC_DUPLICATION_MODE or DXC_SCALED_DUPLICATION_MODE + #if ENABLED(DUAL_X_CARRIAGE) // Only T0 allowed if the Printer is in DXC_DUPLICATION_MODE or DXC_MIRRORED_MODE if (tmp_extruder != 0 && dxc_is_duplicating()) return invalid_extruder_error(tmp_extruder); #endif @@ -689,9 +606,7 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n 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 (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("No move on toolchange"); } #if HAS_LCD_MENU @@ -733,23 +648,8 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n 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 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; - const float minx = soft_endstop_min[X_AXIS], maxx = soft_endstop_max[X_AXIS]; - #else - // 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 - - // Don't move the new extruder out of bounds - if (!WITHIN(current_position[X_AXIS], minx, maxx)) no_move = true; - + #if HAS_SOFTWARE_ENDSTOPS && ENABLED(DUAL_X_CARRIAGE) + update_software_endstops(X_AXIS, active_extruder, tmp_extruder); #endif set_destination_from_current(); @@ -763,14 +663,14 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n #endif current_position[Z_AXIS] += toolchange_settings.z_raise; #if HAS_SOFTWARE_ENDSTOPS - NOMORE(current_position[Z_AXIS], soft_endstop_max[Z_AXIS]); + NOMORE(current_position[Z_AXIS], soft_endstop[Z_AXIS].max); #endif planner.buffer_line(current_position, feedrate_mm_s, active_extruder); #endif planner.synchronize(); } - #if HOTENDS > 1 + #if HAS_HOTEND_OFFSET #if ENABLED(DUAL_X_CARRIAGE) constexpr float xdiff = 0; #else @@ -795,20 +695,13 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n // SWITCHING_NOZZLE_TWO_SERVOS, as both nozzles will lift instead. 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]); + NOMORE(current_position[Z_AXIS], soft_endstop[Z_AXIS].max); #endif - if (!no_move)planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Z_AXIS], active_extruder); + if (!no_move) fast_line_to_current(Z_AXIS); 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(" }"); - } - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Offset Tool XY by { ", xdiff, ", ", ydiff, ", ", zdiff, " }"); // The newly-selected extruder XY is actually at... current_position[X_AXIS] += xdiff; @@ -830,9 +723,7 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n // 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 (DEBUGGING(LEVELING)) DEBUG_POS("Move back", destination); #if ENABLED(SINGLENOZZLE) #if FAN_COUNT > 0 @@ -840,10 +731,10 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n thermalManager.fan_speed[0] = singlenozzle_fan_speed[tmp_extruder]; #endif - singlenozzle_temp[active_extruder] = thermalManager.target_temperature[0]; + singlenozzle_temp[active_extruder] = thermalManager.temp_hotend[0].target; if (singlenozzle_temp[tmp_extruder] && singlenozzle_temp[tmp_extruder] != singlenozzle_temp[active_extruder]) { thermalManager.setTargetHotend(singlenozzle_temp[tmp_extruder], 0); - #if ENABLED(ULTRA_LCD) || ENABLED(EXTENSIBLE_UI) + #if EITHER(ULTRA_LCD, EXTENSIBLE_UI) thermalManager.set_heating_message(0); #endif (void)thermalManager.wait_for_hotend(0, false); // Wait for heating or cooling @@ -867,8 +758,12 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n } #endif + // Prevent a move outside physical bounds + apply_motion_limits(destination); + // Move back to the original (or tweaked) position do_blocking_move_to(destination); + #if ENABLED(DUAL_X_CARRIAGE) active_extruder_parked = false; #endif @@ -912,10 +807,6 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n enable_solenoid_on_active_extruder(); #endif - #if HAS_SOFTWARE_ENDSTOPS && ENABLED(DUAL_X_CARRIAGE) - update_software_endstops(X_AXIS); - #endif - #if ENABLED(MK2_MULTIPLEXER) if (tmp_extruder >= E_STEPPERS) return invalid_extruder_error(tmp_extruder); select_multiplexed_stepper(tmp_extruder); diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 032a05936b..c3ece1346f 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -163,9 +163,11 @@ #elif MB(FYSETC_F6_13) #include "pins_FYSETC_F6_13.h" // ATmega2560 env:megaatmega2560 #elif MB(DUPLICATOR_I3_PLUS) - #include "pins_DUPLICATOR_I3_PLUS.h" // ATmega2560 env:megaatmega2560 + #include "pins_DUPLICATOR_I3_PLUS.h" // ATmega2560 env:megaatmega2560 #elif MB(VORON) #include "pins_VORON.h" // ATmega2560 env:megaatmega2560 +#elif MB(TRONXY_V3_1_0) + #include "pins_TRONXY_V3_1_0.h" // ATmega2560 env:megaatmega2560 // // Other ATmega1280, ATmega2560 @@ -415,7 +417,7 @@ #elif MB(MORPHEUS) #include "pins_MORPHEUS.h" // STM32F1 env:STM32F1 #elif MB(MKS_ROBIN) - #include "pins_MKS_ROBIN.h" // STM32F1 env:STM32F1 + #include "pins_MKS_ROBIN.h" // STM32F1 env:mks_robin // // STM32 ARM Cortex-M4F @@ -433,9 +435,13 @@ #include "pins_ARMED.h" // STM32F4 env:ARMED #elif MB(RUMBA32) #include "pins_RUMBA32.h" // STM32F4 env:RUMBA32 +#elif MB(BLACK_STM32F407VE) + #include "pins_BLACK_STM32F407VE.h" // STM32F4 env:black_stm32f407ve #elif MB(STEVAL) #include "pins_STEVAL.h" // STM32F4 env:STM32F4 + + // // ARM Cortex M7 // @@ -872,7 +878,7 @@ #define _EPIN(p,q) __EPIN(p,q) // The X2 axis, if any, should be the next open extruder port -#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(X_DUAL_STEPPER_DRIVERS) +#if EITHER(DUAL_X_CARRIAGE, X_DUAL_STEPPER_DRIVERS) #ifndef X2_STEP_PIN #define X2_STEP_PIN _EPIN(E_STEPPERS, STEP) #define X2_DIR_PIN _EPIN(E_STEPPERS, DIR) diff --git a/Marlin/src/pins/pinsDebug.h b/Marlin/src/pins/pinsDebug.h index cd963f87c4..2cf896abbb 100644 --- a/Marlin/src/pins/pinsDebug.h +++ b/Marlin/src/pins/pinsDebug.h @@ -102,6 +102,9 @@ const PinInfo pin_array[] PROGMEM = { #include HAL_PATH(../HAL, pinsDebug.h) // get the correct support file for this CPU +#ifndef M43_NEVER_TOUCH + #define M43_NEVER_TOUCH(Q) false +#endif static void print_input_or_output(const bool isout) { serialprintPGM(isout ? PSTR("Output = ") : PSTR("Input = ")); @@ -139,11 +142,11 @@ inline void report_pin_state_extended(pin_t pin, bool ignore, bool extended = fa #if AVR_AT90USB1286_FAMILY //Teensy IDEs don't know about these pins so must use FASTIO if (pin == 46 || pin == 47) { if (pin == 46) { - print_input_or_output(GET_OUTPUT(46)); + print_input_or_output(IS_OUTPUT(46)); SERIAL_CHAR('0' + READ(46)); } else if (pin == 47) { - print_input_or_output(GET_OUTPUT(47)); + print_input_or_output(IS_OUTPUT(47)); SERIAL_CHAR('0' + READ(47)); } } @@ -195,11 +198,11 @@ inline void report_pin_state_extended(pin_t pin, bool ignore, bool extended = fa if (pin == 46 || pin == 47) { SERIAL_ECHO_SP(12); if (pin == 46) { - print_input_or_output(GET_OUTPUT(46)); + print_input_or_output(IS_OUTPUT(46)); SERIAL_CHAR('0' + READ(46)); } else { - print_input_or_output(GET_OUTPUT(47)); + print_input_or_output(IS_OUTPUT(47)); SERIAL_CHAR('0' + READ(47)); } } diff --git a/Marlin/src/pins/pinsDebug_list.h b/Marlin/src/pins/pinsDebug_list.h index 07c58c7069..533a945447 100644 --- a/Marlin/src/pins/pinsDebug_list.h +++ b/Marlin/src/pins/pinsDebug_list.h @@ -77,6 +77,9 @@ #if PIN_EXISTS(TEMP_4) && TEMP_4_PIN < NUM_ANALOG_INPUTS REPORT_NAME_ANALOG(__LINE__, TEMP_4_PIN) #endif +#if PIN_EXISTS(TEMP_5) && TEMP_5_PIN < NUM_ANALOG_INPUTS + REPORT_NAME_ANALOG(__LINE__, TEMP_5_PIN) +#endif #if PIN_EXISTS(TEMP_BED) && TEMP_BED_PIN < NUM_ANALOG_INPUTS REPORT_NAME_ANALOG(__LINE__, TEMP_BED_PIN) #endif diff --git a/Marlin/src/pins/pins_3DRAG.h b/Marlin/src/pins/pins_3DRAG.h index 1b2ac3c06d..d84edb3c49 100644 --- a/Marlin/src/pins/pins_3DRAG.h +++ b/Marlin/src/pins/pins_3DRAG.h @@ -75,7 +75,7 @@ // // LCD / Controller // -#if ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL) +#if BOTH(ULTRA_LCD, NEWPANEL) #undef BEEPER_PIN #undef LCD_PINS_RS @@ -154,7 +154,7 @@ #define SPINDLE_LASER_PWM_PIN 46 // MUST BE HARDWARE PWM #define SPINDLE_LASER_ENABLE_PIN 62 // Pin should have a pullup! #define SPINDLE_DIR_PIN 48 - #elif !(ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL)) // use expansion header if no LCD in use + #elif !BOTH(ULTRA_LCD, NEWPANEL) // use expansion header if no LCD in use #define SPINDLE_LASER_ENABLE_PIN 16 // Pin should have a pullup/pulldown! #define SPINDLE_DIR_PIN 17 #endif diff --git a/Marlin/src/pins/pins_ANET_10.h b/Marlin/src/pins/pins_ANET_10.h index fceba0e26d..192373834f 100644 --- a/Marlin/src/pins/pins_ANET_10.h +++ b/Marlin/src/pins/pins_ANET_10.h @@ -162,7 +162,7 @@ #define LCD_PINS_D6 16 #define LCD_PINS_D7 17 #define ADC_KEYPAD_PIN 1 - #elif ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) || ENABLED(ANET_FULL_GRAPHICS_LCD) + #elif EITHER(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER, ANET_FULL_GRAPHICS_LCD) // Pin definitions for the Anet A6 Full Graphics display and the RepRapDiscount Full Graphics // display using an adapter board // https://go.aisler.net/benlye/anet-lcd-adapter/pcb // See below for alternative pin definitions for use with https://www.thingiverse.com/thing:2103748 diff --git a/Marlin/src/pins/pins_AZTEEG_X3.h b/Marlin/src/pins/pins_AZTEEG_X3.h index 95a0b826eb..f86d7ecbc2 100644 --- a/Marlin/src/pins/pins_AZTEEG_X3.h +++ b/Marlin/src/pins/pins_AZTEEG_X3.h @@ -53,7 +53,7 @@ #undef STAT_LED_RED_PIN #undef STAT_LED_BLUE_PIN -#if ENABLED(VIKI2) || ENABLED(miniVIKI) +#if ANY(VIKI2, miniVIKI) #undef DOGLCD_A0 #undef DOGLCD_CS @@ -75,7 +75,7 @@ // // Misc // -#if ENABLED(CASE_LIGHT_ENABLE) && PIN_EXISTS(CASE_LIGHT) && PIN_EXISTS(STAT_LED_RED) && STAT_LED_RED_PIN == CASE_LIGHT_PIN +#if ENABLED(CASE_LIGHT_ENABLE) && PIN_EXISTS(CASE_LIGHT, STAT_LED_RED) && STAT_LED_RED_PIN == CASE_LIGHT_PIN #undef STAT_LED_RED_PIN #endif diff --git a/Marlin/src/pins/pins_AZTEEG_X3_PRO.h b/Marlin/src/pins/pins_AZTEEG_X3_PRO.h index f5256a72e5..ea72af04da 100644 --- a/Marlin/src/pins/pins_AZTEEG_X3_PRO.h +++ b/Marlin/src/pins/pins_AZTEEG_X3_PRO.h @@ -139,7 +139,7 @@ #undef BEEPER_PIN #define BEEPER_PIN 33 -#if ENABLED(VIKI2) || ENABLED(miniVIKI) +#if ANY(VIKI2, miniVIKI) #undef SD_DETECT_PIN #define SD_DETECT_PIN 49 // For easy adapter board #undef BEEPER_PIN @@ -152,7 +152,7 @@ // // Misc. Functions // -#if ENABLED(CASE_LIGHT_ENABLE) && PIN_EXISTS(CASE_LIGHT) && defined(DOGLCD_A0) && DOGLCD_A0 == CASE_LIGHT_PIN +#if ENABLED(CASE_LIGHT_ENABLE) && PIN_EXISTS(CASE_LIGHT) && defined(DOGLCD_A0) && DOGLCD_A0 == CASE_LIGHT_PIN #undef DOGLCD_A0 // Steal pin 44 for the case light; if you have a Viki2 and have connected it #define DOGLCD_A0 57 // following the Panucatt wiring diagram, you may need to tweak these pin assignments // as the wiring diagram uses pin 44 for DOGLCD_A0 @@ -166,7 +166,7 @@ #undef SPINDLE_DIR_PIN #if ENABLED(SPINDLE_LASER_ENABLE) // EXP2 header - #if ENABLED(VIKI2) || ENABLED(miniVIKI) + #if ANY(VIKI2, miniVIKI) #undef BTN_EN2 #define BTN_EN2 31 // need 7 for the spindle speed PWM #endif diff --git a/Marlin/src/pins/pins_AZTEEG_X5_GT.h b/Marlin/src/pins/pins_AZTEEG_X5_GT.h index a4c7d82546..9de083cffb 100644 --- a/Marlin/src/pins/pins_AZTEEG_X5_GT.h +++ b/Marlin/src/pins/pins_AZTEEG_X5_GT.h @@ -112,7 +112,7 @@ // Display // -#if ENABLED(VIKI2) || ENABLED(miniVIKI) +#if ANY(VIKI2, miniVIKI) #define BEEPER_PIN P1_31 #define DOGLCD_A0 P2_06 #define DOGLCD_CS P0_16 diff --git a/Marlin/src/pins/pins_AZTEEG_X5_MINI_WIFI.h b/Marlin/src/pins/pins_AZTEEG_X5_MINI_WIFI.h index 0b66e99916..b71cf0e530 100644 --- a/Marlin/src/pins/pins_AZTEEG_X5_MINI_WIFI.h +++ b/Marlin/src/pins/pins_AZTEEG_X5_MINI_WIFI.h @@ -143,7 +143,7 @@ //#define SHIFT_EN P1_22 // (41) J5-4 & AUX-4 #endif - #if ENABLED(VIKI2) || ENABLED(miniVIKI) + #if ANY(VIKI2, miniVIKI) //#define LCD_SCREEN_ROT_180 #define BEEPER_PIN P1_30 // (37) may change if cable changes @@ -165,7 +165,6 @@ #if ENABLED(MINIPANEL) // GLCD features - //#define LCD_CONTRAST 190 // Uncomment screen orientation //#define LCD_SCREEN_ROT_90 //#define LCD_SCREEN_ROT_180 diff --git a/Marlin/src/pins/pins_BEAST.h b/Marlin/src/pins/pins_BEAST.h index e01c7775a5..5f9709a175 100644 --- a/Marlin/src/pins/pins_BEAST.h +++ b/Marlin/src/pins/pins_BEAST.h @@ -126,7 +126,7 @@ #define LCD_PINS_RS 49 // CS chip select /SS chip slave select #define LCD_PINS_ENABLE 51 // SID (MOSI) #define LCD_PINS_D4 52 // SCK (CLK) clock - #elif ENABLED(NEWPANEL) && ENABLED(PANEL_ONE) + #elif BOTH(NEWPANEL, PANEL_ONE) #define LCD_PINS_RS PB8 #define LCD_PINS_ENABLE PD2 #define LCD_PINS_D4 PB12 @@ -193,7 +193,7 @@ #define LCD_SDSS 53 #define SD_DETECT_PIN 49 - #elif ENABLED(VIKI2) || ENABLED(miniVIKI) + #elif ANY(VIKI2, miniVIKI) #define BEEPER_PIN 33 @@ -238,7 +238,6 @@ #define KILL_PIN 64 // GLCD features - //#define LCD_CONTRAST 190 // Uncomment screen orientation //#define LCD_SCREEN_ROT_90 //#define LCD_SCREEN_ROT_180 diff --git a/Marlin/src/pins/pins_BIGTREE_SKR_V1.3.h b/Marlin/src/pins/pins_BIGTREE_SKR_V1.3.h index 34686fde49..2efb410b46 100644 --- a/Marlin/src/pins/pins_BIGTREE_SKR_V1.3.h +++ b/Marlin/src/pins/pins_BIGTREE_SKR_V1.3.h @@ -50,6 +50,13 @@ #define Z_MIN_PROBE_PIN P1_24 #endif +// +// Filament Runout Sensor +// +#ifndef FIL_RUNOUT_PIN + #define FIL_RUNOUT_PIN P1_28 +#endif + // // Steppers // @@ -127,13 +134,16 @@ #define Z_SERIAL_TX_PIN P1_14 #define Z_SERIAL_RX_PIN P1_10 - #define E0_SERIAL_TX_PIN P1_09 #define E0_SERIAL_RX_PIN P1_08 #define E1_SERIAL_TX_PIN P1_04 - #define E1_SERIAL_RX_PIN P1_01 + #define E1_SERIAL_RX_PIN P1_01 + + #define Z2_SERIAL_TX_PIN P1_04 + #define Z2_SERIAL_RX_PIN P1_01 + #endif // @@ -163,28 +173,43 @@ | (MOSI)0.18 | · · | 3.25(BTN_EN2) (LCD_D5) 1.21 | · · | 1.20 (LCD_D4) | (SD_SS)0.16 | · · | 3.26(BTN_EN1) (LCD_RS) 1.19 | · · | 1.18 (LCD_EN) | (SCK)0.15 | · · | 0.17(MISO) (BTN_ENC) 0.28 | · · | 1.30 (BEEPER) -|  ̄ ̄  ̄ ̄ -| EXP2 EXP1 +|  ̄ ̄  ̄ ̄ +| EXP2 EXP1 */ #if ENABLED(ULTRA_LCD) - #define BEEPER_PIN P1_30 // (37) not 5V tolerant - #define BTN_ENC P0_28 // (58) open-drain - #define LCD_PINS_RS P1_19 + #define BEEPER_PIN P1_30 // (37) not 5V tolerant + #define BTN_ENC P0_28 // (58) open-drain - #define BTN_EN1 P3_26 // (31) J3-2 & AUX-4 - #define BTN_EN2 P3_25 // (33) J3-4 & AUX-4 - #define SD_DETECT_PIN P1_31 // (49) (NOT 5V tolerant) + #if ENABLED(CR10_STOCKDISPLAY) + #define LCD_PINS_RS P1_22 - #define LCD_SDSS P0_16 // (16) J3-7 & AUX-4 + #define BTN_EN1 P1_18 + #define BTN_EN2 P1_20 - #define LCD_PINS_ENABLE P1_18 - #define LCD_PINS_D4 P1_20 + #define LCD_PINS_ENABLE P1_23 + #define LCD_PINS_D4 P1_21 + + #else + + #define LCD_PINS_RS P1_19 + + #define BTN_EN1 P3_26 // (31) J3-2 & AUX-4 + #define BTN_EN2 P3_25 // (33) J3-4 & AUX-4 + #define SD_DETECT_PIN P1_31 // (49) (NOT 5V tolerant) + + #define LCD_SDSS P0_16 // (16) J3-7 & AUX-4 + + #define LCD_PINS_ENABLE P1_18 + #define LCD_PINS_D4 P1_20 + + #if ENABLED(ULTIPANEL) + #define LCD_PINS_D5 P1_21 + #define LCD_PINS_D6 P1_22 + #define LCD_PINS_D7 P1_23 + #endif - #if ENABLED(ULTIPANEL) - #define LCD_PINS_D5 P1_21 - #define LCD_PINS_D6 P1_22 - #define LCD_PINS_D7 P1_23 #endif + #endif // ULTRA_LCD //#define USB_SD_DISABLED diff --git a/Marlin/src/pins/pins_BLACK_STM32F407VE.h b/Marlin/src/pins/pins_BLACK_STM32F407VE.h new file mode 100644 index 0000000000..477bb909ad --- /dev/null +++ b/Marlin/src/pins/pins_BLACK_STM32F407VE.h @@ -0,0 +1,131 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * STM32F407VET6 with RAMPS-like shield + * 'Black' STM32F407VET6 board - http://wiki.stm32duino.com/index.php?title=STM32F407 + * Shield - https://github.com/jmz52/Hardware + */ + +#pragma once + +#if !defined(STM32F4) && !defined(STM32F4xx) + #error "Oops! Select an STM32F4 board in 'Tools > Board.'" +#endif + +#define DEFAULT_MACHINE_NAME "STM32F407VET6" +//#define BOARD_NAME "Black STM32F4VET6" + +//#define I2C_EEPROM +//#define E2END 0x1FFF // EEPROM end address (8kB) +#define EEPROM_EMULATED_WITH_SRAM + +#if HOTENDS > 2 || E_STEPPERS > 2 + #error "Black STM32F4VET6 supports up to 2 hotends / E-steppers." +#endif + +// +// Servos +// +#define SERVO0_PIN PC6 +#define SERVO1_PIN PC7 + +// +// Limit Switches +// +#define X_MIN_PIN PC13 +#define X_MAX_PIN PA15 +#define Y_MIN_PIN PA5 +#define Y_MAX_PIN PD12 +#define Z_MIN_PIN PD14 +#define Z_MAX_PIN PD15 + +// +// Steppers +// +#define X_STEP_PIN PC4 +#define X_DIR_PIN PA4 +#define X_ENABLE_PIN PE7 + +#define Y_STEP_PIN PE5 +#define Y_DIR_PIN PE2 +#define Y_ENABLE_PIN PE6 + +#define Z_STEP_PIN PD5 +#define Z_DIR_PIN PD3 +#define Z_ENABLE_PIN PD6 + +#define E0_STEP_PIN PD7 +#define E0_DIR_PIN PD0 +#define E0_ENABLE_PIN PB9 + +#define E1_STEP_PIN PE0 +#define E1_DIR_PIN PE1 +#define E1_ENABLE_PIN PB8 + +// +// Temperature Sensors +// +#define TEMP_0_PIN PC0 // T0 +#define TEMP_1_PIN PC1 // T1 +#define TEMP_BED_PIN PC2 // TB +#define TEMP_CHAMBER_PIN PC3 // TC + +// +// Heaters / Fans +// +#define HEATER_0_PIN PA2 // Heater0 +#define HEATER_1_PIN PA3 // Heater1 +#define HEATER_BED_PIN PA1 // Hotbed + +#define FAN_PIN PE9 // Fan0 +#define FAN1_PIN PE11 // Fan1 +#define FAN2_PIN PE13 // Fan2 +#define FAN3_PIN PE14 // Fan3 + +// +// Misc. Functions +// +#define SDSS PB12 +#define LED_PIN PA6 +//#define LED_PIN PA7 +#define KILL_PIN PB1 + +// +// LCD / Controller +// +#define SD_DETECT_PIN PC5 +//#define SD_DETECT_PIN PA8 // SDIO SD_DETECT_PIN, external SDIO card reader only + +#define BEEPER_PIN PD10 +#define LCD_PINS_RS PE15 +#define LCD_PINS_ENABLE PD8 +#define LCD_PINS_D4 PE10 +#define LCD_PINS_D5 PE12 +#define LCD_PINS_D6 PD1 +#define LCD_PINS_D7 PE8 +#define BTN_ENC PD9 +#define BTN_EN1 PD4 +#define BTN_EN2 PD13 + +#define DOGLCD_CS LCD_PINS_D5 +#define DOGLCD_A0 LCD_PINS_D6 diff --git a/Marlin/src/pins/pins_CHITU3D.h b/Marlin/src/pins/pins_CHITU3D.h index d6b9def951..db094c76c0 100644 --- a/Marlin/src/pins/pins_CHITU3D.h +++ b/Marlin/src/pins/pins_CHITU3D.h @@ -125,7 +125,7 @@ #define LCD_PINS_RS 49 // CS chip select /SS chip slave select #define LCD_PINS_ENABLE 51 // SID (MOSI) #define LCD_PINS_D4 52 // SCK (CLK) clock - #elif ENABLED(NEWPANEL) && ENABLED(PANEL_ONE) + #elif BOTH(NEWPANEL, PANEL_ONE) #define LCD_PINS_RS PB8 #define LCD_PINS_ENABLE PD2 #define LCD_PINS_D4 PB12 @@ -192,7 +192,7 @@ #define LCD_SDSS 53 #define SD_DETECT_PIN 49 - #elif ENABLED(VIKI2) || ENABLED(miniVIKI) + #elif ANY(VIKI2, miniVIKI) #define BEEPER_PIN 33 @@ -236,7 +236,6 @@ #define KILL_PIN 64 // GLCD features - //#define LCD_CONTRAST 190 // Uncomment screen orientation //#define LCD_SCREEN_ROT_90 //#define LCD_SCREEN_ROT_180 diff --git a/Marlin/src/pins/pins_EINSTART-S.h b/Marlin/src/pins/pins_EINSTART-S.h index 138623cfb4..c078a2d9c6 100644 --- a/Marlin/src/pins/pins_EINSTART-S.h +++ b/Marlin/src/pins/pins_EINSTART-S.h @@ -31,7 +31,7 @@ #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 DISABLED(IS_RAMPS_SMART, IS_RAMPS_DUO, IS_RAMPS4DUE, TARGET_LPC1768) #if !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega2560__) #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" #endif diff --git a/Marlin/src/pins/pins_EINSY_RETRO.h b/Marlin/src/pins/pins_EINSY_RETRO.h index f24235763d..40db378f43 100644 --- a/Marlin/src/pins/pins_EINSY_RETRO.h +++ b/Marlin/src/pins/pins_EINSY_RETRO.h @@ -176,8 +176,8 @@ #define BTN_EN2 19 #else #define LCD_PINS_RS 82 - #define LCD_PINS_ENABLE 18 - #define LCD_PINS_D4 19 + #define LCD_PINS_ENABLE 18 // On 0.6b, use 61 + #define LCD_PINS_D4 19 // On 0.6b, use 59 #define LCD_PINS_D5 70 #define LCD_PINS_D6 85 #define LCD_PINS_D7 71 diff --git a/Marlin/src/pins/pins_ESP32.h b/Marlin/src/pins/pins_ESP32.h index 8271efb7c1..343f3841a6 100644 --- a/Marlin/src/pins/pins_ESP32.h +++ b/Marlin/src/pins/pins_ESP32.h @@ -24,6 +24,10 @@ * Espressif ESP32 (Tensilica Xtensa LX6) pin assignments */ +#ifndef ARDUINO_ARCH_ESP32 + "Oops! Select an ESP32 board in 'Tools > Board.'" +#endif + #define BOARD_NAME "Espressif ESP32" // @@ -39,32 +43,32 @@ #define X_STEP_PIN 128 #define X_DIR_PIN 129 #define X_ENABLE_PIN 130 -//#define X_CS_PIN 0 +//#define X_CS_PIN 0 #define Y_STEP_PIN 131 #define Y_DIR_PIN 132 #define Y_ENABLE_PIN 133 -//#define Y_CS_PIN 13 +//#define Y_CS_PIN 13 #define Z_STEP_PIN 134 #define Z_DIR_PIN 135 #define Z_ENABLE_PIN 136 -//#define Z_CS_PIN 5 // SS_PIN +//#define Z_CS_PIN 5 // SS_PIN #define E0_STEP_PIN 137 #define E0_DIR_PIN 138 #define E0_ENABLE_PIN 139 -//#define E0_CS_PIN 21 +//#define E0_CS_PIN 21 // // Temperature Sensors // -#define TEMP_0_PIN 36 // Analog Input -#define TEMP_BED_PIN 39 // Analog Input +#define TEMP_0_PIN 36 // Analog Input +#define TEMP_BED_PIN 39 // Analog Input // // Heaters / Fans // -#define HEATER_0_PIN 2 -#define FAN_PIN 13 -#define HEATER_BED_PIN 4 +#define HEATER_0_PIN 2 +#define FAN_PIN 13 +#define HEATER_BED_PIN 4 diff --git a/Marlin/src/pins/pins_FELIX2.h b/Marlin/src/pins/pins_FELIX2.h index eecb648633..615629d9c7 100644 --- a/Marlin/src/pins/pins_FELIX2.h +++ b/Marlin/src/pins/pins_FELIX2.h @@ -49,7 +49,7 @@ // // LCD / Controller // -#if ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL) +#if BOTH(ULTRA_LCD, NEWPANEL) #define SD_DETECT_PIN 6 diff --git a/Marlin/src/pins/pins_FORMBOT_RAPTOR.h b/Marlin/src/pins/pins_FORMBOT_RAPTOR.h index 46dd097a06..e746c16995 100644 --- a/Marlin/src/pins/pins_FORMBOT_RAPTOR.h +++ b/Marlin/src/pins/pins_FORMBOT_RAPTOR.h @@ -124,7 +124,7 @@ // // Augmentation for auto-assigning RAMPS plugs // -#if DISABLED(IS_RAMPS_EEB) && DISABLED(IS_RAMPS_EEF) && DISABLED(IS_RAMPS_EFB) && DISABLED(IS_RAMPS_EFF) && DISABLED(IS_RAMPS_SF) && !PIN_EXISTS(MOSFET_D) +#if DISABLED(IS_RAMPS_EEB, IS_RAMPS_EEF, IS_RAMPS_EFB, IS_RAMPS_EFF, IS_RAMPS_SF) && !PIN_EXISTS(MOSFET_D) #if HOTENDS > 1 #if TEMP_SENSOR_BED #define IS_RAMPS_EEB diff --git a/Marlin/src/pins/pins_FORMBOT_RAPTOR2.h b/Marlin/src/pins/pins_FORMBOT_RAPTOR2.h index 00681b0868..30de2e3ffc 100644 --- a/Marlin/src/pins/pins_FORMBOT_RAPTOR2.h +++ b/Marlin/src/pins/pins_FORMBOT_RAPTOR2.h @@ -35,9 +35,7 @@ #define FIL_RUNOUT_PIN 22 #endif -#define GREEDY_PANEL ( ENABLED(PANEL_ONE) || ENABLED(VIKI2) \ - || ENABLED(miniVIKI) || ENABLED(MINIPANEL) \ - || ENABLED(REPRAPWORLD_KEYPAD) ) +#define GREEDY_PANEL ANY(PANEL_ONE, VIKI2, miniVIKI, MINIPANEL, REPRAPWORLD_KEYPAD) // // M3/M4/M5 - Spindle/Laser Control diff --git a/Marlin/src/pins/pins_FORMBOT_TREX2PLUS.h b/Marlin/src/pins/pins_FORMBOT_TREX2PLUS.h index 2bb8855b0f..5970123e1f 100644 --- a/Marlin/src/pins/pins_FORMBOT_TREX2PLUS.h +++ b/Marlin/src/pins/pins_FORMBOT_TREX2PLUS.h @@ -121,7 +121,7 @@ // // Augmentation for auto-assigning RAMPS plugs // -#if DISABLED(IS_RAMPS_EEB) && DISABLED(IS_RAMPS_EEF) && DISABLED(IS_RAMPS_EFB) && DISABLED(IS_RAMPS_EFF) && DISABLED(IS_RAMPS_SF) && !PIN_EXISTS(MOSFET_D) +#if DISABLED(IS_RAMPS_EEB, IS_RAMPS_EEF, IS_RAMPS_EFB, IS_RAMPS_EFF, IS_RAMPS_SF) && !PIN_EXISTS(MOSFET_D) #if HOTENDS > 1 #if TEMP_SENSOR_BED #define IS_RAMPS_EEB diff --git a/Marlin/src/pins/pins_FYSETC_F6_13.h b/Marlin/src/pins/pins_FYSETC_F6_13.h index a3c972c25c..cd67db281a 100644 --- a/Marlin/src/pins/pins_FYSETC_F6_13.h +++ b/Marlin/src/pins/pins_FYSETC_F6_13.h @@ -28,6 +28,10 @@ #error "Oops! Select 'FYSETC F6' in 'Tools > Board.'" #endif +#ifdef SD_DETECT_INVERTED + #error "SD_DETECT_INVERTED must be disabled for the FYSETC_F6_13 board." +#endif + #define BOARD_NAME "FYSETC F6 1.3" #define RESET_PIN 30 diff --git a/Marlin/src/pins/pins_MEGACONTROLLER.h b/Marlin/src/pins/pins_MEGACONTROLLER.h index 60c3e816ea..0899e65f25 100644 --- a/Marlin/src/pins/pins_MEGACONTROLLER.h +++ b/Marlin/src/pins/pins_MEGACONTROLLER.h @@ -144,7 +144,6 @@ #define KILL_PIN 12 // GLCD features - //#define LCD_CONTRAST 190 // Uncomment screen orientation //#define LCD_SCREEN_ROT_90 //#define LCD_SCREEN_ROT_180 diff --git a/Marlin/src/pins/pins_MEGATRONICS.h b/Marlin/src/pins/pins_MEGATRONICS.h index 8d18fa4c44..c5eea8dcc3 100644 --- a/Marlin/src/pins/pins_MEGATRONICS.h +++ b/Marlin/src/pins/pins_MEGATRONICS.h @@ -104,7 +104,7 @@ // #define BEEPER_PIN 33 -#if ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL) +#if BOTH(ULTRA_LCD, NEWPANEL) #define LCD_PINS_RS 16 #define LCD_PINS_ENABLE 17 diff --git a/Marlin/src/pins/pins_MIGHTYBOARD_REVE.h b/Marlin/src/pins/pins_MIGHTYBOARD_REVE.h index 810d08c5a3..115f86b1e7 100644 --- a/Marlin/src/pins/pins_MIGHTYBOARD_REVE.h +++ b/Marlin/src/pins/pins_MIGHTYBOARD_REVE.h @@ -175,9 +175,9 @@ #endif #ifndef FAN_PIN - #if ENABLED(IS_EFB) || ENABLED(IS_EFF) // Hotend, Fan, Bed or Hotend, Fan, Fan + #if EITHER(IS_EFB, IS_EFF) // Hotend, Fan, Bed or Hotend, Fan, Fan #define FAN_PIN EX2_HEAT_PIN - #elif ENABLED(IS_EEF) || ENABLED(IS_SF) // Hotend, Hotend, Fan or Spindle, Fan + #elif EITHER(IS_EEF, IS_SF) // Hotend, Hotend, Fan or Spindle, Fan #define FAN_PIN HBP_PIN #else #define FAN_PIN EXTRA_FET_PIN diff --git a/Marlin/src/pins/pins_MKS_GEN_13.h b/Marlin/src/pins/pins_MKS_GEN_13.h index fb982e6892..39ec95db59 100644 --- a/Marlin/src/pins/pins_MKS_GEN_13.h +++ b/Marlin/src/pins/pins_MKS_GEN_13.h @@ -56,7 +56,7 @@ // // LCD / Controller // -#if ENABLED(VIKI2) || ENABLED(miniVIKI) +#if ANY(VIKI2, miniVIKI) /** * VIKI2 Has two groups of wires with... * diff --git a/Marlin/src/pins/pins_MKS_SBASE.h b/Marlin/src/pins/pins_MKS_SBASE.h index e8fce81883..19f9e5acf4 100644 --- a/Marlin/src/pins/pins_MKS_SBASE.h +++ b/Marlin/src/pins/pins_MKS_SBASE.h @@ -245,7 +245,7 @@ #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) + #if ANY(VIKI2, miniVIKI) #define DOGLCD_SCK SCK_PIN #define DOGLCD_MOSI MOSI_PIN #endif diff --git a/Marlin/src/pins/pins_PRINTRBOARD.h b/Marlin/src/pins/pins_PRINTRBOARD.h index 5e6ba84420..1587c0fa37 100644 --- a/Marlin/src/pins/pins_PRINTRBOARD.h +++ b/Marlin/src/pins/pins_PRINTRBOARD.h @@ -123,7 +123,7 @@ // // LCD / Controller // -#if ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL) +#if BOTH(ULTRA_LCD, NEWPANEL) #define LCD_PINS_RS 9 // E1 JP11-11 #define LCD_PINS_ENABLE 8 // E0 JP11-10 @@ -132,7 +132,7 @@ #define LCD_PINS_D6 5 // D5 JP11-6 #define LCD_PINS_D7 4 // D4 JP11-5 - #if ENABLED(VIKI2) || ENABLED(miniVIKI) + #if ANY(VIKI2, miniVIKI) #define BEEPER_PIN 8 // E0 JP11-10 #define DOGLCD_A0 40 // F2 JP2-2 diff --git a/Marlin/src/pins/pins_PRINTRBOARD_REVF.h b/Marlin/src/pins/pins_PRINTRBOARD_REVF.h index 33a1995083..fb338e8d19 100644 --- a/Marlin/src/pins/pins_PRINTRBOARD_REVF.h +++ b/Marlin/src/pins/pins_PRINTRBOARD_REVF.h @@ -208,7 +208,7 @@ #define LCD_PINS_D6 5 // D5 JP11-6 #define LCD_PINS_D7 4 // D4 JP11-5 - #if ENABLED(VIKI2) || ENABLED(miniVIKI) + #if ANY(VIKI2, miniVIKI) #define BEEPER_PIN 8 // E0 JP11-10 #define DOGLCD_A0 40 // F2 JP2-2 diff --git a/Marlin/src/pins/pins_RAMBO.h b/Marlin/src/pins/pins_RAMBO.h index ab72cee7e3..95ce033936 100644 --- a/Marlin/src/pins/pins_RAMBO.h +++ b/Marlin/src/pins/pins_RAMBO.h @@ -175,7 +175,7 @@ #define LCD_PINS_D6 74 #define LCD_PINS_D7 75 - #if ENABLED(VIKI2) || ENABLED(miniVIKI) + #if ANY(VIKI2, miniVIKI) #define BEEPER_PIN 44 // NB: Panucatt's Viki 2.0 wiring diagram (v1.2) indicates that the // beeper/buzzer is connected to pin 33; however, the pin used in the diff --git a/Marlin/src/pins/pins_RAMPS.h b/Marlin/src/pins/pins_RAMPS.h index d3009a2374..1f06992cfa 100644 --- a/Marlin/src/pins/pins_RAMPS.h +++ b/Marlin/src/pins/pins_RAMPS.h @@ -50,7 +50,7 @@ #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 DISABLED(IS_RAMPS_SMART, IS_RAMPS_DUO, IS_RAMPS4DUE, TARGET_LPC1768) #if !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega2560__) #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" #endif @@ -63,10 +63,12 @@ // // Servos // -#ifdef IS_RAMPS_13 - #define SERVO0_PIN 7 // RAMPS_13 // Will conflict with BTN_EN2 on LCD_I2C_VIKI -#else - #define SERVO0_PIN 11 +#ifndef SERVO0_PIN + #ifdef IS_RAMPS_13 + #define SERVO0_PIN 7 // RAMPS_13 // Will conflict with BTN_EN2 on LCD_I2C_VIKI + #else + #define SERVO0_PIN 11 + #endif #endif #define SERVO1_PIN 6 #define SERVO2_PIN 5 @@ -148,7 +150,7 @@ // // Augmentation for auto-assigning RAMPS plugs // -#if DISABLED(IS_RAMPS_EEB) && DISABLED(IS_RAMPS_EEF) && DISABLED(IS_RAMPS_EFB) && DISABLED(IS_RAMPS_EFF) && DISABLED(IS_RAMPS_SF) && !PIN_EXISTS(MOSFET_D) +#if DISABLED(IS_RAMPS_EEB, IS_RAMPS_EEF, IS_RAMPS_EFB, IS_RAMPS_EFF, IS_RAMPS_SF) && !PIN_EXISTS(MOSFET_D) #if HOTENDS > 1 #if TEMP_SENSOR_BED #define IS_RAMPS_EEB @@ -199,13 +201,13 @@ #endif #ifndef FAN_PIN - #if ENABLED(IS_RAMPS_EFB) || ENABLED(IS_RAMPS_EFF) // Hotend, Fan, Bed or Hotend, Fan, Fan + #if EITHER(IS_RAMPS_EFB, IS_RAMPS_EFF) // Hotend, Fan, Bed or Hotend, Fan, Fan #define FAN_PIN RAMPS_D9_PIN - #elif ENABLED(IS_RAMPS_EEF) || ENABLED(IS_RAMPS_SF) // Hotend, Hotend, Fan or Spindle, Fan + #elif EITHER(IS_RAMPS_EEF, IS_RAMPS_SF) // Hotend, Hotend, Fan or Spindle, Fan #define FAN_PIN RAMPS_D8_PIN - #elif ENABLED(IS_RAMPS_EEB) // Hotend, Hotend, Bed - #define FAN_PIN 4 // IO pin. Buffer needed - #else // Non-specific are "EFB" (i.e., "EFBF" or "EFBE") + #elif ENABLED(IS_RAMPS_EEB) // Hotend, Hotend, Bed + #define FAN_PIN 4 // IO pin. Buffer needed + #else // Non-specific are "EFB" (i.e., "EFBF" or "EFBE") #define FAN_PIN RAMPS_D9_PIN #endif #endif @@ -232,8 +234,7 @@ #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 + #elif !(BOTH(ULTRA_LCD, NEWPANEL) && ANY(PANEL_ONE, VIKI2, miniVIKI, MINIPANEL, REPRAPWORLD_KEYPAD)) // try to use AUX 2 #define CASE_LIGHT_PIN 44 // MUST BE HARDWARE PWM #endif #endif @@ -246,8 +247,7 @@ #define SPINDLE_LASER_ENABLE_PIN 4 // Pin should have a pullup/pulldown! #define SPINDLE_LASER_PWM_PIN 6 // 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 + #elif !(BOTH(ULTRA_LCD, NEWPANEL) && ANY(PANEL_ONE, VIKI2, miniVIKI, MINIPANEL, REPRAPWORLD_KEYPAD)) // try to use AUX 2 #define SPINDLE_LASER_ENABLE_PIN 40 // Pin should have a pullup/pulldown! #define SPINDLE_LASER_PWM_PIN 44 // MUST BE HARDWARE PWM #define SPINDLE_DIR_PIN 65 @@ -347,7 +347,7 @@ #define LCD_PINS_ENABLE 51 // SID (MOSI) #define LCD_PINS_D4 52 // SCK (CLK) clock - #elif ENABLED(NEWPANEL) && ENABLED(PANEL_ONE) + #elif BOTH(NEWPANEL, PANEL_ONE) #define LCD_PINS_RS 40 #define LCD_PINS_ENABLE 42 @@ -379,7 +379,7 @@ #else - #if ENABLED(MKS_12864OLED) || ENABLED(MKS_12864OLED_SSD1306) + #if EITHER(MKS_12864OLED, MKS_12864OLED_SSD1306) #define LCD_PINS_DC 25 // Set as output on init #define LCD_PINS_RS 27 // Pull low for 1s to init // DOGM SPI LCD Support @@ -463,7 +463,7 @@ #define LCD_SDSS SDSS #define SD_DETECT_PIN 49 - #elif ENABLED(VIKI2) || ENABLED(miniVIKI) + #elif ANY(VIKI2, miniVIKI) #define DOGLCD_CS 45 #define DOGLCD_A0 44 @@ -502,7 +502,6 @@ #define DOGLCD_CS 25 // GLCD features - //#define LCD_CONTRAST 190 // Uncomment screen orientation //#define LCD_SCREEN_ROT_90 //#define LCD_SCREEN_ROT_180 @@ -517,7 +516,7 @@ #define BTN_ENC 35 #define SD_DETECT_PIN 49 - #define KILL_PIN 64 + #define KILL_PIN 41 #elif ENABLED(MINIPANEL) @@ -529,7 +528,6 @@ #define DOGLCD_CS 66 // GLCD features - //#define LCD_CONTRAST 190 // Uncomment screen orientation //#define LCD_SCREEN_ROT_90 //#define LCD_SCREEN_ROT_180 diff --git a/Marlin/src/pins/pins_RAMPS_DUO.h b/Marlin/src/pins/pins_RAMPS_DUO.h index 987d8ba3eb..7573ef404b 100644 --- a/Marlin/src/pins/pins_RAMPS_DUO.h +++ b/Marlin/src/pins/pins_RAMPS_DUO.h @@ -76,7 +76,7 @@ // #if ENABLED(ULTRA_LCD) - #if ENABLED(NEWPANEL) && ENABLED(PANEL_ONE) + #if BOTH(NEWPANEL, PANEL_ONE) #undef LCD_PINS_D4 #define LCD_PINS_D4 68 diff --git a/Marlin/src/pins/pins_RAMPS_ENDER_4.h b/Marlin/src/pins/pins_RAMPS_ENDER_4.h index c808b68188..8d14bddc4a 100644 --- a/Marlin/src/pins/pins_RAMPS_ENDER_4.h +++ b/Marlin/src/pins/pins_RAMPS_ENDER_4.h @@ -28,8 +28,13 @@ #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 +// The board only has one PWM fan connector. The others are 12V always-on. +// The default config uses this pin to control the brightness of the LED +// band (case light). Thus the hotend and controller fans are always-on. + +#if ENABLED(CASE_LIGHT_ENABLE) + #undef FAN_PIN + #ifndef CASE_LIGHT_PIN + #define CASE_LIGHT_PIN RAMPS_D9_PIN + #endif +#endif diff --git a/Marlin/src/pins/pins_RAMPS_FD_V1.h b/Marlin/src/pins/pins_RAMPS_FD_V1.h index e897204860..45ad8d1651 100644 --- a/Marlin/src/pins/pins_RAMPS_FD_V1.h +++ b/Marlin/src/pins/pins_RAMPS_FD_V1.h @@ -161,7 +161,7 @@ #define DOGLCD_A0 27 #endif - #if ENABLED(VIKI2) || ENABLED(miniVIKI) + #if ANY(VIKI2, miniVIKI) #define DOGLCD_A0 16 #define KILL_PIN 51 #define STAT_LED_BLUE_PIN 29 diff --git a/Marlin/src/pins/pins_RAMPS_LINUX.h b/Marlin/src/pins/pins_RAMPS_LINUX.h index 0c14bc713e..8520975bce 100644 --- a/Marlin/src/pins/pins_RAMPS_LINUX.h +++ b/Marlin/src/pins/pins_RAMPS_LINUX.h @@ -138,7 +138,7 @@ // // Augmentation for auto-assigning RAMPS plugs // -#if DISABLED(IS_RAMPS_EEB) && DISABLED(IS_RAMPS_EEF) && DISABLED(IS_RAMPS_EFB) && DISABLED(IS_RAMPS_EFF) && DISABLED(IS_RAMPS_SF) && !PIN_EXISTS(MOSFET_D) +#if DISABLED(IS_RAMPS_EEB, IS_RAMPS_EEF, IS_RAMPS_EFB, IS_RAMPS_EFF, IS_RAMPS_SF) && !PIN_EXISTS(MOSFET_D) #if HOTENDS > 1 #if TEMP_SENSOR_BED #define IS_RAMPS_EEB @@ -220,8 +220,7 @@ #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 + #elif !(BOTH(ULTRA_LCD, NEWPANEL) && ANY(PANEL_ONE, VIKI2, miniVIKI, MINIPANEL, REPRAPWORLD_KEYPAD)) // try to use AUX 2 #define CASE_LIGHT_PIN 44 // MUST BE HARDWARE PWM #endif #endif @@ -234,8 +233,7 @@ #define SPINDLE_LASER_ENABLE_PIN 4 // Pin should have a pullup/pulldown! #define SPINDLE_LASER_PWM_PIN 6 // 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 + #elif !(BOTH(ULTRA_LCD, NEWPANEL) && ANY(PANEL_ONE, VIKI2, miniVIKI, MINIPANEL, REPRAPWORLD_KEYPAD)) // try to use AUX 2 #define SPINDLE_LASER_ENABLE_PIN 40 // Pin should have a pullup/pulldown! #define SPINDLE_LASER_PWM_PIN 44 // MUST BE HARDWARE PWM #define SPINDLE_DIR_PIN 65 @@ -335,7 +333,7 @@ #define LCD_PINS_ENABLE 51 // SID (MOSI) #define LCD_PINS_D4 52 // SCK (CLK) clock - #elif ENABLED(NEWPANEL) && ENABLED(PANEL_ONE) + #elif BOTH(NEWPANEL, PANEL_ONE) #define LCD_PINS_RS 40 #define LCD_PINS_ENABLE 42 @@ -367,7 +365,7 @@ #else - #if ENABLED(MKS_12864OLED) || ENABLED(MKS_12864OLED_SSD1306) + #if EITHER(MKS_12864OLED, MKS_12864OLED_SSD1306) #define LCD_PINS_DC 25 // Set as output on init #define LCD_PINS_RS 27 // Pull low for 1s to init // DOGM SPI LCD Support @@ -451,7 +449,7 @@ #define LCD_SDSS SDSS #define SD_DETECT_PIN 49 - #elif ENABLED(VIKI2) || ENABLED(miniVIKI) + #elif ANY(VIKI2, miniVIKI) #define DOGLCD_CS 45 #define DOGLCD_A0 44 @@ -490,7 +488,6 @@ #define DOGLCD_CS 25 // GLCD features - //#define LCD_CONTRAST 190 // Uncomment screen orientation //#define LCD_SCREEN_ROT_90 //#define LCD_SCREEN_ROT_180 @@ -517,7 +514,6 @@ #define DOGLCD_CS 66 // GLCD features - //#define LCD_CONTRAST 190 // Uncomment screen orientation //#define LCD_SCREEN_ROT_90 //#define LCD_SCREEN_ROT_180 diff --git a/Marlin/src/pins/pins_RAMPS_PLUS.h b/Marlin/src/pins/pins_RAMPS_PLUS.h index f8f109f1b9..795830bd63 100644 --- a/Marlin/src/pins/pins_RAMPS_PLUS.h +++ b/Marlin/src/pins/pins_RAMPS_PLUS.h @@ -73,7 +73,7 @@ #undef E0_CS_PIN #undef E1_CS_PIN -#if ENABLED(ULTRA_LCD) && DISABLED(REPRAPWORLD_GRAPHICAL_LCD) && (DISABLED(NEWPANEL) || DISABLED(PANEL_ONE)) && DISABLED(CR10_STOCKDISPLAY) +#if ENABLED(ULTRA_LCD, REPRAPWORLD_GRAPHICAL_LCD, CR10_STOCKDISPLAY) && !BOTH(NEWPANEL, PANEL_ONE) #if DISABLED(MKS_12864OLED) || ENABLED(MKS_12864OLED_SSD1306) #undef LCD_PINS_RS #define LCD_PINS_RS 42 // 3DYMY boards pin 16 -> 42 diff --git a/Marlin/src/pins/pins_RAMPS_RE_ARM.h b/Marlin/src/pins/pins_RAMPS_RE_ARM.h index a1e2c43d0a..496a6d29aa 100644 --- a/Marlin/src/pins/pins_RAMPS_RE_ARM.h +++ b/Marlin/src/pins/pins_RAMPS_RE_ARM.h @@ -122,7 +122,7 @@ // // Augmentation for auto-assigning RAMPS plugs // -#if DISABLED(IS_RAMPS_EEB) && DISABLED(IS_RAMPS_EEF) && DISABLED(IS_RAMPS_EFB) && DISABLED(IS_RAMPS_EFF) && DISABLED(IS_RAMPS_SF) && !PIN_EXISTS(MOSFET_D) +#if DISABLED(IS_RAMPS_EEB, IS_RAMPS_EEF, IS_RAMPS_EFB, IS_RAMPS_EFF, IS_RAMPS_SF) && !PIN_EXISTS(MOSFET_D) #if HOTENDS > 1 #if TEMP_SENSOR_BED #define IS_RAMPS_EEB @@ -173,13 +173,13 @@ #endif #ifndef FAN_PIN - #if ENABLED(IS_RAMPS_EFB) || ENABLED(IS_RAMPS_EFF) // Hotend, Fan, Bed or Hotend, Fan, Fan + #if EITHER(IS_RAMPS_EFB, IS_RAMPS_EFF) // Hotend, Fan, Bed or Hotend, Fan, Fan #define FAN_PIN RAMPS_D9_PIN - #elif ENABLED(IS_RAMPS_EEF) || ENABLED(IS_RAMPS_SF) // Hotend, Hotend, Fan or Spindle, Fan + #elif EITHER(IS_RAMPS_EEF, IS_RAMPS_SF) // Hotend, Hotend, Fan or Spindle, Fan #define FAN_PIN RAMPS_D8_PIN - #elif ENABLED(IS_RAMPS_EEB) // Hotend, Hotend, Bed - #define FAN_PIN P1_18 // (4) IO pin. Buffer needed - #else // Non-specific are "EFB" (i.e., "EFBF" or "EFBE") + #elif ENABLED(IS_RAMPS_EEB) // Hotend, Hotend, Bed + #define FAN_PIN P1_18 // (4) IO pin. Buffer needed + #else // Non-specific are "EFB" (i.e., "EFBF" or "EFBE") #define FAN_PIN RAMPS_D9_PIN #endif #endif @@ -293,7 +293,7 @@ //#define SHIFT_EN P1_22 // (41) J5-4 & AUX-4 #endif - #if ENABLED(VIKI2) || ENABLED(miniVIKI) + #if ANY(VIKI2, miniVIKI) // #define LCD_SCREEN_ROT_180 #define BTN_EN1 P3_26 // (31) J3-2 & AUX-4 @@ -330,7 +330,6 @@ #if ENABLED(MINIPANEL) // GLCD features - //#define LCD_CONTRAST 190 // Uncomment screen orientation //#define LCD_SCREEN_ROT_90 //#define LCD_SCREEN_ROT_180 diff --git a/Marlin/src/pins/pins_RUMBA.h b/Marlin/src/pins/pins_RUMBA.h index dbba7f4472..d7ce1c2112 100644 --- a/Marlin/src/pins/pins_RUMBA.h +++ b/Marlin/src/pins/pins_RUMBA.h @@ -167,7 +167,7 @@ // // LCD / Controller // -#if ENABLED(MKS_12864OLED) || ENABLED(MKS_12864OLED_SSD1306) +#if EITHER(MKS_12864OLED, MKS_12864OLED_SSD1306) #define LCD_PINS_DC 38 // Set as output on init #define LCD_PINS_RS 41 // Pull low for 1s to init // DOGM SPI LCD Support diff --git a/Marlin/src/pins/pins_RURAMPS4D_11.h b/Marlin/src/pins/pins_RURAMPS4D_11.h index fd50e7ef1d..517be5b9b5 100644 --- a/Marlin/src/pins/pins_RURAMPS4D_11.h +++ b/Marlin/src/pins/pins_RURAMPS4D_11.h @@ -118,7 +118,7 @@ //#define E3_MS2_PIN ? //#define E3_MS3_PIN ? -#if DISABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) +#if USES_Z_MIN_PROBE_ENDSTOP #define Z_MIN_PROBE_PIN 49 #endif @@ -202,7 +202,7 @@ // #if ENABLED(ULTRA_LCD) - #if ENABLED(RADDS_DISPLAY) || ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) + #if EITHER(RADDS_DISPLAY, REPRAP_DISCOUNT_SMART_CONTROLLER) #define BEEPER_PIN 62 diff --git a/Marlin/src/pins/pins_RURAMPS4D_13.h b/Marlin/src/pins/pins_RURAMPS4D_13.h index 5f23846db4..8ea571ed46 100644 --- a/Marlin/src/pins/pins_RURAMPS4D_13.h +++ b/Marlin/src/pins/pins_RURAMPS4D_13.h @@ -106,7 +106,7 @@ #define E2_CS_PIN 61 #endif -#if DISABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) +#if USES_Z_MIN_PROBE_ENDSTOP #define Z_MIN_PROBE_PIN 49 #endif @@ -188,7 +188,7 @@ // #if ENABLED(ULTRA_LCD) - #if ENABLED(RADDS_DISPLAY) || ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) + #if EITHER(RADDS_DISPLAY, REPRAP_DISCOUNT_SMART_CONTROLLER) #define BEEPER_PIN 62 diff --git a/Marlin/src/pins/pins_SANGUINOLOLU_11.h b/Marlin/src/pins/pins_SANGUINOLOLU_11.h index f17c485cb6..fb80edc1f2 100644 --- a/Marlin/src/pins/pins_SANGUINOLOLU_11.h +++ b/Marlin/src/pins/pins_SANGUINOLOLU_11.h @@ -137,7 +137,7 @@ #define LCD_BACKLIGHT_PIN 17 // LCD backlight LED #endif -#if DISABLED(SPINDLE_LASER_ENABLE) && ENABLED(SANGUINOLOLU_V_1_2) && !(ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL)) // try to use IO Header +#if DISABLED(SPINDLE_LASER_ENABLE) && ENABLED(SANGUINOLOLU_V_1_2) && !BOTH(ULTRA_LCD, NEWPANEL) // try to use IO Header #define CASE_LIGHT_PIN 4 // MUST BE HARDWARE PWM - see if IO Header is available #endif @@ -179,7 +179,6 @@ #else // DOGM SPI LCD Support #define DOGLCD_A0 30 - #define LCD_CONTRAST 1 #if ENABLED(MAKRPANEL) @@ -278,7 +277,7 @@ // M3/M4/M5 - Spindle/Laser Control // #if ENABLED(SPINDLE_LASER_ENABLE) - #if !MB(AZTEEG_X1) && ENABLED(SANGUINOLOLU_V_1_2) && !(ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL)) // try to use IO Header + #if !MB(AZTEEG_X1) && ENABLED(SANGUINOLOLU_V_1_2) && !BOTH(ULTRA_LCD, NEWPANEL) // try to use IO Header #define SPINDLE_LASER_ENABLE_PIN 10 // Pin should have a pullup/pulldown! #define SPINDLE_LASER_PWM_PIN 4 // MUST BE HARDWARE PWM diff --git a/Marlin/src/pins/pins_SAV_MKI.h b/Marlin/src/pins/pins_SAV_MKI.h index dc57d7b9f7..c4744c69b5 100644 --- a/Marlin/src/pins/pins_SAV_MKI.h +++ b/Marlin/src/pins/pins_SAV_MKI.h @@ -161,7 +161,7 @@ #define SR_CLK_PIN EXT_AUX_SCL_D0 #endif -#if ENABLED(SAV_3DLCD) || ENABLED(SAV_3DGLCD) +#if EITHER(SAV_3DLCD, SAV_3DGLCD) #define BTN_EN1 EXT_AUX_A1_IO #define BTN_EN2 EXT_AUX_A0_IO diff --git a/Marlin/src/pins/pins_SCOOVO_X9H.h b/Marlin/src/pins/pins_SCOOVO_X9H.h index b99829b7a3..95c1a58854 100644 --- a/Marlin/src/pins/pins_SCOOVO_X9H.h +++ b/Marlin/src/pins/pins_SCOOVO_X9H.h @@ -144,7 +144,7 @@ #define HOME_PIN BTN_HOME -#if ENABLED(VIKI2) || ENABLED(miniVIKI) +#if ANY(VIKI2, miniVIKI) #define BEEPER_PIN 44 // Pins for DOGM SPI LCD Support #define DOGLCD_A0 70 diff --git a/Marlin/src/pins/pins_SMOOTHIEBOARD.h b/Marlin/src/pins/pins_SMOOTHIEBOARD.h index ba632835b6..d6c4a129ea 100644 --- a/Marlin/src/pins/pins_SMOOTHIEBOARD.h +++ b/Marlin/src/pins/pins_SMOOTHIEBOARD.h @@ -95,7 +95,7 @@ // // LCD / Controller // -#if ENABLED(VIKI2) || ENABLED(miniVIKI) +#if ANY(VIKI2, miniVIKI) #define BEEPER_PIN P1_31 #define DOGLCD_A0 P2_11 diff --git a/Marlin/src/pins/pins_STM32F1R.h b/Marlin/src/pins/pins_STM32F1R.h index 150332aa2d..0e124f5c54 100644 --- a/Marlin/src/pins/pins_STM32F1R.h +++ b/Marlin/src/pins/pins_STM32F1R.h @@ -105,7 +105,7 @@ #define LCD_PINS_RS 49 // CS chip select /SS chip slave select #define LCD_PINS_ENABLE 51 // SID (MOSI) #define LCD_PINS_D4 52 // SCK (CLK) clock - #elif ENABLED(NEWPANEL) && ENABLED(PANEL_ONE) + #elif BOTH(NEWPANEL, PANEL_ONE) #define LCD_PINS_RS PB8 #define LCD_PINS_ENABLE PD2 #define LCD_PINS_D4 PB12 @@ -172,7 +172,7 @@ #define LCD_SDSS 53 #define SD_DETECT_PIN 49 - #elif ENABLED(VIKI2) || ENABLED(miniVIKI) + #elif ANY(VIKI2, miniVIKI) #define BEEPER_PIN 33 @@ -216,7 +216,6 @@ #define KILL_PIN 64 // GLCD features - //#define LCD_CONTRAST 190 // Uncomment screen orientation //#define LCD_SCREEN_ROT_90 //#define LCD_SCREEN_ROT_180 diff --git a/Marlin/src/pins/pins_STM3R_MINI.h b/Marlin/src/pins/pins_STM3R_MINI.h index e634e13538..2b5c6c3a4d 100644 --- a/Marlin/src/pins/pins_STM3R_MINI.h +++ b/Marlin/src/pins/pins_STM3R_MINI.h @@ -120,7 +120,7 @@ #define LCD_PINS_RS 49 // CS chip select /SS chip slave select #define LCD_PINS_ENABLE 51 // SID (MOSI) #define LCD_PINS_D4 52 // SCK (CLK) clock - #elif ENABLED(NEWPANEL) && ENABLED(PANEL_ONE) + #elif BOTH(NEWPANEL, PANEL_ONE) #define LCD_PINS_RS PB8 #define LCD_PINS_ENABLE PD2 #define LCD_PINS_D4 PB12 @@ -187,7 +187,7 @@ #define LCD_SDSS 53 #define SD_DETECT_PIN 49 - #elif ENABLED(VIKI2) || ENABLED(miniVIKI) + #elif ANY(VIKI2, miniVIKI) #define BEEPER_PIN 33 @@ -232,7 +232,6 @@ #define KILL_PIN 64 // GLCD features - //#define LCD_CONTRAST 190 // Uncomment screen orientation //#define LCD_SCREEN_ROT_90 //#define LCD_SCREEN_ROT_180 diff --git a/Marlin/src/pins/pins_TEENSYLU.h b/Marlin/src/pins/pins_TEENSYLU.h index 618ee60c22..d60233da52 100644 --- a/Marlin/src/pins/pins_TEENSYLU.h +++ b/Marlin/src/pins/pins_TEENSYLU.h @@ -140,7 +140,7 @@ // // LCD / Controller // -#if ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL) +#if BOTH(ULTRA_LCD, NEWPANEL) #define BEEPER_PIN -1 diff --git a/Marlin/src/pins/pins_TRIGORILLA_14.h b/Marlin/src/pins/pins_TRIGORILLA_14.h index 3d062816cf..7d231b32da 100644 --- a/Marlin/src/pins/pins_TRIGORILLA_14.h +++ b/Marlin/src/pins/pins_TRIGORILLA_14.h @@ -74,14 +74,14 @@ #if 0 && ENABLED(ULTRA_LCD) // LCD Display output pins - #if ENABLED(NEWPANEL) && ENABLED(PANEL_ONE) + #if BOTH(NEWPANEL, PANEL_ONE) #undef LCD_PINS_D6 #define LCD_PINS_D6 57 #endif // LCD Display input pins #if ENABLED(NEWPANEL) - #if ENABLED(VIKI2) || ENABLED(miniVIKI) + #if ANY(VIKI2, miniVIKI) #undef DOGLCD_A0 #define DOGLCD_A0 23 #elif ENABLED(ELB_FULL_GRAPHIC_CONTROLLER) diff --git a/Marlin/src/pins/pins_TRONXY_V3_1_0.h b/Marlin/src/pins/pins_TRONXY_V3_1_0.h new file mode 100644 index 0000000000..91fabb329b --- /dev/null +++ b/Marlin/src/pins/pins_TRONXY_V3_1_0.h @@ -0,0 +1,278 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * Arduino Mega for Tronxy X5S-2E, etc. + */ + +#ifndef __AVR_ATmega2560__ + #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" +#endif + +#if HOTENDS > 2 || E_STEPPERS > 2 + #error "TRONXY-V3-1.0 supports only 2 hotends/E-steppers. Comment out this line to continue." +#endif + +#define BOARD_NAME "TRONXY-V3-1.0" + +#include "pins_RAMPS.h" + +// +// Servos +// +#undef SERVO1_PIN +#define SERVO1_PIN 12 // 2560 PIN 25/PB6 + +/** + * @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + * + * ===== AUX-1 connector ===== + * + * 2 4 6 8 + * #----------------# + * #2 | ° ° ° ° | + * #1 | ° ° ° ° | + * NOTCH #------ ------# + * 1 3 5 7 + * + * ################################### + * # Pin | ATMEGA2560 Pin | Arduino # + * ################################### + * # 1 | VCC | + # + * # 2 | VCC | + # + * # 3 | GND | - # + * # 4 | GND | - # + * # 5 | N/C | # + * # 6 | 3 / PE1 (TXD0) | D1 # + * # 7 | N/C | # + * # 8 | 2 / PE0 (RXD0) | D0 # + * ################################### + * + * @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + * + * ===== Limit Switch connectors ===== + * + * ############## X+ ################# + * X+ # Pin | ATMEGA2560 Pin | Arduino # + * 1 2 3 ################################### + * #- --- -# # 1 | 6 / PE4 (INT4) | D2 # + * | ° ° ° | # 2 | GND | - # + * #-------# # 3 | VCC | + # + * ################################### + * + * ############## X- ################# + * X- # Pin | ATMEGA2560 Pin | Arduino # + * 1 2 3 ################################### + * #- --- -# # 1 | 7 / PE5 (INT5) | D3 # + * | ° ° ° | # 2 | GND | - # + * #-------# # 3 | VCC | + # + * ################################### + * + * ############## Y+ ################# + * Y+ # Pin | ATMEGA2560 Pin | Arduino # + * 1 2 3 ################################### + * #- --- -# # 1 | 63/PJ0 (PCINT9) | D15 # + * | ° ° ° | # 2 | GND | - # + * #-------# # 3 | VCC | + # + * ################################### + * + * ############## Y- ################# + * Y- # Pin | ATMEGA2560 Pin | Arduino # + * 1 2 3 ################################### + * #- --- -# # 1 | 64/PJ1 (PCINT10)| D14 # + * | ° ° ° | # 2 | GND | - # + * #-------# # 3 | VCC | + # + * ################################### + * + * ############## Z+ ################# + * Z+ # Pin | ATMEGA2560 Pin | Arduino # + * 1 2 3 ################################### + * #- --- -# # 1 | 45 / PD2 (INT2) | D19 # + * | ° ° ° | # 2 | GND | - # + * #-------# # 3 | VCC | + # + * ################################### + * + * ############## Z- ################# + * Z- # Pin | ATMEGA2560 Pin | Arduino # + * 1 2 3 ################################### + * #- --- -# # 1 | 46 / PD3 (INT3) | D18 # + * | ° ° ° | # 2 | GND | - # + * #-------# # 3 | VCC | + # + * ################################### + * + * @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + * + * ===== EXP1/EXP2 connectors ===== + * + * (NOTE ORDER) EXP2 EXP1 + * 2 4 6 8 10 2 4 6 8 10 + * #-------------------# #-------------------# + * #2 | ° ° ° ° ° | #2 | ° ° ° ° ° | + * #1 | ° ° ° ° ° | #1 | ° ° ° ° ° | + * NOTCH #-------- -------# NOTCH #-------- -------# + * 1 3 5 7 9 1 3 5 7 9 + * + * ############# EXP1 ################ + * # Pin | ATMEGA2560 Pin | Arduino # + * ################################### + * # 1 | 53 / PC0 | D37 # + * # 2 | 55 / PC2 | D35 # + * # 3 | 12 / PH0 (RXD2) | D17 # + * # 4 | 13 / PH1 (TXD2) | D16 # + * # 5 | 77 / PA1 | D23 # + * # 6 | 75 / PA3 | D25 # + * # 7 | 73 / PA5 | D27 # + * # 8 | 71 / PA7 | D29 # + * # 9 | GND | - # + * # 10 | VCC | + # + * ################################### + * + * ############# EXP2 ################ + * # Pin | ATMEGA2560 Pin | Arduino # + * ################################### + * # 1 | 22 / PB3 (MISO) | D50 # + * # 2 | 20 / PB1 (SCK) | D52 # + * # 3 | 59 / PC6 | D31 # + * # 4 | N/C | # + * # 5 | 57 / PC4 | D33 # + * # 6 | 21 / PB2 (MOSI) | D51 # + * # 7 | N/C | # + * # 8 | 30 / !RESET | RESET # + * # 9 | GND | - # + * # 10 | 51 / PG0 | D41 # + * ################################### + * + * @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + * + * ===== ICSP connector ===== + * + * 2 4 6 + * #---------# + * | ° ° ° | + * | ° ° ° | + * #---------# + * 1 3 5 + * + * ################################## + * # Pin | ATMEGA2560 Pin | Arduino # + * ################################## + * # 1 | 22 / PB3 (MISO)| 50 # + * # 2 | VCC | + # + * # 3 | 20 / PB1 (SCK) | 52 # + * # 4 | 21 / PB2 (MOSI)| 51 # + * # 5 | 30 / !RESET | RESET # + * # 6 | GND | - # + * ################################## + * + * @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + * + * ===== SERVOS connector ===== + * + * 2 4 6 + * #---------# + * | ° ° ° | + * | ° ° ° | + * #---------# + * 1 3 5 + * + * ################################## + * # Pin | ATMEGA2560 Pin | Arduino # + * ################################## + * # 1 | 25 / PB6 (OC1B)| D12 # + * # 2 | 24 / PB5 (OC1A)| D11 # + * # 3 | GND | - # + * # 4 | GND | - # + * # 5 | VCC | + # + * # 6 | VCC | + # + * ################################## + * + * NOTE: Pins 1 and 2 are the ones closest to the "L" and "PWR" LEDs. + * + * NOTE: Check servo wiring before connecting, for example: + * + Airtronics (non-Z) use: Red = +; Black = -; Black & White, White or Orange = signal. + * + Airtronics-Z use: Red = +; Black = -; Blue = signal. + * + Futaba use: Red = +; Black = -; White = signal. + * + Hitec use: Red = +; Black = -; Yellow = signal. + * + JR use: Red = +; Brown = -; Orange = signal. + * + * NOTE: Test your servo limits: + * Due to effects of component tolerances and/or age, the usable range of S-values for individual servos may be less than the settable 0-255 range. For example: + * 1. One servo may have a fully usable range of M280 P0 S0 through M280 P0 S255. + * 2. A different servo (of the same brand and model) may have a usable range of only M280 P0 S0 through M280 P0 S165 after which you experience binding. + * + * @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + * + * ===== Thermistor connectors ===== + * + * (NOTE ORDER) TH2 TH1 TB + * 1 2 1 2 1 2 + * #- -# #- -# #- -# + * | ° ° | | ° ° | | ° ° | + * #-----# #-----# #-----# + * + * ############## TB ################# + * # Pin | ATMEGA2560 Pin | Arduino # + * ################################### + * # 1 | GND | - # + * # 2 | 83 / PK6 (ADC14)| A14 # + * ################################### + * + * ############## TH1 ################ + * # Pin | ATMEGA2560 Pin | Arduino # + * ################################### + * # 1 | GND | - # + * # 2 | 84 / PK5 (ADC13)| A13 # + * ################################### + * + * ############## TH2 ################ + * # Pin | ATMEGA2560 Pin | Arduino # + * ################################### + * # 1 | GND | - # + * # 2 | 82 / PK7 (ADC15)| A15 # + * ################################### + * + * @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + * + * ===== XS3 connector ===== + * + * 2 4 6 + * #---------# + * | ° ° ° | + * | ° ° ° | + * #---------# + * 1 3 5 + * + * ################################## + * # Pin | ATMEGA2560 Pin | Arduino # + * ################################## + * # 1 | 85 / ADC12 | A12 # + * # 2 | 86 / ADC11 | A11 # + * # 3 | GND | - # + * # 4 | GND | - # + * # 5 | VCC | + # + * # 6 | VCC | + # + * ################################## + * + * NOTE: Pins 1 and 2 are the ones closest to the "L" and "PWR" LEDs. + * + * @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + */ diff --git a/Marlin/src/pins/pins_ULTIMAKER_OLD.h b/Marlin/src/pins/pins_ULTIMAKER_OLD.h index c383d33088..44e14354d8 100644 --- a/Marlin/src/pins/pins_ULTIMAKER_OLD.h +++ b/Marlin/src/pins/pins_ULTIMAKER_OLD.h @@ -144,14 +144,15 @@ // // LCD / Controller // -#if ENABLED(board_rev_1_0) || ENABLED(board_rev_1_1_TO_1_3) +#if ANY(board_rev_1_0, board_rev_1_1_TO_1_3) #define LCD_PINS_RS 24 #define LCD_PINS_ENABLE 22 #define LCD_PINS_D4 36 #define LCD_PINS_D5 34 #define LCD_PINS_D6 32 #define LCD_PINS_D7 30 -#elif ENABLED(board_rev_1_5) && ENABLED(ULTRA_LCD) + +#elif ENABLED(board_rev_1_5, ULTRA_LCD) #define BEEPER_PIN 18 diff --git a/Marlin/src/pins/sensitive_pins.h b/Marlin/src/pins/sensitive_pins.h index e39f880c15..02d888cc43 100644 --- a/Marlin/src/pins/sensitive_pins.h +++ b/Marlin/src/pins/sensitive_pins.h @@ -131,7 +131,7 @@ // 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) + || (DISABLED(SWITCHING_EXTRUDER, MIXING_EXTRUDER) && EXTRUDERS > N) #define _E0_CS #define _E0_MS1 @@ -367,7 +367,7 @@ // Chip Select and Digital Micro-stepping // -#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(X_DUAL_STEPPER_DRIVERS) +#if EITHER(DUAL_X_CARRIAGE, X_DUAL_STEPPER_DRIVERS) #if PIN_EXISTS(X2_CS) #define _X2_CS X2_CS_PIN, #else diff --git a/Marlin/src/sd/Sd2Card.cpp b/Marlin/src/sd/Sd2Card.cpp index ab221e4971..0abc8142a0 100644 --- a/Marlin/src/sd/Sd2Card.cpp +++ b/Marlin/src/sd/Sd2Card.cpp @@ -30,7 +30,7 @@ #include "../inc/MarlinConfig.h" -#if ENABLED(SDSUPPORT) && DISABLED(USB_FLASH_DRIVE_SUPPORT) && DISABLED(SDIO_SUPPORT) +#if ENABLED(SDSUPPORT) && DISABLED(USB_FLASH_DRIVE_SUPPORT, SDIO_SUPPORT) /* Enable FAST CRC computations - You can trade speed for FLASH space if * needed by disabling the following define */ @@ -156,13 +156,13 @@ uint32_t Sd2Card::cardSize() { } void Sd2Card::chipDeselect() { - digitalWrite(chipSelectPin_, HIGH); + extDigitalWrite(chipSelectPin_, HIGH); spiSend(0xFF); // Ensure MISO goes high impedance } void Sd2Card::chipSelect() { spiInit(spiRate_); - digitalWrite(chipSelectPin_, LOW); + extDigitalWrite(chipSelectPin_, LOW); } /** @@ -241,8 +241,8 @@ bool Sd2Card::init(const uint8_t sckRateID/*=0*/, const pin_t chipSelectPin/*=SD #endif // Set pin modes - digitalWrite(chipSelectPin_, HIGH); // For some CPUs pinMode can write the wrong data so init desired data value first - pinMode(chipSelectPin_, OUTPUT); // Solution for #8746 by @benlye + extDigitalWrite(chipSelectPin_, HIGH); // For some CPUs pinMode can write the wrong data so init desired data value first + pinMode(chipSelectPin_, OUTPUT); // Solution for #8746 by @benlye spiBegin(); // Set SCK rate for initialization commands diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index d76bbe8c97..95527a9b85 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -438,9 +438,7 @@ void CardReader::openFile(char * const path, const bool read, const bool subcall filespos[file_subcall_ctr] = sdpos; SERIAL_ECHO_START(); - SERIAL_ECHOPAIR("SUBROUTINE CALL target:\"", path); - SERIAL_ECHOPAIR("\" parent:\"", proc_filenames[file_subcall_ctr]); - SERIAL_ECHOLNPAIR("\" pos", sdpos); + SERIAL_ECHOLNPAIR("SUBROUTINE CALL target:\"", path, "\" parent:\"", proc_filenames[file_subcall_ctr], "\" pos", sdpos); file_subcall_ctr++; } else @@ -470,8 +468,7 @@ void CardReader::openFile(char * const path, const bool read, const bool subcall if (file.open(curDir, fname, O_READ)) { filesize = file.fileSize(); sdpos = 0; - SERIAL_ECHOPAIR(MSG_SD_FILE_OPENED, fname); - SERIAL_ECHOLNPAIR(MSG_SD_SIZE, filesize); + SERIAL_ECHOLNPAIR(MSG_SD_FILE_OPENED, fname, MSG_SD_SIZE, filesize); SERIAL_ECHOLNPGM(MSG_SD_FILE_SELECTED); getfilename(0, fname); @@ -480,18 +477,12 @@ void CardReader::openFile(char * const path, const bool read, const bool subcall // SERIAL_ECHOPAIR(MSG_SD_FILE_LONG_NAME, longFilename); //} } - else { - SERIAL_ECHOPAIR(MSG_SD_OPEN_FILE_FAIL, fname); - SERIAL_CHAR('.'); - SERIAL_EOL(); - } + else + SERIAL_ECHOLNPAIR(MSG_SD_OPEN_FILE_FAIL, fname, "."); } else { //write - if (!file.open(curDir, fname, O_CREAT | O_APPEND | O_WRITE | O_TRUNC)) { - SERIAL_ECHOPAIR(MSG_SD_OPEN_FILE_FAIL, fname); - SERIAL_CHAR('.'); - SERIAL_EOL(); - } + if (!file.open(curDir, fname, O_CREAT | O_APPEND | O_WRITE | O_TRUNC)) + SERIAL_ECHOLNPAIR(MSG_SD_OPEN_FILE_FAIL, fname, "."); else { flag.saving = true; getfilename(0, fname); @@ -520,10 +511,8 @@ void CardReader::removeFile(const char * const name) { presort(); #endif } - else { - SERIAL_ECHOPAIR("Deletion failed, File: ", fname); - SERIAL_CHAR('.'); - } + else + SERIAL_ECHOLNPAIR("Deletion failed, File: ", fname, "."); } void CardReader::report_status() { @@ -669,9 +658,7 @@ const char* CardReader::diveToFile(SdFile*& curDir, const char * const path, con if (echo) SERIAL_ECHOLN(dosSubdirname); if (!myDir.open(curDir, dosSubdirname, O_READ)) { - SERIAL_ECHOPAIR(MSG_SD_OPEN_FILE_FAIL, dosSubdirname); - SERIAL_CHAR('.'); - SERIAL_EOL(); + SERIAL_ECHOLNPAIR(MSG_SD_OPEN_FILE_FAIL, dosSubdirname, "."); return NULL; } curDir = &myDir; @@ -826,7 +813,11 @@ void CardReader::setroot() { // Init sort order. for (uint16_t i = 0; i < fileCnt; i++) { - sort_order[i] = i; + sort_order[i] = ( + #if ENABLED(SDCARD_RATHERRECENTFIRST) + fileCnt - 1 - + #endif + i); // If using RAM then read all filenames now. #if ENABLED(SDSORT_USES_RAM) getfilename(i); @@ -913,12 +904,10 @@ void CardReader::setroot() { } else { sort_order[0] = 0; - #if ENABLED(SDSORT_USES_RAM) && ENABLED(SDSORT_CACHE_NAMES) + #if BOTH(SDSORT_USES_RAM, SDSORT_CACHE_NAMES) #if ENABLED(SDSORT_DYNAMIC_RAM) sortnames = new char*[1]; - #if ENABLED(SDSORT_CACHE_NAMES) - sortshort = new char*[1]; - #endif + sortshort = new char*[1]; isDir = new uint8_t[1]; #endif getfilename(0); @@ -988,7 +977,7 @@ void CardReader::printingHasFinished() { presort(); #endif - #if (ENABLED(ULTRA_LCD) || ENABLED(EXTENSIBLE_UI)) && ENABLED(LCD_SET_PROGRESS_MANUALLY) + #if EITHER(ULTRA_LCD, EXTENSIBLE_UI) && ENABLED(LCD_SET_PROGRESS_MANUALLY) ui.progress_bar_percent = 0; #endif @@ -1019,7 +1008,7 @@ void CardReader::printingHasFinished() { #if ENABLED(POWER_LOSS_RECOVERY) - constexpr char job_recovery_file_name[4] = "BIN"; + constexpr char job_recovery_file_name[4] = "PLR"; bool CardReader::jobRecoverFileExists() { const bool exists = recovery.file.open(&root, job_recovery_file_name, O_READ); @@ -1030,11 +1019,8 @@ void CardReader::printingHasFinished() { void CardReader::openJobRecoveryFile(const bool read) { if (!isDetected()) 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_ECHOPAIR(MSG_SD_OPEN_FILE_FAIL, job_recovery_file_name); - SERIAL_CHAR('.'); - SERIAL_EOL(); - } + if (!recovery.file.open(&root, job_recovery_file_name, read ? O_READ : O_CREAT | O_WRITE | O_TRUNC | O_SYNC)) + SERIAL_ECHOLNPAIR(MSG_SD_OPEN_FILE_FAIL, job_recovery_file_name, "."); else if (!read) SERIAL_ECHOLNPAIR(MSG_SD_WRITE_TO_FILE, job_recovery_file_name); } @@ -1044,7 +1030,6 @@ void CardReader::printingHasFinished() { // be zeroed and written instead of deleted. void CardReader::removeJobRecoveryFile() { if (jobRecoverFileExists()) { - //closefile(); removeFile(job_recovery_file_name); #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) SERIAL_ECHOPGM("Power-loss file delete"); diff --git a/Marlin/src/sd/cardreader.h b/Marlin/src/sd/cardreader.h index 44a698bd5c..9faf050574 100644 --- a/Marlin/src/sd/cardreader.h +++ b/Marlin/src/sd/cardreader.h @@ -25,7 +25,7 @@ #if ENABLED(SDSUPPORT) -#define SD_RESORT ENABLED(SDCARD_SORT_ALPHA) && ENABLED(SDSORT_DYNAMIC_RAM) +#define SD_RESORT BOTH(SDCARD_SORT_ALPHA, SDSORT_DYNAMIC_RAM) #define MAX_DIR_DEPTH 10 // Maximum folder depth #define MAXDIRNAMELENGTH 8 // DOS folder name size @@ -173,7 +173,7 @@ private: static uint8_t sort_order[SDSORT_LIMIT]; #endif - #if ENABLED(SDSORT_USES_RAM) && ENABLED(SDSORT_CACHE_NAMES) && DISABLED(SDSORT_DYNAMIC_RAM) + #if BOTH(SDSORT_USES_RAM, SDSORT_CACHE_NAMES) && DISABLED(SDSORT_DYNAMIC_RAM) #define SORTED_LONGNAME_MAXLEN ((SDSORT_CACHE_VFATS) * (FILENAME_LENGTH) + 1) #else #define SORTED_LONGNAME_MAXLEN LONG_FILENAME_LENGTH diff --git a/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp b/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp index 9a98797f5f..8de27cb319 100644 --- a/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp +++ b/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp @@ -31,7 +31,7 @@ #include "Sd2Card_FlashDrive.h" -#if ENABLED(ULTRA_LCD) || ENABLED(EXTENSIBLE_UI) +#if EITHER(ULTRA_LCD, EXTENSIBLE_UI) #include "../../lcd/ultralcd.h" #endif @@ -63,7 +63,7 @@ void Sd2Card::idle() { SERIAL_ECHOPGM("Starting USB host..."); if (!usb.start()) { SERIAL_ECHOPGM(" Failed. Retrying in 2s."); - #if ENABLED(ULTRA_LCD) || ENABLED(EXTENSIBLE_UI) + #if EITHER(ULTRA_LCD, EXTENSIBLE_UI) LCD_MESSAGEPGM("USB start failed"); #endif state = USB_HOST_DELAY_INIT; diff --git a/Marlin/src/config/default/Configuration.h b/config/default/Configuration.h similarity index 96% rename from Marlin/src/config/default/Configuration.h rename to config/default/Configuration.h index 34b3512363..ef0042315b 100644 --- a/Marlin/src/config/default/Configuration.h +++ b/config/default/Configuration.h @@ -218,7 +218,7 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 0 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -545,6 +547,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -814,6 +817,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1012,7 +1026,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1105,7 +1119,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1124,13 +1138,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1199,7 +1214,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1226,6 +1241,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1397,10 +1413,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2033,11 +2049,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2062,7 +2078,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/default/Configuration_adv.h b/config/default/Configuration_adv.h similarity index 93% rename from Marlin/src/config/default/Configuration_adv.h rename to config/default/Configuration_adv.h index 401505d958..e82396cab2 100644 --- a/Marlin/src/config/default/Configuration_adv.h +++ b/config/default/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,7 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) @@ -980,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1020,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1028,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1599,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1614,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2182,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/3DFabXYZ/Migbot/Configuration.h b/config/examples/3DFabXYZ/Migbot/Configuration.h similarity index 96% rename from Marlin/src/config/examples/3DFabXYZ/Migbot/Configuration.h rename to config/examples/3DFabXYZ/Migbot/Configuration.h index ccb2a8a4a4..8f245bba1c 100644 --- a/Marlin/src/config/examples/3DFabXYZ/Migbot/Configuration.h +++ b/config/examples/3DFabXYZ/Migbot/Configuration.h @@ -218,7 +218,7 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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 5 // (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. +#define TEMP_RESIDENCY_TIME 5 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 5 // (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. +#define TEMP_BED_RESIDENCY_TIME 5 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -550,6 +552,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -820,6 +823,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1018,7 +1032,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1111,7 +1125,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1130,13 +1144,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1205,7 +1220,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1232,6 +1247,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1428,10 +1444,10 @@ #define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2064,7 +2080,7 @@ //#define RGB_LED //#define RGBW_LED -#if ENABLED(RGB_LED) || ENABLED(RGBW_LED) +#if EITHER(RGB_LED, RGBW_LED) #define RGB_LED_R_PIN 50 #define RGB_LED_G_PIN 51 #define RGB_LED_B_PIN 52 @@ -2093,7 +2109,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/3DFabXYZ/Migbot/Configuration_adv.h b/config/examples/3DFabXYZ/Migbot/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/3DFabXYZ/Migbot/Configuration_adv.h rename to config/examples/3DFabXYZ/Migbot/Configuration_adv.h index bb05cbf4cb..84bc191b0b 100644 --- a/Marlin/src/config/examples/3DFabXYZ/Migbot/Configuration_adv.h +++ b/config/examples/3DFabXYZ/Migbot/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G27" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,7 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) @@ -980,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1020,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1028,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1599,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1614,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2184,6 +2252,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/3DFabXYZ/Migbot/Readme.md b/config/examples/3DFabXYZ/Migbot/Readme.md similarity index 100% rename from Marlin/src/config/examples/3DFabXYZ/Migbot/Readme.md rename to config/examples/3DFabXYZ/Migbot/Readme.md diff --git a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration.h b/config/examples/AlephObjects/TAZ4/Configuration.h similarity index 96% rename from Marlin/src/config/examples/AlephObjects/TAZ4/Configuration.h rename to config/examples/AlephObjects/TAZ4/Configuration.h index c23d54f7fa..879a6e9515 100644 --- a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration.h +++ b/config/examples/AlephObjects/TAZ4/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 7 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (Use MINTEMP for thermistor short/failure protection.) #define HEATER_0_MAXTEMP 250 #define HEATER_1_MAXTEMP 250 #define HEATER_2_MAXTEMP 250 #define HEATER_3_MAXTEMP 250 #define HEATER_4_MAXTEMP 250 #define HEATER_5_MAXTEMP 250 -#define BED_MAXTEMP 150 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -565,6 +567,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -834,6 +837,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1032,7 +1046,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1125,7 +1139,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1144,13 +1158,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1219,7 +1234,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1246,6 +1261,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1417,10 +1433,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2053,11 +2069,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2082,7 +2098,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h b/config/examples/AlephObjects/TAZ4/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h rename to config/examples/AlephObjects/TAZ4/Configuration_adv.h index 513b627b4f..e9f373b81f 100644 --- a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h +++ b/config/examples/AlephObjects/TAZ4/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #define Z_HOME_BUMP_MM 4 #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h b/config/examples/AliExpress/CL-260/Configuration.h similarity index 96% rename from Marlin/src/config/examples/AliExpress/CL-260/Configuration.h rename to config/examples/AliExpress/CL-260/Configuration.h index 67643a38ba..ff5f50f692 100644 --- a/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h +++ b/config/examples/AliExpress/CL-260/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -545,6 +547,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -814,6 +817,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1012,7 +1026,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1105,7 +1119,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1124,13 +1138,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1199,7 +1214,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1226,6 +1241,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1397,10 +1413,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2033,11 +2049,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2062,7 +2078,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/AliExpress/CL-260/README.txt b/config/examples/AliExpress/CL-260/README.txt similarity index 100% rename from Marlin/src/config/examples/AliExpress/CL-260/README.txt rename to config/examples/AliExpress/CL-260/README.txt diff --git a/Marlin/src/config/examples/AliExpress/UM2pExt/Configuration.h b/config/examples/AliExpress/UM2pExt/Configuration.h similarity index 96% rename from Marlin/src/config/examples/AliExpress/UM2pExt/Configuration.h rename to config/examples/AliExpress/UM2pExt/Configuration.h index 08cb970401..6b622c83cc 100644 --- a/Marlin/src/config/examples/AliExpress/UM2pExt/Configuration.h +++ b/config/examples/AliExpress/UM2pExt/Configuration.h @@ -218,7 +218,7 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 20 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 130 +#define BED_MAXTEMP 130 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -556,6 +558,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -825,6 +828,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1023,7 +1037,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) #define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1116,7 +1130,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1135,13 +1149,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1210,7 +1225,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1237,6 +1252,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1408,10 +1424,10 @@ #define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2044,11 +2060,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2073,7 +2089,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/AliExpress/UM2pExt/Configuration_adv.h b/config/examples/AliExpress/UM2pExt/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/AliExpress/UM2pExt/Configuration_adv.h rename to config/examples/AliExpress/UM2pExt/Configuration_adv.h index 5b281a8367..3d55d7daf9 100644 --- a/Marlin/src/config/examples/AliExpress/UM2pExt/Configuration_adv.h +++ b/config/examples/AliExpress/UM2pExt/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,28 +404,37 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G27" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -906,9 +961,15 @@ #define STATUS_HOTEND_ANIM // Use a second bitmap to indicate hotend heating #define STATUS_BED_ANIM // Use a second bitmap to indicate bed heating //#define STATUS_ALT_BED_BITMAP // Use the alternative bed bitmap + //#define STATUS_ALT_FAN_BITMAP // Use the alternative fan bitmap //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -951,6 +1012,7 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) @@ -979,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1600,7 +1670,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1615,8 +1685,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2183,6 +2252,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/Anet/A2/Configuration.h b/config/examples/Anet/A2/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Anet/A2/Configuration.h rename to config/examples/Anet/A2/Configuration.h index 9565659b1d..e6dddd039a 100644 --- a/Marlin/src/config/examples/Anet/A2/Configuration.h +++ b/config/examples/Anet/A2/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 5 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -545,6 +547,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -814,6 +817,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1012,7 +1026,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1105,7 +1119,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1124,13 +1138,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1199,7 +1214,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1226,6 +1241,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1397,10 +1413,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2035,11 +2051,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2064,7 +2080,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Anet/A2plus/Configuration_adv.h b/config/examples/Anet/A2/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Anet/A2plus/Configuration_adv.h rename to config/examples/Anet/A2/Configuration_adv.h index d88da485ec..0dced6ec2e 100644 --- a/Marlin/src/config/examples/Anet/A2plus/Configuration_adv.h +++ b/config/examples/Anet/A2/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/Anet/A2plus/Configuration.h b/config/examples/Anet/A2plus/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Anet/A2plus/Configuration.h rename to config/examples/Anet/A2plus/Configuration.h index b0822e48cc..e2c41c9bc8 100644 --- a/Marlin/src/config/examples/Anet/A2plus/Configuration.h +++ b/config/examples/Anet/A2plus/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 5 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -545,6 +547,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -814,6 +817,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1012,7 +1026,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1105,7 +1119,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1124,13 +1138,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1199,7 +1214,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1226,6 +1241,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1397,10 +1413,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2035,11 +2051,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2064,7 +2080,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Anet/A2/Configuration_adv.h b/config/examples/Anet/A2plus/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Anet/A2/Configuration_adv.h rename to config/examples/Anet/A2plus/Configuration_adv.h index d88da485ec..0dced6ec2e 100644 --- a/Marlin/src/config/examples/Anet/A2/Configuration_adv.h +++ b/config/examples/Anet/A2plus/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/Anet/A6/Configuration.h b/config/examples/Anet/A6/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Anet/A6/Configuration.h rename to config/examples/Anet/A6/Configuration.h index 2521909b04..ff52d555a1 100644 --- a/Marlin/src/config/examples/Anet/A6/Configuration.h +++ b/config/examples/Anet/A6/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 11 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 130 +#define BED_MAXTEMP 130 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -565,6 +567,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -861,6 +864,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1126,7 +1140,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1219,7 +1233,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1238,13 +1252,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 4 @@ -1337,7 +1352,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1364,6 +1379,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1549,10 +1565,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2187,11 +2203,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2216,7 +2232,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Anet/A6/Configuration_adv.h b/config/examples/Anet/A6/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Anet/A6/Configuration_adv.h rename to config/examples/Anet/A6/Configuration_adv.h index d7e8502780..51713dcc62 100644 --- a/Marlin/src/config/examples/Anet/A6/Configuration_adv.h +++ b/config/examples/Anet/A6/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 10 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,30 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ +//#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -405,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -437,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -462,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -719,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -909,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -951,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -978,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1018,7 +1082,8 @@ //#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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1026,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1597,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1612,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2180,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/Anet/A8/Configuration.h b/config/examples/Anet/A8/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Anet/A8/Configuration.h rename to config/examples/Anet/A8/Configuration.h index b80e1360ec..dfdb7d2eff 100644 --- a/Marlin/src/config/examples/Anet/A8/Configuration.h +++ b/config/examples/Anet/A8/Configuration.h @@ -219,10 +219,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -378,6 +378,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 5 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -388,37 +389,38 @@ //#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 6 // (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. +#define TEMP_RESIDENCY_TIME 6 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 6 // (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. +#define TEMP_BED_RESIDENCY_TIME 6 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 130 +#define BED_MAXTEMP 130 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -558,6 +560,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -827,6 +830,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1025,7 +1039,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1118,7 +1132,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1137,13 +1151,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1212,7 +1227,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) #define PROBE_PT_1_X 20 #define PROBE_PT_1_Y 160 #define PROBE_PT_2_X 20 @@ -1239,6 +1254,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1410,10 +1426,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2048,11 +2064,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2077,7 +2093,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Anet/A8/Configuration_adv.h b/config/examples/Anet/A8/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Anet/A8/Configuration_adv.h rename to config/examples/Anet/A8/Configuration_adv.h index 7592de0147..7c7611c23a 100644 --- a/Marlin/src/config/examples/Anet/A8/Configuration_adv.h +++ b/config/examples/Anet/A8/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 10 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ //#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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/AnimationExample/_Bootscreen.h b/config/examples/AnimationExample/_Bootscreen.h similarity index 100% rename from Marlin/src/config/examples/AnimationExample/_Bootscreen.h rename to config/examples/AnimationExample/_Bootscreen.h diff --git a/Marlin/src/config/examples/AnyCubic/i3/Configuration.h b/config/examples/AnyCubic/i3/Configuration.h similarity index 96% rename from Marlin/src/config/examples/AnyCubic/i3/Configuration.h rename to config/examples/AnyCubic/i3/Configuration.h index d6444b74b7..71406a9c87 100644 --- a/Marlin/src/config/examples/AnyCubic/i3/Configuration.h +++ b/config/examples/AnyCubic/i3/Configuration.h @@ -218,7 +218,7 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -555,6 +557,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -824,6 +827,17 @@ #define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1022,7 +1036,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1115,7 +1129,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1134,13 +1148,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1209,7 +1224,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1236,6 +1251,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1407,10 +1423,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2043,11 +2059,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2072,7 +2088,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/AnyCubic/i3/Configuration_adv.h b/config/examples/AnyCubic/i3/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/AnyCubic/i3/Configuration_adv.h rename to config/examples/AnyCubic/i3/Configuration_adv.h index d5cde973b9..e491757f7c 100644 --- a/Marlin/src/config/examples/AnyCubic/i3/Configuration_adv.h +++ b/config/examples/AnyCubic/i3/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,7 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) @@ -980,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1020,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1028,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1263,6 +1332,7 @@ // 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. + #define ADVANCED_PAUSE_RESUME_PRIME 0 // (mm) Extra distance to prime nozzle after returning from park. // Filament Unload does a Retract, Delay, and Purge first: #define FILAMENT_UNLOAD_RETRACT_LENGTH 13 // (mm) Unload initial retract length. @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/ArmEd/Configuration.h b/config/examples/ArmEd/Configuration.h similarity index 96% rename from Marlin/src/config/examples/ArmEd/Configuration.h rename to config/examples/ArmEd/Configuration.h index bf3acb3deb..84fd88190f 100644 --- a/Marlin/src/config/examples/ArmEd/Configuration.h +++ b/config/examples/ArmEd/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 13 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -546,6 +548,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -815,6 +818,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1013,7 +1027,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1106,7 +1120,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1125,13 +1139,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1200,7 +1215,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1227,6 +1242,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1398,10 +1414,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2034,11 +2050,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2063,7 +2079,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/config/examples/ArmEd/Configuration_adv.h b/config/examples/ArmEd/Configuration_adv.h new file mode 100644 index 0000000000..150494a6dc --- /dev/null +++ b/config/examples/ArmEd/Configuration_adv.h @@ -0,0 +1,2336 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +/** + * 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 + + //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) + //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 + #endif + + /** + * 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 + +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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 + +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + +// @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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. + */ +//#define DUAL_X_CARRIAGE +#if ENABLED(DUAL_X_CARRIAGE) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. + + // This is the default power-up mode which can be later using M605. + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing + +// 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} + +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION + +// 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 EITHER(ULTIPANEL, EXTENSIBLE_UI) + #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) + #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) + +// +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. +// +//#define BACKLASH_COMPENSATION +#if ENABLED(BACKLASH_COMPENSATION) + // Define values for backlash distance and correction. + // If BACKLASH_GCODE is enabled these values are the defaults. + #define BACKLASH_DISTANCE_MM { 0, 0, 0 } // (mm) + #define BACKLASH_CORRECTION 0.0 // 0.0 = no correction; 1.0 = full correction + + // Set BACKLASH_SMOOTHING_MM to spread backlash correction over multiple segments + // to reduce print artifacts. (Enabling this is costly in memory and computation!) + //#define BACKLASH_SMOOTHING_MM 3 // (mm) + + // Add runtime configuration and tuning of backlash values (M425) + //#define BACKLASH_GCODE + + #if ENABLED(BACKLASH_GCODE) + // Measure the Z backlash when probing (G29) and set with "M425 Z" + #define MEASURE_BACKLASH_WHEN_PROBING + + #if ENABLED(MEASURE_BACKLASH_WHEN_PROBING) + // When measuring, the probe will move up to BACKLASH_MEASUREMENT_LIMIT + // mm away from point of contact in BACKLASH_MEASUREMENT_RESOLUTION + // increments while checking for the contact to be broken. + #define BACKLASH_MEASUREMENT_LIMIT 0.5 // (mm) + #define BACKLASH_MEASUREMENT_RESOLUTION 0.005 // (mm) + #define BACKLASH_MEASUREMENT_FEEDRATE Z_PROBE_SPEED_SLOW // (mm/m) + #endif + #endif +#endif + +/** + * Automatic backlash, position and hotend offset calibration + * + * Enable G425 to run automatic calibration using an electrically- + * conductive cube, bolt, or washer mounted on the bed. + * + * G425 uses the probe to touch the top and sides of the calibration object + * on the bed and measures and/or correct positional offsets, axis backlash + * and hotend offsets. + * + * Note: HOTEND_OFFSET and CALIBRATION_OBJECT_CENTER must be set to within + * ±5mm of true values for G425 to succeed. + */ +//#define CALIBRATION_GCODE +#if ENABLED(CALIBRATION_GCODE) + + #define CALIBRATION_MEASUREMENT_RESOLUTION 0.01 // mm + + #define CALIBRATION_FEEDRATE_SLOW 60 // mm/m + #define CALIBRATION_FEEDRATE_FAST 1200 // mm/m + #define CALIBRATION_FEEDRATE_TRAVEL 3000 // mm/m + + // The following parameters refer to the conical section of the nozzle tip. + #define CALIBRATION_NOZZLE_TIP_HEIGHT 1.0 // mm + #define CALIBRATION_NOZZLE_OUTER_DIAMETER 2.0 // mm + + // Uncomment to enable reporting (required for "G425 V", but consumes PROGMEM). + //#define CALIBRATION_REPORTING + + // The true location and dimension the cube/bolt/washer on the bed. + #define CALIBRATION_OBJECT_CENTER { 264.0, -22.0, -2.0} // mm + #define CALIBRATION_OBJECT_DIMENSIONS { 10.0, 10.0, 10.0} // mm + + // Comment out any sides which are unreachable by the probe. For best + // auto-calibration results, all sides must be reachable. + #define CALIBRATION_MEASURE_RIGHT + #define CALIBRATION_MEASURE_FRONT + #define CALIBRATION_MEASURE_LEFT + #define CALIBRATION_MEASURE_BACK + + // Probing at the exact top center only works if the center is flat. If + // probing on a screwhead or hollow washer, probe near the edges. + //#define CALIBRATION_MEASURE_AT_TOP_EDGES + + // Define pin which is read during calibration + #ifndef CALIBRATION_PIN + #define CALIBRATION_PIN -1 // Override in pins.h or set to -1 to use your Z endstop + #define CALIBRATION_PIN_INVERTING false // set to true to invert the pin + //#define CALIBRATION_PIN_PULLDOWN + #define CALIBRATION_PIN_PULLUP + #endif +#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 + +// Play a beep when the feedrate is changed from the Status Screen +//#define BEEP_ON_FEEDRATE_CHANGE +#if ENABLED(BEEP_ON_FEEDRATE_CHANGE) + #define FEEDRATE_CHANGE_BEEP_DURATION 10 + #define FEEDRATE_CHANGE_BEEP_FREQUENCY 440 +#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 + +/** + * 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 + + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") + + /** + * 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 BINARY_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 + + /** + * 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. + */ + #if ENABLED(U8GLIB_ST7920) + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + + /** + * Status (Info) Screen customizations + * These options may affect code size and screen render time. + * Custom status screens can forcibly override these settings. + */ + //#define STATUS_COMBINE_HEATERS // Use combined heater images instead of separate ones + //#define STATUS_HOTEND_NUMBERLESS // Use plain hotend icons instead of numbered ones (with 2+ hotends) + #define STATUS_HOTEND_INVERTED // Show solid nozzle bitmaps when heating (Requires STATUS_HOTEND_ANIM) + #define STATUS_HOTEND_ANIM // Use a second bitmap to indicate hotend heating + #define STATUS_BED_ANIM // Use a second bitmap to indicate bed heating + //#define STATUS_ALT_BED_BITMAP // Use the alternative bed bitmap + //#define STATUS_ALT_FAN_BITMAP // Use the alternative fan bitmap + //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames + //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + +#endif // HAS_GRAPHICAL_LCD + +// @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_WITHOUT_HOMING + //#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. + //#define BABYSTEP_ALWAYS_AVAILABLE // Allow babystepping at all times (not just during movement). + //#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 + #endif + + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + + //#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 EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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 EITHER(MESH_BED_LEVELING, 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" + +#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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ +//#define G38_PROBE_TARGET +#if ENABLED(G38_PROBE_TARGET) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a 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 + +// Printrun may have trouble receiving long strings all at once. +// This option inserts short delays between lines of serial output. +#define SERIAL_OVERRUN_PROTECTION + +// @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_EXTRA_PRIME 2 // (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. + #define ADVANCED_PAUSE_RESUME_PRIME 0 // (mm) Extra distance to prime nozzle after returning from park. + + // 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) + + #if AXIS_DRIVER_TYPE_X(TMC26X) + #define X_MAX_CURRENT 1000 // (mA) + #define X_SENSE_RESISTOR 91 // (mOhms) + #define X_MICROSTEPS 16 // Number of microsteps + #endif + + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_E5(TMC26X) + #define E5_MAX_CURRENT 1000 + #define E5_SENSE_RESISTOR 91 + #define E5_MICROSTEPS 16 + #endif + +#endif // TMC26X + +// @section tmc_smart + +/** + * To use TMC2130, TMC2160, TMC2660, TMC5130, TMC5160 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. + * + * 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. + * + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper + */ +#if HAS_TRINAMIC + + #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current + #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 + + #if AXIS_IS_TMC(X) + #define X_CURRENT 800 // (mA) RMS current. Multiply by 1.414 for peak current. + #define X_MICROSTEPS 16 // 0..256 + #define X_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(E1) + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + #define E1_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(E2) + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + #define E2_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif + + /** + * Override default SPI pins for TMC2130, TMC2160, TMC2660, TMC5130 and TMC5160 drivers here. + * The default pins can be found in your board's pins file. + */ + //#define X_CS_PIN -1 + //#define Y_CS_PIN -1 + //#define Z_CS_PIN -1 + //#define X2_CS_PIN -1 + //#define Y2_CS_PIN -1 + //#define Z2_CS_PIN -1 + //#define Z3_CS_PIN -1 + //#define E0_CS_PIN -1 + //#define E1_CS_PIN -1 + //#define E2_CS_PIN -1 + //#define E3_CS_PIN -1 + //#define E4_CS_PIN -1 + //#define E5_CS_PIN -1 + + /** + * Use software SPI for TMC2130. + * Software option for SPI driven drivers (TMC2130, TMC2160, TMC2660, TMC5130 and TMC5160). + * 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 + + /** + * Software enable + * + * Use for drivers that do not use a dedicated enable pin, but rather handle the same + * function through a communication line such as SPI or UART. + */ + //#define SOFTWARE_DRIVER_ENABLE + + /** + * TMC2130, TMC2160, TMC2208, TMC5130 and TMC5160 only + * Use Trinamic's ultra quiet stepping mode. + * When disabled, Marlin will use spreadCycle stepping mode. + */ + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E + + /** + * Optimize spreadCycle chopper parameters by using predefined parameter sets + * or with the help of an example included in the library. + * Provided parameter sets are + * CHOPPER_DEFAULT_12V + * CHOPPER_DEFAULT_19V + * CHOPPER_DEFAULT_24V + * CHOPPER_DEFAULT_36V + * CHOPPER_PRUSAMK3_24V // Imported parameters from the official Prusa firmware for MK3 (24V) + * CHOPPER_MARLIN_119 // Old defaults from Marlin v1.1.9 + * + * Define you own with + * { , , hysteresis_start[1..8] } + */ + #define CHOPPER_TIMING CHOPPER_DEFAULT_12V + + /** + * Monitor Trinamic 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 - 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 + + /** + * TMC2130, TMC2160, TMC2208, TMC5130 and TMC5160 only + * 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_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. + * 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 + + /** + * TMC2130, TMC2160, TMC2660, TMC5130, and TMC5160 only + * 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 EITHER(SENSORLESS_HOMING, 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 + + /** + * 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/TMCStepper + * + * Example: + * #define TMC_ADV() { \ + * stepperX.diag0_temp_prewarn(1); \ + * stepperY.interpolate(0); \ + * } + */ + #define TMC_ADV() { } + +#endif // HAS_TRINAMIC + +// @section L6470 + +/** + * L6470 Stepper Driver options + * + * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver. + * https://github.com/ameyer/Arduino-L6470 + * + * Requires the following to be defined in your pins_YOUR_BOARD file + * L6470_CHAIN_SCK_PIN + * L6470_CHAIN_MISO_PIN + * L6470_CHAIN_MOSI_PIN + * L6470_CHAIN_SS_PIN + * L6470_RESET_CHAIN_PIN (optional) + */ +#if HAS_DRIVER(L6470) + + //#define L6470_CHITCHAT // Display additional status info + + #if AXIS_DRIVER_TYPE_X(L6470) + #define X_MICROSTEPS 128 // Number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128) + #define X_OVERCURRENT 2000 // (mA) Current where the driver detects an over current (VALID: 375 x (1 - 16) - 6A max - rounds down) + #define X_STALLCURRENT 1500 // (mA) Current where the driver detects a stall (VALID: 31.25 * (1-128) - 4A max - rounds down) + #define X_MAX_VOLTAGE 127 // 0-255, Maximum effective voltage seen by stepper + #define X_CHAIN_POS 0 // Position in SPI chain, 0=Not in chain, 1=Nearest MOSI + #endif + + #if AXIS_DRIVER_TYPE_X2(L6470) + #define X2_MICROSTEPS 128 + #define X2_OVERCURRENT 2000 + #define X2_STALLCURRENT 1500 + #define X2_MAX_VOLTAGE 127 + #define X2_CHAIN_POS 0 + #endif + + #if AXIS_DRIVER_TYPE_Y(L6470) + #define Y_MICROSTEPS 128 + #define Y_OVERCURRENT 2000 + #define Y_STALLCURRENT 1500 + #define Y_MAX_VOLTAGE 127 + #define Y_CHAIN_POS 0 + #endif + + #if AXIS_DRIVER_TYPE_Y2(L6470) + #define Y2_MICROSTEPS 128 + #define Y2_OVERCURRENT 2000 + #define Y2_STALLCURRENT 1500 + #define Y2_MAX_VOLTAGE 127 + #define Y2_CHAIN_POS 0 + #endif + + #if AXIS_DRIVER_TYPE_Z(L6470) + #define Z_MICROSTEPS 128 + #define Z_OVERCURRENT 2000 + #define Z_STALLCURRENT 1500 + #define Z_MAX_VOLTAGE 127 + #define Z_CHAIN_POS 0 + #endif + + #if AXIS_DRIVER_TYPE_Z2(L6470) + #define Z2_MICROSTEPS 128 + #define Z2_OVERCURRENT 2000 + #define Z2_STALLCURRENT 1500 + #define Z2_MAX_VOLTAGE 127 + #define Z2_CHAIN_POS 0 + #endif + + #if AXIS_DRIVER_TYPE_Z3(L6470) + #define Z3_MICROSTEPS 128 + #define Z3_OVERCURRENT 2000 + #define Z3_STALLCURRENT 1500 + #define Z3_MAX_VOLTAGE 127 + #define Z3_CHAIN_POS 0 + #endif + + #if AXIS_DRIVER_TYPE_E0(L6470) + #define E0_MICROSTEPS 128 + #define E0_OVERCURRENT 2000 + #define E0_STALLCURRENT 1500 + #define E0_MAX_VOLTAGE 127 + #define E0_CHAIN_POS 0 + #endif + + #if AXIS_DRIVER_TYPE_E1(L6470) + #define E1_MICROSTEPS 128 + #define E1_OVERCURRENT 2000 + #define E1_STALLCURRENT 1500 + #define E1_MAX_VOLTAGE 127 + #define E1_CHAIN_POS 0 + #endif + + #if AXIS_DRIVER_TYPE_E2(L6470) + #define E2_MICROSTEPS 128 + #define E2_OVERCURRENT 2000 + #define E2_STALLCURRENT 1500 + #define E2_MAX_VOLTAGE 127 + #define E2_CHAIN_POS 0 + #endif + + #if AXIS_DRIVER_TYPE_E3(L6470) + #define E3_MICROSTEPS 128 + #define E3_OVERCURRENT 2000 + #define E3_STALLCURRENT 1500 + #define E3_MAX_VOLTAGE 127 + #define E3_CHAIN_POS 0 + #endif + + #if AXIS_DRIVER_TYPE_E4(L6470) + #define E4_MICROSTEPS 128 + #define E4_OVERCURRENT 2000 + #define E4_STALLCURRENT 1500 + #define E4_MAX_VOLTAGE 127 + #define E4_CHAIN_POS 0 + #endif + + #if AXIS_DRIVER_TYPE_E5(L6470) + #define E5_MICROSTEPS 128 + #define E5_OVERCURRENT 2000 + #define E5_STALLCURRENT 1500 + #define E5_MAX_VOLTAGE 127 + #define E5_CHAIN_POS 0 + #endif + + /** + * Monitor L6470 drivers for error conditions like over temperature and over current. + * In the case of over temperature Marlin can decrease the drive until the error condition clears. + * Other detected conditions can be used to stop the current print. + * Relevant g-codes: + * M906 - I1/2/3/4/5 Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given. + * I not present or I0 or I1 - X, Y, Z or E0 + * I2 - X2, Y2, Z2 or E1 + * I3 - Z3 or E3 + * I4 - E4 + * I5 - E5 + * M916 - Increase drive level until get thermal warning + * M917 - Find minimum current thresholds + * M918 - Increase speed until max or error + * M122 S0/1 - Report driver parameters + */ + //#define MONITOR_L6470_DRIVER_STATUS + + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif + +#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 + +/** + * Photo G-code + * Add the M240 G-code to take a photo. + * The photo can be triggered by a digital pin or a physical movement. + */ +//#define PHOTO_GCODE +#if ENABLED(PHOTO_GCODE) + // A position to move to (and raise Z) before taking the photo + //#define PHOTO_POSITION { X_MAX_POS - 5, Y_MAX_POS, 0 } // { xpos, ypos, zraise } (M240 X Y Z) + //#define PHOTO_DELAY_MS 100 // (ms) Duration to pause before moving back (M240 P) + //#define PHOTO_RETRACT_MM 6.5 // (mm) E retract/recover for the photo move (M240 R S) + + // Canon RC-1 or homebrew digital camera trigger + // Data from: http://www.doc-diy.net/photo/rc-1_hacked/ + //#define PHOTOGRAPH_PIN 23 + + // Canon Hack Development Kit + // http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + //#define CHDK_PIN 4 + + // Optional second move with delay to trigger the camera shutter + //#define PHOTO_SWITCH_POSITION { X_MAX_POS, Y_MAX_POS } // { xpos, ypos } (M240 I J) + + // Duration to hold the switch or keep CHDK_PIN high + //#define PHOTO_SWITCH_MS 50 // (ms) (M240 D) +#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 + +/** + * 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 + +/** + * Host Action Commands + * + * Define host streamer action commands in compliance with the standard. + * + * See https://reprap.org/wiki/G-code#Action_commands + * Common commands ........ poweroff, pause, paused, resume, resumed, cancel + * G29_RETRY_AND_RECOVER .. probe_rewipe, probe_failed + * + * Some features add reason codes to extend these commands. + * + * Host Prompt Support enables Marlin to use the host for user prompts so + * filament runout and other processes can be managed from the host side. + */ +//#define HOST_ACTION_COMMANDS +#if ENABLED(HOST_ACTION_COMMANDS) + //#define HOST_PROMPT_SUPPORT +#endif + +//=========================================================================== +//====================== 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/ + * + * Reliabuild 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" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates +#endif + +/** + * Prusa Multi-Material Unit v2 + * Enable in Configuration.h + */ +#if ENABLED(PRUSA_MMU2) + + // Serial port used for communication with MMU2. + // For AVR enable the UART port used for the MMU. (e.g., internalSerial) + // For 32-bit boards check your HAL for available serial ports. (e.g., Serial2) + #define INTERNAL_SERIAL_PORT 2 + #define MMU2_SERIAL internalSerial + + // Use hardware reset for MMU if a pin is defined for it + //#define MMU2_RST_PIN 23 + + // Enable if the MMU2 has 12V stepper motors (MMU2 Firmware 1.0.2 and up) + //#define MMU2_MODE_12V + + // G-code to execute when MMU2 F.I.N.D.A. probe detects filament runout + #define MMU2_FILAMENT_RUNOUT_SCRIPT "M600" + + // Add an LCD menu for MMU2 + //#define MMU2_MENUS + #if ENABLED(MMU2_MENUS) + // Settings for filament load / unload from the LCD menu. + // This is for Prusa MK3-style extruders. Customize for your hardware. + #define MMU2_FILAMENTCHANGE_EJECT_FEED 80.0 + #define MMU2_LOAD_TO_NOZZLE_SEQUENCE \ + { 7.2, 562 }, \ + { 14.4, 871 }, \ + { 36.0, 1393 }, \ + { 14.4, 871 }, \ + { 50.0, 198 } + + #define MMU2_RAMMING_SEQUENCE \ + { 1.0, 1000 }, \ + { 1.0, 1500 }, \ + { 2.0, 2000 }, \ + { 1.5, 3000 }, \ + { 2.5, 4000 }, \ + { -15.0, 5000 }, \ + { -14.0, 1200 }, \ + { -6.0, 600 }, \ + { 10.0, 700 }, \ + { -10.0, 400 }, \ + { -50.0, 2000 } + + #endif + + //#define MMU2_DEBUG // Write debug info to serial output + +#endif // PRUSA_MMU2 + +/** + * Advanced Print Counter settings + */ +#if ENABLED(PRINTCOUNTER) + #define SERVICE_WARNING_BUZZES 3 + // Activate up to 3 service interval watchdogs + //#define SERVICE_NAME_1 "Service S" + //#define SERVICE_INTERVAL_1 100 // print hours + //#define SERVICE_NAME_2 "Service L" + //#define SERVICE_INTERVAL_2 200 // print hours + //#define SERVICE_NAME_3 "Service 3" + //#define SERVICE_INTERVAL_3 1 // print hours +#endif + +// @section develop + +/** + * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins + */ +//#define PINS_DEBUGGING + +// 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/config/examples/Azteeg/X5GT/Configuration.h similarity index 95% rename from Marlin/src/config/examples/Azteeg/X5GT/Configuration.h rename to config/examples/Azteeg/X5GT/Configuration.h index 2b8b91d16d..c3077da5ac 100644 --- a/Marlin/src/config/examples/Azteeg/X5GT/Configuration.h +++ b/config/examples/Azteeg/X5GT/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -545,6 +547,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -814,6 +817,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1012,7 +1026,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1105,7 +1119,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1124,13 +1138,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1199,7 +1214,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1226,6 +1241,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1259,8 +1275,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 axis (G28). - #define Z_SAFE_HOMING_Y_POINT ((Y_BED_SIZE) / 2) // Y point for Z homing when homing all axis (G28). + #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) @@ -1397,10 +1413,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2033,11 +2049,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2062,7 +2078,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration.h b/config/examples/BIBO/TouchX/cyclops/Configuration.h similarity index 95% rename from Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration.h rename to config/examples/BIBO/TouchX/cyclops/Configuration.h index dc1405c10a..c7e64ca4bf 100644 --- a/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration.h +++ b/config/examples/BIBO/TouchX/cyclops/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 5 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (Use MINTEMP for thermistor short/failure protection.) #define HEATER_0_MAXTEMP 285 #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 115 +#define BED_MAXTEMP 115 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -545,6 +547,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -814,6 +817,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1012,7 +1026,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1105,7 +1119,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1122,15 +1136,16 @@ */ #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. + #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 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1199,7 +1214,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1226,6 +1241,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1397,10 +1413,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2033,11 +2049,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2062,7 +2078,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration_adv.h b/config/examples/BIBO/TouchX/cyclops/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration_adv.h rename to config/examples/BIBO/TouchX/cyclops/Configuration_adv.h index 5f15b3b3dc..045afa0e93 100644 --- a/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration_adv.h +++ b/config/examples/BIBO/TouchX/cyclops/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 2 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 1 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,30 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ +//#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -405,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -437,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -462,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -719,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -909,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -951,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -978,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1018,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1026,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1597,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1612,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2180,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/BIBO/TouchX/default/Configuration.h b/config/examples/BIBO/TouchX/default/Configuration.h similarity index 95% rename from Marlin/src/config/examples/BIBO/TouchX/default/Configuration.h rename to config/examples/BIBO/TouchX/default/Configuration.h index 98e0a15a20..264f599a07 100644 --- a/Marlin/src/config/examples/BIBO/TouchX/default/Configuration.h +++ b/config/examples/BIBO/TouchX/default/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 60 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 115 +#define BED_MAXTEMP 115 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -545,6 +547,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -814,6 +817,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1012,7 +1026,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1105,7 +1119,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1122,15 +1136,16 @@ */ #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. + #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 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1199,7 +1214,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1226,6 +1241,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1397,10 +1413,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2033,11 +2049,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2062,7 +2078,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/BIBO/TouchX/default/Configuration_adv.h b/config/examples/BIBO/TouchX/default/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/BIBO/TouchX/default/Configuration_adv.h rename to config/examples/BIBO/TouchX/default/Configuration_adv.h index c6005be857..a44d10d454 100644 --- a/Marlin/src/config/examples/BIBO/TouchX/default/Configuration_adv.h +++ b/config/examples/BIBO/TouchX/default/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 2 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/BQ/Hephestos/Configuration.h b/config/examples/BQ/Hephestos/Configuration.h similarity index 96% rename from Marlin/src/config/examples/BQ/Hephestos/Configuration.h rename to config/examples/BQ/Hephestos/Configuration.h index 42468c5f10..a789bf0a38 100644 --- a/Marlin/src/config/examples/BQ/Hephestos/Configuration.h +++ b/config/examples/BQ/Hephestos/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 0 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (Use MINTEMP for thermistor short/failure protection.) #define HEATER_0_MAXTEMP 260 #define HEATER_1_MAXTEMP 260 #define HEATER_2_MAXTEMP 260 #define HEATER_3_MAXTEMP 260 #define HEATER_4_MAXTEMP 260 #define HEATER_5_MAXTEMP 260 -#define BED_MAXTEMP 150 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -533,6 +535,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -802,6 +805,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1000,7 +1014,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1093,7 +1107,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1112,13 +1126,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1187,7 +1202,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1214,6 +1229,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1385,10 +1401,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2021,11 +2037,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2050,7 +2066,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h b/config/examples/BQ/Hephestos/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h rename to config/examples/BQ/Hephestos/Configuration_adv.h index 0a5f8826c6..6012ab6ea4 100644 --- a/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h +++ b/config/examples/BQ/Hephestos/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -720,8 +771,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +962,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1009,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1038,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1079,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1088,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1665,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1680,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2247,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration.h b/config/examples/BQ/Hephestos_2/Configuration.h similarity index 96% rename from Marlin/src/config/examples/BQ/Hephestos_2/Configuration.h rename to config/examples/BQ/Hephestos_2/Configuration.h index 5646f75967..73e7b67f5d 100644 --- a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration.h +++ b/config/examples/BQ/Hephestos_2/Configuration.h @@ -226,10 +226,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -385,6 +385,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 0 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -395,30 +396,30 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (Use MINTEMP for thermistor short/failure protection.) #define HEATER_0_MAXTEMP 230 #define HEATER_1_MAXTEMP 275 #define HEATER_2_MAXTEMP 275 @@ -426,6 +427,7 @@ #define HEATER_4_MAXTEMP 275 #define HEATER_5_MAXTEMP 275 #define BED_MAXTEMP 100 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -546,6 +548,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -815,6 +818,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1013,7 +1027,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1105,7 +1119,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1124,13 +1138,14 @@ #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 185.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 50.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 185 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 50 // (°C) Defaultbed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 5 @@ -1199,7 +1214,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1226,6 +1241,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1397,10 +1413,10 @@ #define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #define NOZZLE_PARK_POINT { (X_MIN_POS + 10), (Y_MAX_POS - 10), 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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2033,11 +2049,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2062,7 +2078,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h b/config/examples/BQ/Hephestos_2/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h rename to config/examples/BQ/Hephestos_2/Configuration_adv.h index fad23e893c..f8e7e99ae8 100644 --- a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h +++ b/config/examples/BQ/Hephestos_2/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #define Z_HOME_BUMP_MM 1 #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X #define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -728,8 +779,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G27" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -918,6 +970,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -960,6 +1017,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -987,13 +1046,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1027,7 +1087,8 @@ //#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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1035,11 +1096,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1606,7 +1673,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1621,8 +1688,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2189,6 +2255,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/BQ/Hephestos_2/README.md b/config/examples/BQ/Hephestos_2/README.md similarity index 100% rename from Marlin/src/config/examples/BQ/Hephestos_2/README.md rename to config/examples/BQ/Hephestos_2/README.md diff --git a/Marlin/src/config/examples/BQ/Hephestos_2/_Bootscreen.h b/config/examples/BQ/Hephestos_2/_Bootscreen.h similarity index 100% rename from Marlin/src/config/examples/BQ/Hephestos_2/_Bootscreen.h rename to config/examples/BQ/Hephestos_2/_Bootscreen.h diff --git a/Marlin/src/config/examples/BQ/WITBOX/Configuration.h b/config/examples/BQ/WITBOX/Configuration.h similarity index 96% rename from Marlin/src/config/examples/BQ/WITBOX/Configuration.h rename to config/examples/BQ/WITBOX/Configuration.h index ef690c5aa9..f061ab5d0d 100644 --- a/Marlin/src/config/examples/BQ/WITBOX/Configuration.h +++ b/config/examples/BQ/WITBOX/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 0 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (Use MINTEMP for thermistor short/failure protection.) #define HEATER_0_MAXTEMP 260 #define HEATER_1_MAXTEMP 260 #define HEATER_2_MAXTEMP 260 #define HEATER_3_MAXTEMP 260 #define HEATER_4_MAXTEMP 260 #define HEATER_5_MAXTEMP 260 -#define BED_MAXTEMP 150 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -533,6 +535,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -802,6 +805,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1000,7 +1014,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1093,7 +1107,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1112,13 +1126,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1187,7 +1202,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1214,6 +1229,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1385,10 +1401,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2021,11 +2037,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2050,7 +2066,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h b/config/examples/BQ/WITBOX/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h rename to config/examples/BQ/WITBOX/Configuration_adv.h index 0a5f8826c6..6012ab6ea4 100644 --- a/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h +++ b/config/examples/BQ/WITBOX/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -720,8 +771,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +962,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1009,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1038,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1079,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1088,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1665,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1680,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2247,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/Cartesio/Configuration.h b/config/examples/Cartesio/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Cartesio/Configuration.h rename to config/examples/Cartesio/Configuration.h index 6ffa782294..ab6f5c25df 100644 --- a/Marlin/src/config/examples/Cartesio/Configuration.h +++ b/config/examples/Cartesio/Configuration.h @@ -219,10 +219,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -378,6 +378,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -388,37 +389,38 @@ //#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 4 // (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. +#define TEMP_RESIDENCY_TIME 4 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 1 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (Use MINTEMP for thermistor short/failure protection.) #define HEATER_0_MAXTEMP 415 #define HEATER_1_MAXTEMP 415 #define HEATER_2_MAXTEMP 415 #define HEATER_3_MAXTEMP 415 #define HEATER_4_MAXTEMP 415 #define HEATER_5_MAXTEMP 415 -#define BED_MAXTEMP 165 +#define BED_MAXTEMP 165 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -544,6 +546,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -813,6 +816,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1011,7 +1025,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1104,7 +1118,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1123,13 +1137,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1198,7 +1213,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1225,6 +1240,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1396,10 +1412,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2032,11 +2048,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2061,7 +2077,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Cartesio/Configuration_adv.h b/config/examples/Cartesio/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Cartesio/Configuration_adv.h rename to config/examples/Cartesio/Configuration_adv.h index 09499f02b4..229402d7eb 100644 --- a/Marlin/src/config/examples/Cartesio/Configuration_adv.h +++ b/config/examples/Cartesio/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X #define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/Cartesio/_Bootscreen.h b/config/examples/Cartesio/_Bootscreen.h similarity index 100% rename from Marlin/src/config/examples/Cartesio/_Bootscreen.h rename to config/examples/Cartesio/_Bootscreen.h diff --git a/Marlin/src/config/examples/Creality/CR-10/Configuration.h b/config/examples/Creality/CR-10/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Creality/CR-10/Configuration.h rename to config/examples/Creality/CR-10/Configuration.h index 4f6916a282..c333a70633 100644 --- a/Marlin/src/config/examples/Creality/CR-10/Configuration.h +++ b/config/examples/Creality/CR-10/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 5 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 120 +#define BED_MAXTEMP 120 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -555,6 +557,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -824,6 +827,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1022,7 +1036,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1115,7 +1129,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1134,13 +1148,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1209,7 +1224,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1236,6 +1251,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1274,7 +1290,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 @@ -1407,10 +1423,10 @@ #define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2043,11 +2059,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2072,7 +2088,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h b/config/examples/Creality/CR-10/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h rename to config/examples/Creality/CR-10/Configuration_adv.h index 620dd7efa0..d077e71e55 100644 --- a/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h +++ b/config/examples/Creality/CR-10/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G27" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ //#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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2184,6 +2253,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/Creality/CR-10/_Bootscreen.h b/config/examples/Creality/CR-10/_Bootscreen.h similarity index 100% rename from Marlin/src/config/examples/Creality/CR-10/_Bootscreen.h rename to config/examples/Creality/CR-10/_Bootscreen.h diff --git a/Marlin/src/config/examples/Creality/CR-10/_Statusscreen.h b/config/examples/Creality/CR-10/_Statusscreen.h similarity index 100% rename from Marlin/src/config/examples/Creality/CR-10/_Statusscreen.h rename to config/examples/Creality/CR-10/_Statusscreen.h diff --git a/Marlin/src/config/examples/Creality/CR-10S/Configuration.h b/config/examples/Creality/CR-10S/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Creality/CR-10S/Configuration.h rename to config/examples/Creality/CR-10S/Configuration.h index 7bd92bcf4b..9ae81bd3a1 100644 --- a/Marlin/src/config/examples/Creality/CR-10S/Configuration.h +++ b/config/examples/Creality/CR-10S/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 5 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (Use MINTEMP for thermistor short/failure protection.) #define HEATER_0_MAXTEMP 250 #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 120 +#define BED_MAXTEMP 120 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -545,6 +547,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -814,6 +817,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1012,7 +1026,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1106,7 +1120,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1125,13 +1139,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1200,7 +1215,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1227,6 +1242,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1265,7 +1281,7 @@ #endif // Homing speeds (mm/m) -#define HOMING_FEEDRATE_XY (50*60) +#define HOMING_FEEDRATE_XY (20*60) #define HOMING_FEEDRATE_Z (8*60) // Validate that endstops are triggered on homing moves @@ -1398,10 +1414,10 @@ #define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #define NOZZLE_PARK_POINT { (X_MIN_POS + 3), (Y_MAX_POS - 3), 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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2034,11 +2050,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2063,7 +2079,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h b/config/examples/Creality/CR-10S/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h rename to config/examples/Creality/CR-10S/Configuration_adv.h index 1e3dd0d679..d4cf96bc04 100644 --- a/Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h +++ b/config/examples/Creality/CR-10S/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G27" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/Creality/CR-10S/_Bootscreen.h b/config/examples/Creality/CR-10S/_Bootscreen.h similarity index 100% rename from Marlin/src/config/examples/Creality/CR-10S/_Bootscreen.h rename to config/examples/Creality/CR-10S/_Bootscreen.h diff --git a/Marlin/src/config/examples/Creality/CR-10S/_Statusscreen.h b/config/examples/Creality/CR-10S/_Statusscreen.h similarity index 100% rename from Marlin/src/config/examples/Creality/CR-10S/_Statusscreen.h rename to config/examples/Creality/CR-10S/_Statusscreen.h diff --git a/Marlin/src/config/examples/Creality/CR-10_5S/Configuration.h b/config/examples/Creality/CR-10_5S/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Creality/CR-10_5S/Configuration.h rename to config/examples/Creality/CR-10_5S/Configuration.h index 72010ea0b7..c2d6db97c1 100644 --- a/Marlin/src/config/examples/Creality/CR-10_5S/Configuration.h +++ b/config/examples/Creality/CR-10_5S/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 5 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (Use MINTEMP for thermistor short/failure protection.) #define HEATER_0_MAXTEMP 265 #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 120 +#define BED_MAXTEMP 120 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -545,6 +547,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -815,6 +818,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1014,7 +1028,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1108,7 +1122,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1127,13 +1141,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1202,7 +1217,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1229,6 +1244,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1267,7 +1283,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 @@ -1400,10 +1416,10 @@ #define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #define NOZZLE_PARK_POINT { (X_MIN_POS + 20), (Y_MAX_POS - 20), 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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2036,11 +2052,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2065,7 +2081,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Creality/CR-10_5S/Configuration_adv.h b/config/examples/Creality/CR-10_5S/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Creality/CR-10_5S/Configuration_adv.h rename to config/examples/Creality/CR-10_5S/Configuration_adv.h index 283675127d..46b41b97df 100644 --- a/Marlin/src/config/examples/Creality/CR-10_5S/Configuration_adv.h +++ b/config/examples/Creality/CR-10_5S/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,28 +404,37 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G27" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/Creality/CR-10_5S/_Bootscreen.h b/config/examples/Creality/CR-10_5S/_Bootscreen.h similarity index 100% rename from Marlin/src/config/examples/Creality/CR-10_5S/_Bootscreen.h rename to config/examples/Creality/CR-10_5S/_Bootscreen.h diff --git a/Marlin/src/config/examples/Creality/CR-10mini/Configuration.h b/config/examples/Creality/CR-10mini/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Creality/CR-10mini/Configuration.h rename to config/examples/Creality/CR-10mini/Configuration.h index e085483008..4ca8ead16a 100644 --- a/Marlin/src/config/examples/Creality/CR-10mini/Configuration.h +++ b/config/examples/Creality/CR-10mini/Configuration.h @@ -227,10 +227,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -386,6 +386,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 5 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -396,37 +397,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 120 +#define BED_MAXTEMP 120 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -564,6 +566,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -833,6 +836,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1031,7 +1045,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1124,7 +1138,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1143,13 +1157,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1218,7 +1233,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1245,6 +1260,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1283,7 +1299,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 @@ -1416,10 +1432,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2052,11 +2068,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2081,7 +2097,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Creality/CR-10mini/Configuration_adv.h b/config/examples/Creality/CR-10mini/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Creality/CR-10mini/Configuration_adv.h rename to config/examples/Creality/CR-10mini/Configuration_adv.h index 30a0c11caa..af4b4164c2 100644 --- a/Marlin/src/config/examples/Creality/CR-10mini/Configuration_adv.h +++ b/config/examples/Creality/CR-10mini/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/Creality/CR-10mini/_Bootscreen.h b/config/examples/Creality/CR-10mini/_Bootscreen.h similarity index 100% rename from Marlin/src/config/examples/Creality/CR-10mini/_Bootscreen.h rename to config/examples/Creality/CR-10mini/_Bootscreen.h diff --git a/Marlin/src/config/examples/Creality/CR-10mini/_Statusscreen.h b/config/examples/Creality/CR-10mini/_Statusscreen.h similarity index 100% rename from Marlin/src/config/examples/Creality/CR-10mini/_Statusscreen.h rename to config/examples/Creality/CR-10mini/_Statusscreen.h diff --git a/Marlin/src/config/examples/Creality/CR-8/Configuration.h b/config/examples/Creality/CR-8/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Creality/CR-8/Configuration.h rename to config/examples/Creality/CR-8/Configuration.h index bbe7d00626..8190e94d4f 100644 --- a/Marlin/src/config/examples/Creality/CR-8/Configuration.h +++ b/config/examples/Creality/CR-8/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -555,6 +557,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -824,6 +827,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1022,7 +1036,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1115,7 +1129,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1134,13 +1148,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1209,7 +1224,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1236,6 +1251,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1274,7 +1290,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 @@ -1407,10 +1423,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2043,11 +2059,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2072,7 +2088,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Creality/CR-8/Configuration_adv.h b/config/examples/Creality/CR-8/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Creality/CR-8/Configuration_adv.h rename to config/examples/Creality/CR-8/Configuration_adv.h index f44cd66ecc..ff49ea25ed 100644 --- a/Marlin/src/config/examples/Creality/CR-8/Configuration_adv.h +++ b/config/examples/Creality/CR-8/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/Creality/Ender-2/Configuration.h b/config/examples/Creality/Ender-2/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Creality/Ender-2/Configuration.h rename to config/examples/Creality/Ender-2/Configuration.h index daf3ffd52d..a376e947b1 100644 --- a/Marlin/src/config/examples/Creality/Ender-2/Configuration.h +++ b/config/examples/Creality/Ender-2/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 75 +#define BED_MAXTEMP 75 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -549,6 +551,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -818,6 +821,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1016,7 +1030,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1109,7 +1123,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1128,13 +1142,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1203,7 +1218,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1230,6 +1245,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1268,7 +1284,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 @@ -1401,10 +1417,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2037,11 +2053,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2066,7 +2082,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Creality/Ender-2/Configuration_adv.h b/config/examples/Creality/Ender-2/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Creality/Ender-2/Configuration_adv.h rename to config/examples/Creality/Ender-2/Configuration_adv.h index 6c80015a79..b635bcd9ad 100644 --- a/Marlin/src/config/examples/Creality/Ender-2/Configuration_adv.h +++ b/config/examples/Creality/Ender-2/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #define Z_HOME_BUMP_MM 1 #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -720,8 +771,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +962,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1009,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1038,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1079,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1088,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1665,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1680,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2247,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/Creality/Ender-2/README.md b/config/examples/Creality/Ender-2/README.md similarity index 100% rename from Marlin/src/config/examples/Creality/Ender-2/README.md rename to config/examples/Creality/Ender-2/README.md diff --git a/Marlin/src/config/examples/Creality/Ender-2/_Bootscreen.h b/config/examples/Creality/Ender-2/_Bootscreen.h similarity index 100% rename from Marlin/src/config/examples/Creality/Ender-2/_Bootscreen.h rename to config/examples/Creality/Ender-2/_Bootscreen.h diff --git a/Marlin/src/config/examples/Creality/Ender-2/_Statusscreen.h b/config/examples/Creality/Ender-2/_Statusscreen.h similarity index 100% rename from Marlin/src/config/examples/Creality/Ender-2/_Statusscreen.h rename to config/examples/Creality/Ender-2/_Statusscreen.h diff --git a/Marlin/src/config/examples/Creality/Ender-3/Configuration.h b/config/examples/Creality/Ender-3/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Creality/Ender-3/Configuration.h rename to config/examples/Creality/Ender-3/Configuration.h index 1c999bb78c..624824af2c 100644 --- a/Marlin/src/config/examples/Creality/Ender-3/Configuration.h +++ b/config/examples/Creality/Ender-3/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 125 +#define BED_MAXTEMP 125 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -549,6 +551,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -818,6 +821,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1016,7 +1030,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1109,7 +1123,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1128,13 +1142,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1203,7 +1218,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1230,6 +1245,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1401,10 +1417,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2037,11 +2053,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2066,7 +2082,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Creality/Ender-3/Configuration_adv.h b/config/examples/Creality/Ender-3/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Creality/Ender-3/Configuration_adv.h rename to config/examples/Creality/Ender-3/Configuration_adv.h index fccb793a41..b728715db1 100644 --- a/Marlin/src/config/examples/Creality/Ender-3/Configuration_adv.h +++ b/config/examples/Creality/Ender-3/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -720,8 +771,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +962,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1009,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1038,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1079,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1088,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1531,7 +1598,7 @@ * Define you own with * { , , hysteresis_start[1..8] } */ - #define CHOPPER_TIMING CHOPPER_DEFAULT_12V + #define CHOPPER_TIMING CHOPPER_DEFAULT_24V /** * Monitor Trinamic drivers for error conditions, @@ -1598,7 +1665,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1680,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2247,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/Creality/Ender-3/README.md b/config/examples/Creality/Ender-3/README.md similarity index 100% rename from Marlin/src/config/examples/Creality/Ender-3/README.md rename to config/examples/Creality/Ender-3/README.md diff --git a/Marlin/src/config/examples/Creality/Ender-3/_Bootscreen.h b/config/examples/Creality/Ender-3/_Bootscreen.h similarity index 100% rename from Marlin/src/config/examples/Creality/Ender-3/_Bootscreen.h rename to config/examples/Creality/Ender-3/_Bootscreen.h diff --git a/Marlin/src/config/examples/Creality/Ender-3/_Statusscreen.h b/config/examples/Creality/Ender-3/_Statusscreen.h similarity index 100% rename from Marlin/src/config/examples/Creality/Ender-3/_Statusscreen.h rename to config/examples/Creality/Ender-3/_Statusscreen.h diff --git a/Marlin/src/config/examples/Creality/Ender-4/Configuration.h b/config/examples/Creality/Ender-4/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Creality/Ender-4/Configuration.h rename to config/examples/Creality/Ender-4/Configuration.h index 88671c5f56..026f090fe4 100644 --- a/Marlin/src/config/examples/Creality/Ender-4/Configuration.h +++ b/config/examples/Creality/Ender-4/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -555,6 +557,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -824,6 +827,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1022,7 +1036,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) #define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1115,7 +1129,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1134,13 +1148,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1209,7 +1224,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1236,6 +1251,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1274,7 +1290,7 @@ #endif // Homing speeds (mm/m) -#define HOMING_FEEDRATE_XY (50*60) +#define HOMING_FEEDRATE_XY (20*60) #define HOMING_FEEDRATE_Z (7*60) // Validate that endstops are triggered on homing moves @@ -1407,10 +1423,10 @@ #define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2043,11 +2059,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2072,7 +2088,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Creality/Ender-4/Configuration_adv.h b/config/examples/Creality/Ender-4/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Creality/Ender-4/Configuration_adv.h rename to config/examples/Creality/Ender-4/Configuration_adv.h index 435e831e6c..4fac0025cf 100644 --- a/Marlin/src/config/examples/Creality/Ender-4/Configuration_adv.h +++ b/config/examples/Creality/Ender-4/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -267,7 +308,7 @@ */ #define CASE_LIGHT_ENABLE #if ENABLED(CASE_LIGHT_ENABLE) - #define CASE_LIGHT_PIN ENDER4_FAN_PIN // Override the default pin if needed + //#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 false // Set default power-up state on #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105 // Set default power-up brightness (0-255, requires PWM pin) @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G27" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/Einstart-S/Configuration.h b/config/examples/Einstart-S/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Einstart-S/Configuration.h rename to config/examples/Einstart-S/Configuration.h index ec8c3476b1..06fff93d7f 100644 --- a/Marlin/src/config/examples/Einstart-S/Configuration.h +++ b/config/examples/Einstart-S/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -379,6 +379,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 0 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -389,37 +390,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -553,6 +555,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -825,6 +828,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1022,7 +1036,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1115,7 +1129,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1134,13 +1148,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1209,7 +1224,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1236,6 +1251,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1407,10 +1423,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2039,11 +2055,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2068,7 +2084,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Einstart-S/Configuration_adv.h b/config/examples/Einstart-S/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Einstart-S/Configuration_adv.h rename to config/examples/Einstart-S/Configuration_adv.h index b007186a09..9db20a5f0e 100644 --- a/Marlin/src/config/examples/Einstart-S/Configuration_adv.h +++ b/config/examples/Einstart-S/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/Einstart-S/readme.md b/config/examples/Einstart-S/readme.md similarity index 100% rename from Marlin/src/config/examples/Einstart-S/readme.md rename to config/examples/Einstart-S/readme.md diff --git a/Marlin/src/config/examples/Felix/Configuration.h b/config/examples/Felix/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Felix/Configuration.h rename to config/examples/Felix/Configuration.h index dbe75566d5..d92bbe974a 100644 --- a/Marlin/src/config/examples/Felix/Configuration.h +++ b/config/examples/Felix/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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 15 // (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. +#define TEMP_RESIDENCY_TIME 15 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -526,6 +528,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -796,6 +799,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -994,7 +1008,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1087,7 +1101,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1106,13 +1120,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1181,7 +1196,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1208,6 +1223,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1379,10 +1395,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2015,11 +2031,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2044,7 +2060,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Felix/Configuration_adv.h b/config/examples/Felix/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Felix/Configuration_adv.h rename to config/examples/Felix/Configuration_adv.h index a694c531db..2465721735 100644 --- a/Marlin/src/config/examples/Felix/Configuration_adv.h +++ b/config/examples/Felix/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #define Z_HOME_BUMP_MM 3 #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/Felix/DUAL/Configuration.h b/config/examples/Felix/DUAL/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Felix/DUAL/Configuration.h rename to config/examples/Felix/DUAL/Configuration.h index d8f77af12b..75f0bfeb2e 100644 --- a/Marlin/src/config/examples/Felix/DUAL/Configuration.h +++ b/config/examples/Felix/DUAL/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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 15 // (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. +#define TEMP_RESIDENCY_TIME 15 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -526,6 +528,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -796,6 +799,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -994,7 +1008,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1087,7 +1101,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1106,13 +1120,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1181,7 +1196,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1208,6 +1223,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1379,10 +1395,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2015,11 +2031,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2044,7 +2060,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Felix/README.md b/config/examples/Felix/README.md similarity index 100% rename from Marlin/src/config/examples/Felix/README.md rename to config/examples/Felix/README.md diff --git a/Marlin/src/config/examples/FlashForge/CreatorPro/Configuration.h b/config/examples/FlashForge/CreatorPro/Configuration.h similarity index 96% rename from Marlin/src/config/examples/FlashForge/CreatorPro/Configuration.h rename to config/examples/FlashForge/CreatorPro/Configuration.h index e47078d9b5..b4167230c6 100644 --- a/Marlin/src/config/examples/FlashForge/CreatorPro/Configuration.h +++ b/config/examples/FlashForge/CreatorPro/Configuration.h @@ -218,7 +218,7 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -535,6 +537,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -806,6 +809,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1005,7 +1019,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1098,7 +1112,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1117,13 +1131,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1192,7 +1207,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1389,10 +1404,10 @@ #define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #define NOZZLE_PARK_POINT { (X_MAX_POS - 2), (Y_MAX_POS - 2), 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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2025,11 +2040,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2054,7 +2069,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/FlashForge/CreatorPro/Configuration_adv.h b/config/examples/FlashForge/CreatorPro/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/FlashForge/CreatorPro/Configuration_adv.h rename to config/examples/FlashForge/CreatorPro/Configuration_adv.h index 9f5c2fa111..19356643d8 100644 --- a/Marlin/src/config/examples/FlashForge/CreatorPro/Configuration_adv.h +++ b/config/examples/FlashForge/CreatorPro/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -719,8 +770,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G27" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -909,6 +961,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -951,6 +1008,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -978,13 +1037,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1018,7 +1078,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1026,11 +1087,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1597,7 +1664,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1612,8 +1679,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2180,6 +2246,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h b/config/examples/FolgerTech/i3-2020/Configuration.h similarity index 96% rename from Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h rename to config/examples/FolgerTech/i3-2020/Configuration.h index 38278a40a0..ad4673f27e 100644 --- a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h +++ b/config/examples/FolgerTech/i3-2020/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (Use MINTEMP for thermistor short/failure protection.) #define HEATER_0_MAXTEMP 245 #define HEATER_1_MAXTEMP 245 #define HEATER_2_MAXTEMP 245 #define HEATER_3_MAXTEMP 245 #define HEATER_4_MAXTEMP 245 #define HEATER_5_MAXTEMP 245 -#define BED_MAXTEMP 115 +#define BED_MAXTEMP 115 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -550,6 +552,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -820,6 +823,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1018,7 +1032,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1111,7 +1125,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1130,13 +1144,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1205,7 +1220,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) #define PROBE_PT_1_X 45 #define PROBE_PT_1_Y 170 #define PROBE_PT_2_X 45 @@ -1232,6 +1247,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1403,10 +1419,10 @@ #define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2039,11 +2055,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2068,7 +2084,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h b/config/examples/FolgerTech/i3-2020/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h rename to config/examples/FolgerTech/i3-2020/Configuration_adv.h index 0c13a992f9..ca6d48764e 100644 --- a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h +++ b/config/examples/FolgerTech/i3-2020/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 2 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G27" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2189,6 +2258,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/Formbot/Raptor/Configuration.h b/config/examples/Formbot/Raptor/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Formbot/Raptor/Configuration.h rename to config/examples/Formbot/Raptor/Configuration.h index 9a4e949439..f3b390b304 100644 --- a/Marlin/src/config/examples/Formbot/Raptor/Configuration.h +++ b/config/examples/Formbot/Raptor/Configuration.h @@ -259,10 +259,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -422,6 +422,7 @@ #define TEMP_SENSOR_BED 1 #endif #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -432,39 +433,40 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 BED_MINTEMP 5 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 BED_MINTEMP 5 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (Use MINTEMP for thermistor short/failure protection.) #define HEATER_0_MAXTEMP 290 #define HEATER_1_MAXTEMP 275 #define HEATER_2_MAXTEMP 275 #define HEATER_3_MAXTEMP 275 #define HEATER_4_MAXTEMP 275 #if ENABLED(BED_AC) - #define BED_MAXTEMP 150 + #define BED_MAXTEMP 150 #else - #define BED_MAXTEMP 100 + #define BED_MAXTEMP 100 #endif +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -597,6 +599,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -897,6 +900,17 @@ #define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1107,7 +1121,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) #define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1207,7 +1221,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1226,13 +1240,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 6 @@ -1304,7 +1319,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) #define PROBE_PT_1_X 50 #define PROBE_PT_1_Y 350 #define PROBE_PT_2_X 50 @@ -1331,6 +1346,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1364,8 +1380,8 @@ #define Z_SAFE_HOMING #if ENABLED(Z_SAFE_HOMING) - #define Z_SAFE_HOMING_X_POINT 50 // X point for Z homing when homing all axis (G28). - #define Z_SAFE_HOMING_Y_POINT 50 // Y point for Z homing when homing all axis (G28). + #define Z_SAFE_HOMING_X_POINT 50 // X point for Z homing when homing all axes (G28). + #define Z_SAFE_HOMING_Y_POINT 50 // Y point for Z homing when homing all axes (G28). #endif // Homing speeds (mm/m) @@ -1502,10 +1518,10 @@ #define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #define NOZZLE_PARK_POINT { 10, 10, 20} - #define NOZZLE_PARK_XY_FEEDRATE 70 // 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) + #define NOZZLE_PARK_XY_FEEDRATE 70 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2138,11 +2154,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2167,7 +2183,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Formbot/Raptor/Configuration_adv.h b/config/examples/Formbot/Raptor/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Formbot/Raptor/Configuration_adv.h rename to config/examples/Formbot/Raptor/Configuration_adv.h index f7e3367061..bf9111e962 100644 --- a/Marlin/src/config/examples/Formbot/Raptor/Configuration_adv.h +++ b/config/examples/Formbot/Raptor/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 2 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G27" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + #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 @@ -981,13 +1043,14 @@ #define LIN_ADVANCE #endif #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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1021,7 +1084,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1029,11 +1093,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1600,7 +1670,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1615,8 +1685,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2185,6 +2254,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/Formbot/Raptor/_Bootscreen.h b/config/examples/Formbot/Raptor/_Bootscreen.h similarity index 100% rename from Marlin/src/config/examples/Formbot/Raptor/_Bootscreen.h rename to config/examples/Formbot/Raptor/_Bootscreen.h diff --git a/Marlin/src/config/examples/Formbot/Raptor/_Statusscreen.h b/config/examples/Formbot/Raptor/_Statusscreen.h similarity index 100% rename from Marlin/src/config/examples/Formbot/Raptor/_Statusscreen.h rename to config/examples/Formbot/Raptor/_Statusscreen.h diff --git a/Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration.h b/config/examples/Formbot/T_Rex_2+/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration.h rename to config/examples/Formbot/T_Rex_2+/Configuration.h index 44a6093a1c..c46748303c 100644 --- a/Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration.h +++ b/config/examples/Formbot/T_Rex_2+/Configuration.h @@ -221,10 +221,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -392,6 +392,7 @@ #endif #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -402,37 +403,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (Use MINTEMP for thermistor short/failure protection.) #define HEATER_0_MAXTEMP 410 #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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -574,6 +576,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -843,6 +846,17 @@ #define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif @@ -1042,7 +1056,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) #define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1135,7 +1149,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1154,13 +1168,14 @@ #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 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. + #define MESH_TEST_HOTEND_TEMP 208 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1234,7 +1249,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) #define PROBE_PT_1_X 35 #define PROBE_PT_1_Y 365 #define PROBE_PT_2_X 35 @@ -1261,6 +1276,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1432,10 +1448,10 @@ #define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #define NOZZLE_PARK_POINT { 50, (Y_MIN_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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2068,11 +2084,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2097,7 +2113,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration_adv.h b/config/examples/Formbot/T_Rex_2+/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration_adv.h rename to config/examples/Formbot/T_Rex_2+/Configuration_adv.h index 244b0ab887..5df0d4f669 100644 --- a/Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration_adv.h +++ b/config/examples/Formbot/T_Rex_2+/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 10 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ #define FAN_MIN_PWM 45 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -367,28 +408,37 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ #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 - // 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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS (X_BED_SIZE) // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 0 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS (442-4.0) // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE @@ -410,6 +460,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -442,8 +493,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -467,8 +518,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -724,8 +778,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G27" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -914,6 +969,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -940,8 +1000,8 @@ */ #define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#define BABYSTEP_WITHOUT_HOMING - //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! + #define BABYSTEP_WITHOUT_HOMING + #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. @@ -949,13 +1009,14 @@ #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. - //#define BABYSTEP_ALWAYS_AVAILABLE // Allow babystepping at all times (not just during movement). + #define BABYSTEP_ALWAYS_AVAILABLE // Allow babystepping at all times (not just during movement). //#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 #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) @@ -984,13 +1045,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL) // Override the mesh area if the automatic (max) area is too large //#define MESH_MIN_X 4 //#define MESH_MIN_Y MESH_INSET @@ -1024,7 +1086,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1032,11 +1095,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1603,7 +1672,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1618,8 +1687,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2196,6 +2264,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/Formbot/T_Rex_2+/_Bootscreen.h b/config/examples/Formbot/T_Rex_2+/_Bootscreen.h similarity index 100% rename from Marlin/src/config/examples/Formbot/T_Rex_2+/_Bootscreen.h rename to config/examples/Formbot/T_Rex_2+/_Bootscreen.h diff --git a/Marlin/src/config/examples/Formbot/T_Rex_2+/_Statusscreen.h b/config/examples/Formbot/T_Rex_2+/_Statusscreen.h similarity index 100% rename from Marlin/src/config/examples/Formbot/T_Rex_2+/_Statusscreen.h rename to config/examples/Formbot/T_Rex_2+/_Statusscreen.h diff --git a/Marlin/src/config/examples/Formbot/T_Rex_3/Configuration.h b/config/examples/Formbot/T_Rex_3/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Formbot/T_Rex_3/Configuration.h rename to config/examples/Formbot/T_Rex_3/Configuration.h index ecff0d5c09..808c6ff664 100644 --- a/Marlin/src/config/examples/Formbot/T_Rex_3/Configuration.h +++ b/config/examples/Formbot/T_Rex_3/Configuration.h @@ -222,10 +222,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -386,6 +386,7 @@ #endif #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -396,37 +397,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (Use MINTEMP for thermistor short/failure protection.) #define HEATER_0_MAXTEMP 410 #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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -554,6 +556,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -830,6 +833,17 @@ #define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1032,7 +1046,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) #define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1130,7 +1144,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1149,13 +1163,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1224,7 +1239,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) #define PROBE_PT_1_X 35 #define PROBE_PT_1_Y 365 #define PROBE_PT_2_X 35 @@ -1251,6 +1266,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1422,10 +1438,10 @@ #define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #define NOZZLE_PARK_POINT { 100, (Y_MIN_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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2061,11 +2077,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2090,7 +2106,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Formbot/T_Rex_3/Configuration_adv.h b/config/examples/Formbot/T_Rex_3/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Formbot/T_Rex_3/Configuration_adv.h rename to config/examples/Formbot/T_Rex_3/Configuration_adv.h index ec9de6e5eb..c16275f9e5 100644 --- a/Marlin/src/config/examples/Formbot/T_Rex_3/Configuration_adv.h +++ b/config/examples/Formbot/T_Rex_3/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 10 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ #define FAN_MIN_PWM 64 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -367,29 +408,37 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ #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 - // 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]) - // Mode 3 (DXC_SCALED_DUPLICATION_MODE) : Not working yet, but support routines in place + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 0 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS (442-4.0) // Set this 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 X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE @@ -411,6 +460,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -443,8 +493,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -468,8 +518,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -725,8 +778,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G27" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -915,6 +969,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -957,6 +1016,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -984,13 +1045,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL) // Override the mesh area if the automatic (max) area is too large //#define MESH_MIN_X 4 //#define MESH_MIN_Y MESH_INSET @@ -1024,7 +1086,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1032,11 +1095,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1603,7 +1672,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1618,8 +1687,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2191,6 +2259,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/Formbot/T_Rex_3/_Bootscreen.h b/config/examples/Formbot/T_Rex_3/_Bootscreen.h similarity index 100% rename from Marlin/src/config/examples/Formbot/T_Rex_3/_Bootscreen.h rename to config/examples/Formbot/T_Rex_3/_Bootscreen.h diff --git a/Marlin/src/config/examples/Formbot/T_Rex_3/_Statusscreen.h b/config/examples/Formbot/T_Rex_3/_Statusscreen.h similarity index 100% rename from Marlin/src/config/examples/Formbot/T_Rex_3/_Statusscreen.h rename to config/examples/Formbot/T_Rex_3/_Statusscreen.h diff --git a/Marlin/src/config/examples/Geeetech/A10M/Configuration.h b/config/examples/Geeetech/A10M/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Geeetech/A10M/Configuration.h rename to config/examples/Geeetech/A10M/Configuration.h index 62fd3c47e7..9c104785d9 100644 --- a/Marlin/src/config/examples/Geeetech/A10M/Configuration.h +++ b/config/examples/Geeetech/A10M/Configuration.h @@ -218,7 +218,7 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -528,6 +530,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -797,6 +800,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -995,7 +1009,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1090,7 +1104,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1109,13 +1123,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 5 @@ -1184,7 +1199,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1211,6 +1226,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1382,10 +1398,10 @@ #define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #define NOZZLE_PARK_POINT { 3, 3, 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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2018,11 +2034,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2047,7 +2063,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Geeetech/A10M/Configuration_adv.h b/config/examples/Geeetech/A10M/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Geeetech/A10M/Configuration_adv.h rename to config/examples/Geeetech/A10M/Configuration_adv.h index 87d5de9058..c8e924e7d2 100644 --- a/Marlin/src/config/examples/Geeetech/A10M/Configuration_adv.h +++ b/config/examples/Geeetech/A10M/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G27" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/Geeetech/A20M/Configuration.h b/config/examples/Geeetech/A20M/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Geeetech/A20M/Configuration.h rename to config/examples/Geeetech/A20M/Configuration.h index dff1888ffc..e47c25d89d 100644 --- a/Marlin/src/config/examples/Geeetech/A20M/Configuration.h +++ b/config/examples/Geeetech/A20M/Configuration.h @@ -218,7 +218,7 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -528,6 +530,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -797,6 +800,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -995,7 +1009,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1090,7 +1104,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1109,13 +1123,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1184,7 +1199,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1211,6 +1226,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1382,10 +1398,10 @@ #define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #define NOZZLE_PARK_POINT { 3, 3, 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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2022,11 +2038,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2051,7 +2067,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Geeetech/A20M/Configuration_adv.h b/config/examples/Geeetech/A20M/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Geeetech/A20M/Configuration_adv.h rename to config/examples/Geeetech/A20M/Configuration_adv.h index 6dbf4dfdef..83c8f19a50 100644 --- a/Marlin/src/config/examples/Geeetech/A20M/Configuration_adv.h +++ b/config/examples/Geeetech/A20M/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G27" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/Geeetech/GT2560/Configuration.h b/config/examples/Geeetech/GT2560/Configuration.h similarity index 95% rename from Marlin/src/config/examples/Geeetech/GT2560/Configuration.h rename to config/examples/Geeetech/GT2560/Configuration.h index c2af0f4dc5..783b617a6d 100644 --- a/Marlin/src/config/examples/Geeetech/GT2560/Configuration.h +++ b/config/examples/Geeetech/GT2560/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -560,6 +562,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -829,6 +832,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1027,7 +1041,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1120,7 +1134,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1139,13 +1153,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1214,7 +1229,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1241,6 +1256,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1412,10 +1428,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2048,11 +2064,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2077,7 +2093,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif @@ -2106,7 +2122,7 @@ /** * Customize common displays for GT2560 */ -#if ENABLED(ULTIMAKERCONTROLLER) || ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) || ENABLED(G3D_PANEL) || ENABLED(MKS_MINI_12864) +#if ANY(ULTIMAKERCONTROLLER, REPRAP_DISCOUNT_SMART_CONTROLLER, G3D_PANEL, MKS_MINI_12864) #define SDSUPPORT // Force SD Card support on for these displays #elif DISABLED(LIGHTWEIGHT_UI) #define LCD_WIDTH 20 // Default is 22. For this Geeetech use 20. diff --git a/Marlin/src/config/examples/Geeetech/I3_Pro_X-GT2560/Configuration.h b/config/examples/Geeetech/I3_Pro_X-GT2560/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Geeetech/I3_Pro_X-GT2560/Configuration.h rename to config/examples/Geeetech/I3_Pro_X-GT2560/Configuration.h index b8603b484a..64b764fdd3 100644 --- a/Marlin/src/config/examples/Geeetech/I3_Pro_X-GT2560/Configuration.h +++ b/config/examples/Geeetech/I3_Pro_X-GT2560/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -545,6 +547,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -1012,7 +1015,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1105,7 +1108,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1124,13 +1127,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1199,7 +1203,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1226,6 +1230,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1397,10 +1402,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2033,11 +2038,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2062,7 +2067,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Geeetech/MeCreator2/Configuration.h b/config/examples/Geeetech/MeCreator2/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Geeetech/MeCreator2/Configuration.h rename to config/examples/Geeetech/MeCreator2/Configuration.h index 5c9672169c..037b92a9bf 100644 --- a/Marlin/src/config/examples/Geeetech/MeCreator2/Configuration.h +++ b/config/examples/Geeetech/MeCreator2/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -552,6 +554,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -821,6 +824,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1019,7 +1033,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1112,7 +1126,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1131,13 +1145,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1206,7 +1221,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1233,6 +1248,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1404,10 +1420,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2040,11 +2056,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2069,7 +2085,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Geeetech/MeCreator2/Configuration_adv.h b/config/examples/Geeetech/MeCreator2/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Geeetech/MeCreator2/Configuration_adv.h rename to config/examples/Geeetech/MeCreator2/Configuration_adv.h index 0fd4dfd99f..75e2d4d95e 100644 --- a/Marlin/src/config/examples/Geeetech/MeCreator2/Configuration_adv.h +++ b/config/examples/Geeetech/MeCreator2/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,7 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) @@ -986,7 +1047,7 @@ // @section leveling -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_UBL) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1020,7 +1081,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1028,11 +1090,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1599,7 +1667,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1614,8 +1682,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2167,6 +2234,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro B/README.md b/config/examples/Geeetech/Prusa i3 Pro B/README.md similarity index 100% rename from Marlin/src/config/examples/Geeetech/Prusa i3 Pro B/README.md rename to config/examples/Geeetech/Prusa i3 Pro B/README.md diff --git a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro B/bltouch/Configuration.h b/config/examples/Geeetech/Prusa i3 Pro B/bltouch/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Geeetech/Prusa i3 Pro B/bltouch/Configuration.h rename to config/examples/Geeetech/Prusa i3 Pro B/bltouch/Configuration.h index 6bbc024352..b867638f66 100644 --- a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro B/bltouch/Configuration.h +++ b/config/examples/Geeetech/Prusa i3 Pro B/bltouch/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 125 +#define BED_MAXTEMP 125 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -560,6 +562,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -830,6 +833,17 @@ #define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1028,7 +1042,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1121,7 +1135,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1140,13 +1154,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 4 @@ -1215,7 +1230,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1242,6 +1257,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1413,10 +1429,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2049,11 +2065,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2078,7 +2094,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro B/noprobe/Configuration.h b/config/examples/Geeetech/Prusa i3 Pro B/noprobe/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Geeetech/Prusa i3 Pro B/noprobe/Configuration.h rename to config/examples/Geeetech/Prusa i3 Pro B/noprobe/Configuration.h index 60546e7831..cdafe15c8b 100644 --- a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro B/noprobe/Configuration.h +++ b/config/examples/Geeetech/Prusa i3 Pro B/noprobe/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 125 +#define BED_MAXTEMP 125 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -560,6 +562,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -829,6 +832,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1027,7 +1041,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1120,7 +1134,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1139,13 +1153,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 4 @@ -1214,7 +1229,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1241,6 +1256,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1412,10 +1428,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2048,11 +2064,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2077,7 +2093,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration.h b/config/examples/Geeetech/Prusa i3 Pro C/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration.h rename to config/examples/Geeetech/Prusa i3 Pro C/Configuration.h index 68a3b79906..6804590559 100644 --- a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration.h +++ b/config/examples/Geeetech/Prusa i3 Pro C/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -545,6 +547,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -814,6 +817,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1012,7 +1026,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1105,7 +1119,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1124,13 +1138,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1199,7 +1214,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1226,6 +1241,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1397,10 +1413,10 @@ #define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2033,11 +2049,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2062,7 +2078,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration_adv.h b/config/examples/Geeetech/Prusa i3 Pro C/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration_adv.h rename to config/examples/Geeetech/Prusa i3 Pro C/Configuration_adv.h index f75f6d0d3e..7c72150634 100644 --- a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration_adv.h +++ b/config/examples/Geeetech/Prusa i3 Pro C/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G27" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ #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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration.h b/config/examples/Geeetech/Prusa i3 Pro W/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration.h rename to config/examples/Geeetech/Prusa i3 Pro W/Configuration.h index 81dab2a589..0b97b4762e 100644 --- a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration.h +++ b/config/examples/Geeetech/Prusa i3 Pro W/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -545,6 +547,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -814,6 +817,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1012,7 +1026,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1105,7 +1119,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1124,13 +1138,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1199,7 +1214,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1226,6 +1241,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1397,10 +1413,10 @@ #define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2033,11 +2049,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2062,7 +2078,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration_adv.h b/config/examples/Geeetech/Prusa i3 Pro W/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration_adv.h rename to config/examples/Geeetech/Prusa i3 Pro W/Configuration_adv.h index f75f6d0d3e..7c72150634 100644 --- a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration_adv.h +++ b/config/examples/Geeetech/Prusa i3 Pro W/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G27" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ #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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h b/config/examples/Infitary/i3-M508/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Infitary/i3-M508/Configuration.h rename to config/examples/Infitary/i3-M508/Configuration.h index 21d379e593..8c88ff7bb1 100644 --- a/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h +++ b/config/examples/Infitary/i3-M508/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 125 +#define BED_MAXTEMP 125 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -549,6 +551,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -818,6 +821,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1016,7 +1030,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1109,7 +1123,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1128,13 +1142,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1203,7 +1218,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1230,6 +1245,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1401,10 +1417,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2037,11 +2053,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2066,7 +2082,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h b/config/examples/Infitary/i3-M508/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h rename to config/examples/Infitary/i3-M508/Configuration_adv.h index 6a241349d7..db288373c4 100644 --- a/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h +++ b/config/examples/Infitary/i3-M508/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #define Z_HOME_BUMP_MM 1 #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/JGAurora/A5/Configuration.h b/config/examples/JGAurora/A5/Configuration.h similarity index 95% rename from Marlin/src/config/examples/JGAurora/A5/Configuration.h rename to config/examples/JGAurora/A5/Configuration.h index 7d79c61e00..73aa202eb8 100644 --- a/Marlin/src/config/examples/JGAurora/A5/Configuration.h +++ b/config/examples/JGAurora/A5/Configuration.h @@ -223,10 +223,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -382,6 +382,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 // measured to be satisfactorily accurate on center of bed within +/- 1 degC. #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -392,37 +393,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (Use MINTEMP for thermistor short/failure protection.) #define HEATER_0_MAXTEMP 265 #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 120 +#define BED_MAXTEMP 120 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -557,6 +559,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -826,6 +829,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1024,7 +1038,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1117,7 +1131,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1134,15 +1148,16 @@ */ #define G26_MESH_VALIDATION // Enable 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. + #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 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Defaultbed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 5 @@ -1211,7 +1226,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1238,6 +1253,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1409,10 +1425,10 @@ #define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2045,11 +2061,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2074,7 +2090,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h b/config/examples/JGAurora/A5/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h rename to config/examples/JGAurora/A5/Configuration_adv.h index 3dcb30e54d..73e9ef0c5e 100644 --- a/Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h +++ b/config/examples/JGAurora/A5/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #define Z_HOME_BUMP_MM 2 #define HOMING_BUMP_DIVISOR { 10, 10, 6 } // Re-Bump Speed Divisor (Divides the Homing Feedrate) #define QUICK_HOME // If homing includes X and Y, do a diagonal move initially +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -720,8 +771,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G27" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +962,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1009,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1038,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1079,8 @@ //#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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1088,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1665,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1680,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2247,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/JGAurora/A5/README.md b/config/examples/JGAurora/A5/README.md similarity index 100% rename from Marlin/src/config/examples/JGAurora/A5/README.md rename to config/examples/JGAurora/A5/README.md diff --git a/Marlin/src/config/examples/MakerParts/Configuration.h b/config/examples/MakerParts/Configuration.h similarity index 96% rename from Marlin/src/config/examples/MakerParts/Configuration.h rename to config/examples/MakerParts/Configuration.h index 59ee1387ba..977abf4589 100644 --- a/Marlin/src/config/examples/MakerParts/Configuration.h +++ b/config/examples/MakerParts/Configuration.h @@ -238,10 +238,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -397,6 +397,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -407,37 +408,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -565,6 +567,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -834,6 +837,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1032,7 +1046,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1125,7 +1139,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1144,13 +1158,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1219,7 +1234,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1246,6 +1261,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1417,10 +1433,10 @@ #define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2053,11 +2069,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2082,7 +2098,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/MakerParts/Configuration_adv.h b/config/examples/MakerParts/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/MakerParts/Configuration_adv.h rename to config/examples/MakerParts/Configuration_adv.h index 7e14bcbaab..3279351806 100644 --- a/Marlin/src/config/examples/MakerParts/Configuration_adv.h +++ b/config/examples/MakerParts/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G27" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/MakerParts/_Bootscreen.h b/config/examples/MakerParts/_Bootscreen.h similarity index 100% rename from Marlin/src/config/examples/MakerParts/_Bootscreen.h rename to config/examples/MakerParts/_Bootscreen.h diff --git a/Marlin/src/config/examples/Malyan/M150/Configuration.h b/config/examples/Malyan/M150/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Malyan/M150/Configuration.h rename to config/examples/Malyan/M150/Configuration.h index 267d446fd0..9545203b4b 100644 --- a/Marlin/src/config/examples/Malyan/M150/Configuration.h +++ b/config/examples/Malyan/M150/Configuration.h @@ -223,10 +223,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -385,6 +385,7 @@ // The reasons are inconclusive so I leave at 1 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -395,37 +396,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -553,6 +555,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -834,6 +837,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1036,7 +1050,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1133,7 +1147,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1152,13 +1166,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1227,7 +1242,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) #define PROBE_PT_1_X 50 #define PROBE_PT_1_Y 150 #define PROBE_PT_2_X 50 @@ -1254,6 +1269,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1425,10 +1441,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2061,11 +2077,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2090,7 +2106,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h b/config/examples/Malyan/M150/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Malyan/M150/Configuration_adv.h rename to config/examples/Malyan/M150/Configuration_adv.h index 1308bac15d..0217a05aea 100644 --- a/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h +++ b/config/examples/Malyan/M150/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/Malyan/M150/README.md b/config/examples/Malyan/M150/README.md similarity index 97% rename from Marlin/src/config/examples/Malyan/M150/README.md rename to config/examples/Malyan/M150/README.md index 44c308de22..3a5026a4bd 100644 --- a/Marlin/src/config/examples/Malyan/M150/README.md +++ b/config/examples/Malyan/M150/README.md @@ -39,7 +39,7 @@ Config without automatic bed level sensor, or in other words, "as stock" 1. Configure Marlin * Copy `_Bootscreen.h`, `Configuration.h`, and `Configuration_adv.h` - from `Marlin/config/examples/Malyan/M150` to `Marlin` + from `config/examples/Malyan/M150` to `Marlin` (overwrite files) * Read `Configuration.h` and make any necessary changes diff --git a/Marlin/src/config/examples/Malyan/M150/_Bootscreen.h b/config/examples/Malyan/M150/_Bootscreen.h similarity index 100% rename from Marlin/src/config/examples/Malyan/M150/_Bootscreen.h rename to config/examples/Malyan/M150/_Bootscreen.h diff --git a/Marlin/src/config/examples/Malyan/M200/Configuration.h b/config/examples/Malyan/M200/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Malyan/M200/Configuration.h rename to config/examples/Malyan/M200/Configuration.h index 739c3a3c29..61b26dc035 100644 --- a/Marlin/src/config/examples/Malyan/M200/Configuration.h +++ b/config/examples/Malyan/M200/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 11 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (Use MINTEMP for thermistor short/failure protection.) #define HEATER_0_MAXTEMP 250 #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 100 +#define BED_MAXTEMP 100 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -544,6 +546,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -813,6 +816,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1011,7 +1025,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1104,7 +1118,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1123,13 +1137,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1198,7 +1213,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1225,6 +1240,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1396,10 +1412,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2032,11 +2048,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2061,7 +2077,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h b/config/examples/Malyan/M200/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Malyan/M200/Configuration_adv.h rename to config/examples/Malyan/M200/Configuration_adv.h index 9db8a18dfc..9b34e6f875 100644 --- a/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h +++ b/config/examples/Malyan/M200/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ //#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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/Micromake/C1/README.md b/config/examples/Micromake/C1/README.md similarity index 100% rename from Marlin/src/config/examples/Micromake/C1/README.md rename to config/examples/Micromake/C1/README.md diff --git a/Marlin/src/config/examples/Micromake/C1/basic/Configuration.h b/config/examples/Micromake/C1/basic/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Micromake/C1/basic/Configuration.h rename to config/examples/Micromake/C1/basic/Configuration.h index 6240d4cfa8..bdea2bacab 100644 --- a/Marlin/src/config/examples/Micromake/C1/basic/Configuration.h +++ b/config/examples/Micromake/C1/basic/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 0 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -545,6 +547,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -818,6 +821,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1016,7 +1030,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1109,7 +1123,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1128,13 +1142,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1203,7 +1218,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1230,6 +1245,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1401,10 +1417,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2037,11 +2053,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2066,7 +2082,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration.h b/config/examples/Micromake/C1/enhanced/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Micromake/C1/enhanced/Configuration.h rename to config/examples/Micromake/C1/enhanced/Configuration.h index 14524d8e11..38c215eb3f 100644 --- a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration.h +++ b/config/examples/Micromake/C1/enhanced/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 0 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -545,6 +547,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -818,6 +821,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1016,7 +1030,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1109,7 +1123,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1128,13 +1142,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1203,7 +1218,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1230,6 +1245,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1401,10 +1417,10 @@ #define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2037,11 +2053,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2066,7 +2082,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h b/config/examples/Micromake/C1/enhanced/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h rename to config/examples/Micromake/C1/enhanced/Configuration_adv.h index 70720edef0..e5a7f28f4c 100644 --- a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h +++ b/config/examples/Micromake/C1/enhanced/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G27" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/Mks/Robin/Configuration.h b/config/examples/Mks/Robin/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Mks/Robin/Configuration.h rename to config/examples/Mks/Robin/Configuration.h index 198fbef4ef..e04a6d9f20 100644 --- a/Marlin/src/config/examples/Mks/Robin/Configuration.h +++ b/config/examples/Mks/Robin/Configuration.h @@ -219,7 +219,7 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder @@ -378,6 +378,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -388,37 +389,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -546,6 +548,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -815,6 +818,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1013,7 +1027,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1106,7 +1120,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1125,13 +1139,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1200,7 +1215,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1227,6 +1242,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1398,10 +1414,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2035,11 +2051,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2064,7 +2080,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Mks/Robin/Configuration_adv.h b/config/examples/Mks/Robin/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Mks/Robin/Configuration_adv.h rename to config/examples/Mks/Robin/Configuration_adv.h index 28bf573528..f607e7bf6b 100644 --- a/Marlin/src/config/examples/Mks/Robin/Configuration_adv.h +++ b/config/examples/Mks/Robin/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,7 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) @@ -980,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1020,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1028,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1599,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1614,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2182,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/Mks/Sbase/000-README_RepRap_Discount_Full_Graphic_Smart_Controller.txt b/config/examples/Mks/Sbase/000-README_RepRap_Discount_Full_Graphic_Smart_Controller.txt similarity index 100% rename from Marlin/src/config/examples/Mks/Sbase/000-README_RepRap_Discount_Full_Graphic_Smart_Controller.txt rename to config/examples/Mks/Sbase/000-README_RepRap_Discount_Full_Graphic_Smart_Controller.txt diff --git a/Marlin/src/config/examples/Mks/Sbase/Configuration.h b/config/examples/Mks/Sbase/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Mks/Sbase/Configuration.h rename to config/examples/Mks/Sbase/Configuration.h index c72911b256..4a0eb1a03c 100644 --- a/Marlin/src/config/examples/Mks/Sbase/Configuration.h +++ b/config/examples/Mks/Sbase/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 5 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -545,6 +547,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -814,6 +817,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1012,7 +1026,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1105,7 +1119,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1124,13 +1138,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1199,7 +1214,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1226,6 +1241,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1397,10 +1413,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2033,11 +2049,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2062,7 +2078,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h b/config/examples/Mks/Sbase/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h rename to config/examples/Mks/Sbase/Configuration_adv.h index 915f954c3a..6d2f5b19d3 100644 --- a/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h +++ b/config/examples/Mks/Sbase/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 6 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -721,8 +775,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -877,13 +932,6 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE - - // VIKI2 and miniVIKI require DOGLCD_SCK and DOGLCD_MOSI to be defined. - #if ENABLED(VIKI2) || ENABLED(miniVIKI) - #define DOGLCD_SCK SCK_PIN - #define DOGLCD_MOSI MOSI_PIN - #endif - /** * ST7920-based LCDs can emulate a 16 x 4 character display using * the ST7920 character-generator for very fast screen updates. @@ -918,6 +966,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -960,6 +1013,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -987,13 +1042,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1027,7 +1083,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1035,11 +1092,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1606,7 +1669,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1621,8 +1684,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2189,6 +2251,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/Printrbot/PrintrboardG2/Configuration.h b/config/examples/Printrbot/PrintrboardG2/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Printrbot/PrintrboardG2/Configuration.h rename to config/examples/Printrbot/PrintrboardG2/Configuration.h index 5a3c4270cd..35cf0546ba 100644 --- a/Marlin/src/config/examples/Printrbot/PrintrboardG2/Configuration.h +++ b/config/examples/Printrbot/PrintrboardG2/Configuration.h @@ -219,7 +219,7 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder @@ -378,6 +378,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -388,37 +389,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -546,6 +548,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -822,6 +825,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1020,7 +1034,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1113,7 +1127,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1132,13 +1146,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1207,7 +1222,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1234,6 +1249,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1405,10 +1421,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2041,11 +2057,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2070,7 +2086,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/RapideLite/RL200/Configuration.h b/config/examples/RapideLite/RL200/Configuration.h similarity index 96% rename from Marlin/src/config/examples/RapideLite/RL200/Configuration.h rename to config/examples/RapideLite/RL200/Configuration.h index 2b02d2e165..45e76ec6d0 100644 --- a/Marlin/src/config/examples/RapideLite/RL200/Configuration.h +++ b/config/examples/RapideLite/RL200/Configuration.h @@ -218,7 +218,7 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (Use MINTEMP for thermistor short/failure protection.) #define HEATER_0_MAXTEMP 250 #define HEATER_1_MAXTEMP 250 #define HEATER_2_MAXTEMP 250 #define HEATER_3_MAXTEMP 250 #define HEATER_4_MAXTEMP 250 #define HEATER_5_MAXTEMP 250 -#define BED_MAXTEMP 120 +#define BED_MAXTEMP 120 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -545,6 +547,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -814,6 +817,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1012,7 +1026,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1105,7 +1119,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1124,13 +1138,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1199,7 +1214,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1226,6 +1241,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1397,10 +1413,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2033,11 +2049,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2062,7 +2078,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/RapideLite/RL200/Configuration_adv.h b/config/examples/RapideLite/RL200/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/RapideLite/RL200/Configuration_adv.h rename to config/examples/RapideLite/RL200/Configuration_adv.h index b8678f4c2a..5be48b10eb 100644 --- a/Marlin/src/config/examples/RapideLite/RL200/Configuration_adv.h +++ b/config/examples/RapideLite/RL200/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,7 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) @@ -980,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1020,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1028,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1599,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1614,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2182,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/RepRapPro/Huxley/Configuration.h b/config/examples/RepRapPro/Huxley/Configuration.h similarity index 96% rename from Marlin/src/config/examples/RepRapPro/Huxley/Configuration.h rename to config/examples/RepRapPro/Huxley/Configuration.h index 6bc563c6de..94115924c5 100644 --- a/Marlin/src/config/examples/RepRapPro/Huxley/Configuration.h +++ b/config/examples/RepRapPro/Huxley/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 // Sanguinololu v1.3 with 4.7kOhm pullup #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -545,6 +547,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -854,6 +857,17 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1061,7 +1075,7 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1154,7 +1168,7 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1173,13 +1187,14 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1248,7 +1263,7 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1275,6 +1290,7 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1446,10 +1462,10 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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 DEFAULT_MAX_Z_FEEDRATE // Z axis feedrate in mm/s (not used for delta printers) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE DEFAULT_MAX_Z_FEEDRATE // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2082,11 +2098,11 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley //#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 +#if EITHER(RGB_LED, 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 @@ -2111,7 +2127,7 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/RepRapWorld/Megatronics/Configuration.h b/config/examples/RepRapWorld/Megatronics/Configuration.h similarity index 96% rename from Marlin/src/config/examples/RepRapWorld/Megatronics/Configuration.h rename to config/examples/RepRapWorld/Megatronics/Configuration.h index 7a0bd07bd3..337af65f29 100644 --- a/Marlin/src/config/examples/RepRapWorld/Megatronics/Configuration.h +++ b/config/examples/RepRapWorld/Megatronics/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -545,6 +547,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -814,6 +817,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1012,7 +1026,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1105,7 +1119,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1124,13 +1138,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1199,7 +1214,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1226,6 +1241,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1397,10 +1413,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2033,11 +2049,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2062,7 +2078,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/RigidBot/Configuration.h b/config/examples/RigidBot/Configuration.h similarity index 96% rename from Marlin/src/config/examples/RigidBot/Configuration.h rename to config/examples/RigidBot/Configuration.h index 79b162abc2..128caea0c8 100644 --- a/Marlin/src/config/examples/RigidBot/Configuration.h +++ b/config/examples/RigidBot/Configuration.h @@ -221,10 +221,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -380,6 +380,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -390,37 +391,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -541,6 +543,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -812,6 +815,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1010,7 +1024,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1103,7 +1117,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1122,13 +1136,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1197,7 +1212,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1224,6 +1239,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1395,10 +1411,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2033,11 +2049,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2062,7 +2078,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/RigidBot/Configuration_adv.h b/config/examples/RigidBot/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/RigidBot/Configuration_adv.h rename to config/examples/RigidBot/Configuration_adv.h index f095f32063..0327e9d861 100644 --- a/Marlin/src/config/examples/RigidBot/Configuration_adv.h +++ b/config/examples/RigidBot/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/SCARA/Configuration.h b/config/examples/SCARA/Configuration.h similarity index 96% rename from Marlin/src/config/examples/SCARA/Configuration.h rename to config/examples/SCARA/Configuration.h index b3b2fc2c89..2bc87d19f7 100644 --- a/Marlin/src/config/examples/SCARA/Configuration.h +++ b/config/examples/SCARA/Configuration.h @@ -70,7 +70,7 @@ #define MORGAN_SCARA //#define MAKERARM_SCARA -#if ENABLED(MORGAN_SCARA) || ENABLED(MAKERARM_SCARA) +#if EITHER(MORGAN_SCARA, MAKERARM_SCARA) //#define DEBUG_SCARA_KINEMATICS #define SCARA_FEEDRATE_SCALING // Convert XY feedrate from mm/s to degrees/s on the fly @@ -249,10 +249,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -408,6 +408,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -418,37 +419,38 @@ //#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 3 // (seconds) -#define TEMP_HYSTERESIS 2 // (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. +#define TEMP_RESIDENCY_TIME 3 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_HYSTERESIS 2 // (°C) Temperature proximity considered "close enough" to the target +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer -// 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. +#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -558,6 +560,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -827,6 +830,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1025,7 +1039,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1118,7 +1132,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1137,13 +1151,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1212,7 +1227,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1239,6 +1254,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1410,10 +1426,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2046,11 +2062,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2075,7 +2091,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/SCARA/Configuration_adv.h b/config/examples/SCARA/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/SCARA/Configuration_adv.h rename to config/examples/SCARA/Configuration_adv.h index 8ed7481da2..33834da7df 100644 --- a/Marlin/src/config/examples/SCARA/Configuration_adv.h +++ b/config/examples/SCARA/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #define Z_HOME_BUMP_MM 3 #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -720,8 +771,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + //#define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +962,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1009,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1038,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1079,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1088,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1665,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1680,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2247,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/config/examples/STM32/Black_STM32F407VET6/Configuration.h b/config/examples/STM32/Black_STM32F407VET6/Configuration.h new file mode 100644 index 0000000000..3463e2baf0 --- /dev/null +++ b/config/examples/STM32/Black_STM32F407VET6/Configuration.h @@ -0,0 +1,2108 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +/** + * 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_BLACK_STM32F407VE +#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 2 + +// 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 + +/** + * Prusa Multi-Material Unit v2 + * + * Requires NOZZLE_PARK_FEATURE to park print head in case MMU unit fails. + * Requires EXTRUDERS = 5 + * + * For additional configuration see Configuration_adv.h + */ +//#define PRUSA_MMU2 + +// 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 (or both) of the nozzles +//#define SWITCHING_NOZZLE +#if ENABLED(SWITCHING_NOZZLE) + #define SWITCHING_NOZZLE_SERVO_NR 0 + //#define SWITCHING_NOZZLE_E1_SERVO_NR 1 // If two servos are used, the index of the second + #define SWITCHING_NOZZLE_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 (single servo) or lowered/raised (dual servo) +#endif + +/** + * Two separate X-carriages with extruders that connect to a moving part + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. + */ +//#define PARKING_EXTRUDER + +/** + * Two separate X-carriages with extruders that connect to a moving part + * via a magnetic docking mechanism using movements and no solenoid + * + * project : https://www.thingiverse.com/thing:3080893 + * movements : https://youtu.be/0xCEiG9VS3k + * https://youtu.be/Bqbcs0CU2FE + */ +//#define MAGNETIC_PARKING_EXTRUDER + +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) + + #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders + #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 + + #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 // (ms) Delay for magnetic field. No delay if 0 or not defined. + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 + + #elif ENABLED(MAGNETIC_PARKING_EXTRUDER) + + #define MPE_FAST_SPEED 9000 // (mm/m) Speed for travel before last distance point + #define MPE_SLOW_SPEED 4500 // (mm/m) Speed for last distance travel to park and couple + #define MPE_TRAVEL_DISTANCE 10 // (mm) Last distance point + #define MPE_COMPENSATION 0 // Offset Compensation -1 , 0 , 1 (multiplier) only for coupling + + #endif + +#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 + //#define GRADIENT_MIX // Support for gradient mixing with M166 and LCD + #if ENABLED(GRADIENT_MIX) + //#define GRADIENT_VTOOL // Add M166 T to use a V-tool index as a Gradient alias + #endif +#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 + * 61 : 100k Formbot / Vivedino 3950 350C thermistor 4.7k pullup + * 66 : 4.7M High Temperature thermistor from Dyze Design + * 67 : 450C thermistor from SliceEngineering + * 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", '61':"100k Formbot / Vivedino 3950 350C thermistor 4.7k pullup", '66':"Dyze Design 4.7M High Temperature thermistor", '67':"Slice Engineering 450C 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 1 +#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 1 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system + +// 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 + +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target + +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target + +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target + +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define CHAMBER_MAXTEMP 100 + +//=========================================================================== +//============================= 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_EDIT_MENU // Add PID editing to the "Advanced Settings" menu. (~700 bytes of PROGMEM) + //#define PID_AUTOTUNE_MENU // Add PID auto-tuning to the "Advanced Settings" menu. (~250 bytes of PROGMEM) + //#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 +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + +//=========================================================================== +//============================= 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, + * TMC2160, TMC2160_STANDALONE, TMC5130, TMC5130_STANDALONE, + * TMC5160, TMC5160_STANDALONE + * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2160', 'TMC2160_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE', 'TMC5160', 'TMC5160_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, 4000, 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 + +// +// 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 + +/** + * 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. + */ +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 10.0 + #define DEFAULT_YJERK 10.0 + #define DEFAULT_ZJERK 0.3 +#endif + +#define DEFAULT_EJERK 5.0 // May be used by Linear Advance + +/** + * 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_PIN + * + * Define this pin if the probe is not connected to Z_MIN_PIN. + * If not defined the default pin for the selected MOTHERBOARD + * will be used. Most of the time the default is what you want. + * + * - 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. + * + */ +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default + +/** + * 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 + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif +#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 EITHER(MIN_SOFTWARE_ENDSTOPS, 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. + + // Set one or more commands to execute on filament runout. + // (After 'M412 H' Marlin will ask the host to handle the process.) + #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 ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. + #endif + +#endif + +#if EITHER(AUTO_BED_LEVELING_LINEAR, 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 EITHER(AUTO_BED_LEVELING_3POINT, 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_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points + //#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_raise } + #define NOZZLE_PARK_POINT { (X_MIN_POS + 10), (Y_MAX_POS - 10), 20 } + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (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 + +// +// 3-wire SR LCD with strobe using 74HC4094 +// https://github.com/mikeshub/SailfishLCD +// Uses the code directly from Sailfish +// +//#define FF_INTERFACEBOARD + +//============================================================================= +//======================= 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 + +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + +//============================================================================= +//============================ 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 + +// 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 + +// Support for PCA9533 PWM LED driver +// https://github.com/mikeshub/SailfishRGB_LED +//#define PCA9533 + +/** + * 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 EITHER(RGB_LED, 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 ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, 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 2 // 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, 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/config/examples/STM32/Black_STM32F407VET6/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/ArmEd/Configuration_adv.h rename to config/examples/STM32/Black_STM32F407VET6/Configuration_adv.h index 2d7b9b6ddd..4a184d2430 100644 --- a/Marlin/src/config/examples/ArmEd/Configuration_adv.h +++ b/config/examples/STM32/Black_STM32F407VET6/Configuration_adv.h @@ -39,10 +39,6 @@ //=============================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 @@ -82,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -116,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -231,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -245,8 +282,8 @@ * 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 E0_AUTO_FAN_PIN FAN1_PIN +#define E1_AUTO_FAN_PIN FAN2_PIN #define E2_AUTO_FAN_PIN -1 #define E3_AUTO_FAN_PIN -1 #define E4_AUTO_FAN_PIN -1 @@ -367,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -410,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -442,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -724,8 +771,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -914,6 +962,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -956,7 +1009,6 @@ #endif #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 @@ -984,13 +1036,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1024,7 +1077,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1032,11 +1086,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1603,7 +1663,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1618,8 +1678,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2186,6 +2245,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/STM32F10/Configuration.h b/config/examples/STM32/STM32F10/Configuration.h similarity index 96% rename from Marlin/src/config/examples/STM32F10/Configuration.h rename to config/examples/STM32/STM32F10/Configuration.h index deaf828b36..4e616636ee 100644 --- a/Marlin/src/config/examples/STM32F10/Configuration.h +++ b/config/examples/STM32/STM32F10/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -378,6 +378,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 998 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 60 @@ -388,37 +389,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -547,6 +549,7 @@ #warning "disabled temperature protection" //#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders //#define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -816,6 +819,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1014,7 +1028,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1107,7 +1121,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1126,13 +1140,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1201,7 +1216,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1228,6 +1243,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1399,10 +1415,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2035,11 +2051,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2064,7 +2080,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/STM32F4/Configuration.h b/config/examples/STM32/STM32F4/Configuration.h similarity index 96% rename from Marlin/src/config/examples/STM32F4/Configuration.h rename to config/examples/STM32/STM32F4/Configuration.h index 412e81df25..77dea2ebb0 100644 --- a/Marlin/src/config/examples/STM32F4/Configuration.h +++ b/config/examples/STM32/STM32F4/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 0 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -545,6 +547,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -814,6 +817,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1012,7 +1026,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1105,7 +1119,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1124,13 +1138,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1199,7 +1214,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1226,6 +1241,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1397,10 +1413,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2033,11 +2049,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2062,7 +2078,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/stm32f103ret6/Configuration.h b/config/examples/STM32/stm32f103ret6/Configuration.h similarity index 96% rename from Marlin/src/config/examples/stm32f103ret6/Configuration.h rename to config/examples/STM32/stm32f103ret6/Configuration.h index afa9b63d04..3a2f443481 100644 --- a/Marlin/src/config/examples/stm32f103ret6/Configuration.h +++ b/config/examples/STM32/stm32f103ret6/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -378,6 +378,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 998 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 60 @@ -388,37 +389,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -547,6 +549,7 @@ #warning "disabled temperature protection" //#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders //#define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -816,6 +819,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1014,7 +1028,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1107,7 +1121,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1126,13 +1140,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1201,7 +1216,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1228,6 +1243,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1399,10 +1415,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2035,11 +2051,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2064,7 +2080,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Sanguinololu/Configuration.h b/config/examples/Sanguinololu/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Sanguinololu/Configuration.h rename to config/examples/Sanguinololu/Configuration.h index 6c3ec1e297..3a07899a4d 100644 --- a/Marlin/src/config/examples/Sanguinololu/Configuration.h +++ b/config/examples/Sanguinololu/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -545,6 +547,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -845,6 +848,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1043,7 +1057,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1136,7 +1150,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1155,13 +1169,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1230,7 +1245,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1257,6 +1272,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1428,10 +1444,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2064,7 +2080,7 @@ #define RGB_LED //#define RGBW_LED -#if ENABLED(RGB_LED) || ENABLED(RGBW_LED) +#if EITHER(RGB_LED, RGBW_LED) #define RGB_LED_R_PIN 11 #define RGB_LED_G_PIN 10 #define RGB_LED_B_PIN 17 @@ -2093,7 +2109,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h b/config/examples/Sanguinololu/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Sanguinololu/Configuration_adv.h rename to config/examples/Sanguinololu/Configuration_adv.h index 6e79599b9e..a4031046dd 100644 --- a/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h +++ b/config/examples/Sanguinololu/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/TheBorg/Configuration.h b/config/examples/TheBorg/Configuration.h similarity index 96% rename from Marlin/src/config/examples/TheBorg/Configuration.h rename to config/examples/TheBorg/Configuration.h index 6de8c04eb2..8ab9461c92 100644 --- a/Marlin/src/config/examples/TheBorg/Configuration.h +++ b/config/examples/TheBorg/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 5 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -545,6 +547,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -814,6 +817,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1012,7 +1026,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1105,7 +1119,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1124,13 +1138,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1199,7 +1214,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1226,6 +1241,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1397,10 +1413,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2033,11 +2049,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2062,7 +2078,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/TheBorg/Configuration_adv.h b/config/examples/TheBorg/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/TheBorg/Configuration_adv.h rename to config/examples/TheBorg/Configuration_adv.h index 1cb1367c84..7e8cfb4056 100644 --- a/Marlin/src/config/examples/TheBorg/Configuration_adv.h +++ b/config/examples/TheBorg/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 6 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/TinyBoy2/Configuration.h b/config/examples/TinyBoy2/Configuration.h similarity index 96% rename from Marlin/src/config/examples/TinyBoy2/Configuration.h rename to config/examples/TinyBoy2/Configuration.h index 480af111ea..d33391b3d4 100644 --- a/Marlin/src/config/examples/TinyBoy2/Configuration.h +++ b/config/examples/TinyBoy2/Configuration.h @@ -240,10 +240,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -404,6 +404,7 @@ #define TEMP_SENSOR_BED 0 #endif #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -414,37 +415,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (Use MINTEMP for thermistor short/failure protection.) #define HEATER_0_MAXTEMP 250 #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 100 +#define BED_MAXTEMP 100 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -595,6 +597,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -865,6 +868,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1068,7 +1082,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1161,7 +1175,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1180,13 +1194,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1255,7 +1270,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1282,6 +1297,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1453,10 +1469,10 @@ #define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2089,11 +2105,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2118,7 +2134,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h b/config/examples/TinyBoy2/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/TinyBoy2/Configuration_adv.h rename to config/examples/TinyBoy2/Configuration_adv.h index 39c26d6d5a..3531c3a47d 100644 --- a/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h +++ b/config/examples/TinyBoy2/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G27" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/Tronxy/X1/Configuration.h b/config/examples/Tronxy/X1/Configuration.h similarity index 95% rename from Marlin/src/config/examples/Tronxy/X1/Configuration.h rename to config/examples/Tronxy/X1/Configuration.h index 2922606690..ec04bb09b2 100644 --- a/Marlin/src/config/examples/Tronxy/X1/Configuration.h +++ b/config/examples/Tronxy/X1/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 0 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (Use MINTEMP for thermistor short/failure protection.) #define HEATER_0_MAXTEMP 260 #define HEATER_1_MAXTEMP 260 #define HEATER_2_MAXTEMP 260 #define HEATER_3_MAXTEMP 260 #define HEATER_4_MAXTEMP 260 #define HEATER_5_MAXTEMP 260 -#define BED_MAXTEMP 150 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -545,6 +547,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -814,6 +817,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1012,7 +1026,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1105,7 +1119,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1122,15 +1136,16 @@ */ #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. + #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 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1199,7 +1214,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1226,6 +1241,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1397,10 +1413,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2033,11 +2049,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2062,7 +2078,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Tronxy/X3A/Configuration.h b/config/examples/Tronxy/X3A/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Tronxy/X3A/Configuration.h rename to config/examples/Tronxy/X3A/Configuration.h index 58ad9582ad..36f03f710f 100644 --- a/Marlin/src/config/examples/Tronxy/X3A/Configuration.h +++ b/config/examples/Tronxy/X3A/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 501 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 130 +#define BED_MAXTEMP 130 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -545,6 +547,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -814,6 +817,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1016,7 +1030,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1109,7 +1123,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1128,13 +1142,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1203,7 +1218,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1230,6 +1245,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1401,10 +1417,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2037,11 +2053,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2066,7 +2082,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Tronxy/X3A/Configuration_adv.h b/config/examples/Tronxy/X3A/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Tronxy/X3A/Configuration_adv.h rename to config/examples/Tronxy/X3A/Configuration_adv.h index b7a7acf5fd..fb6e859e94 100644 --- a/Marlin/src/config/examples/Tronxy/X3A/Configuration_adv.h +++ b/config/examples/Tronxy/X3A/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/config/examples/Tronxy/X5S-2E/Configuration.h b/config/examples/Tronxy/X5S-2E/Configuration.h new file mode 100644 index 0000000000..28f3b646b3 --- /dev/null +++ b/config/examples/Tronxy/X5S-2E/Configuration.h @@ -0,0 +1,2129 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +/** + * 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 "(Anthony Rich, OEM stock 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 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_TRONXY_V3_1_0 +#endif + +// Optional custom name for your RepStrap or other custom machine +// Displayed in the LCD "Ready" message +#define CUSTOM_MACHINE_NAME "Tronxy X5S-2E" + +// 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 2 + +// Generally expected filament diameter (1.75, 2.85, 3.0, ...). Used for Volumetric, Filament Width Sensor, etc. +#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75 + +// Tronxy X5S-2E: +// The OEM stock model uses an E3D Cyclops clone hotend (2 in 1 out, color mixing) for 1.75mm filament. +// 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 + +/** + * Prusa Multi-Material Unit v2 + * + * Requires NOZZLE_PARK_FEATURE to park print head in case MMU unit fails. + * Requires EXTRUDERS = 5 + * + * For additional configuration see Configuration_adv.h + */ +//#define PRUSA_MMU2 + +// 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 (or both) of the nozzles +//#define SWITCHING_NOZZLE +#if ENABLED(SWITCHING_NOZZLE) + #define SWITCHING_NOZZLE_SERVO_NR 0 + //#define SWITCHING_NOZZLE_E1_SERVO_NR 1 // If two servos are used, the index of the second + #define SWITCHING_NOZZLE_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 (single servo) or lowered/raised (dual servo) +#endif + +/** + * Two separate X-carriages with extruders that connect to a moving part + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. + */ +//#define PARKING_EXTRUDER + +/** + * Two separate X-carriages with extruders that connect to a moving part + * via a magnetic docking mechanism using movements and no solenoid + * + * project : https://www.thingiverse.com/thing:3080893 + * movements : https://youtu.be/0xCEiG9VS3k + * https://youtu.be/Bqbcs0CU2FE + */ +//#define MAGNETIC_PARKING_EXTRUDER + +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) + + #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders + #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 + + #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 // (ms) Delay for magnetic field. No delay if 0 or not defined. + //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 + + #elif ENABLED(MAGNETIC_PARKING_EXTRUDER) + + #define MPE_FAST_SPEED 9000 // (mm/m) Speed for travel before last distance point + #define MPE_SLOW_SPEED 4500 // (mm/m) Speed for last distance travel to park and couple + #define MPE_TRAVEL_DISTANCE 10 // (mm) Last distance point + #define MPE_COMPENSATION 0 // Offset Compensation -1 , 0 , 1 (multiplier) only for coupling + + #endif + +#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 + //#define GRADIENT_MIX // Support for gradient mixing with M166 and LCD + #if ENABLED(GRADIENT_MIX) + //#define GRADIENT_VTOOL // Add M166 T to use a V-tool index as a Gradient alias + #endif +#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 + * 61 : 100k Formbot / Vivedino 3950 350C thermistor 4.7k pullup + * 66 : 4.7M High Temperature thermistor from Dyze Design + * 67 : 450C thermistor from SliceEngineering + * 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", '61':"100k Formbot / Vivedino 3950 350C thermistor 4.7k pullup", '66':"Dyze Design 4.7M High Temperature thermistor", '67':"Slice Engineering 450C 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 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system + +// 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 + +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target + +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target + +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target + +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (Use MINTEMP for thermistor short/failure protection.) +// Tronxy X5S-2E: +// WARNING: Never exceed 260C. The OEM stock model uses low temperature heat breaks with PTFE-lining. +#define HEATER_0_MAXTEMP 260 +#define HEATER_1_MAXTEMP 260 +#define HEATER_2_MAXTEMP 260 +#define HEATER_3_MAXTEMP 260 +#define HEATER_4_MAXTEMP 260 +#define HEATER_5_MAXTEMP 260 +// Tronxy X5S-2E: +// The OEM stock model uses a clone MK3a 300 @ 12V with no insulation and can reach a maximum 70C at 25C ambient. +#define BED_MAXTEMP 81 +#define CHAMBER_MAXTEMP 100 + +//=========================================================================== +//============================= 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_EDIT_MENU // Add PID editing to the "Advanced Settings" menu. (~700 bytes of PROGMEM) + //#define PID_AUTOTUNE_MENU // Add PID auto-tuning to the "Advanced Settings" menu. (~250 bytes of PROGMEM) + //#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 + + // Tronxy X5S-2E: + // The OEM stock model uses an E3D Cyclops clone hotend (2 in 1 out, color mixing) and a long 12V/40W heater catridge. + // Tested with command(s): "M301 P50 I5 D100" and "M303 C10 E0 S210" + #define DEFAULT_Kp 26.19 + #define DEFAULT_Ki 2.41 + #define DEFAULT_Kd 71.28 + +#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 + + // Tronxy X5S-2E: + // The OEM stock model uses a clone MK3a 300 @ 12V with no insulation and can reach a maximum 70C at 25C ambient. + // Tested with commands: "M304 P100 I20 D500" and "M303 C10 E-1 S65" + #define DEFAULT_bedKp 379.43 + #define DEFAULT_bedKi 72.37 + #define DEFAULT_bedKd 497.33 + +#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 +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + +//=========================================================================== +//============================= 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 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, + * TMC2160, TMC2160_STANDALONE, TMC5130, TMC5130_STANDALONE, + * TMC5160, TMC5160_STANDALONE + * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2160', 'TMC2160_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE', 'TMC5160', 'TMC5160_STANDALONE'] + */ +// Tronxy X5S-2E: +// The OEM stock model uses HEROIC HR4982MTE982 stepper drivers which are similar to A4988 except that they only have 2 step divider pins instead of three. +//#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, 94 } + +/** + * 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 { 1000, 1000, 100, 1000 } + +/** + * 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 + +// +// 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 + +/** + * 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. + */ +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 20.0 + #define DEFAULT_YJERK 20.0 + #define DEFAULT_ZJERK 0.4 +#endif + +#define DEFAULT_EJERK 5.0 // May be used by Linear Advance + +/** + * 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_PIN + * + * Define this pin if the probe is not connected to Z_MIN_PIN. + * If not defined the default pin for the selected MOTHERBOARD + * will be used. Most of the time the default is what you want. + * + * - 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. + * + */ +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default + +/** + * 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 + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif +#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 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 330 +#define Y_BED_SIZE 330 + +// 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 400 + +/** + * 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 EITHER(MIN_SOFTWARE_ENDSTOPS, 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. + + // Set one or more commands to execute on filament runout. + // (After 'M412 H' Marlin will ask the host to handle the process.) + #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 ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. + #endif + +#endif + +#if EITHER(AUTO_BED_LEVELING_LINEAR, 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 EITHER(AUTO_BED_LEVELING_3POINT, 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_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points + //#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 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 230 +#define PREHEAT_2_TEMP_BED 70 +#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 P2 + +#if ENABLED(NOZZLE_PARK_FEATURE) + // Specify a park position as { X, Y, Z_raise } + #define NOZZLE_PARK_POINT { (X_MIN_POS + 10), (Y_MAX_POS - 10), 20 } + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (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 + +// +// 3-wire SR LCD with strobe using 74HC4094 +// https://github.com/mikeshub/SailfishLCD +// Uses the code directly from Sailfish +// +//#define FF_INTERFACEBOARD + +//============================================================================= +//======================= 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 + +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + +//============================================================================= +//============================ 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 + +// 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 + +// Support for PCA9533 PWM LED driver +// https://github.com/mikeshub/SailfishRGB_LED +//#define PCA9533 + +/** + * 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 EITHER(RGB_LED, 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 ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, 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 2 // 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, 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/config/examples/Tronxy/X5S-2E/Configuration_adv.h b/config/examples/Tronxy/X5S-2E/Configuration_adv.h new file mode 100644 index 0000000000..7bb2d8eb71 --- /dev/null +++ b/config/examples/Tronxy/X5S-2E/Configuration_adv.h @@ -0,0 +1,2332 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +/** + * 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 + + //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) + //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 + #endif + + /** + * 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 30 // 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 + +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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 + +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + +// @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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. + */ +//#define DUAL_X_CARRIAGE +#if ENABLED(DUAL_X_CARRIAGE) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. + + // 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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing + +// 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} + +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION + +// 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 EITHER(ULTIPANEL, EXTENSIBLE_UI) + #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) + #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) + +// +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. +// +//#define BACKLASH_COMPENSATION +#if ENABLED(BACKLASH_COMPENSATION) + // Define values for backlash distance and correction. + // If BACKLASH_GCODE is enabled these values are the defaults. + #define BACKLASH_DISTANCE_MM { 0, 0, 0 } // (mm) + #define BACKLASH_CORRECTION 0.0 // 0.0 = no correction; 1.0 = full correction + + // Set BACKLASH_SMOOTHING_MM to spread backlash correction over multiple segments + // to reduce print artifacts. (Enabling this is costly in memory and computation!) + //#define BACKLASH_SMOOTHING_MM 3 // (mm) + + // Add runtime configuration and tuning of backlash values (M425) + //#define BACKLASH_GCODE + + #if ENABLED(BACKLASH_GCODE) + // Measure the Z backlash when probing (G29) and set with "M425 Z" + #define MEASURE_BACKLASH_WHEN_PROBING + + #if ENABLED(MEASURE_BACKLASH_WHEN_PROBING) + // When measuring, the probe will move up to BACKLASH_MEASUREMENT_LIMIT + // mm away from point of contact in BACKLASH_MEASUREMENT_RESOLUTION + // increments while checking for the contact to be broken. + #define BACKLASH_MEASUREMENT_LIMIT 0.5 // (mm) + #define BACKLASH_MEASUREMENT_RESOLUTION 0.005 // (mm) + #define BACKLASH_MEASUREMENT_FEEDRATE Z_PROBE_SPEED_SLOW // (mm/m) + #endif + #endif +#endif + +/** + * Automatic backlash, position and hotend offset calibration + * + * Enable G425 to run automatic calibration using an electrically- + * conductive cube, bolt, or washer mounted on the bed. + * + * G425 uses the probe to touch the top and sides of the calibration object + * on the bed and measures and/or correct positional offsets, axis backlash + * and hotend offsets. + * + * Note: HOTEND_OFFSET and CALIBRATION_OBJECT_CENTER must be set to within + * ±5mm of true values for G425 to succeed. + */ +//#define CALIBRATION_GCODE +#if ENABLED(CALIBRATION_GCODE) + + #define CALIBRATION_MEASUREMENT_RESOLUTION 0.01 // mm + + #define CALIBRATION_FEEDRATE_SLOW 60 // mm/m + #define CALIBRATION_FEEDRATE_FAST 1200 // mm/m + #define CALIBRATION_FEEDRATE_TRAVEL 3000 // mm/m + + // The following parameters refer to the conical section of the nozzle tip. + #define CALIBRATION_NOZZLE_TIP_HEIGHT 1.0 // mm + #define CALIBRATION_NOZZLE_OUTER_DIAMETER 2.0 // mm + + // Uncomment to enable reporting (required for "G425 V", but consumes PROGMEM). + //#define CALIBRATION_REPORTING + + // The true location and dimension the cube/bolt/washer on the bed. + #define CALIBRATION_OBJECT_CENTER { 264.0, -22.0, -2.0} // mm + #define CALIBRATION_OBJECT_DIMENSIONS { 10.0, 10.0, 10.0} // mm + + // Comment out any sides which are unreachable by the probe. For best + // auto-calibration results, all sides must be reachable. + #define CALIBRATION_MEASURE_RIGHT + #define CALIBRATION_MEASURE_FRONT + #define CALIBRATION_MEASURE_LEFT + #define CALIBRATION_MEASURE_BACK + + // Probing at the exact top center only works if the center is flat. If + // probing on a screwhead or hollow washer, probe near the edges. + //#define CALIBRATION_MEASURE_AT_TOP_EDGES + + // Define pin which is read during calibration + #ifndef CALIBRATION_PIN + #define CALIBRATION_PIN -1 // Override in pins.h or set to -1 to use your Z endstop + #define CALIBRATION_PIN_INVERTING false // set to true to invert the pin + //#define CALIBRATION_PIN_PULLDOWN + #define CALIBRATION_PIN_PULLUP + #endif +#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 + +// Play a beep when the feedrate is changed from the Status Screen +//#define BEEP_ON_FEEDRATE_CHANGE +#if ENABLED(BEEP_ON_FEEDRATE_CHANGE) + #define FEEDRATE_CHANGE_BEEP_DURATION 10 + #define FEEDRATE_CHANGE_BEEP_FREQUENCY 440 +#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 + +/** + * 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 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 + + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G27" // G-code to run on Stop Print (e.g., "G28XY" or "G27") + + /** + * 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 BINARY_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 + + /** + * 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. + */ + #if ENABLED(U8GLIB_ST7920) + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + + /** + * Status (Info) Screen customizations + * These options may affect code size and screen render time. + * Custom status screens can forcibly override these settings. + */ + //#define STATUS_COMBINE_HEATERS // Use combined heater images instead of separate ones + //#define STATUS_HOTEND_NUMBERLESS // Use plain hotend icons instead of numbered ones (with 2+ hotends) + #define STATUS_HOTEND_INVERTED // Show solid nozzle bitmaps when heating (Requires STATUS_HOTEND_ANIM) + #define STATUS_HOTEND_ANIM // Use a second bitmap to indicate hotend heating + #define STATUS_BED_ANIM // Use a second bitmap to indicate bed heating + //#define STATUS_ALT_BED_BITMAP // Use the alternative bed bitmap + //#define STATUS_ALT_FAN_BITMAP // Use the alternative fan bitmap + //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames + //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + +#endif // HAS_GRAPHICAL_LCD + +// @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_WITHOUT_HOMING + //#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. + //#define BABYSTEP_ALWAYS_AVAILABLE // Allow babystepping at all times (not just during movement). + //#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 + #endif + + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + + //#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 EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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 EITHER(MESH_BED_LEVELING, 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" + +#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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ +//#define G38_PROBE_TARGET +#if ENABLED(G38_PROBE_TARGET) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a 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 + +// Printrun may have trouble receiving long strings all at once. +// This option inserts short delays between lines of serial output. +#define SERIAL_OVERRUN_PROTECTION + +// @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_EXTRA_PRIME 2 // (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. + #define ADVANCED_PAUSE_RESUME_PRIME 0 // (mm) Extra distance to prime nozzle after returning from park. + + // 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) + + #if AXIS_DRIVER_TYPE_X(TMC26X) + #define X_MAX_CURRENT 1000 // (mA) + #define X_SENSE_RESISTOR 91 // (mOhms) + #define X_MICROSTEPS 16 // Number of microsteps + #endif + + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_E5(TMC26X) + #define E5_MAX_CURRENT 1000 + #define E5_SENSE_RESISTOR 91 + #define E5_MICROSTEPS 16 + #endif + +#endif // TMC26X + +// @section tmc_smart + +/** + * To use TMC2130, TMC2160, TMC2660, TMC5130, TMC5160 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. + * + * 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. + * + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper + */ +#if HAS_TRINAMIC + + #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current + #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 + + #if AXIS_IS_TMC(X) + #define X_CURRENT 800 // (mA) RMS current. Multiply by 1.414 for peak current. + #define X_MICROSTEPS 16 // 0..256 + #define X_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(E1) + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + #define E1_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(E2) + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + #define E2_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif + + /** + * Override default SPI pins for TMC2130, TMC2160, TMC2660, TMC5130 and TMC5160 drivers here. + * The default pins can be found in your board's pins file. + */ + //#define X_CS_PIN -1 + //#define Y_CS_PIN -1 + //#define Z_CS_PIN -1 + //#define X2_CS_PIN -1 + //#define Y2_CS_PIN -1 + //#define Z2_CS_PIN -1 + //#define Z3_CS_PIN -1 + //#define E0_CS_PIN -1 + //#define E1_CS_PIN -1 + //#define E2_CS_PIN -1 + //#define E3_CS_PIN -1 + //#define E4_CS_PIN -1 + //#define E5_CS_PIN -1 + + /** + * Use software SPI for TMC2130. + * Software option for SPI driven drivers (TMC2130, TMC2160, TMC2660, TMC5130 and TMC5160). + * 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 + + /** + * Software enable + * + * Use for drivers that do not use a dedicated enable pin, but rather handle the same + * function through a communication line such as SPI or UART. + */ + //#define SOFTWARE_DRIVER_ENABLE + + /** + * TMC2130, TMC2160, TMC2208, TMC5130 and TMC5160 only + * Use Trinamic's ultra quiet stepping mode. + * When disabled, Marlin will use spreadCycle stepping mode. + */ + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E + + /** + * Optimize spreadCycle chopper parameters by using predefined parameter sets + * or with the help of an example included in the library. + * Provided parameter sets are + * CHOPPER_DEFAULT_12V + * CHOPPER_DEFAULT_19V + * CHOPPER_DEFAULT_24V + * CHOPPER_DEFAULT_36V + * CHOPPER_PRUSAMK3_24V // Imported parameters from the official Prusa firmware for MK3 (24V) + * CHOPPER_MARLIN_119 // Old defaults from Marlin v1.1.9 + * + * Define you own with + * { , , hysteresis_start[1..8] } + */ + #define CHOPPER_TIMING CHOPPER_DEFAULT_12V + + /** + * Monitor Trinamic 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 - 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 + + /** + * TMC2130, TMC2160, TMC2208, TMC5130 and TMC5160 only + * 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_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. + * 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 + + /** + * TMC2130, TMC2160, TMC2660, TMC5130, and TMC5160 only + * 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 EITHER(SENSORLESS_HOMING, 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 + + /** + * 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/TMCStepper + * + * Example: + * #define TMC_ADV() { \ + * stepperX.diag0_temp_prewarn(1); \ + * stepperY.interpolate(0); \ + * } + */ + #define TMC_ADV() { } + +#endif // HAS_TRINAMIC + +// @section L6470 + +/** + * L6470 Stepper Driver options + * + * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver. + * https://github.com/ameyer/Arduino-L6470 + * + * Requires the following to be defined in your pins_YOUR_BOARD file + * L6470_CHAIN_SCK_PIN + * L6470_CHAIN_MISO_PIN + * L6470_CHAIN_MOSI_PIN + * L6470_CHAIN_SS_PIN + * L6470_RESET_CHAIN_PIN (optional) + */ +#if HAS_DRIVER(L6470) + + //#define L6470_CHITCHAT // Display additional status info + + #if AXIS_DRIVER_TYPE_X(L6470) + #define X_MICROSTEPS 128 // Number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128) + #define X_OVERCURRENT 2000 // (mA) Current where the driver detects an over current (VALID: 375 x (1 - 16) - 6A max - rounds down) + #define X_STALLCURRENT 1500 // (mA) Current where the driver detects a stall (VALID: 31.25 * (1-128) - 4A max - rounds down) + #define X_MAX_VOLTAGE 127 // 0-255, Maximum effective voltage seen by stepper + #define X_CHAIN_POS 0 // Position in SPI chain, 0=Not in chain, 1=Nearest MOSI + #endif + + #if AXIS_DRIVER_TYPE_X2(L6470) + #define X2_MICROSTEPS 128 + #define X2_OVERCURRENT 2000 + #define X2_STALLCURRENT 1500 + #define X2_MAX_VOLTAGE 127 + #define X2_CHAIN_POS 0 + #endif + + #if AXIS_DRIVER_TYPE_Y(L6470) + #define Y_MICROSTEPS 128 + #define Y_OVERCURRENT 2000 + #define Y_STALLCURRENT 1500 + #define Y_MAX_VOLTAGE 127 + #define Y_CHAIN_POS 0 + #endif + + #if AXIS_DRIVER_TYPE_Y2(L6470) + #define Y2_MICROSTEPS 128 + #define Y2_OVERCURRENT 2000 + #define Y2_STALLCURRENT 1500 + #define Y2_MAX_VOLTAGE 127 + #define Y2_CHAIN_POS 0 + #endif + + #if AXIS_DRIVER_TYPE_Z(L6470) + #define Z_MICROSTEPS 128 + #define Z_OVERCURRENT 2000 + #define Z_STALLCURRENT 1500 + #define Z_MAX_VOLTAGE 127 + #define Z_CHAIN_POS 0 + #endif + + #if AXIS_DRIVER_TYPE_Z2(L6470) + #define Z2_MICROSTEPS 128 + #define Z2_OVERCURRENT 2000 + #define Z2_STALLCURRENT 1500 + #define Z2_MAX_VOLTAGE 127 + #define Z2_CHAIN_POS 0 + #endif + + #if AXIS_DRIVER_TYPE_Z3(L6470) + #define Z3_MICROSTEPS 128 + #define Z3_OVERCURRENT 2000 + #define Z3_STALLCURRENT 1500 + #define Z3_MAX_VOLTAGE 127 + #define Z3_CHAIN_POS 0 + #endif + + #if AXIS_DRIVER_TYPE_E0(L6470) + #define E0_MICROSTEPS 128 + #define E0_OVERCURRENT 2000 + #define E0_STALLCURRENT 1500 + #define E0_MAX_VOLTAGE 127 + #define E0_CHAIN_POS 0 + #endif + + #if AXIS_DRIVER_TYPE_E1(L6470) + #define E1_MICROSTEPS 128 + #define E1_OVERCURRENT 2000 + #define E1_STALLCURRENT 1500 + #define E1_MAX_VOLTAGE 127 + #define E1_CHAIN_POS 0 + #endif + + #if AXIS_DRIVER_TYPE_E2(L6470) + #define E2_MICROSTEPS 128 + #define E2_OVERCURRENT 2000 + #define E2_STALLCURRENT 1500 + #define E2_MAX_VOLTAGE 127 + #define E2_CHAIN_POS 0 + #endif + + #if AXIS_DRIVER_TYPE_E3(L6470) + #define E3_MICROSTEPS 128 + #define E3_OVERCURRENT 2000 + #define E3_STALLCURRENT 1500 + #define E3_MAX_VOLTAGE 127 + #define E3_CHAIN_POS 0 + #endif + + #if AXIS_DRIVER_TYPE_E4(L6470) + #define E4_MICROSTEPS 128 + #define E4_OVERCURRENT 2000 + #define E4_STALLCURRENT 1500 + #define E4_MAX_VOLTAGE 127 + #define E4_CHAIN_POS 0 + #endif + + #if AXIS_DRIVER_TYPE_E5(L6470) + #define E5_MICROSTEPS 128 + #define E5_OVERCURRENT 2000 + #define E5_STALLCURRENT 1500 + #define E5_MAX_VOLTAGE 127 + #define E5_CHAIN_POS 0 + #endif + + /** + * Monitor L6470 drivers for error conditions like over temperature and over current. + * In the case of over temperature Marlin can decrease the drive until the error condition clears. + * Other detected conditions can be used to stop the current print. + * Relevant g-codes: + * M906 - I1/2/3/4/5 Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given. + * I not present or I0 or I1 - X, Y, Z or E0 + * I2 - X2, Y2, Z2 or E1 + * I3 - Z3 or E3 + * I4 - E4 + * I5 - E5 + * M916 - Increase drive level until get thermal warning + * M917 - Find minimum current thresholds + * M918 - Increase speed until max or error + * M122 S0/1 - Report driver parameters + */ + //#define MONITOR_L6470_DRIVER_STATUS + + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif + +#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 + +/** + * Photo G-code + * Add the M240 G-code to take a photo. + * The photo can be triggered by a digital pin or a physical movement. + */ +//#define PHOTO_GCODE +#if ENABLED(PHOTO_GCODE) + // A position to move to (and raise Z) before taking the photo + //#define PHOTO_POSITION { X_MAX_POS - 5, Y_MAX_POS, 0 } // { xpos, ypos, zraise } (M240 X Y Z) + //#define PHOTO_DELAY_MS 100 // (ms) Duration to pause before moving back (M240 P) + //#define PHOTO_RETRACT_MM 6.5 // (mm) E retract/recover for the photo move (M240 R S) + + // Canon RC-1 or homebrew digital camera trigger + // Data from: http://www.doc-diy.net/photo/rc-1_hacked/ + //#define PHOTOGRAPH_PIN 23 + + // Canon Hack Development Kit + // http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + //#define CHDK_PIN 4 + + // Optional second move with delay to trigger the camera shutter + //#define PHOTO_SWITCH_POSITION { X_MAX_POS, Y_MAX_POS } // { xpos, ypos } (M240 I J) + + // Duration to hold the switch or keep CHDK_PIN high + //#define PHOTO_SWITCH_MS 50 // (ms) (M240 D) +#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 + +/** + * 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 + +/** + * Host Action Commands + * + * Define host streamer action commands in compliance with the standard. + * + * See https://reprap.org/wiki/G-code#Action_commands + * Common commands ........ poweroff, pause, paused, resume, resumed, cancel + * G29_RETRY_AND_RECOVER .. probe_rewipe, probe_failed + * + * Some features add reason codes to extend these commands. + * + * Host Prompt Support enables Marlin to use the host for user prompts so + * filament runout and other processes can be managed from the host side. + */ +//#define HOST_ACTION_COMMANDS +#if ENABLED(HOST_ACTION_COMMANDS) + //#define HOST_PROMPT_SUPPORT +#endif + +//=========================================================================== +//====================== 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/ + * + * Reliabuild 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" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates +#endif + +/** + * Prusa Multi-Material Unit v2 + * Enable in Configuration.h + */ +#if ENABLED(PRUSA_MMU2) + + // Serial port used for communication with MMU2. + // For AVR enable the UART port used for the MMU. (e.g., internalSerial) + // For 32-bit boards check your HAL for available serial ports. (e.g., Serial2) + #define INTERNAL_SERIAL_PORT 2 + #define MMU2_SERIAL internalSerial + + // Use hardware reset for MMU if a pin is defined for it + //#define MMU2_RST_PIN 23 + + // Enable if the MMU2 has 12V stepper motors (MMU2 Firmware 1.0.2 and up) + //#define MMU2_MODE_12V + + // G-code to execute when MMU2 F.I.N.D.A. probe detects filament runout + #define MMU2_FILAMENT_RUNOUT_SCRIPT "M600" + + // Add an LCD menu for MMU2 + //#define MMU2_MENUS + #if ENABLED(MMU2_MENUS) + // Settings for filament load / unload from the LCD menu. + // This is for Prusa MK3-style extruders. Customize for your hardware. + #define MMU2_FILAMENTCHANGE_EJECT_FEED 80.0 + #define MMU2_LOAD_TO_NOZZLE_SEQUENCE \ + { 7.2, 562 }, \ + { 14.4, 871 }, \ + { 36.0, 1393 }, \ + { 14.4, 871 }, \ + { 50.0, 198 } + + #define MMU2_RAMMING_SEQUENCE \ + { 1.0, 1000 }, \ + { 1.0, 1500 }, \ + { 2.0, 2000 }, \ + { 1.5, 3000 }, \ + { 2.5, 4000 }, \ + { -15.0, 5000 }, \ + { -14.0, 1200 }, \ + { -6.0, 600 }, \ + { 10.0, 700 }, \ + { -10.0, 400 }, \ + { -50.0, 2000 } + + #endif + + //#define MMU2_DEBUG // Write debug info to serial output + +#endif // PRUSA_MMU2 + +/** + * Advanced Print Counter settings + */ +#if ENABLED(PRINTCOUNTER) + #define SERVICE_WARNING_BUZZES 3 + // Activate up to 3 service interval watchdogs + //#define SERVICE_NAME_1 "Service S" + //#define SERVICE_INTERVAL_1 100 // print hours + //#define SERVICE_NAME_2 "Service L" + //#define SERVICE_INTERVAL_2 200 // print hours + //#define SERVICE_NAME_3 "Service 3" + //#define SERVICE_INTERVAL_3 1 // print hours +#endif + +// @section develop + +/** + * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins + */ +//#define PINS_DEBUGGING + +// Enable Marlin dev mode which adds some special commands +//#define MARLIN_DEV_MODE diff --git a/Marlin/src/config/examples/Tronxy/X5S/Configuration.h b/config/examples/Tronxy/X5S/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Tronxy/X5S/Configuration.h rename to config/examples/Tronxy/X5S/Configuration.h index d89f28edd2..2abef0f134 100644 --- a/Marlin/src/config/examples/Tronxy/X5S/Configuration.h +++ b/config/examples/Tronxy/X5S/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -544,6 +546,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -813,6 +816,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1011,7 +1025,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1104,7 +1118,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1123,13 +1137,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1198,7 +1213,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1225,6 +1240,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1396,10 +1412,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2032,11 +2048,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2061,7 +2077,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Tronxy/XY100/Configuration.h b/config/examples/Tronxy/XY100/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Tronxy/XY100/Configuration.h rename to config/examples/Tronxy/XY100/Configuration.h index 9669817722..f68dbffff2 100644 --- a/Marlin/src/config/examples/Tronxy/XY100/Configuration.h +++ b/config/examples/Tronxy/XY100/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 0 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -556,6 +558,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -825,6 +828,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1023,7 +1037,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1116,7 +1130,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1135,13 +1149,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1210,7 +1225,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1237,6 +1252,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1408,10 +1424,10 @@ #define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2044,11 +2060,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2073,7 +2089,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/UltiMachine/Archim1/Configuration.h b/config/examples/UltiMachine/Archim1/Configuration.h similarity index 96% rename from Marlin/src/config/examples/UltiMachine/Archim1/Configuration.h rename to config/examples/UltiMachine/Archim1/Configuration.h index f6ac9705f9..bcd37d01f0 100644 --- a/Marlin/src/config/examples/UltiMachine/Archim1/Configuration.h +++ b/config/examples/UltiMachine/Archim1/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 0 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -545,6 +547,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -814,6 +817,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1012,7 +1026,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1105,7 +1119,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1124,13 +1138,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1199,7 +1214,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1226,6 +1241,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1397,10 +1413,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2033,11 +2049,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2062,7 +2078,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/UltiMachine/Archim1/Configuration_adv.h b/config/examples/UltiMachine/Archim1/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/UltiMachine/Archim1/Configuration_adv.h rename to config/examples/UltiMachine/Archim1/Configuration_adv.h index bd0197d47e..cd5a795b21 100644 --- a/Marlin/src/config/examples/UltiMachine/Archim1/Configuration_adv.h +++ b/config/examples/UltiMachine/Archim1/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,7 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) @@ -980,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1020,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1028,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1599,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1614,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2182,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/UltiMachine/Archim2/Configuration.h b/config/examples/UltiMachine/Archim2/Configuration.h similarity index 96% rename from Marlin/src/config/examples/UltiMachine/Archim2/Configuration.h rename to config/examples/UltiMachine/Archim2/Configuration.h index 37f7e9400d..af69c76d66 100644 --- a/Marlin/src/config/examples/UltiMachine/Archim2/Configuration.h +++ b/config/examples/UltiMachine/Archim2/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 0 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -545,6 +547,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -814,6 +817,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1012,7 +1026,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1105,7 +1119,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1124,13 +1138,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1199,7 +1214,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1226,6 +1241,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1397,10 +1413,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2033,11 +2049,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2062,7 +2078,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h b/config/examples/UltiMachine/Archim2/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h rename to config/examples/UltiMachine/Archim2/Configuration_adv.h index fc0f450120..ce24e6ebb5 100644 --- a/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h +++ b/config/examples/UltiMachine/Archim2/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/VORONDesign/Configuration.h b/config/examples/VORONDesign/Configuration.h similarity index 96% rename from Marlin/src/config/examples/VORONDesign/Configuration.h rename to config/examples/VORONDesign/Configuration.h index 93379337f2..01c10872a4 100644 --- a/Marlin/src/config/examples/VORONDesign/Configuration.h +++ b/config/examples/VORONDesign/Configuration.h @@ -218,7 +218,7 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -554,6 +556,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -823,6 +826,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1021,7 +1035,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1114,7 +1128,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1133,13 +1147,14 @@ #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 200.0 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. - #define MESH_TEST_BED_TEMP 100.0 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_HOTEND_TEMP 200 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 100 // (°C) Defaultbed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1208,7 +1223,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1235,6 +1250,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1406,10 +1422,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2042,11 +2058,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2071,7 +2087,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/VORONDesign/Configuration_adv.h b/config/examples/VORONDesign/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/VORONDesign/Configuration_adv.h rename to config/examples/VORONDesign/Configuration_adv.h index 18f51b3dbd..646ff994c0 100644 --- a/Marlin/src/config/examples/VORONDesign/Configuration_adv.h +++ b/config/examples/VORONDesign/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,7 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) @@ -980,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1020,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1028,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1599,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1614,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2182,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/VORONDesign/_Bootscreen.h b/config/examples/VORONDesign/_Bootscreen.h similarity index 100% rename from Marlin/src/config/examples/VORONDesign/_Bootscreen.h rename to config/examples/VORONDesign/_Bootscreen.h diff --git a/Marlin/src/config/examples/Velleman/K8200/Configuration.h b/config/examples/Velleman/K8200/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Velleman/K8200/Configuration.h rename to config/examples/Velleman/K8200/Configuration.h index f2f9c6b4b0..2e1ef788cd 100644 --- a/Marlin/src/config/examples/Velleman/K8200/Configuration.h +++ b/config/examples/Velleman/K8200/Configuration.h @@ -238,10 +238,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -397,6 +397,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 5 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -407,37 +408,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -575,6 +577,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -843,6 +846,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1042,7 +1056,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1135,7 +1149,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1154,13 +1168,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1229,7 +1244,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1256,6 +1271,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1427,10 +1443,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2068,11 +2084,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2097,7 +2113,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h b/config/examples/Velleman/K8200/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h rename to config/examples/Velleman/K8200/Configuration_adv.h index 3d8f20773c..bcca5b74ee 100644 --- a/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h +++ b/config/examples/Velleman/K8200/Configuration_adv.h @@ -88,7 +88,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 8 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -125,6 +125,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -240,6 +254,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -376,31 +417,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -419,6 +469,7 @@ #define Z_HOME_BUMP_MM 2 #define HOMING_BUMP_DIVISOR { 4, 4, 8 } // Re-Bump Speed Divisor (Divides the Homing Feedrate) #define QUICK_HOME // If homing includes X and Y, do a diagonal move initially +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -451,8 +502,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -476,8 +527,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -733,8 +787,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -923,6 +978,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -965,6 +1025,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -992,13 +1054,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1032,7 +1095,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1040,11 +1104,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1611,7 +1681,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1626,8 +1696,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2194,6 +2263,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/Velleman/K8200/README.md b/config/examples/Velleman/K8200/README.md similarity index 100% rename from Marlin/src/config/examples/Velleman/K8200/README.md rename to config/examples/Velleman/K8200/README.md diff --git a/Marlin/src/config/examples/Velleman/K8400/Configuration.h b/config/examples/Velleman/K8400/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Velleman/K8400/Configuration.h rename to config/examples/Velleman/K8400/Configuration.h index 749d230dc0..4dc1e11c49 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Configuration.h +++ b/config/examples/Velleman/K8400/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 0 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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 2 // (seconds) -#define TEMP_HYSTERESIS 5 // (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. +#define TEMP_RESIDENCY_TIME 2 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 5 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -545,6 +547,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -814,6 +817,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1012,7 +1026,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1105,7 +1119,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1124,13 +1138,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1199,7 +1214,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1226,6 +1241,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1397,10 +1413,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2033,7 +2049,7 @@ //#define RGB_LED // Enable for the Velleman RGB LED Add-on. https://www.velleman.eu/products/view/?id=430100 //#define RGBW_LED -#if ENABLED(RGB_LED) || ENABLED(RGBW_LED) +#if EITHER(RGB_LED, RGBW_LED) // Pin defines for the RGB LED Add-on. #define RGB_LED_R_PIN 41 #define RGB_LED_G_PIN 40 @@ -2063,7 +2079,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h b/config/examples/Velleman/K8400/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h rename to config/examples/Velleman/K8400/Configuration_adv.h index 13a6e1d7eb..8aadb3df20 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h +++ b/config/examples/Velleman/K8400/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #define Z_HOME_BUMP_MM 3 #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h b/config/examples/Velleman/K8400/Dual-head/Configuration.h similarity index 96% rename from Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h rename to config/examples/Velleman/K8400/Dual-head/Configuration.h index 92585d97c1..81396a32cf 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h +++ b/config/examples/Velleman/K8400/Dual-head/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 0 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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 2 // (seconds) -#define TEMP_HYSTERESIS 5 // (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. +#define TEMP_RESIDENCY_TIME 2 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_HYSTERESIS 5 // (°C) Temperature proximity considered "close enough" to the target +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -545,6 +547,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -814,6 +817,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1012,7 +1026,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1105,7 +1119,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1124,13 +1138,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1199,7 +1214,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1226,6 +1241,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1397,10 +1413,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2033,7 +2049,7 @@ //#define RGB_LED // Enable for the Velleman RGB LED Add-on. https://www.velleman.eu/products/view/?id=430100 //#define RGBW_LED -#if ENABLED(RGB_LED) || ENABLED(RGBW_LED) +#if EITHER(RGB_LED, RGBW_LED) // Pin defines for the RGB LED Add-on. #define RGB_LED_R_PIN 41 #define RGB_LED_G_PIN 40 @@ -2063,7 +2079,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Velleman/K8400/README.md b/config/examples/Velleman/K8400/README.md similarity index 100% rename from Marlin/src/config/examples/Velleman/K8400/README.md rename to config/examples/Velleman/K8400/README.md diff --git a/Marlin/src/config/examples/WASP/PowerWASP/Configuration.h b/config/examples/WASP/PowerWASP/Configuration.h similarity index 96% rename from Marlin/src/config/examples/WASP/PowerWASP/Configuration.h rename to config/examples/WASP/PowerWASP/Configuration.h index 13cd36f648..50fa8df038 100644 --- a/Marlin/src/config/examples/WASP/PowerWASP/Configuration.h +++ b/config/examples/WASP/PowerWASP/Configuration.h @@ -237,7 +237,7 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder @@ -396,6 +396,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 0 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -406,37 +407,38 @@ //#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 5 // (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. +#define TEMP_RESIDENCY_TIME 5 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (Use MINTEMP for thermistor short/failure protection.) #define HEATER_0_MAXTEMP 230 #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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -564,6 +566,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -833,6 +836,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1031,7 +1045,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1124,7 +1138,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1143,13 +1157,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1218,7 +1233,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1245,6 +1260,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1416,10 +1432,10 @@ #define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #define NOZZLE_PARK_POINT { (X_MIN_POS + 10), (Y_MAX_POS - 10), 190 } - #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 10 // Z axis feedrate in mm/s (not used for delta printers) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 10 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2052,11 +2068,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2081,7 +2097,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/config/examples/WASP/PowerWASP/Configuration_adv.h b/config/examples/WASP/PowerWASP/Configuration_adv.h new file mode 100644 index 0000000000..d875ca7b92 --- /dev/null +++ b/config/examples/WASP/PowerWASP/Configuration_adv.h @@ -0,0 +1,2332 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +/** + * 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 + + //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) + //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 + #endif + + /** + * 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 + +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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 180 + #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 + +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + +// @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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. + */ +//#define DUAL_X_CARRIAGE +#if ENABLED(DUAL_X_CARRIAGE) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. + + // 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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing + +// 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} + +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION + +// 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 EITHER(ULTIPANEL, EXTENSIBLE_UI) + #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) + #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) + +// +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. +// +//#define BACKLASH_COMPENSATION +#if ENABLED(BACKLASH_COMPENSATION) + // Define values for backlash distance and correction. + // If BACKLASH_GCODE is enabled these values are the defaults. + #define BACKLASH_DISTANCE_MM { 0, 0, 0 } // (mm) + #define BACKLASH_CORRECTION 0.0 // 0.0 = no correction; 1.0 = full correction + + // Set BACKLASH_SMOOTHING_MM to spread backlash correction over multiple segments + // to reduce print artifacts. (Enabling this is costly in memory and computation!) + //#define BACKLASH_SMOOTHING_MM 3 // (mm) + + // Add runtime configuration and tuning of backlash values (M425) + //#define BACKLASH_GCODE + + #if ENABLED(BACKLASH_GCODE) + // Measure the Z backlash when probing (G29) and set with "M425 Z" + #define MEASURE_BACKLASH_WHEN_PROBING + + #if ENABLED(MEASURE_BACKLASH_WHEN_PROBING) + // When measuring, the probe will move up to BACKLASH_MEASUREMENT_LIMIT + // mm away from point of contact in BACKLASH_MEASUREMENT_RESOLUTION + // increments while checking for the contact to be broken. + #define BACKLASH_MEASUREMENT_LIMIT 0.5 // (mm) + #define BACKLASH_MEASUREMENT_RESOLUTION 0.005 // (mm) + #define BACKLASH_MEASUREMENT_FEEDRATE Z_PROBE_SPEED_SLOW // (mm/m) + #endif + #endif +#endif + +/** + * Automatic backlash, position and hotend offset calibration + * + * Enable G425 to run automatic calibration using an electrically- + * conductive cube, bolt, or washer mounted on the bed. + * + * G425 uses the probe to touch the top and sides of the calibration object + * on the bed and measures and/or correct positional offsets, axis backlash + * and hotend offsets. + * + * Note: HOTEND_OFFSET and CALIBRATION_OBJECT_CENTER must be set to within + * ±5mm of true values for G425 to succeed. + */ +//#define CALIBRATION_GCODE +#if ENABLED(CALIBRATION_GCODE) + + #define CALIBRATION_MEASUREMENT_RESOLUTION 0.01 // mm + + #define CALIBRATION_FEEDRATE_SLOW 60 // mm/m + #define CALIBRATION_FEEDRATE_FAST 1200 // mm/m + #define CALIBRATION_FEEDRATE_TRAVEL 3000 // mm/m + + // The following parameters refer to the conical section of the nozzle tip. + #define CALIBRATION_NOZZLE_TIP_HEIGHT 1.0 // mm + #define CALIBRATION_NOZZLE_OUTER_DIAMETER 2.0 // mm + + // Uncomment to enable reporting (required for "G425 V", but consumes PROGMEM). + //#define CALIBRATION_REPORTING + + // The true location and dimension the cube/bolt/washer on the bed. + #define CALIBRATION_OBJECT_CENTER { 264.0, -22.0, -2.0} // mm + #define CALIBRATION_OBJECT_DIMENSIONS { 10.0, 10.0, 10.0} // mm + + // Comment out any sides which are unreachable by the probe. For best + // auto-calibration results, all sides must be reachable. + #define CALIBRATION_MEASURE_RIGHT + #define CALIBRATION_MEASURE_FRONT + #define CALIBRATION_MEASURE_LEFT + #define CALIBRATION_MEASURE_BACK + + // Probing at the exact top center only works if the center is flat. If + // probing on a screwhead or hollow washer, probe near the edges. + //#define CALIBRATION_MEASURE_AT_TOP_EDGES + + // Define pin which is read during calibration + #ifndef CALIBRATION_PIN + #define CALIBRATION_PIN -1 // Override in pins.h or set to -1 to use your Z endstop + #define CALIBRATION_PIN_INVERTING false // set to true to invert the pin + //#define CALIBRATION_PIN_PULLDOWN + #define CALIBRATION_PIN_PULLUP + #endif +#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 + +// Play a beep when the feedrate is changed from the Status Screen +//#define BEEP_ON_FEEDRATE_CHANGE +#if ENABLED(BEEP_ON_FEEDRATE_CHANGE) + #define FEEDRATE_CHANGE_BEEP_DURATION 10 + #define FEEDRATE_CHANGE_BEEP_FREQUENCY 440 +#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 + +/** + * 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 "G1 Y190 Z190\nM84 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 + + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G27" // G-code to run on Stop Print (e.g., "G28XY" or "G27") + + /** + * 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 65 // Pin to detect power loss + #define POWER_LOSS_STATE LOW // 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 BINARY_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 + + /** + * 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. + */ + #if ENABLED(U8GLIB_ST7920) + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + + /** + * Status (Info) Screen customizations + * These options may affect code size and screen render time. + * Custom status screens can forcibly override these settings. + */ + //#define STATUS_COMBINE_HEATERS // Use combined heater images instead of separate ones + //#define STATUS_HOTEND_NUMBERLESS // Use plain hotend icons instead of numbered ones (with 2+ hotends) + #define STATUS_HOTEND_INVERTED // Show solid nozzle bitmaps when heating (Requires STATUS_HOTEND_ANIM) + #define STATUS_HOTEND_ANIM // Use a second bitmap to indicate hotend heating + #define STATUS_BED_ANIM // Use a second bitmap to indicate bed heating + //#define STATUS_ALT_BED_BITMAP // Use the alternative bed bitmap + //#define STATUS_ALT_FAN_BITMAP // Use the alternative fan bitmap + //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames + //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + +#endif // HAS_GRAPHICAL_LCD + +// @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_WITHOUT_HOMING + //#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. + //#define BABYSTEP_ALWAYS_AVAILABLE // Allow babystepping at all times (not just during movement). + //#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 + #endif + + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + + //#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 EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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 EITHER(MESH_BED_LEVELING, 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" + +#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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ +//#define G38_PROBE_TARGET +#if ENABLED(G38_PROBE_TARGET) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a 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 + +// Printrun may have trouble receiving long strings all at once. +// This option inserts short delays between lines of serial output. +#define SERIAL_OVERRUN_PROTECTION + +// @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_EXTRA_PRIME 2 // (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 20 // (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 400 // (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 20 // (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 400 // (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. + #define ADVANCED_PAUSE_RESUME_PRIME 0 // (mm) Extra distance to prime nozzle after returning from park. + + // 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 5 // 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) + + #if AXIS_DRIVER_TYPE_X(TMC26X) + #define X_MAX_CURRENT 1000 // (mA) + #define X_SENSE_RESISTOR 91 // (mOhms) + #define X_MICROSTEPS 16 // Number of microsteps + #endif + + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif + + #if AXIS_DRIVER_TYPE_E5(TMC26X) + #define E5_MAX_CURRENT 1000 + #define E5_SENSE_RESISTOR 91 + #define E5_MICROSTEPS 16 + #endif + +#endif // TMC26X + +// @section tmc_smart + +/** + * To use TMC2130, TMC2160, TMC2660, TMC5130, TMC5160 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. + * + * 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. + * + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper + */ +#if HAS_TRINAMIC + + #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current + #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 + + #if AXIS_IS_TMC(X) + #define X_CURRENT 800 // (mA) RMS current. Multiply by 1.414 for peak current. + #define X_MICROSTEPS 16 // 0..256 + #define X_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(E1) + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + #define E1_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(E2) + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + #define E2_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif + + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif + + /** + * Override default SPI pins for TMC2130, TMC2160, TMC2660, TMC5130 and TMC5160 drivers here. + * The default pins can be found in your board's pins file. + */ + //#define X_CS_PIN -1 + //#define Y_CS_PIN -1 + //#define Z_CS_PIN -1 + //#define X2_CS_PIN -1 + //#define Y2_CS_PIN -1 + //#define Z2_CS_PIN -1 + //#define Z3_CS_PIN -1 + //#define E0_CS_PIN -1 + //#define E1_CS_PIN -1 + //#define E2_CS_PIN -1 + //#define E3_CS_PIN -1 + //#define E4_CS_PIN -1 + //#define E5_CS_PIN -1 + + /** + * Use software SPI for TMC2130. + * Software option for SPI driven drivers (TMC2130, TMC2160, TMC2660, TMC5130 and TMC5160). + * 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 + + /** + * Software enable + * + * Use for drivers that do not use a dedicated enable pin, but rather handle the same + * function through a communication line such as SPI or UART. + */ + //#define SOFTWARE_DRIVER_ENABLE + + /** + * TMC2130, TMC2160, TMC2208, TMC5130 and TMC5160 only + * Use Trinamic's ultra quiet stepping mode. + * When disabled, Marlin will use spreadCycle stepping mode. + */ + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E + + /** + * Optimize spreadCycle chopper parameters by using predefined parameter sets + * or with the help of an example included in the library. + * Provided parameter sets are + * CHOPPER_DEFAULT_12V + * CHOPPER_DEFAULT_19V + * CHOPPER_DEFAULT_24V + * CHOPPER_DEFAULT_36V + * CHOPPER_PRUSAMK3_24V // Imported parameters from the official Prusa firmware for MK3 (24V) + * CHOPPER_MARLIN_119 // Old defaults from Marlin v1.1.9 + * + * Define you own with + * { , , hysteresis_start[1..8] } + */ + #define CHOPPER_TIMING CHOPPER_DEFAULT_12V + + /** + * Monitor Trinamic 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 - 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 + + /** + * TMC2130, TMC2160, TMC2208, TMC5130 and TMC5160 only + * 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_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. + * 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 + + /** + * TMC2130, TMC2160, TMC2660, TMC5130, and TMC5160 only + * 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 EITHER(SENSORLESS_HOMING, 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 + + /** + * 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/TMCStepper + * + * Example: + * #define TMC_ADV() { \ + * stepperX.diag0_temp_prewarn(1); \ + * stepperY.interpolate(0); \ + * } + */ + #define TMC_ADV() { } + +#endif // HAS_TRINAMIC + +// @section L6470 + +/** + * L6470 Stepper Driver options + * + * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver. + * https://github.com/ameyer/Arduino-L6470 + * + * Requires the following to be defined in your pins_YOUR_BOARD file + * L6470_CHAIN_SCK_PIN + * L6470_CHAIN_MISO_PIN + * L6470_CHAIN_MOSI_PIN + * L6470_CHAIN_SS_PIN + * L6470_RESET_CHAIN_PIN (optional) + */ +#if HAS_DRIVER(L6470) + + //#define L6470_CHITCHAT // Display additional status info + + #if AXIS_DRIVER_TYPE_X(L6470) + #define X_MICROSTEPS 128 // Number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128) + #define X_OVERCURRENT 2000 // (mA) Current where the driver detects an over current (VALID: 375 x (1 - 16) - 6A max - rounds down) + #define X_STALLCURRENT 1500 // (mA) Current where the driver detects a stall (VALID: 31.25 * (1-128) - 4A max - rounds down) + #define X_MAX_VOLTAGE 127 // 0-255, Maximum effective voltage seen by stepper + #define X_CHAIN_POS 0 // Position in SPI chain, 0=Not in chain, 1=Nearest MOSI + #endif + + #if AXIS_DRIVER_TYPE_X2(L6470) + #define X2_MICROSTEPS 128 + #define X2_OVERCURRENT 2000 + #define X2_STALLCURRENT 1500 + #define X2_MAX_VOLTAGE 127 + #define X2_CHAIN_POS 0 + #endif + + #if AXIS_DRIVER_TYPE_Y(L6470) + #define Y_MICROSTEPS 128 + #define Y_OVERCURRENT 2000 + #define Y_STALLCURRENT 1500 + #define Y_MAX_VOLTAGE 127 + #define Y_CHAIN_POS 0 + #endif + + #if AXIS_DRIVER_TYPE_Y2(L6470) + #define Y2_MICROSTEPS 128 + #define Y2_OVERCURRENT 2000 + #define Y2_STALLCURRENT 1500 + #define Y2_MAX_VOLTAGE 127 + #define Y2_CHAIN_POS 0 + #endif + + #if AXIS_DRIVER_TYPE_Z(L6470) + #define Z_MICROSTEPS 128 + #define Z_OVERCURRENT 2000 + #define Z_STALLCURRENT 1500 + #define Z_MAX_VOLTAGE 127 + #define Z_CHAIN_POS 0 + #endif + + #if AXIS_DRIVER_TYPE_Z2(L6470) + #define Z2_MICROSTEPS 128 + #define Z2_OVERCURRENT 2000 + #define Z2_STALLCURRENT 1500 + #define Z2_MAX_VOLTAGE 127 + #define Z2_CHAIN_POS 0 + #endif + + #if AXIS_DRIVER_TYPE_Z3(L6470) + #define Z3_MICROSTEPS 128 + #define Z3_OVERCURRENT 2000 + #define Z3_STALLCURRENT 1500 + #define Z3_MAX_VOLTAGE 127 + #define Z3_CHAIN_POS 0 + #endif + + #if AXIS_DRIVER_TYPE_E0(L6470) + #define E0_MICROSTEPS 128 + #define E0_OVERCURRENT 2000 + #define E0_STALLCURRENT 1500 + #define E0_MAX_VOLTAGE 127 + #define E0_CHAIN_POS 0 + #endif + + #if AXIS_DRIVER_TYPE_E1(L6470) + #define E1_MICROSTEPS 128 + #define E1_OVERCURRENT 2000 + #define E1_STALLCURRENT 1500 + #define E1_MAX_VOLTAGE 127 + #define E1_CHAIN_POS 0 + #endif + + #if AXIS_DRIVER_TYPE_E2(L6470) + #define E2_MICROSTEPS 128 + #define E2_OVERCURRENT 2000 + #define E2_STALLCURRENT 1500 + #define E2_MAX_VOLTAGE 127 + #define E2_CHAIN_POS 0 + #endif + + #if AXIS_DRIVER_TYPE_E3(L6470) + #define E3_MICROSTEPS 128 + #define E3_OVERCURRENT 2000 + #define E3_STALLCURRENT 1500 + #define E3_MAX_VOLTAGE 127 + #define E3_CHAIN_POS 0 + #endif + + #if AXIS_DRIVER_TYPE_E4(L6470) + #define E4_MICROSTEPS 128 + #define E4_OVERCURRENT 2000 + #define E4_STALLCURRENT 1500 + #define E4_MAX_VOLTAGE 127 + #define E4_CHAIN_POS 0 + #endif + + #if AXIS_DRIVER_TYPE_E5(L6470) + #define E5_MICROSTEPS 128 + #define E5_OVERCURRENT 2000 + #define E5_STALLCURRENT 1500 + #define E5_MAX_VOLTAGE 127 + #define E5_CHAIN_POS 0 + #endif + + /** + * Monitor L6470 drivers for error conditions like over temperature and over current. + * In the case of over temperature Marlin can decrease the drive until the error condition clears. + * Other detected conditions can be used to stop the current print. + * Relevant g-codes: + * M906 - I1/2/3/4/5 Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given. + * I not present or I0 or I1 - X, Y, Z or E0 + * I2 - X2, Y2, Z2 or E1 + * I3 - Z3 or E3 + * I4 - E4 + * I5 - E5 + * M916 - Increase drive level until get thermal warning + * M917 - Find minimum current thresholds + * M918 - Increase speed until max or error + * M122 S0/1 - Report driver parameters + */ + //#define MONITOR_L6470_DRIVER_STATUS + + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif + +#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 + +/** + * Photo G-code + * Add the M240 G-code to take a photo. + * The photo can be triggered by a digital pin or a physical movement. + */ +//#define PHOTO_GCODE +#if ENABLED(PHOTO_GCODE) + // A position to move to (and raise Z) before taking the photo + //#define PHOTO_POSITION { X_MAX_POS - 5, Y_MAX_POS, 0 } // { xpos, ypos, zraise } (M240 X Y Z) + //#define PHOTO_DELAY_MS 100 // (ms) Duration to pause before moving back (M240 P) + //#define PHOTO_RETRACT_MM 6.5 // (mm) E retract/recover for the photo move (M240 R S) + + // Canon RC-1 or homebrew digital camera trigger + // Data from: http://www.doc-diy.net/photo/rc-1_hacked/ + //#define PHOTOGRAPH_PIN 23 + + // Canon Hack Development Kit + // http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + //#define CHDK_PIN 4 + + // Optional second move with delay to trigger the camera shutter + //#define PHOTO_SWITCH_POSITION { X_MAX_POS, Y_MAX_POS } // { xpos, ypos } (M240 I J) + + // Duration to hold the switch or keep CHDK_PIN high + //#define PHOTO_SWITCH_MS 50 // (ms) (M240 D) +#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 + +/** + * 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 + +/** + * Host Action Commands + * + * Define host streamer action commands in compliance with the standard. + * + * See https://reprap.org/wiki/G-code#Action_commands + * Common commands ........ poweroff, pause, paused, resume, resumed, cancel + * G29_RETRY_AND_RECOVER .. probe_rewipe, probe_failed + * + * Some features add reason codes to extend these commands. + * + * Host Prompt Support enables Marlin to use the host for user prompts so + * filament runout and other processes can be managed from the host side. + */ +//#define HOST_ACTION_COMMANDS +#if ENABLED(HOST_ACTION_COMMANDS) + //#define HOST_PROMPT_SUPPORT +#endif + +//=========================================================================== +//====================== 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/ + * + * Reliabuild 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" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates +#endif + +/** + * Prusa Multi-Material Unit v2 + * Enable in Configuration.h + */ +#if ENABLED(PRUSA_MMU2) + + // Serial port used for communication with MMU2. + // For AVR enable the UART port used for the MMU. (e.g., internalSerial) + // For 32-bit boards check your HAL for available serial ports. (e.g., Serial2) + #define INTERNAL_SERIAL_PORT 2 + #define MMU2_SERIAL internalSerial + + // Use hardware reset for MMU if a pin is defined for it + //#define MMU2_RST_PIN 23 + + // Enable if the MMU2 has 12V stepper motors (MMU2 Firmware 1.0.2 and up) + //#define MMU2_MODE_12V + + // G-code to execute when MMU2 F.I.N.D.A. probe detects filament runout + #define MMU2_FILAMENT_RUNOUT_SCRIPT "M600" + + // Add an LCD menu for MMU2 + //#define MMU2_MENUS + #if ENABLED(MMU2_MENUS) + // Settings for filament load / unload from the LCD menu. + // This is for Prusa MK3-style extruders. Customize for your hardware. + #define MMU2_FILAMENTCHANGE_EJECT_FEED 80.0 + #define MMU2_LOAD_TO_NOZZLE_SEQUENCE \ + { 7.2, 562 }, \ + { 14.4, 871 }, \ + { 36.0, 1393 }, \ + { 14.4, 871 }, \ + { 50.0, 198 } + + #define MMU2_RAMMING_SEQUENCE \ + { 1.0, 1000 }, \ + { 1.0, 1500 }, \ + { 2.0, 2000 }, \ + { 1.5, 3000 }, \ + { 2.5, 4000 }, \ + { -15.0, 5000 }, \ + { -14.0, 1200 }, \ + { -6.0, 600 }, \ + { 10.0, 700 }, \ + { -10.0, 400 }, \ + { -50.0, 2000 } + + #endif + + //#define MMU2_DEBUG // Write debug info to serial output + +#endif // PRUSA_MMU2 + +/** + * Advanced Print Counter settings + */ +#if ENABLED(PRINTCOUNTER) + #define SERVICE_WARNING_BUZZES 3 + // Activate up to 3 service interval watchdogs + //#define SERVICE_NAME_1 "Service S" + //#define SERVICE_INTERVAL_1 100 // print hours + //#define SERVICE_NAME_2 "Service L" + //#define SERVICE_INTERVAL_2 200 // print hours + //#define SERVICE_NAME_3 "Service 3" + //#define SERVICE_INTERVAL_3 1 // print hours +#endif + +// @section develop + +/** + * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins + */ +//#define PINS_DEBUGGING + +// Enable Marlin dev mode which adds some special commands +//#define MARLIN_DEV_MODE diff --git a/Marlin/src/config/examples/WASP/PowerWASP/README.md b/config/examples/WASP/PowerWASP/README.md similarity index 100% rename from Marlin/src/config/examples/WASP/PowerWASP/README.md rename to config/examples/WASP/PowerWASP/README.md diff --git a/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration.h b/config/examples/Wanhao/Duplicator 6/Configuration.h similarity index 95% rename from Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration.h rename to config/examples/Wanhao/Duplicator 6/Configuration.h index f36a1a86fc..ac83f6646d 100644 --- a/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration.h +++ b/config/examples/Wanhao/Duplicator 6/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (Use MINTEMP for thermistor short/failure protection.) #define HEATER_0_MAXTEMP 260 #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 120 +#define BED_MAXTEMP 120 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -555,6 +557,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -824,6 +827,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1022,7 +1036,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1115,7 +1129,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1134,13 +1148,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1209,7 +1224,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1236,6 +1251,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1407,10 +1423,10 @@ #define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2017,6 +2033,10 @@ // Support for PCA9632 PWM LED driver #define PCA9632 +// Support for PCA9533 PWM LED driver +// https://github.com/mikeshub/SailfishRGB_LED +//#define PCA9533 + /** * RGB LED / LED Strip Control * @@ -2042,11 +2062,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2071,7 +2091,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h b/config/examples/Wanhao/Duplicator 6/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h rename to config/examples/Wanhao/Duplicator 6/Configuration_adv.h index 13f41ecb24..554f1a9ac0 100644 --- a/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h +++ b/config/examples/Wanhao/Duplicator 6/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -722,8 +773,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G27" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -912,6 +964,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -954,6 +1011,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -981,13 +1040,14 @@ */ #define LIN_ADVANCE #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 0 // Unit: mm compression per 1mm/s extruder speed - //#define LA_DEBUG // If enabled, this will generate debug information output over USB. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #define LIN_ADVANCE_K 0.00 // 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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1021,7 +1081,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1029,11 +1090,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1600,7 +1667,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1615,8 +1682,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2183,6 +2249,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/adafruit/ST7565/Configuration.h b/config/examples/adafruit/ST7565/Configuration.h similarity index 96% rename from Marlin/src/config/examples/adafruit/ST7565/Configuration.h rename to config/examples/adafruit/ST7565/Configuration.h index 7e34c3a2ca..1af86dba33 100644 --- a/Marlin/src/config/examples/adafruit/ST7565/Configuration.h +++ b/config/examples/adafruit/ST7565/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 0 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -545,6 +547,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -814,6 +817,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1012,7 +1026,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1105,7 +1119,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1124,13 +1138,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1199,7 +1214,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1226,6 +1241,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1397,10 +1413,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2033,11 +2049,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2062,7 +2078,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration.h b/config/examples/delta/Anycubic/Kossel/Configuration.h similarity index 96% rename from Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration.h rename to config/examples/delta/Anycubic/Kossel/Configuration.h index b963813de0..68019f4e98 100644 --- a/Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration.h +++ b/config/examples/delta/Anycubic/Kossel/Configuration.h @@ -233,10 +233,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -398,6 +398,7 @@ #endif #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -408,37 +409,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 120 +#define BED_MAXTEMP 120 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -586,6 +588,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -635,7 +638,7 @@ #define DELTA_CALIBRATION_DEFAULT_POINTS 4 #endif - #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) + #if EITHER(DELTA_AUTO_CALIBRATION, 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) // Set the steprate for papertest probing @@ -950,6 +953,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1200,7 +1214,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) #define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1295,7 +1309,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1314,13 +1328,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. // Works best with 5 or more points in each dimension. @@ -1390,7 +1405,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) #define PROBE_PT_1_X -40 #define PROBE_PT_1_Y 60 #define PROBE_PT_2_X 40 @@ -1417,6 +1432,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1587,10 +1603,10 @@ #define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #define NOZZLE_PARK_POINT { 0, 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 100 // Z axis feedrate in mm/s (not used for delta printers) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 100 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2223,11 +2239,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2252,7 +2268,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration_adv.h b/config/examples/delta/Anycubic/Kossel/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration_adv.h rename to config/examples/delta/Anycubic/Kossel/Configuration_adv.h index 54a5ec27f2..9fb9c4ce96 100644 --- a/Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration_adv.h +++ b/config/examples/delta/Anycubic/Kossel/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -722,8 +773,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G27" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -912,6 +964,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -954,6 +1011,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -981,13 +1040,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1021,7 +1081,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1029,11 +1090,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1600,7 +1667,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1615,8 +1682,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2183,6 +2249,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/delta/Anycubic/Kossel/README.md b/config/examples/delta/Anycubic/Kossel/README.md similarity index 100% rename from Marlin/src/config/examples/delta/Anycubic/Kossel/README.md rename to config/examples/delta/Anycubic/Kossel/README.md diff --git a/Marlin/src/config/examples/delta/Anycubic/Kossel/images/Version1Probe.jpg b/config/examples/delta/Anycubic/Kossel/images/Version1Probe.jpg similarity index 100% rename from Marlin/src/config/examples/delta/Anycubic/Kossel/images/Version1Probe.jpg rename to config/examples/delta/Anycubic/Kossel/images/Version1Probe.jpg diff --git a/Marlin/src/config/examples/delta/Anycubic/Kossel/images/Version2Probe.jpg b/config/examples/delta/Anycubic/Kossel/images/Version2Probe.jpg similarity index 100% rename from Marlin/src/config/examples/delta/Anycubic/Kossel/images/Version2Probe.jpg rename to config/examples/delta/Anycubic/Kossel/images/Version2Probe.jpg diff --git a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration.h b/config/examples/delta/FLSUN/auto_calibrate/Configuration.h similarity index 96% rename from Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration.h rename to config/examples/delta/FLSUN/auto_calibrate/Configuration.h index 0f1dd82c99..aa4334a74a 100644 --- a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration.h +++ b/config/examples/delta/FLSUN/auto_calibrate/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 5 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 5 -// 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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 1 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (Use MINTEMP for thermistor short/failure protection.) #define HEATER_0_MAXTEMP 250 #define HEATER_1_MAXTEMP 250 #define HEATER_2_MAXTEMP 250 #define HEATER_3_MAXTEMP 250 #define HEATER_4_MAXTEMP 250 #define HEATER_5_MAXTEMP 250 -#define BED_MAXTEMP 115 +#define BED_MAXTEMP 115 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -555,6 +557,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -602,7 +605,7 @@ #define DELTA_CALIBRATION_DEFAULT_POINTS 4 #endif - #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) + #if EITHER(DELTA_AUTO_CALIBRATION, 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) // Set the steprate for papertest probing @@ -896,6 +899,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1140,7 +1154,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1233,7 +1247,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1252,13 +1266,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. // Works best with 5 or more points in each dimension. @@ -1328,7 +1343,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1355,6 +1370,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1525,10 +1541,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2161,11 +2177,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2190,7 +2206,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h b/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h rename to config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h index 7573ba6e0f..dcac946956 100644 --- a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h +++ b/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -722,8 +773,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -912,6 +964,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -954,6 +1011,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -981,13 +1040,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1021,7 +1081,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1029,11 +1090,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1600,7 +1667,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1615,8 +1682,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2183,6 +2249,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration.h b/config/examples/delta/FLSUN/kossel/Configuration.h similarity index 95% rename from Marlin/src/config/examples/delta/FLSUN/kossel/Configuration.h rename to config/examples/delta/FLSUN/kossel/Configuration.h index 6b77864fe0..4ab27daf37 100644 --- a/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration.h +++ b/config/examples/delta/FLSUN/kossel/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 5 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 5 -// 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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 1 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (Use MINTEMP for thermistor short/failure protection.) #define HEATER_0_MAXTEMP 250 #define HEATER_1_MAXTEMP 250 #define HEATER_2_MAXTEMP 250 #define HEATER_3_MAXTEMP 250 #define HEATER_4_MAXTEMP 250 #define HEATER_5_MAXTEMP 250 -#define BED_MAXTEMP 115 +#define BED_MAXTEMP 115 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -555,6 +557,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -602,7 +605,7 @@ #define DELTA_CALIBRATION_DEFAULT_POINTS 7 #endif - #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) + #if EITHER(DELTA_AUTO_CALIBRATION, 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) // Set the steprate for papertest probing @@ -896,6 +899,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1139,7 +1153,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1232,7 +1246,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1249,15 +1263,16 @@ */ //#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. + #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 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. // Works best with 5 or more points in each dimension. @@ -1327,7 +1342,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1354,6 +1369,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1524,10 +1540,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2160,11 +2176,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2189,7 +2205,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h b/config/examples/delta/FLSUN/kossel/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h rename to config/examples/delta/FLSUN/kossel/Configuration_adv.h index 7573ba6e0f..dcac946956 100644 --- a/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h +++ b/config/examples/delta/FLSUN/kossel/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -722,8 +773,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -912,6 +964,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -954,6 +1011,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -981,13 +1040,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1021,7 +1081,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1029,11 +1090,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1600,7 +1667,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1615,8 +1682,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2183,6 +2249,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration.h b/config/examples/delta/FLSUN/kossel_mini/Configuration.h similarity index 96% rename from Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration.h rename to config/examples/delta/FLSUN/kossel_mini/Configuration.h index 4b90dcc541..6cc810170c 100644 --- a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration.h +++ b/config/examples/delta/FLSUN/kossel_mini/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 5 -// 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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 1 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -555,6 +557,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -602,7 +605,7 @@ #define DELTA_CALIBRATION_DEFAULT_POINTS 4 #endif - #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) + #if EITHER(DELTA_AUTO_CALIBRATION, 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) // Set the steprate for papertest probing @@ -896,6 +899,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1139,7 +1153,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1232,7 +1246,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1251,13 +1265,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. // Works best with 5 or more points in each dimension. @@ -1327,7 +1342,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1354,6 +1369,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1524,10 +1540,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2160,11 +2176,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2189,7 +2205,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/delta/generic/Configuration_adv.h b/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/delta/generic/Configuration_adv.h rename to config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h index bf4cb2fb55..b267a6df22 100644 --- a/Marlin/src/config/examples/delta/generic/Configuration_adv.h +++ b/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -722,8 +773,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -912,6 +964,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -954,6 +1011,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -981,13 +1040,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1021,7 +1081,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1029,11 +1090,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1600,7 +1667,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1615,8 +1682,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2183,6 +2249,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/delta/Geeetech/Rostock 301/Configuration.h b/config/examples/delta/Geeetech/Rostock 301/Configuration.h similarity index 96% rename from Marlin/src/config/examples/delta/Geeetech/Rostock 301/Configuration.h rename to config/examples/delta/Geeetech/Rostock 301/Configuration.h index 7bb9fdc018..61fe789d37 100644 --- a/Marlin/src/config/examples/delta/Geeetech/Rostock 301/Configuration.h +++ b/config/examples/delta/Geeetech/Rostock 301/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -545,6 +547,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -592,7 +595,7 @@ #define DELTA_CALIBRATION_DEFAULT_POINTS 4 #endif - #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) + #if EITHER(DELTA_AUTO_CALIBRATION, 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 @@ -886,6 +889,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1130,7 +1144,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1223,7 +1237,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1242,13 +1256,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. // Works best with 5 or more points in each dimension. @@ -1318,7 +1333,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1345,6 +1360,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1515,10 +1531,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2151,11 +2167,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2180,7 +2196,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h b/config/examples/delta/Geeetech/Rostock 301/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h rename to config/examples/delta/Geeetech/Rostock 301/Configuration_adv.h index bf4cb2fb55..b267a6df22 100644 --- a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h +++ b/config/examples/delta/Geeetech/Rostock 301/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -722,8 +773,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -912,6 +964,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -954,6 +1011,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -981,13 +1040,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1021,7 +1081,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1029,11 +1090,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1600,7 +1667,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1615,8 +1682,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2183,6 +2249,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/delta/Hatchbox_Alpha/Configuration.h b/config/examples/delta/Hatchbox_Alpha/Configuration.h similarity index 96% rename from Marlin/src/config/examples/delta/Hatchbox_Alpha/Configuration.h rename to config/examples/delta/Hatchbox_Alpha/Configuration.h index 1482cf1db1..e4a2167a64 100644 --- a/Marlin/src/config/examples/delta/Hatchbox_Alpha/Configuration.h +++ b/config/examples/delta/Hatchbox_Alpha/Configuration.h @@ -223,10 +223,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -382,6 +382,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -392,37 +393,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -560,6 +562,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -607,7 +610,7 @@ #define DELTA_CALIBRATION_DEFAULT_POINTS 4 #endif - #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) + #if EITHER(DELTA_AUTO_CALIBRATION, 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 @@ -901,6 +904,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1142,7 +1156,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1235,7 +1249,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1254,13 +1268,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. // Works best with 5 or more points in each dimension. @@ -1330,7 +1345,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) #define PROBE_PT_1_X -116 #define PROBE_PT_1_Y -67.5 #define PROBE_PT_2_X 116 @@ -1357,6 +1372,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1527,10 +1543,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2163,11 +2179,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2192,7 +2208,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/delta/MKS/SBASE/Configuration.h b/config/examples/delta/MKS/SBASE/Configuration.h similarity index 96% rename from Marlin/src/config/examples/delta/MKS/SBASE/Configuration.h rename to config/examples/delta/MKS/SBASE/Configuration.h index 3c93a36057..784d92f0a4 100644 --- a/Marlin/src/config/examples/delta/MKS/SBASE/Configuration.h +++ b/config/examples/delta/MKS/SBASE/Configuration.h @@ -218,7 +218,7 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 5 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -545,6 +547,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -592,7 +595,7 @@ #define DELTA_CALIBRATION_DEFAULT_POINTS 4 #endif - #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) + #if EITHER(DELTA_AUTO_CALIBRATION, 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 @@ -886,6 +889,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1127,7 +1141,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1220,7 +1234,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1239,13 +1253,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. // Works best with 5 or more points in each dimension. @@ -1315,7 +1330,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1342,6 +1357,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1512,10 +1528,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2148,11 +2164,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2177,7 +2193,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/delta/MKS/SBASE/Configuration_adv.h b/config/examples/delta/MKS/SBASE/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/delta/MKS/SBASE/Configuration_adv.h rename to config/examples/delta/MKS/SBASE/Configuration_adv.h index 9aec36a484..44d15dfd34 100644 --- a/Marlin/src/config/examples/delta/MKS/SBASE/Configuration_adv.h +++ b/config/examples/delta/MKS/SBASE/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 6 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -722,8 +773,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -912,6 +964,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -954,6 +1011,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -981,13 +1040,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1021,7 +1081,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1029,11 +1090,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1600,7 +1667,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1615,8 +1682,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2183,6 +2249,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/delta/MKS/SBASE/RRD Full Graphic Smart Controller.md b/config/examples/delta/MKS/SBASE/RRD Full Graphic Smart Controller.md similarity index 100% rename from Marlin/src/config/examples/delta/MKS/SBASE/RRD Full Graphic Smart Controller.md rename to config/examples/delta/MKS/SBASE/RRD Full Graphic Smart Controller.md diff --git a/Marlin/src/config/examples/delta/Tevo Little Monster/Configuration.h b/config/examples/delta/Tevo Little Monster/Configuration.h similarity index 96% rename from Marlin/src/config/examples/delta/Tevo Little Monster/Configuration.h rename to config/examples/delta/Tevo Little Monster/Configuration.h index dd689173ad..a66af60bb6 100644 --- a/Marlin/src/config/examples/delta/Tevo Little Monster/Configuration.h +++ b/config/examples/delta/Tevo Little Monster/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 1 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -549,6 +551,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -596,7 +599,7 @@ #define DELTA_CALIBRATION_DEFAULT_POINTS 7 #endif - #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) + #if EITHER(DELTA_AUTO_CALIBRATION, 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 @@ -1131,7 +1134,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1224,7 +1227,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1243,13 +1246,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. // Works best with 5 or more points in each dimension. @@ -1319,7 +1323,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1346,6 +1350,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1516,10 +1521,10 @@ #define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2152,11 +2157,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2181,7 +2186,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/delta/Tevo Little Monster/Configuration_adv.h b/config/examples/delta/Tevo Little Monster/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/delta/Tevo Little Monster/Configuration_adv.h rename to config/examples/delta/Tevo Little Monster/Configuration_adv.h index 9193fdea6b..addcfb04fb 100644 --- a/Marlin/src/config/examples/delta/Tevo Little Monster/Configuration_adv.h +++ b/config/examples/delta/Tevo Little Monster/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 10 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -722,8 +773,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G27" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -912,6 +964,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -954,6 +1011,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -981,13 +1040,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1021,7 +1081,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1029,11 +1090,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1600,7 +1667,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1615,8 +1682,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2171,6 +2237,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/delta/generic/Configuration.h b/config/examples/delta/generic/Configuration.h similarity index 96% rename from Marlin/src/config/examples/delta/generic/Configuration.h rename to config/examples/delta/generic/Configuration.h index 57d9b0509b..8ac52da201 100644 --- a/Marlin/src/config/examples/delta/generic/Configuration.h +++ b/config/examples/delta/generic/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 0 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -545,6 +547,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -592,7 +595,7 @@ #define DELTA_CALIBRATION_DEFAULT_POINTS 4 #endif - #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) + #if EITHER(DELTA_AUTO_CALIBRATION, 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 @@ -886,6 +889,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1127,7 +1141,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1220,7 +1234,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1239,13 +1253,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. // Works best with 5 or more points in each dimension. @@ -1315,7 +1330,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1342,6 +1357,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1512,10 +1528,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2148,11 +2164,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2177,7 +2193,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h b/config/examples/delta/generic/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h rename to config/examples/delta/generic/Configuration_adv.h index bb5c2316de..b267a6df22 100644 --- a/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h +++ b/config/examples/delta/generic/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -574,6 +625,7 @@ #define CALIBRATION_PIN_PULLUP #endif #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 @@ -721,8 +773,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -911,6 +964,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -953,6 +1011,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -980,13 +1040,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1020,7 +1081,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1028,11 +1090,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1599,7 +1667,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1614,8 +1682,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2182,6 +2249,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/delta/kossel_mini/Configuration.h b/config/examples/delta/kossel_mini/Configuration.h similarity index 96% rename from Marlin/src/config/examples/delta/kossel_mini/Configuration.h rename to config/examples/delta/kossel_mini/Configuration.h index 741611ead6..50f64134bd 100644 --- a/Marlin/src/config/examples/delta/kossel_mini/Configuration.h +++ b/config/examples/delta/kossel_mini/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 11 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 5 -// 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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -545,6 +547,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -592,7 +595,7 @@ #define DELTA_CALIBRATION_DEFAULT_POINTS 4 #endif - #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) + #if EITHER(DELTA_AUTO_CALIBRATION, 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) // Set the steprate for papertest probing @@ -886,6 +889,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1129,7 +1143,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1222,7 +1236,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1241,13 +1255,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. // Works best with 5 or more points in each dimension. @@ -1317,7 +1332,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1344,6 +1359,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1514,10 +1530,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2150,11 +2166,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2179,7 +2195,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/delta/Geeetech/Rostock 301/Configuration_adv.h b/config/examples/delta/kossel_mini/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/delta/Geeetech/Rostock 301/Configuration_adv.h rename to config/examples/delta/kossel_mini/Configuration_adv.h index 98cafe1e95..6c599d27e4 100644 --- a/Marlin/src/config/examples/delta/Geeetech/Rostock 301/Configuration_adv.h +++ b/config/examples/delta/kossel_mini/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -574,7 +625,6 @@ #define CALIBRATION_PIN_PULLUP #endif #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 @@ -722,8 +772,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -912,6 +963,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -954,6 +1010,7 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) @@ -982,13 +1039,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1022,7 +1080,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1030,11 +1089,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1601,7 +1666,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1616,8 +1681,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2184,6 +2248,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/delta/kossel_pro/Configuration.h b/config/examples/delta/kossel_pro/Configuration.h similarity index 96% rename from Marlin/src/config/examples/delta/kossel_pro/Configuration.h rename to config/examples/delta/kossel_pro/Configuration.h index 02c4a451e4..ff9a1bfbac 100644 --- a/Marlin/src/config/examples/delta/kossel_pro/Configuration.h +++ b/config/examples/delta/kossel_pro/Configuration.h @@ -222,10 +222,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -381,6 +381,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 5 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -391,37 +392,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -531,6 +533,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -578,7 +581,7 @@ #define DELTA_CALIBRATION_DEFAULT_POINTS 4 #endif - #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) + #if EITHER(DELTA_AUTO_CALIBRATION, 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) // Set the steprate for papertest probing @@ -879,6 +882,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1130,7 +1144,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1223,7 +1237,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1242,13 +1256,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. // Works best with 5 or more points in each dimension. @@ -1318,7 +1333,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1345,6 +1360,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1515,10 +1531,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2151,11 +2167,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2180,7 +2196,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/delta/kossel_pro/README.md b/config/examples/delta/kossel_pro/README.md similarity index 100% rename from Marlin/src/config/examples/delta/kossel_pro/README.md rename to config/examples/delta/kossel_pro/README.md diff --git a/Marlin/src/config/examples/delta/kossel_xl/Configuration.h b/config/examples/delta/kossel_xl/Configuration.h similarity index 96% rename from Marlin/src/config/examples/delta/kossel_xl/Configuration.h rename to config/examples/delta/kossel_xl/Configuration.h index cbab19958b..012e723e5b 100644 --- a/Marlin/src/config/examples/delta/kossel_xl/Configuration.h +++ b/config/examples/delta/kossel_xl/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 5 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -549,6 +551,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -596,7 +599,7 @@ #define DELTA_CALIBRATION_DEFAULT_POINTS 4 #endif - #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) + #if EITHER(DELTA_AUTO_CALIBRATION, 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 @@ -889,6 +892,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1130,7 +1144,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1223,7 +1237,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1242,13 +1256,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. // Works best with 5 or more points in each dimension. @@ -1318,7 +1333,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1345,6 +1360,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1515,10 +1531,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2151,11 +2167,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2180,7 +2196,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h b/config/examples/delta/kossel_xl/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h rename to config/examples/delta/kossel_xl/Configuration_adv.h index d35891d8da..4380c01d0e 100644 --- a/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h +++ b/config/examples/delta/kossel_xl/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #define Z_HOME_BUMP_MM 2 // deltas need the same for all three axes #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -722,8 +773,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -912,6 +964,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -954,6 +1011,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -981,13 +1040,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1021,7 +1081,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1029,11 +1090,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1600,7 +1667,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1615,8 +1682,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2183,6 +2249,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/delta/kossel_xl/README.md b/config/examples/delta/kossel_xl/README.md similarity index 100% rename from Marlin/src/config/examples/delta/kossel_xl/README.md rename to config/examples/delta/kossel_xl/README.md diff --git a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h b/config/examples/gCreate/gMax1.5+/Configuration.h similarity index 96% rename from Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h rename to config/examples/gCreate/gMax1.5+/Configuration.h index 866210d849..bd890b64a6 100644 --- a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h +++ b/config/examples/gCreate/gMax1.5+/Configuration.h @@ -223,10 +223,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -385,6 +385,7 @@ // a Fortek SSR to do it. If you are using an unaltered gCreate machine, this needs // to be set to 0 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -395,37 +396,38 @@ //#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 16 // (seconds) -#define TEMP_HYSTERESIS 12 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 5 // (degC) Window around target to start the residency timer x degC early. +#define TEMP_RESIDENCY_TIME 16 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 5 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 12 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (Use MINTEMP for thermistor short/failure protection.) #define HEATER_0_MAXTEMP 245 #define HEATER_1_MAXTEMP 245 #define HEATER_2_MAXTEMP 245 #define HEATER_3_MAXTEMP 245 #define HEATER_4_MAXTEMP 245 #define HEATER_5_MAXTEMP 245 -#define BED_MAXTEMP 115 +#define BED_MAXTEMP 115 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -558,6 +560,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -1026,7 +1029,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1119,7 +1122,7 @@ */ #define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1138,13 +1141,14 @@ #if ENABLED(G26_MESH_VALIDATION) #define MESH_TEST_NOZZLE_SIZE 0.5 // (mm) Diameter of primary nozzle. #define MESH_TEST_LAYER_HEIGHT 0.3 // (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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1213,7 +1217,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) #define PROBE_PT_1_X 53 #define PROBE_PT_1_Y 323 #define PROBE_PT_2_X 53 @@ -1240,6 +1244,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1411,10 +1416,10 @@ #define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2047,11 +2052,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2076,7 +2081,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h b/config/examples/gCreate/gMax1.5+/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h rename to config/examples/gCreate/gMax1.5+/Configuration_adv.h index 97c79c0aa8..0be67b634e 100644 --- a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h +++ b/config/examples/gCreate/gMax1.5+/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 3 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G27" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/gCreate/gMax1.5+/_Bootscreen.h b/config/examples/gCreate/gMax1.5+/_Bootscreen.h similarity index 100% rename from Marlin/src/config/examples/gCreate/gMax1.5+/_Bootscreen.h rename to config/examples/gCreate/gMax1.5+/_Bootscreen.h diff --git a/Marlin/src/config/examples/makibox/Configuration.h b/config/examples/makibox/Configuration.h similarity index 96% rename from Marlin/src/config/examples/makibox/Configuration.h rename to config/examples/makibox/Configuration.h index 962a7de2f5..61a6c89d97 100644 --- a/Marlin/src/config/examples/makibox/Configuration.h +++ b/config/examples/makibox/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 12 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -548,6 +550,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -817,6 +820,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1015,7 +1029,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1108,7 +1122,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1127,13 +1141,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1202,7 +1217,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1229,6 +1244,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1400,10 +1416,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2036,11 +2052,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2065,7 +2081,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/makibox/Configuration_adv.h b/config/examples/makibox/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/makibox/Configuration_adv.h rename to config/examples/makibox/Configuration_adv.h index 8649933261..5fb70cab6b 100644 --- a/Marlin/src/config/examples/makibox/Configuration_adv.h +++ b/config/examples/makibox/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/tvrrug/Round2/Configuration.h b/config/examples/tvrrug/Round2/Configuration.h similarity index 96% rename from Marlin/src/config/examples/tvrrug/Round2/Configuration.h rename to config/examples/tvrrug/Round2/Configuration.h index c55a81e165..80f837ec7e 100644 --- a/Marlin/src/config/examples/tvrrug/Round2/Configuration.h +++ b/config/examples/tvrrug/Round2/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 5 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -534,6 +536,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -809,6 +812,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1007,7 +1021,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1100,7 +1114,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1119,13 +1133,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1194,7 +1209,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1221,6 +1236,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1392,10 +1408,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2028,11 +2044,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2057,7 +2073,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h b/config/examples/tvrrug/Round2/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h rename to config/examples/tvrrug/Round2/Configuration_adv.h index c09a4916b0..95be68dd89 100644 --- a/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h +++ b/config/examples/tvrrug/Round2/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #define Z_HOME_BUMP_MM 1 #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -720,8 +774,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G27" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -910,6 +965,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -952,6 +1012,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -979,13 +1041,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1019,7 +1082,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1027,11 +1091,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1598,7 +1668,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1613,8 +1683,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2181,6 +2250,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /** diff --git a/Marlin/src/config/examples/wt150/Configuration.h b/config/examples/wt150/Configuration.h similarity index 96% rename from Marlin/src/config/examples/wt150/Configuration.h rename to config/examples/wt150/Configuration.h index 46f0aea375..a342d543c7 100644 --- a/Marlin/src/config/examples/wt150/Configuration.h +++ b/config/examples/wt150/Configuration.h @@ -218,10 +218,10 @@ */ //#define MAGNETIC_PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER) +#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #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_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder //#define MANUAL_SOLENOID_CONTROL // Manual control of docking solenoids with M380 S / M381 #if ENABLED(PARKING_EXTRUDER) @@ -377,6 +377,7 @@ #define TEMP_SENSOR_5 0 #define TEMP_SENSOR_BED 0 #define TEMP_SENSOR_CHAMBER 0 +#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 @@ -387,37 +388,38 @@ //#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. +#define TEMP_RESIDENCY_TIME 10 // (seconds) Time to wait for hotend to "settle" in M109 +#define TEMP_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) Time to wait for bed to "settle" in M190 +#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer +#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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 +#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target -// 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. +// Below this temperature the heater will be switched off +// because it probably indicates a broken thermistor wire. +#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 +#define CHAMBER_MINTEMP 5 + +// Above this temperature the heater will be switched off. +// This can protect components from overheating, but NOT from shorts and failures. +// (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 +#define BED_MAXTEMP 150 +#define CHAMBER_MAXTEMP 100 //=========================================================================== //============================= PID Settings ================================ @@ -550,6 +552,7 @@ #define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders #define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber //=========================================================================== //============================= Mechanical Settings ========================= @@ -819,6 +822,17 @@ //#define BLTOUCH #if ENABLED(BLTOUCH) //#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed + + /** + * BLTouch V3.0 and newer smart series + * For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV. + * If the pin trigger is not detected, first try swapping the black and white wires then toggle this. + */ + //#define BLTOUCH_V3 + #if ENABLED(BLTOUCH_V3) + //#define BLTOUCH_FORCE_5V_MODE + //#define BLTOUCH_FORCE_OPEN_DRAIN_MODE + #endif #endif // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) @@ -1017,7 +1031,7 @@ #define MAX_SOFTWARE_ENDSTOP_Z #endif -#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS) +#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) //#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD #endif @@ -1110,7 +1124,7 @@ */ //#define DEBUG_LEVELING_FEATURE -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) +#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, 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 @@ -1129,13 +1143,14 @@ #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. + #define MESH_TEST_HOTEND_TEMP 205 // (°C) Default nozzle temperature for the G26 Mesh Validation Tool. + #define MESH_TEST_BED_TEMP 60 // (°C) Default bed temperature for the G26 Mesh Validation Tool. + #define G26_XY_FEEDRATE 20 // (mm/s) Feedrate for XY Moves for the G26 Mesh Validation Tool. #endif #endif -#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR) +#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) // Set the number of grid points per dimension. #define GRID_MAX_POINTS_X 3 @@ -1204,7 +1219,7 @@ * 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) +#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL) //#define PROBE_PT_1_X 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1231,6 +1246,7 @@ #if ENABLED(LEVEL_BED_CORNERS) #define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling #define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners + #define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points //#define LEVEL_CENTER_TOO // Move to the center after the last corner #endif @@ -1402,10 +1418,10 @@ //#define NOZZLE_PARK_FEATURE #if ENABLED(NOZZLE_PARK_FEATURE) - // Specify a park position as { X, Y, Z } + // Specify a park position as { X, Y, Z_raise } #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) + #define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis) + #define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers) #endif /** @@ -2038,11 +2054,11 @@ //#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 +#if EITHER(RGB_LED, 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 @@ -2067,7 +2083,7 @@ * - 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(PCA9533)|| ENABLED(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/Marlin/src/config/examples/wt150/Configuration_adv.h b/config/examples/wt150/Configuration_adv.h similarity index 93% rename from Marlin/src/config/examples/wt150/Configuration_adv.h rename to config/examples/wt150/Configuration_adv.h index 01c98b1ec0..57b840d695 100644 --- a/Marlin/src/config/examples/wt150/Configuration_adv.h +++ b/config/examples/wt150/Configuration_adv.h @@ -78,7 +78,7 @@ #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius //#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops - #if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP) + #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) //#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303 #endif @@ -112,6 +112,20 @@ #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #endif +/** + * Thermal Protection parameters for the heated chamber. + */ +#if ENABLED(THERMAL_PROTECTION_CHAMBER) + #define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds + #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius + + /** + * Heated chamber watch settings (M141/M191). + */ + #define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds + #define WATCH_CHAMBER_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. @@ -227,6 +241,33 @@ //#define FAN_MIN_PWM 50 //#define FAN_MAX_PWM 128 +/** + * FAST PWM FAN Settings + * + * Use to change the FAST FAN PWM frequency (if enabled in Configuration.h) + * Combinations of PWM Modes, prescale values and TOP resolutions are used internally to produce a + * frequency as close as possible to the desired frequency. + * + * FAST_PWM_FAN_FREQUENCY [undefined by default] + * Set this to your desired frequency. + * If left undefined this defaults to F = F_CPU/(2*255*1) + * ie F = 31.4 Khz on 16 MHz microcontrollers or F = 39.2 KHz on 20 MHz microcontrollers + * These defaults are the same as with the old FAST_PWM_FAN implementation - no migration is required + * NOTE: Setting very low frequencies (< 10 Hz) may result in unexpected timer behaviour. + * + * USE_OCR2A_AS_TOP [undefined by default] + * Boards that use TIMER2 for PWM have limitations resulting in only a few possible frequencies on TIMER2: + * 16MHz MCUs: [62.5KHz, 31.4KHz (default), 7.8KHz, 3.92KHz, 1.95KHz, 977Hz, 488Hz, 244Hz, 60Hz, 122Hz, 30Hz] + * 20MHz MCUs: [78.1KHz, 39.2KHz (default), 9.77KHz, 4.9KHz, 2.44KHz, 1.22KHz, 610Hz, 305Hz, 153Hz, 76Hz, 38Hz] + * A greater range can be achieved by enabling USE_OCR2A_AS_TOP. But note that this option blocks the use of + * PWM on pin OC2A. Only use this option if you don't need PWM on 0C2A. (Check your schematic.) + * USE_OCR2A_AS_TOP sacrifices duty cycle control resolution to achieve this broader range of frequencies. + */ +#if ENABLED(FAST_PWM_FAN) + //#define FAST_PWM_FAN_FREQUENCY 31400 + //#define USE_OCR2A_AS_TOP +#endif + // @section extruder /** @@ -363,31 +404,40 @@ * 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. + * + * The following Dual X Carriage modes can be selected with M605 S: + * + * 0 : (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) + * + * 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so + * that additional slicer support is not required. (M605 S1) + * + * 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with + * the first X-carriage and extruder, to print 2 copies of the same object at the same time. + * Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S2 to initiate duplicated movement. + * + * 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates + * the movement of the first except the second extruder is reversed in the X axis. + * Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and + * follow with M605 S3 to initiate mirrored movement. */ //#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]) + #define X1_MIN_POS X_MIN_POS // Set to X_MIN_POS + #define X1_MAX_POS X_BED_SIZE // Set a maximum so the first X-carriage can't hit the parked second X-carriage + #define X2_MIN_POS 80 // Set a minimum to ensure the second X-carriage can't hit the parked first X-carriage + #define X2_MAX_POS 353 // Set this to the distance between toolheads when both heads are homed + #define X2_HOME_DIR 1 // Set to 1. The second X-carriage always homes to the maximum endstop position + #define X2_HOME_POS X2_MAX_POS // Default X2 home position. Set to X2_MAX_POS. + // 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. // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE + #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_AUTO_PARK_MODE // Default x offset in duplication mode (typically set to half print bed width) #define DEFAULT_DUPLICATION_X_OFFSET 100 @@ -406,6 +456,7 @@ #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 +//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing // When G28 is called, this option will make Y home before X //#define HOME_Y_BEFORE_X @@ -438,8 +489,8 @@ #define AXIS_RELATIVE_MODES {false, false, false, false} -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE +// Add a Duplicate option for well-separated conjoined nozzles +//#define MULTI_NOZZLE_DUPLICATION // 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 @@ -463,8 +514,11 @@ // @section lcd -#if ENABLED(ULTIPANEL) +#if EITHER(ULTIPANEL, EXTENSIBLE_UI) #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel +#endif + +#if ENABLED(ULTIPANEL) #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 @@ -721,8 +775,9 @@ // 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 + //#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files + + #define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27") /** * Continue after Power-Loss (Creality3D) @@ -911,6 +966,11 @@ //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_HEAT_PERCENT // Show heating in a progress bar + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE + #endif // HAS_GRAPHICAL_LCD // @section safety @@ -953,6 +1013,8 @@ #endif #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + //#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 @@ -980,13 +1042,14 @@ */ //#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. + //#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants + #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) +#if EITHER(MESH_BED_LEVELING, 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 @@ -1020,7 +1083,8 @@ #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 MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle + #define N_ARC_CORRECTION 25 // Number of interpolated 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 @@ -1028,11 +1092,17 @@ // 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 +/** + * G38 Probe Target + * + * This option adds G38.2 and G38.3 (probe towards target) + * and optionally G38.4 and G38.5 (probe away from target). + * Set MULTIPLE_PROBING for G38 to probe more than once. + */ //#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) + //#define G38_PROBE_AWAY // Include G38.4 and G38.5 to probe away from target + #define G38_MINIMUM_MOVE 0.0275 // (mm) Minimum distance that will produce a move. #endif // Moves (or segments) with fewer steps than this will be joined with the next move @@ -1599,7 +1669,7 @@ */ //#define SENSORLESS_PROBING // TMC2130 only - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) + #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define X_STALL_SENSITIVITY 8 #define Y_STALL_SENSITIVITY 8 //#define Z_STALL_SENSITIVITY 8 @@ -1614,8 +1684,7 @@ /** * 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 + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -2182,6 +2251,8 @@ #if ENABLED(WIFISUPPORT) #define WIFI_SSID "Wifi SSID" #define WIFI_PWD "Wifi Password" + //#define WEBSUPPORT // Start a webserver with auto-discovery + //#define OTASUPPORT // Support over-the-air firmware updates #endif /**