diff --git a/.circleci/config.yml b/.circleci/config.yml index 7ac3d6078dfe..73fe1f0a373e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -67,7 +67,6 @@ jobs: echo testing megaatmega2560 targets... export TEST_PLATFORM="-e megaatmega2560" - restore_configs echo use_example_configs adafruit/ST7565 use_example_configs adafruit/ST7565 build_marlin_pio ./ ${TEST_PLATFORM} @@ -88,10 +87,10 @@ jobs: use_example_configs AliExpress/CL-260 build_marlin_pio ./ ${TEST_PLATFORM} restore_configs - echo use_example_configs Cartesio - use_example_configs Cartesio - build_marlin_pio ./ ${TEST_PLATFORM} - restore_configs + #echo use_example_configs Cartesio + #use_example_configs Cartesio + #build_marlin_pio ./ ${TEST_PLATFORM} + #restore_configs echo use_example_configs delta/FLSUN/auto_calibrate use_example_configs delta/FLSUN/auto_calibrate build_marlin_pio ./ ${TEST_PLATFORM} @@ -120,6 +119,10 @@ jobs: use_example_configs Felix/DUAL build_marlin_pio ./ ${TEST_PLATFORM} restore_configs + echo use_example_configs FolgerTech/i3-2020 + use_example_configs FolgerTech/i3-2020 + build_marlin_pio ./ ${TEST_PLATFORM} + restore_configs echo use_example_configs gCreate/gMax1.5+ use_example_configs gCreate/gMax1.5+ build_marlin_pio ./ ${TEST_PLATFORM} @@ -128,20 +131,17 @@ jobs: use_example_configs Geeetech/GT2560 build_marlin_pio ./ ${TEST_PLATFORM} restore_configs - echo use_example_configs Geeetech/I3_Pro_X-GT2560 - use_example_configs Geeetech/I3_Pro_X-GT2560 - build_marlin_pio ./ ${TEST_PLATFORM} - restore_configs + #echo use_example_configs Geeetech/I3_Pro_X-GT2560 + #use_example_configs Geeetech/I3_Pro_X-GT2560 + #build_marlin_pio ./ ${TEST_PLATFORM} + #restore_configs echo use_example_configs Infitary/i3-M508 use_example_configs Infitary/i3-M508 build_marlin_pio ./ ${TEST_PLATFORM} restore_configs - # - # Disabled due to compile failure on E0_AUTO_FAN_PIN PB8 - # - # use_example_configs Malyan/M200 - # build_marlin_pio ./ ${TEST_PLATFORM} - # restore_configs + use_example_configs Malyan/M200 + build_marlin_pio ./ ${TEST_PLATFORM} + restore_configs echo use_example_configs Micromake/C1/basic use_example_configs Micromake/C1/basic build_marlin_pio ./ ${TEST_PLATFORM} @@ -177,18 +177,13 @@ jobs: echo use_example_configs Wanhao/Duplicator6 use_example_configs Wanhao/Duplicator6 build_marlin_pio ./ ${TEST_PLATFORM} - # - # Disabled due to compile failure on https://github.com/stawel/SlowSoftI2CMaster - # - # - Requires https://github.com/stawel/SlowSoftI2CMaster - # restore_configs - # use_example_configs wt150 - # build_marlin_pio ./ ${TEST_PLATFORM} - - - echo testing anet10 targets... - export TEST_PLATFORM="-e anet10" restore_configs + # Requires manual load of https://github.com/stawel/SlowSoftI2CMaster + #use_example_configs wt150 + #build_marlin_pio ./ ${TEST_PLATFORM} + #restore_configs + echo testing melzi targets... + export TEST_PLATFORM="-e melzi" echo use_example_configs Anet/A6 use_example_configs Anet/A6 build_marlin_pio ./ ${TEST_PLATFORM} @@ -212,70 +207,57 @@ jobs: echo use_example_configs TinyBoy2 use_example_configs TinyBoy2 build_marlin_pio ./ ${TEST_PLATFORM} - + restore_configs echo testing rambo targets... export TEST_PLATFORM="-e rambo" - restore_configs echo use_example_configs AlephObjects/TAZ4 use_example_configs AlephObjects/TAZ4 build_marlin_pio ./ ${TEST_PLATFORM} - - - echo testing teensy20 targets... - export TEST_PLATFORM="-e teensy20" - # - # Disabled due to Z_MIN_PIN related compile failure - # - # restore_configs - # use_example_configs delta/kossel_pro - # build_marlin_pio ./ ${TEST_PLATFORM} restore_configs + + echo testing at90usb1286_* targets... + export TEST_PLATFORM="-e at90usb1286_dfu" + #echo se_example_configs delta/kossel_pro + #use_example_configs delta/kossel_pro + #build_marlin_pio ./ ${TEST_PLATFORM} + #restore_configs echo use_example_configs makibox use_example_configs makibox build_marlin_pio ./ ${TEST_PLATFORM} - + restore_configs echo testing sanguino_atmega644p targets... export TEST_PLATFORM="-e sanguino_atmega644p" - restore_configs echo use_example_configs tvrrug/Round2 use_example_configs tvrrug/Round2 build_marlin_pio ./ ${TEST_PLATFORM} - + restore_configs echo testing LPC1768 targets... export TEST_PLATFORM="-e LPC1768" + echo use_example_configs Mks/Sbase + use_example_configs Mks/Sbase + build_marlin_pio ./ ${TEST_PLATFORM} restore_configs - echo use_example_configs FolgerTech/i3-2020 - use_example_configs FolgerTech/i3-2020 + echo testing STM32F1 targets... + export TEST_PLATFORM="-e STM32F1" + restore_configs + echo use_example_configs STM32F10 + use_example_configs STM32F10 build_marlin_pio ./ ${TEST_PLATFORM} restore_configs - echo use_example_configs Mks/Sbase - use_example_configs Mks/Sbase + echo use_example_configs stm32f103ret6 + use_example_configs stm32f103ret6 build_marlin_pio ./ ${TEST_PLATFORM} + restore_configs - # - # Disabled due to numerous compile failures - # - # echo testing STM32F1 targets... - # export TEST_PLATFORM="-e STM32F1" - # restore_configs - # use_example_configs STM32F10 - # build_marlin_pio ./ ${TEST_PLATFORM} - # restore_configs - # use_example_configs stm32f103ret6 - # build_marlin_pio ./ ${TEST_PLATFORM} - - - # - # Disabled due do pin related compile failures - # - # echo testing DUE targets... - # export TEST_PLATFORM="-e DUE" - # restore_configs - # use_example_configs UltiMachine/Archim2 - # build_marlin_pio ./ ${TEST_PLATFORM} + echo testing DUE targets... + export TEST_PLATFORM="-e DUE" + #echo use_example_configs UltiMachine/Archim2 + #use_example_configs UltiMachine/Archim2 + #build_marlin_pio ./ ${TEST_PLATFORM} + #restore_configs # # Remove temp files from dependencies tree prior to caching diff --git a/.gitignore b/.gitignore index 7a364bbd4276..e54e6522ce13 100755 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ # # Marlin 3D Printer Firmware -# Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] +# Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] # # Based on Sprinter and grbl. # Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/.travis.yml b/.travis.yml index 25a0c514235b..dec966c92355 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ dist: trusty -sudo: false +sudo: require language: python python: @@ -19,10 +19,21 @@ env: - TEST_PLATFORM="megaatmega2560" - TEST_PLATFORM="DUE" - TEST_PLATFORM="LPC1768" - - TEST_PLATFORM="STM32F1" + - TEST_PLATFORM="LPC1769" + #- TEST_PLATFORM="STM32F1" - TEST_PLATFORM="teensy35" + - TEST_PLATFORM="linux_native" + - TEST_PLATFORM="esp32" + +addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-7 before_install: + - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 90 # # Fetch the tag information for the current branch - git fetch origin --tags diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index be95534845bc..f3bf98751f40 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -73,9 +73,9 @@ // 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 "(V1 Engineering, Ryan, 302)" // Who made the changes. +#define STRING_CONFIG_H_AUTHOR "(V1 Engineering, Ryan, 402)" // Who made the changes. #define SHOW_BOOTSCREEN -#define STRING_SPLASH_LINE1 "302 " SHORT_BUILD_VERSION // will be shown during bootup in line 1 +#define STRING_SPLASH_LINE1 "402 " 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 /** @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 999 #define TEMP_SENSOR_1 0 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -416,7 +471,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -501,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 ========================= @@ -579,19 +635,20 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] - */ -#define X_DRIVER_TYPE DRV8825 -#define Y_DRIVER_TYPE DRV8825 -#define Z_DRIVER_TYPE DRV8825 -#define X2_DRIVER_TYPE DRV8825 -#define Y2_DRIVER_TYPE DRV8825 -#define Z2_DRIVER_TYPE DRV8825 + * 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 DRV8825 -#define E1_DRIVER_TYPE DRV8825 -#define E2_DRIVER_TYPE DRV8825 +//#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 @@ -654,7 +711,7 @@ * Override with M201 * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] */ -#define DEFAULT_MAX_ACCELERATION { 400, 400, 200, 2000 } +#define DEFAULT_MAX_ACCELERATION { 400, 400, 100, 2000 } /** * Default Acceleration (change/s) change = mm/s @@ -668,6 +725,14 @@ #define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration for retracts #define DEFAULT_TRAVEL_ACCELERATION 400 // 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.005 // (mm) Distance from real junction edge +#endif + /** * Default Jerk (mm/s) * Override with M205 X Y Z E @@ -676,10 +741,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 3.0 -#define DEFAULT_YJERK 3.0 -#define DEFAULT_ZJERK 0.2 -#define DEFAULT_EJERK 5.0 +#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 @@ -708,11 +776,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -722,11 +790,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -761,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) @@ -851,6 +927,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -959,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 @@ -977,6 +1056,9 @@ #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 @@ -1049,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 @@ -1068,13 +1150,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 @@ -1143,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 @@ -1169,6 +1252,8 @@ #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 @@ -1284,7 +1369,7 @@ // 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 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. @@ -1340,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 /** @@ -1567,7 +1652,7 @@ // // Add individual axis homing items (Home X, Home Y, and Home Z) to the LCD menu. // -#define INDIVIDUAL_AXIS_HOMING_MENU +//#define INDIVIDUAL_AXIS_HOMING_MENU // // SPEAKER/BUZZER @@ -1710,11 +1795,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1813,6 +1905,18 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_MINI_12864 +#ifdef FYSETC_MINI_12864 + #define FYSETC_MINI_12864_REV_1_2 // types C, D, E & F back light is monochrome (always on) - discrete RGB signals + //#define FYSETC_MINI_12864_REV_2_0 // types A & B back light is RGB - requires LED_USER_PRESET_STARTUP - discrete RGB signals + //#define FYSETC_MINI_12864_REV_2_1 // types A & B back light is RGB - requires LED_USER_PRESET_STARTUP - RGB + //#define FYSETC_MINI_12864_REV_2_1 // types A & B back light is RGB - requires LED_USER_PRESET_STARTUP - Neopixel +#endif + // // 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 @@ -1861,6 +1965,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1906,6 +2019,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1919,10 +2033,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1935,6 +2045,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 * @@ -1960,11 +2074,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 @@ -1989,7 +2103,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(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 d247d6696f97..819b7e9178ff 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -399,8 +467,9 @@ #define X_HOME_BUMP_MM 7 #define Y_HOME_BUMP_MM 7 #define Z_HOME_BUMP_MM 3 -#define HOMING_BUMP_DIVISOR { 4, 4, 6 } // Re-Bump Speed Divisor (Divides the Homing Feedrate) +#define HOMING_BUMP_DIVISOR { 4, 4, 5 } // 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 @@ -433,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 @@ -483,11 +552,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.005 // (mm) Distance from real junction edge +//#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 /** @@ -545,6 +692,7 @@ * A (A shifted) B (B shifted) IC * Smoothie 0x2C (0x58) 0x2D (0x5A) MCP4451 * AZTEEG_X3_PRO 0x2C (0x58) 0x2E (0x5C) MCP4451 + * AZTEEG_X5_MINI 0x2C (0x58) 0x2E (0x5C) MCP4451 * AZTEEG_X5_MINI_WIFI 0x58 0x5C MCP4451 * MIGHTYBOARD_REVE 0x2F (0x5E) MCP4018 */ @@ -571,6 +719,13 @@ #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 @@ -595,7 +750,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +785,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +903,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +955,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +985,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1021,7 @@ */ //#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. @@ -853,12 +1030,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 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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) @@ -887,13 +1066,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 @@ -916,13 +1096,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -933,7 +1107,8 @@ #define ARC_SUPPORT // Disable this feature to save ~3226 bytes #if ENABLED(ARC_SUPPORT) #define MM_PER_ARC_SEGMENT .15 // 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 @@ -941,11 +1116,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 @@ -1125,6 +1306,7 @@ //#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 @@ -1175,6 +1357,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. @@ -1202,127 +1385,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #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 - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E1) + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + #define E1_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #if AXIS_IS_TMC(E2) + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + #define E2_RSENSE 0.11 + #endif - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1332,13 +1596,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1346,7 +1637,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1357,9 +1648,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1379,6 +1671,7 @@ #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. @@ -1400,7 +1693,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 @@ -1412,27 +1705,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1449,62 +1725,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define 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 - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1544,12 +1904,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1640,11 +2018,6 @@ */ #define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1727,7 +2100,7 @@ #define CUSTOM_USER_MENUS #if ENABLED(CUSTOM_USER_MENUS) #define CUSTOM_USER_MENU_TITLE "Custom Commands" - #define USER_SCRIPT_DONE "M117 User Coomand Done" + #define USER_SCRIPT_DONE "M117 User Script Done" #define USER_SCRIPT_AUDIBLE_FEEDBACK //#define USER_SCRIPT_RETURN // Return to status screen after a script @@ -1748,35 +2121,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1898,7 +2275,83 @@ #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/Makefile b/Marlin/Makefile index 864ee949d1cf..a62bccd42073 100644 --- a/Marlin/Makefile +++ b/Marlin/Makefile @@ -196,6 +196,7 @@ else ifeq ($(HARDWARE_MOTHERBOARD),7) # Ultimaker (Older electronics. Pre 1.5.4. This is rare) else ifeq ($(HARDWARE_MOTHERBOARD),71) MCU ?= atmega1280 + # Azteeg X3 else ifeq ($(HARDWARE_MOTHERBOARD),67) # Azteeg X3 Pro @@ -206,6 +207,8 @@ else ifeq ($(HARDWARE_MOTHERBOARD),72) else ifeq ($(HARDWARE_MOTHERBOARD),80) # Raise3D Rumba else ifeq ($(HARDWARE_MOTHERBOARD),333) +# Rapide Lite RL200 Rumba +else ifeq ($(HARDWARE_MOTHERBOARD),801) # Formbot T-Rex 2 Plus else ifeq ($(HARDWARE_MOTHERBOARD),95) # Formbot T-Rex 3 @@ -228,6 +231,12 @@ else ifeq ($(HARDWARE_MOTHERBOARD),243) else ifeq ($(HARDWARE_MOTHERBOARD),244) # Fysetc F6 else ifeq ($(HARDWARE_MOTHERBOARD),541) +# Duplicator i3 Plus +else ifeq ($(HARDWARE_MOTHERBOARD),31) +# VORON +else ifeq ($(HARDWARE_MOTHERBOARD),441) +# TRONXY V3 1.0 +else ifeq ($(HARDWARE_MOTHERBOARD),442) # # Other ATmega1280, ATmega2560 @@ -269,10 +278,16 @@ else ifeq ($(HARDWARE_MOTHERBOARD),999) else ifeq ($(HARDWARE_MOTHERBOARD),310) # abee Scoovo X9H else ifeq ($(HARDWARE_MOTHERBOARD),321) +# Geeetech GT2560 Rev B for Mecreator2 +else ifeq ($(HARDWARE_MOTHERBOARD),73) # Geeetech GT2560 Rev. A else ifeq ($(HARDWARE_MOTHERBOARD),74) # Geeetech GT2560 Rev. A+ (with auto level probe) else ifeq ($(HARDWARE_MOTHERBOARD),75) +# Geeetech GT2560 Rev B for A10(M/D) +else ifeq ($(HARDWARE_MOTHERBOARD),76) +# Geeetech GT2560 Rev B for A20(M/D) +else ifeq ($(HARDWARE_MOTHERBOARD),86) # # ATmega1281, ATmega2561 @@ -659,7 +674,7 @@ ASFLAGS := $(CDEFS) ifeq ($(HARDWARE_VARIANT), archim) LD_PREFIX = -Wl,--gc-sections,-Map,Marlin.ino.map,--cref,--check-sections,--entry=Reset_Handler,--unresolved-symbols=report-all,--warn-common,--warn-section-align LD_SUFFIX = $(LDLIBS) - LDFLAGS = -lm -gcc -T$(LDSCRIPT) -u _sbrk -u link -u _close -u _fstat -u _isatty -u _lseek -u _read -u _write -u _exit -u kill -u _getpid + LDFLAGS = -lm -T$(LDSCRIPT) -u _sbrk -u link -u _close -u _fstat -u _isatty -u _lseek -u _read -u _write -u _exit -u kill -u _getpid else LD_PREFIX = -Wl,--gc-sections,--relax LDFLAGS = -lm @@ -736,7 +751,7 @@ ifeq (${AVRDUDE_PROGRAMMER}, arduino) stty -hup < $(UPLOAD_PORT); true endif - # Display size of file. +# Display size of file. HEXSIZE = $(SIZE) --target=$(FORMAT) $(BUILD_DIR)/$(TARGET).hex ELFSIZE = $(SIZE) $(SIZE_FLAGS) $(BUILD_DIR)/$(TARGET).elf; \ $(SIZE) $(BUILD_DIR)/$(TARGET).elf @@ -786,7 +801,7 @@ extcoff: $(TARGET).elf .elf.sym: $(NM) -n $< > $@ - # Link: create ELF output file from library. +# Link: create ELF output file from library. $(BUILD_DIR)/$(TARGET).elf: $(OBJ) Configuration.h $(Pecho) " CXX $@" diff --git a/Marlin/src/HAL/HAL_AVR/HAL.cpp b/Marlin/src/HAL/HAL_AVR/HAL.cpp index e69455976167..2bfbccdf2dd1 100644 --- a/Marlin/src/HAL/HAL_AVR/HAL.cpp +++ b/Marlin/src/HAL/HAL_AVR/HAL.cpp @@ -1,7 +1,7 @@ /* ************************************************************************** Marlin 3D Printer Firmware - Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com diff --git a/Marlin/src/HAL/HAL_AVR/HAL.h b/Marlin/src/HAL/HAL_AVR/HAL.h index 2992ebe0e3f7..b5b63dc5d146 100644 --- a/Marlin/src/HAL/HAL_AVR/HAL.h +++ b/Marlin/src/HAL/HAL_AVR/HAL.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 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 @@ -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/HAL_spi_AVR.cpp b/Marlin/src/HAL/HAL_AVR/HAL_spi_AVR.cpp index 4e4b2481829c..a3fe161251ab 100644 --- a/Marlin/src/HAL/HAL_AVR/HAL_spi_AVR.cpp +++ b/Marlin/src/HAL/HAL_AVR/HAL_spi_AVR.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -27,8 +27,6 @@ /** * Description: HAL for AVR - SPI functions - * - * For __AVR__ */ #ifdef __AVR__ @@ -68,10 +66,12 @@ void spiBegin (void) { } -//------------------------------------------------------------------------------ #if DISABLED(SOFTWARE_SPI) - // functions for hardware SPI + //------------------------------------------------------------------------------ + // Hardware SPI + //------------------------------------------------------------------------------ + // make sure SPCR rate is in expected bits #if (SPR0 != 0 || SPR1 != 1) #error "unexpected SPCR bits" @@ -95,14 +95,13 @@ void spiBegin (void) { SPSR = spiRate & 1 || spiRate == 6 ? 0 : _BV(SPI2X); } - //------------------------------------------------------------------------------ /** SPI receive a byte */ uint8_t spiRec(void) { SPDR = 0xFF; while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ } return SPDR; } - //------------------------------------------------------------------------------ + /** SPI read data */ void spiRead(uint8_t* buf, uint16_t nbyte) { if (nbyte-- == 0) return; @@ -115,13 +114,13 @@ void spiBegin (void) { while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ } buf[nbyte] = SPDR; } - //------------------------------------------------------------------------------ + /** SPI send a byte */ void spiSend(uint8_t b) { SPDR = b; while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ } } - //------------------------------------------------------------------------------ + /** SPI send block */ void spiSendBlock(uint8_t token, const uint8_t* buf) { SPDR = token; @@ -191,25 +190,21 @@ void spiBegin (void) { } - //------------------------------------------------------------------------------ -#else // SOFTWARE_SPI - //------------------------------------------------------------------------------ +#else + /** nop to tune soft SPI timing */ #define nop asm volatile ("\tnop\n") /** Set SPI rate */ void spiInit(uint8_t spiRate) { - // nothing to do - UNUSED(spiRate); + UNUSED(spiRate); // nothing to do } /** Begin SPI transaction, set clock, bit order, data mode */ void spiBeginTransaction(uint32_t spiClock, uint8_t bitOrder, uint8_t dataMode) { - // nothing to do - UNUSED(spiBeginTransaction); + UNUSED(spiBeginTransaction); // nothing to do } - //------------------------------------------------------------------------------ /** Soft SPI receive byte */ uint8_t spiRec() { uint8_t data = 0; @@ -221,8 +216,7 @@ void spiBegin (void) { for (uint8_t i = 0; i < 8; i++) { WRITE(SCK_PIN, HIGH); - // adjust so SCK is nice - nop; + nop; // adjust so SCK is nice nop; data <<= 1; @@ -231,48 +225,45 @@ void spiBegin (void) { WRITE(SCK_PIN, LOW); } - // enable interrupts + sei(); return data; } - //------------------------------------------------------------------------------ + /** Soft SPI read data */ void spiRead(uint8_t* buf, uint16_t nbyte) { for (uint16_t i = 0; i < nbyte; i++) buf[i] = spiRec(); } - //------------------------------------------------------------------------------ + /** Soft SPI send byte */ void spiSend(uint8_t data) { // no interrupts during byte send - about 8µs cli(); for (uint8_t i = 0; i < 8; i++) { WRITE(SCK_PIN, LOW); - WRITE(MOSI_PIN, data & 0x80); - data <<= 1; - WRITE(SCK_PIN, HIGH); } - // hold SCK high for a few ns - nop; + + nop; // hold SCK high for a few ns nop; nop; nop; WRITE(SCK_PIN, LOW); - // enable interrupts + sei(); } - //------------------------------------------------------------------------------ + /** Soft SPI send block */ void spiSendBlock(uint8_t token, const uint8_t* buf) { spiSend(token); for (uint16_t i = 0; i < 512; i++) spiSend(buf[i]); } -#endif // SOFTWARE_SPI +#endif // SOFTWARE_SPI #endif // __AVR__ diff --git a/Marlin/src/HAL/HAL_AVR/MarlinSerial.cpp b/Marlin/src/HAL/HAL_AVR/MarlinSerial.cpp index 36134f7b89fc..9bc224bd2b78 100644 --- a/Marlin/src/HAL/HAL_AVR/MarlinSerial.cpp +++ b/Marlin/src/HAL/HAL_AVR/MarlinSerial.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -739,6 +739,24 @@ #endif // !USBCON && (UBRRH || UBRR0H || UBRR1H || UBRR2H || UBRR3H) +#ifdef INTERNAL_SERIAL_PORT + + ISR(SERIAL_REGNAME(USART,INTERNAL_SERIAL_PORT,_RX_vect)) { + MarlinSerial>::store_rxd_char(); + } + + ISR(SERIAL_REGNAME(USART,INTERNAL_SERIAL_PORT,_UDRE_vect)) { + MarlinSerial>::_tx_udr_empty_irq(); + } + + // Preinstantiate + template class MarlinSerial>; + + // Instantiate + MarlinSerial> internalSerial; + +#endif + // For AT90USB targets use the UART for BT interfacing #if defined(USBCON) && ENABLED(BLUETOOTH) HardwareSerial bluetoothSerial; diff --git a/Marlin/src/HAL/HAL_AVR/MarlinSerial.h b/Marlin/src/HAL/HAL_AVR/MarlinSerial.h index 132097eb493d..5ada120c6da4 100644 --- a/Marlin/src/HAL/HAL_AVR/MarlinSerial.h +++ b/Marlin/src/HAL/HAL_AVR/MarlinSerial.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -275,6 +275,24 @@ #endif // !USBCON + +#ifdef INTERNAL_SERIAL_PORT + template + struct MarlinInternalSerialCfg { + static constexpr int PORT = serial; + static constexpr unsigned int RX_SIZE = 32; + static constexpr unsigned int TX_SIZE = 32; + static constexpr bool XONOFF = false; + static constexpr bool EMERGENCYPARSER = false; + static constexpr bool DROPPED_RX = false; + static constexpr bool RX_OVERRUNS = false; + static constexpr bool RX_FRAMING_ERRORS = false; + static constexpr bool MAX_RX_QUEUED = false; + }; + + extern MarlinSerial> internalSerial; +#endif + // Use the UART for Bluetooth in AT90USB configurations #if defined(USBCON) && ENABLED(BLUETOOTH) extern HardwareSerial bluetoothSerial; diff --git a/Marlin/src/HAL/HAL_AVR/SanityCheck.h b/Marlin/src/HAL/HAL_AVR/SanityCheck.h index 4485b8f39b91..68bfdc16a01b 100644 --- a/Marlin/src/HAL/HAL_AVR/SanityCheck.h +++ b/Marlin/src/HAL/HAL_AVR/SanityCheck.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -35,12 +35,19 @@ #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." + #if !PIN_EXISTS(SPINDLE_LASER_ENA) + #error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENA_PIN." #elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR) #error "SPINDLE_DIR_PIN not defined." #elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM) @@ -97,20 +104,8 @@ #endif // SPINDLE_LASER_ENABLE /** - * TMC2208 software UART and ENDSTOP_INTERRUPTS both use pin change interrupts (PCI) + * The Trinamic library includes SoftwareSerial.h, leading to a compile error. */ -#if HAS_DRIVER(TMC2208) && ENABLED(ENDSTOP_INTERRUPTS_FEATURE) && !( \ - defined(X_HARDWARE_SERIAL ) \ - || defined(X2_HARDWARE_SERIAL) \ - || defined(Y_HARDWARE_SERIAL ) \ - || defined(Y2_HARDWARE_SERIAL) \ - || defined(Z_HARDWARE_SERIAL ) \ - || defined(Z2_HARDWARE_SERIAL) \ - || defined(Z3_HARDWARE_SERIAL) \ - || defined(E0_HARDWARE_SERIAL) \ - || defined(E1_HARDWARE_SERIAL) \ - || defined(E2_HARDWARE_SERIAL) \ - || defined(E3_HARDWARE_SERIAL) \ - || defined(E4_HARDWARE_SERIAL) ) - #error "Select hardware UART for TMC2208 to use both TMC2208 and ENDSTOP_INTERRUPTS_FEATURE." +#if HAS_TRINAMIC && ENABLED(ENDSTOP_INTERRUPTS_FEATURE) + #error "TMCStepper includes SoftwareSerial.h which is incompatible with ENDSTOP_INTERRUPTS_FEATURE. Disable ENDSTOP_INTERRUPTS_FEATURE to continue." #endif diff --git a/Marlin/src/HAL/HAL_AVR/ServoTimers.h b/Marlin/src/HAL/HAL_AVR/ServoTimers.h index c7c4587adc10..b63b69c82e96 100644 --- a/Marlin/src/HAL/HAL_AVR/ServoTimers.h +++ b/Marlin/src/HAL/HAL_AVR/ServoTimers.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_AVR/endstop_interrupts.h b/Marlin/src/HAL/HAL_AVR/endstop_interrupts.h index 791c9812af8f..c06670394221 100644 --- a/Marlin/src/HAL/HAL_AVR/endstop_interrupts.h +++ b/Marlin/src/HAL/HAL_AVR/endstop_interrupts.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm 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 000000000000..b38a4acea228 --- /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 601c515f7fb6..1e3c44a4f50c 100644 --- a/Marlin/src/HAL/HAL_AVR/fastio_1280.h +++ b/Marlin/src/HAL/HAL_AVR/fastio_1280.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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_1281.h b/Marlin/src/HAL/HAL_AVR/fastio_1281.h index 274bc6285bdd..9707c7d54b4d 100644 --- a/Marlin/src/HAL/HAL_AVR/fastio_1281.h +++ b/Marlin/src/HAL/HAL_AVR/fastio_1281.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_AVR/fastio_168.h b/Marlin/src/HAL/HAL_AVR/fastio_168.h index 36187bc698cd..2964ef5a0b74 100644 --- a/Marlin/src/HAL/HAL_AVR/fastio_168.h +++ b/Marlin/src/HAL/HAL_AVR/fastio_168.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_AVR/fastio_644.h b/Marlin/src/HAL/HAL_AVR/fastio_644.h index 1ad757380152..bcd825d24c1b 100644 --- a/Marlin/src/HAL/HAL_AVR/fastio_644.h +++ b/Marlin/src/HAL/HAL_AVR/fastio_644.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_AVR/fastio_AT90USB.h b/Marlin/src/HAL/HAL_AVR/fastio_AT90USB.h index 70cfcf39b7d1..805c0daf73cb 100644 --- a/Marlin/src/HAL/HAL_AVR/fastio_AT90USB.h +++ b/Marlin/src/HAL/HAL_AVR/fastio_AT90USB.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm 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 000000000000..63fbe4d96990 --- /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 448438c87ec0..a843f1ae753d 100644 --- a/Marlin/src/HAL/HAL_AVR/fastio_AVR.h +++ b/Marlin/src/HAL/HAL_AVR/fastio_AVR.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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/math_AVR.h b/Marlin/src/HAL/HAL_AVR/math_AVR.h index 64c9c7998eba..8299b8bbd33f 100644 --- a/Marlin/src/HAL/HAL_AVR/math_AVR.h +++ b/Marlin/src/HAL/HAL_AVR/math_AVR.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_AVR/persistent_store_eeprom.cpp b/Marlin/src/HAL/HAL_AVR/persistent_store_eeprom.cpp index 99b18001ad32..4c2f9ea4f1c5 100644 --- a/Marlin/src/HAL/HAL_AVR/persistent_store_eeprom.cpp +++ b/Marlin/src/HAL/HAL_AVR/persistent_store_eeprom.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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" @@ -39,8 +39,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui if (v != eeprom_read_byte(p)) { eeprom_write_byte(p, v); if (eeprom_read_byte(p) != v) { - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM(MSG_ERR_EEPROM_WRITE); + SERIAL_ECHO_MSG(MSG_ERR_EEPROM_WRITE); return true; } } diff --git a/Marlin/src/HAL/HAL_AVR/pinsDebug.h b/Marlin/src/HAL/HAL_AVR/pinsDebug.h index 9c0bebbdd413..8df4ffcf8734 100644 --- a/Marlin/src/HAL/HAL_AVR/pinsDebug.h +++ b/Marlin/src/HAL/HAL_AVR/pinsDebug.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -150,7 +150,7 @@ static bool pwm_status(uint8_t pin) { default: return false; } - SERIAL_PROTOCOL_SP(2); + SERIAL_ECHO_SP(2); } // pwm_status @@ -222,24 +222,24 @@ const volatile uint8_t* const PWM_OCR[][3] PROGMEM = { #define OCR_VAL(T, L) pgm_read_word(&PWM_OCR[T][L]) -static void err_is_counter() { SERIAL_PROTOCOLPGM(" non-standard PWM mode"); } -static void err_is_interrupt() { SERIAL_PROTOCOLPGM(" compare interrupt enabled"); } -static void err_prob_interrupt() { SERIAL_PROTOCOLPGM(" overflow interrupt enabled"); } -static void print_is_also_tied() { SERIAL_PROTOCOLPGM(" is also tied to this pin"); SERIAL_PROTOCOL_SP(14); } +static void err_is_counter() { SERIAL_ECHOPGM(" non-standard PWM mode"); } +static void err_is_interrupt() { SERIAL_ECHOPGM(" compare interrupt enabled"); } +static void err_prob_interrupt() { SERIAL_ECHOPGM(" overflow interrupt enabled"); } +static void print_is_also_tied() { SERIAL_ECHOPGM(" is also tied to this pin"); SERIAL_ECHO_SP(14); } void com_print(uint8_t N, uint8_t Z) { const uint8_t *TCCRA = (uint8_t*)TCCR_A(N); - SERIAL_PROTOCOLPGM(" COM"); - SERIAL_PROTOCOLCHAR(N + '0'); + SERIAL_ECHOPGM(" COM"); + SERIAL_CHAR(N + '0'); switch (Z) { case 'A': - SERIAL_PROTOCOLPAIR("A: ", ((*TCCRA & (_BV(7) | _BV(6))) >> 6)); + SERIAL_ECHOPAIR("A: ", ((*TCCRA & (_BV(7) | _BV(6))) >> 6)); break; case 'B': - SERIAL_PROTOCOLPAIR("B: ", ((*TCCRA & (_BV(5) | _BV(4))) >> 4)); + SERIAL_ECHOPAIR("B: ", ((*TCCRA & (_BV(5) | _BV(4))) >> 4)); break; case 'C': - SERIAL_PROTOCOLPAIR("C: ", ((*TCCRA & (_BV(3) | _BV(2))) >> 2)); + SERIAL_ECHOPAIR("C: ", ((*TCCRA & (_BV(3) | _BV(2))) >> 2)); break; } } @@ -251,10 +251,10 @@ void timer_prefix(uint8_t T, char L, uint8_t N) { // T - timer L - pwm N - uint8_t WGM = (((*TCCRB & _BV(WGM_2)) >> 1) | (*TCCRA & (_BV(WGM_0) | _BV(WGM_1)))); if (N == 4) WGM |= ((*TCCRB & _BV(WGM_3)) >> 1); - SERIAL_PROTOCOLPGM(" TIMER"); - SERIAL_PROTOCOLCHAR(T + '0'); - SERIAL_PROTOCOLCHAR(L); - SERIAL_PROTOCOL_SP(3); + SERIAL_ECHOPGM(" TIMER"); + SERIAL_CHAR(T + '0'); + SERIAL_CHAR(L); + SERIAL_ECHO_SP(3); if (N == 3) { const uint8_t *OCRVAL8 = (uint8_t*)OCR_VAL(T, L - 'A'); @@ -264,22 +264,22 @@ void timer_prefix(uint8_t T, char L, uint8_t N) { // T - timer L - pwm N - const uint16_t *OCRVAL16 = (uint16_t*)OCR_VAL(T, L - 'A'); PWM_PRINT(*OCRVAL16); } - SERIAL_PROTOCOLPAIR(" WGM: ", WGM); + SERIAL_ECHOPAIR(" WGM: ", WGM); com_print(T,L); - SERIAL_PROTOCOLPAIR(" CS: ", (*TCCRB & (_BV(CS_0) | _BV(CS_1) | _BV(CS_2)) )); + SERIAL_ECHOPAIR(" CS: ", (*TCCRB & (_BV(CS_0) | _BV(CS_1) | _BV(CS_2)) )); - SERIAL_PROTOCOLPGM(" TCCR"); - SERIAL_PROTOCOLCHAR(T + '0'); - SERIAL_PROTOCOLPAIR("A: ", *TCCRA); + SERIAL_ECHOPGM(" TCCR"); + SERIAL_CHAR(T + '0'); + SERIAL_ECHOPAIR("A: ", *TCCRA); - SERIAL_PROTOCOLPGM(" TCCR"); - SERIAL_PROTOCOLCHAR(T + '0'); - SERIAL_PROTOCOLPAIR("B: ", *TCCRB); + SERIAL_ECHOPGM(" TCCR"); + SERIAL_CHAR(T + '0'); + SERIAL_ECHOPAIR("B: ", *TCCRB); const uint8_t *TMSK = (uint8_t*)TIMSK(T); - SERIAL_PROTOCOLPGM(" TIMSK"); - SERIAL_PROTOCOLCHAR(T + '0'); - SERIAL_PROTOCOLPAIR(": ", *TMSK); + SERIAL_ECHOPGM(" TIMSK"); + SERIAL_CHAR(T + '0'); + SERIAL_ECHOPAIR(": ", *TMSK); const uint8_t OCIE = L - 'A' + 1; if (N == 3) { if (WGM == 0 || WGM == 2 || WGM == 4 || WGM == 6) err_is_counter(); } @@ -336,22 +336,22 @@ static void pwm_details(uint8_t pin) { case NOT_ON_TIMER: break; } - SERIAL_PROTOCOLPGM(" "); + SERIAL_ECHOPGM(" "); // on pins that have two PWMs, print info on second PWM #if AVR_ATmega2560_FAMILY || AVR_AT90USB1286_FAMILY // looking for port B7 - PWMs 0A and 1C if (digitalPinToPort_DEBUG(pin) == 'B' - 64 && 0x80 == digitalPinToBitMask_DEBUG(pin)) { #if !AVR_AT90USB1286_FAMILY - SERIAL_PROTOCOLPGM("\n ."); - SERIAL_PROTOCOL_SP(18); - SERIAL_PROTOCOLPGM("TIMER1C"); + SERIAL_ECHOPGM("\n ."); + SERIAL_ECHO_SP(18); + SERIAL_ECHOPGM("TIMER1C"); print_is_also_tied(); timer_prefix(1, 'C', 4); #else - SERIAL_PROTOCOLPGM("\n ."); - SERIAL_PROTOCOL_SP(18); - SERIAL_PROTOCOLPGM("TIMER0A"); + SERIAL_ECHOPGM("\n ."); + SERIAL_ECHO_SP(18); + SERIAL_ECHOPGM("TIMER0A"); print_is_also_tied(); timer_prefix(0, 'A', 3); #endif @@ -372,7 +372,7 @@ static void pwm_details(uint8_t pin) { void print_port(int8_t pin) { // print port number #ifdef digitalPinToPort_DEBUG uint8_t x; - SERIAL_PROTOCOLPGM(" Port: "); + SERIAL_ECHOPGM(" Port: "); #if AVR_AT90USB1286_FAMILY x = (pin == 46 || pin == 47) ? 'E' : digitalPinToPort_DEBUG(pin) + 64; #else @@ -395,7 +395,7 @@ static void pwm_details(uint8_t pin) { #endif SERIAL_CHAR(x); #else - SERIAL_PROTOCOL_SP(10); + SERIAL_ECHO_SP(10); #endif } diff --git a/Marlin/src/HAL/HAL_AVR/pinsDebug_Teensyduino.h b/Marlin/src/HAL/HAL_AVR/pinsDebug_Teensyduino.h index 8da9570743f4..e97d694bb08d 100644 --- a/Marlin/src/HAL/HAL_AVR/pinsDebug_Teensyduino.h +++ b/Marlin/src/HAL/HAL_AVR/pinsDebug_Teensyduino.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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/pinsDebug_plus_70.h b/Marlin/src/HAL/HAL_AVR/pinsDebug_plus_70.h index 99f83a03a4da..028c8f02a400 100644 --- a/Marlin/src/HAL/HAL_AVR/pinsDebug_plus_70.h +++ b/Marlin/src/HAL/HAL_AVR/pinsDebug_plus_70.h @@ -1,7 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_AVR/servo_AVR.cpp b/Marlin/src/HAL/HAL_AVR/servo_AVR.cpp index ea227b195640..e3d2194bf7f5 100644 --- a/Marlin/src/HAL/HAL_AVR/servo_AVR.cpp +++ b/Marlin/src/HAL/HAL_AVR/servo_AVR.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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_AVR/spi_pins.h b/Marlin/src/HAL/HAL_AVR/spi_pins.h index d3d241241665..85d2d8f6e5a0 100644 --- a/Marlin/src/HAL/HAL_AVR/spi_pins.h +++ b/Marlin/src/HAL/HAL_AVR/spi_pins.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_AVR/watchdog_AVR.cpp b/Marlin/src/HAL/HAL_AVR/watchdog_AVR.cpp index 8845fa04aca8..7c65a904f4af 100644 --- a/Marlin/src/HAL/HAL_AVR/watchdog_AVR.cpp +++ b/Marlin/src/HAL/HAL_AVR/watchdog_AVR.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -62,8 +62,7 @@ void watchdog_init() { #if ENABLED(WATCHDOG_RESET_MANUAL) ISR(WDT_vect) { sei(); // With the interrupt driven serial we need to allow interrupts. - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM(MSG_WATCHDOG_FIRED); + SERIAL_ERROR_MSG(MSG_WATCHDOG_FIRED); minkill(); // interrupt-safe final kill and infinite loop } #endif // WATCHDOG_RESET_MANUAL diff --git a/Marlin/src/HAL/HAL_AVR/watchdog_AVR.h b/Marlin/src/HAL/HAL_AVR/watchdog_AVR.h index ac55c9aebd5f..ed5150fe0893 100644 --- a/Marlin/src/HAL/HAL_AVR/watchdog_AVR.h +++ b/Marlin/src/HAL/HAL_AVR/watchdog_AVR.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_DUE/DebugMonitor_Due.cpp b/Marlin/src/HAL/HAL_DUE/DebugMonitor_Due.cpp index 40407f7f5d9b..89206fa94c9b 100644 --- a/Marlin/src/HAL/HAL_DUE/DebugMonitor_Due.cpp +++ b/Marlin/src/HAL/HAL_DUE/DebugMonitor_Due.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -231,7 +231,7 @@ void HardFault_HandlerC(unsigned long *sp, unsigned long lr, unsigned long cause // Reset controller NVIC_SystemReset(); - while(1) { WDT_Restart(WDT); } + for (;;) WDT_Restart(WDT); } __attribute__((naked)) void NMI_Handler(void) { diff --git a/Marlin/src/HAL/HAL_DUE/EepromEmulation_Due.cpp b/Marlin/src/HAL/HAL_DUE/EepromEmulation_Due.cpp index dfc7842ffd5c..21f1a8c9d40d 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 @@ -120,18 +120,18 @@ static uint8_t buffer[256] = {0}, // The RAM buffer to accumulate writes const uint8_t* c = (const uint8_t*) data; char buffer[80]; - sprintf(buffer, "Page: %d (0x%04x)\n", page, page); - SERIAL_PROTOCOL(buffer); + sprintf_P(buffer, PSTR("Page: %d (0x%04x)\n"), page, page); + SERIAL_ECHO(buffer); char* p = &buffer[0]; for (int i = 0; i< PageSize; ++i) { - if ((i & 0xF) == 0) p += sprintf(p,"%04x] ", i); + if ((i & 0xF) == 0) p += sprintf_P(p, PSTR("%04x] "), i); - p += sprintf(p," %02x", c[i]); + p += sprintf_P(p, PSTR(" %02x"), c[i]); if ((i & 0xF) == 0xF) { *p++ = '\n'; *p = 0; - SERIAL_PROTOCOL(buffer); + SERIAL_ECHO(buffer); p = &buffer[0]; } } @@ -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/G2_PWM.cpp b/Marlin/src/HAL/HAL_DUE/G2_PWM.cpp new file mode 100644 index 000000000000..cfb064097e0a --- /dev/null +++ b/Marlin/src/HAL/HAL_DUE/G2_PWM.cpp @@ -0,0 +1,145 @@ +/** + * 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 . + * + */ + +/** + * The PWM module is only used to generate interrupts at specified times. It + * is NOT used to directly toggle pins. The ISR writes to the pin assigned to + * that interrupt. + * + * All PWMs use the same repetition rate. The G2 needs about 10KHz min in order to + * not have obvious ripple on the Vref signals. + * + * The data structures are setup to minimize the computation done by the ISR which + * minimizes ISR execution time. Execution times are 0.8 to 1.1 microseconds. + * + * FIve PWM interrupt sources are used. Channel 0 sets the base period. All Vref + * signals are set active when this counter overflows and resets to zero. The compare + * values in channels 1-4 are set to give the desired duty cycle for that Vref pin. + * When counter 0 matches the compare value then that channel generates an interrupt. + * The ISR checks the source of the interrupt and sets the corresponding pin inactive. + * + * Some jitter in the Vref signal is OK so the interrupt priority is left at its default value. + */ + +#include "../../inc/MarlinConfig.h" + +#if MB(PRINTRBOARD_G2) + +#include "G2_PWM.h" + +volatile uint32_t *SODR_A = &PIOA->PIO_SODR, + *SODR_B = &PIOB->PIO_SODR, + *CODR_A = &PIOA->PIO_CODR, + *CODR_B = &PIOB->PIO_CODR; + +PWM_map ISR_table[NUM_PWMS] = PWM_MAP_INIT; + +void Stepper::digipot_init() { + + OUT_WRITE(MOTOR_CURRENT_PWM_X_PIN, 0); // init pins + OUT_WRITE(MOTOR_CURRENT_PWM_Y_PIN, 0); + OUT_WRITE(MOTOR_CURRENT_PWM_Z_PIN, 0); + OUT_WRITE(MOTOR_CURRENT_PWM_E_PIN, 0); + + #define WPKEY (0x50574D << 8) // “PWM” in ASCII + #define WPCMD_DIS_SW 0 // command to disable Write Protect SW + #define WPRG_ALL (PWM_WPCR_WPRG0 | PWM_WPCR_WPRG1 | PWM_WPCR_WPRG2 | PWM_WPCR_WPRG3 | PWM_WPCR_WPRG4 | PWM_WPCR_WPRG5) // all Write Protect Groups + + #define PWM_CLOCK_F F_CPU / 1000000UL // set clock to 1MHz + + PMC->PMC_PCER1 = PMC_PCER1_PID36; // enable PWM controller clock (disabled on power up) + + PWM->PWM_WPCR = WPKEY | WPRG_ALL | WPCMD_DIS_SW; // enable setting of all PWM registers + PWM->PWM_CLK = PWM_CLOCK_F; // enable CLK_A and set it to 1MHz, leave CLK_B disabled + PWM->PWM_CH_NUM[0].PWM_CMR = 0b1011; // set channel 0 to Clock A input & to left aligned + PWM->PWM_CH_NUM[1].PWM_CMR = 0b1011; // set channel 1 to Clock A input & to left aligned + PWM->PWM_CH_NUM[2].PWM_CMR = 0b1011; // set channel 2 to Clock A input & to left aligned + PWM->PWM_CH_NUM[3].PWM_CMR = 0b1011; // set channel 3 to Clock A input & to left aligned + PWM->PWM_CH_NUM[4].PWM_CMR = 0b1011; // set channel 4 to Clock A input & to left aligned + + PWM->PWM_CH_NUM[0].PWM_CPRD = PWM_PERIOD_US; // set channel 0 Period + + PWM->PWM_IER2 = PWM_IER1_CHID0; // generate interrupt when counter0 overflows + PWM->PWM_IER2 = PWM_IER2_CMPM0 | PWM_IER2_CMPM1 | PWM_IER2_CMPM2 | PWM_IER2_CMPM3 | PWM_IER2_CMPM4; // generate interrupt on compare event + + PWM->PWM_CMP[1].PWM_CMPV = 0x010000000LL | G2_VREF_COUNT(G2_VREF(motor_current_setting[0])); // interrupt when counter0 == CMPV - used to set Motor 1 PWM inactive + PWM->PWM_CMP[2].PWM_CMPV = 0x010000000LL | G2_VREF_COUNT(G2_VREF(motor_current_setting[0])); // interrupt when counter0 == CMPV - used to set Motor 2 PWM inactive + PWM->PWM_CMP[3].PWM_CMPV = 0x010000000LL | G2_VREF_COUNT(G2_VREF(motor_current_setting[1])); // interrupt when counter0 == CMPV - used to set Motor 3 PWM inactive + PWM->PWM_CMP[4].PWM_CMPV = 0x010000000LL | G2_VREF_COUNT(G2_VREF(motor_current_setting[2])); // interrupt when counter0 == CMPV - used to set Motor 4 PWM inactive + + PWM->PWM_CMP[1].PWM_CMPM = 0x0001; // enable compare event + PWM->PWM_CMP[2].PWM_CMPM = 0x0001; // enable compare event + PWM->PWM_CMP[3].PWM_CMPM = 0x0001; // enable compare event + PWM->PWM_CMP[4].PWM_CMPM = 0x0001; // enable compare event + + PWM->PWM_SCM = PWM_SCM_UPDM_MODE0 | PWM_SCM_SYNC0 | PWM_SCM_SYNC1 | PWM_SCM_SYNC2 | PWM_SCM_SYNC3 | PWM_SCM_SYNC4; // sync 1-4 with 0, use mode 0 for updates + + PWM->PWM_ENA = PWM_ENA_CHID0 | PWM_ENA_CHID1 | PWM_ENA_CHID2 | PWM_ENA_CHID3 | PWM_ENA_CHID4; // enable the channels used by G2 + PWM->PWM_IER1 = PWM_IER1_CHID0 | PWM_IER1_CHID1 | PWM_IER1_CHID2 | PWM_IER1_CHID3 | PWM_IER1_CHID4; // enable interrupts for the channels used by G2 + + NVIC_EnableIRQ(PWM_IRQn); // Enable interrupt handler + NVIC_SetPriority(PWM_IRQn, NVIC_EncodePriority(0, 10, 0)); // normal priority for PWM module (can stand some jitter on the Vref signals) +} + +void Stepper::digipot_current(const uint8_t driver, const int16_t current) { + + if (!(PWM->PWM_CH_NUM[0].PWM_CPRD == PWM_PERIOD_US)) digipot_init(); // Init PWM system if needed + + switch (driver) { + case 0: PWM->PWM_CMP[1].PWM_CMPVUPD = 0x010000000LL | G2_VREF_COUNT(G2_VREF(current)); // update X & Y + PWM->PWM_CMP[2].PWM_CMPVUPD = 0x010000000LL | G2_VREF_COUNT(G2_VREF(current)); + PWM->PWM_CMP[1].PWM_CMPMUPD = 0x0001; // enable compare event + PWM->PWM_CMP[2].PWM_CMPMUPD = 0x0001; // enable compare event + PWM->PWM_SCUC = PWM_SCUC_UPDULOCK; // tell the PWM controller to update the values on the next cycle + break; + case 1: PWM->PWM_CMP[3].PWM_CMPVUPD = 0x010000000LL | G2_VREF_COUNT(G2_VREF(current)); // update Z + PWM->PWM_CMP[3].PWM_CMPMUPD = 0x0001; // enable compare event + PWM->PWM_SCUC = PWM_SCUC_UPDULOCK; // tell the PWM controller to update the values on the next cycle + break; + default:PWM->PWM_CMP[4].PWM_CMPVUPD = 0x010000000LL | G2_VREF_COUNT(G2_VREF(current)); // update E + PWM->PWM_CMP[4].PWM_CMPMUPD = 0x0001; // enable compare event + PWM->PWM_SCUC = PWM_SCUC_UPDULOCK; // tell the PWM controller to update the values on the next cycle + break; + } +} + +volatile uint32_t PWM_ISR1_STATUS, PWM_ISR2_STATUS; + +void PWM_Handler() { + PWM_ISR1_STATUS = PWM->PWM_ISR1; + PWM_ISR2_STATUS = PWM->PWM_ISR2; + if (PWM_ISR1_STATUS & PWM_IER1_CHID0) { // CHAN_0 interrupt + *ISR_table[0].set_register = ISR_table[0].write_mask; // set X to active + *ISR_table[1].set_register = ISR_table[1].write_mask; // set Y to active + *ISR_table[2].set_register = ISR_table[2].write_mask; // set Z to active + *ISR_table[3].set_register = ISR_table[3].write_mask; // set E to active + } + else { + if (PWM_ISR2_STATUS & PWM_IER2_CMPM1) *ISR_table[0].clr_register = ISR_table[0].write_mask; // set X to inactive + if (PWM_ISR2_STATUS & PWM_IER2_CMPM2) *ISR_table[1].clr_register = ISR_table[1].write_mask; // set Y to inactive + if (PWM_ISR2_STATUS & PWM_IER2_CMPM3) *ISR_table[2].clr_register = ISR_table[2].write_mask; // set Z to inactive + if (PWM_ISR2_STATUS & PWM_IER2_CMPM4) *ISR_table[3].clr_register = ISR_table[3].write_mask; // set E to inactive + } + return; +} + +#endif // PRINTRBOARD_G2 diff --git a/Marlin/src/HAL/HAL_DUE/G2_PWM.h b/Marlin/src/HAL/HAL_DUE/G2_PWM.h new file mode 100644 index 000000000000..5cbeaceba987 --- /dev/null +++ b/Marlin/src/HAL/HAL_DUE/G2_PWM.h @@ -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 . + * + */ + +/** + * This module is stripped down version of the LPC1768_PWM.h file from + * PR #7500. It is hardwired for the PRINTRBOARD_G2 Motor Current needs. + */ + +#include "../../inc/MarlinConfigPre.h" +#include "../../module/stepper.h" +//C:\Users\bobku\Documents\GitHub\Marlin-Bob-2\Marlin\src\module\stepper.h +//C:\Users\bobku\Documents\GitHub\Marlin-Bob-2\Marlin\src\HAL\HAL_DUE\G2_PWM.h + +#define PWM_PERIOD_US 100 // base repetition rate in micro seconds + +typedef struct { // holds the data needed by the ISR to control the Vref pin + volatile uint32_t* set_register; + volatile uint32_t* clr_register; + uint32_t write_mask; +} PWM_map; + +#define G2_VREF(I) (uint32_t)(I * 5 * 0.15) // desired Vref * 1000 (scaled so don't loose accuracy in next step) + +#define G2_VREF_COUNT(Q) (uint32_t)map(constrain(Q, 500, 3.3 * 1000), 0, 3.3 * 1000, 0, PWM_PERIOD_US) // under 500 the results are very non-linear + +extern volatile uint32_t *SODR_A, *SODR_B, *CODR_A, *CODR_B; + +#define _PIN(IO) (DIO ## IO ## _PIN) + +#define PWM_MAP_INIT_ROW(IO,ZZ) { ZZ == 'A' ? SODR_A : SODR_B, ZZ == 'A' ? CODR_A : CODR_B, 1 << _PIN(IO) } + + +#define PWM_MAP_INIT { PWM_MAP_INIT_ROW(MOTOR_CURRENT_PWM_X_PIN, 'B'), \ + PWM_MAP_INIT_ROW(MOTOR_CURRENT_PWM_Y_PIN, 'B'), \ + PWM_MAP_INIT_ROW(MOTOR_CURRENT_PWM_Z_PIN, 'B'), \ + PWM_MAP_INIT_ROW(MOTOR_CURRENT_PWM_E_PIN, 'A'), \ + }; + +#define NUM_PWMS 4 + +extern PWM_map ISR_table[NUM_PWMS]; + +extern uint32_t motor_current_setting[3]; + +#define IR_BIT(p) (WITHIN(p, 0, 3) ? (p) : (p) + 4) +#define COPY_ACTIVE_TABLE() do{ for (uint8_t i = 0; i < 6 ; i++) work_table[i] = active_table[i]; }while(0) + +#define PWM_MR0 19999 // base repetition rate minus one count - 20mS +#define PWM_PR 24 // prescaler value - prescaler divide by 24 + 1 - 1 MHz output +#define PWM_PCLKSEL0 0x00 // select clock source for prescaler - defaults to 25MHz on power up + // 0: 25MHz, 1: 100MHz, 2: 50MHz, 3: 12.5MHZ to PWM1 prescaler +#define MR0_MARGIN 200 // if channel value too close to MR0 the system locks up + +extern bool PWM_table_swap; // flag to tell the ISR that the tables have been swapped + +#define HAL_G2_PWM_ISR void PWM_Handler() + +extern volatile uint32_t PWM_ISR1_STATUS, PWM_ISR2_STATUS; diff --git a/Marlin/src/HAL/HAL_DUE/G2_pins.h b/Marlin/src/HAL/HAL_DUE/G2_pins.h new file mode 100644 index 000000000000..a7f432846e37 --- /dev/null +++ b/Marlin/src/HAL/HAL_DUE/G2_pins.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 . + * + */ +#pragma once + +#include + +/** + * This file contains the custom port/pin definitions for the PRINTRBOARD_G2 + * motherboard. This motherboard uses the SAM3X8C which is a subset of the + * SAM3X8E used in the DUE board. It uses port/pin pairs that are not + * available using the DUE definitions. + * + * The first part is a copy of the pin descriptions in the + * "variants\arduino_due_x\variant.cpp" file but with pins 34-41 replaced by + * the G2 pins. + * + * The second part is the FASTIO port/pin definitions. + * + * THESE PINS CAN ONLY BE ACCESSED VIA FASTIO COMMANDS. + */ + +/* + Copyright (c) 2011 Arduino. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +typedef struct _G2_PinDescription { + Pio* pPort; + uint32_t ulPin; + uint32_t ulPeripheralId; + EPioType ulPinType; + uint32_t ulPinConfiguration; + uint32_t ulPinAttribute; + EAnalogChannel ulAnalogChannel; /* Analog pin in the Arduino context (label on the board) */ + EAnalogChannel ulADCChannelNumber; /* ADC Channel number in the SAM device */ + EPWMChannel ulPWMChannel; + ETCChannel ulTCChannel; +} G2_PinDescription; + +/** + * This section is a copy of the pin descriptions in the "variants\arduino_due_x\variant.cpp" file + * with pins 34-41 replaced by the G2 pins. + */ + +/** + * Pins descriptions + */ +const G2_PinDescription G2_g_APinDescription[] = { + // 0 .. 53 - Digital pins + // ---------------------- + // 0/1 - UART (Serial) + { PIOA, PIO_PA8A_URXD, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // URXD + { PIOA, PIO_PA9A_UTXD, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // UTXD + + // 2 + { PIOB, PIO_PB25B_TIOA0, ID_PIOB, PIO_PERIPH_B, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), NO_ADC, NO_ADC, NOT_ON_PWM, TC0_CHA0 }, // TIOA0 + { PIOC, PIO_PC28B_TIOA7, ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), NO_ADC, NO_ADC, NOT_ON_PWM, TC2_CHA7 }, // TIOA7 + { PIOC, PIO_PC26B_TIOB6, ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), NO_ADC, NO_ADC, NOT_ON_PWM, TC2_CHB6 }, // TIOB6 + + // 5 + { PIOC, PIO_PC25B_TIOA6, ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), NO_ADC, NO_ADC, NOT_ON_PWM, TC2_CHA6 }, // TIOA6 + { PIOC, PIO_PC24B_PWML7, ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), NO_ADC, NO_ADC, PWM_CH7, NOT_ON_TIMER }, // PWML7 + { PIOC, PIO_PC23B_PWML6, ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), NO_ADC, NO_ADC, PWM_CH6, NOT_ON_TIMER }, // PWML6 + { PIOC, PIO_PC22B_PWML5, ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), NO_ADC, NO_ADC, PWM_CH5, NOT_ON_TIMER }, // PWML5 + { PIOC, PIO_PC21B_PWML4, ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), NO_ADC, NO_ADC, PWM_CH4, NOT_ON_TIMER }, // PWML4 + // 10 + { PIOC, PIO_PC29B_TIOB7, ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), NO_ADC, NO_ADC, NOT_ON_PWM, TC2_CHB7 }, // TIOB7 + { PIOD, PIO_PD7B_TIOA8, ID_PIOD, PIO_PERIPH_B, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), NO_ADC, NO_ADC, NOT_ON_PWM, TC2_CHA8 }, // TIOA8 + { PIOD, PIO_PD8B_TIOB8, ID_PIOD, PIO_PERIPH_B, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), NO_ADC, NO_ADC, NOT_ON_PWM, TC2_CHB8 }, // TIOB8 + + // 13 - AMBER LED + { PIOB, PIO_PB27B_TIOB0, ID_PIOB, PIO_PERIPH_B, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), NO_ADC, NO_ADC, NOT_ON_PWM, TC0_CHB0 }, // TIOB0 + + // 14/15 - USART3 (Serial3) + { PIOD, PIO_PD4B_TXD3, ID_PIOD, PIO_PERIPH_B, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // TXD3 + { PIOD, PIO_PD5B_RXD3, ID_PIOD, PIO_PERIPH_B, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // RXD3 + + // 16/17 - USART1 (Serial2) + { PIOA, PIO_PA13A_TXD1, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // TXD1 + { PIOA, PIO_PA12A_RXD1, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // RXD1 + + // 18/19 - USART0 (Serial1) + { PIOA, PIO_PA11A_TXD0, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // TXD0 + { PIOA, PIO_PA10A_RXD0, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // RXD0 + + // 20/21 - TWI1 + { PIOB, PIO_PB12A_TWD1, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // TWD1 - SDA0 + { PIOB, PIO_PB13A_TWCK1, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // TWCK1 - SCL0 + + // 22 + { PIOB, PIO_PB26, ID_PIOB, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 22 + { PIOA, PIO_PA14, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 23 + { PIOA, PIO_PA15, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 24 + { PIOD, PIO_PD0, ID_PIOD, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 25 + + // 26 + { PIOD, PIO_PD1, ID_PIOD, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 26 + { PIOD, PIO_PD2, ID_PIOD, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 27 + { PIOD, PIO_PD3, ID_PIOD, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 28 + { PIOD, PIO_PD6, ID_PIOD, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 29 + + // 30 + { PIOD, PIO_PD9, ID_PIOD, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 30 + { PIOA, PIO_PA7, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 31 + { PIOD, PIO_PD10, ID_PIOD, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 32 + { PIOC, PIO_PC1, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 33 + + // 34 + + // start of custom pins + { PIOA, PIO_PA29, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 34 Y_STEP_PIN + { PIOB, PIO_PB1, ID_PIOB, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 35 Y_DIR_PIN + { PIOB, PIO_PB0, ID_PIOB, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 36 Y_ENABLE_PIN + { PIOB, PIO_PB22, ID_PIOB, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 37 E0_ENABLE_PIN + { PIOB, PIO_PB11, ID_PIOB, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 38 E0_MS1_PIN + { PIOB, PIO_PB10, ID_PIOB, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 39 E0_MS3_PIN + { PIOA, PIO_PA5, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 40 HEATER_0_PIN + { PIOB, PIO_PB24, ID_PIOB, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 41 HEATER_BED_PIN + // end of custom pins + + // 42 + { PIOA, PIO_PA19, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 42 + { PIOA, PIO_PA20, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 43 + { PIOC, PIO_PC19, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 44 + { PIOC, PIO_PC18, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 45 + + // 46 + { PIOC, PIO_PC17, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 46 + { PIOC, PIO_PC16, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 47 + { PIOC, PIO_PC15, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 48 + { PIOC, PIO_PC14, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 49 + + // 50 + { PIOC, PIO_PC13, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 50 + { PIOC, PIO_PC12, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 51 + { PIOB, PIO_PB21, ID_PIOB, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 52 + { PIOB, PIO_PB14, ID_PIOB, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 53 + + + // 54 .. 65 - Analog pins + // ---------------------- + { PIOA, PIO_PA16X1_AD7, ID_PIOA, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC0, ADC7, NOT_ON_PWM, NOT_ON_TIMER }, // AD0 + { PIOA, PIO_PA24X1_AD6, ID_PIOA, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC1, ADC6, NOT_ON_PWM, NOT_ON_TIMER }, // AD1 + { PIOA, PIO_PA23X1_AD5, ID_PIOA, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC2, ADC5, NOT_ON_PWM, NOT_ON_TIMER }, // AD2 + { PIOA, PIO_PA22X1_AD4, ID_PIOA, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC3, ADC4, NOT_ON_PWM, NOT_ON_TIMER }, // AD3 + // 58 + { PIOA, PIO_PA6X1_AD3, ID_PIOA, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC4, ADC3, NOT_ON_PWM, TC0_CHB2 }, // AD4 + { PIOA, PIO_PA4X1_AD2, ID_PIOA, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC5, ADC2, NOT_ON_PWM, NOT_ON_TIMER }, // AD5 + { PIOA, PIO_PA3X1_AD1, ID_PIOA, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC6, ADC1, NOT_ON_PWM, TC0_CHB1 }, // AD6 + { PIOA, PIO_PA2X1_AD0, ID_PIOA, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC7, ADC0, NOT_ON_PWM, TC0_CHA1 }, // AD7 + // 62 + { PIOB, PIO_PB17X1_AD10, ID_PIOB, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC8, ADC10, NOT_ON_PWM, NOT_ON_TIMER }, // AD8 + { PIOB, PIO_PB18X1_AD11, ID_PIOB, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC9, ADC11, NOT_ON_PWM, NOT_ON_TIMER }, // AD9 + { PIOB, PIO_PB19X1_AD12, ID_PIOB, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC10, ADC12, NOT_ON_PWM, NOT_ON_TIMER }, // AD10 + { PIOB, PIO_PB20X1_AD13, ID_PIOB, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC11, ADC13, NOT_ON_PWM, NOT_ON_TIMER }, // AD11 + + // 66/67 - DAC0/DAC1 + { PIOB, PIO_PB15X1_DAC0, ID_PIOB, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC12, DA0, NOT_ON_PWM, NOT_ON_TIMER }, // DAC0 + { PIOB, PIO_PB16X1_DAC1, ID_PIOB, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC13, DA1, NOT_ON_PWM, NOT_ON_TIMER }, // DAC1 + + // 68/69 - CANRX0/CANTX0 + { PIOA, PIO_PA1A_CANRX0, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, ADC14, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // CANRX + { PIOA, PIO_PA0A_CANTX0, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, ADC15, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // CANTX + + // 70/71 - TWI0 + { PIOA, PIO_PA17A_TWD0, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // TWD0 - SDA1 + { PIOA, PIO_PA18A_TWCK0, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // TWCK0 - SCL1 + + // 72/73 - LEDs + { PIOC, PIO_PC30, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // LED AMBER RXL + { PIOA, PIO_PA21, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // LED AMBER TXL + + // 74/75/76 - SPI + { PIOA, PIO_PA25A_SPI0_MISO,ID_PIOA,PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // MISO + { PIOA, PIO_PA26A_SPI0_MOSI,ID_PIOA,PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // MOSI + { PIOA, PIO_PA27A_SPI0_SPCK,ID_PIOA,PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // SPCK + + // 77 - SPI CS0 + { PIOA, PIO_PA28A_SPI0_NPCS0,ID_PIOA,PIO_PERIPH_A,PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // NPCS0 + + // 78 - SPI CS3 (unconnected) + { PIOB, PIO_PB23B_SPI0_NPCS3,ID_PIOB,PIO_PERIPH_B,PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // NPCS3 + + // 79 .. 84 - "All pins" masks + + // 79 - TWI0 all pins + { PIOA, PIO_PA17A_TWD0|PIO_PA18A_TWCK0, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_COMBO), NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, + // 80 - TWI1 all pins + { PIOB, PIO_PB12A_TWD1|PIO_PB13A_TWCK1, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_COMBO), NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, + // 81 - UART (Serial) all pins + { PIOA, PIO_PA8A_URXD|PIO_PA9A_UTXD, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_COMBO), NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, + // 82 - USART0 (Serial1) all pins + { PIOA, PIO_PA11A_TXD0|PIO_PA10A_RXD0, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_COMBO), NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, + // 83 - USART1 (Serial2) all pins + { PIOA, PIO_PA13A_TXD1|PIO_PA12A_RXD1, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_COMBO), NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, + // 84 - USART3 (Serial3) all pins + { PIOD, PIO_PD4B_TXD3|PIO_PD5B_RXD3, ID_PIOD, PIO_PERIPH_B, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_COMBO), NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, + + // 85 - USB + { PIOB, PIO_PB11A_UOTGID|PIO_PB10A_UOTGVBOF, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL,NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // ID - VBOF + + // 86 - SPI CS2 + { PIOB, PIO_PB21B_SPI0_NPCS2, ID_PIOB, PIO_PERIPH_B, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // NPCS2 + + // 87 - SPI CS1 + { PIOA, PIO_PA29A_SPI0_NPCS1, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // NPCS1 + + // 88/89 - CANRX1/CANTX1 (same physical pin for 66/53) + { PIOB, PIO_PB15A_CANRX1, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // CANRX1 + { PIOB, PIO_PB14A_CANTX1, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // CANTX1 + + // 90 .. 91 - "All CAN pins" masks + // 90 - CAN0 all pins + { PIOA, PIO_PA1A_CANRX0|PIO_PA0A_CANTX0, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_COMBO), NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, + // 91 - CAN1 all pins + { PIOB, PIO_PB15A_CANRX1|PIO_PB14A_CANTX1, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_COMBO), NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, + + // END + { NULL, 0, 0, PIO_NOT_A_PIN, PIO_DEFAULT, 0, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER } +}; + +// This section replaces the FASTIO definitions of pins 34-41 + +#define DIO34_PIN 29 +#define DIO34_WPORT PIOA // only available via FASTIO // 34 PA29 - Y_STEP_PIN + +#define DIO35_PIN 1 +#define DIO35_WPORT PIOB // only available via FASTIO // 35 PAB1 - Y_DIR_PIN + +#define DIO36_PIN 0 +#define DIO36_WPORT PIOB // only available via FASTIO // 36 PB0 - Y_ENABLE_PIN + +#define DIO37_PIN 22 +#define DIO37_WPORT PIOB // only available via FASTIO // 37 PB22 - E0_ENABLE_PIN + +#define DIO38_PIN 11 +#define DIO38_WPORT PIOB // only available via FASTIO // 38 PB11 - E0_MS1_PIN + +#define DIO39_PIN 10 +#define DIO39_WPORT PIOB // only available via FASTIO // 39 PB10 - E0_MS3_PIN + +#define DIO40_PIN 5 +#define DIO40_WPORT PIOA // only available via FASTIO // 40 PA5 - HEATER_0_PIN + +#define DIO41_PIN 24 +#define DIO41_WPORT PIOB // only available via FASTIO // 41 PB24 - HEATER_BED_PIN diff --git a/Marlin/src/HAL/HAL_DUE/HAL.cpp b/Marlin/src/HAL/HAL_DUE/HAL.cpp index cc2db0eb2669..cefe308e816d 100644 --- a/Marlin/src/HAL/HAL_DUE/HAL.cpp +++ b/Marlin/src/HAL/HAL_DUE/HAL.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 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 diff --git a/Marlin/src/HAL/HAL_DUE/HAL.h b/Marlin/src/HAL/HAL_DUE/HAL.h index 57d3160ca4a3..d430e6b649fb 100644 --- a/Marlin/src/HAL/HAL_DUE/HAL.h +++ b/Marlin/src/HAL/HAL_DUE/HAL.h @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com * @@ -112,10 +112,8 @@ uint8_t HAL_get_reset_source(void); // get reset reason // Write single byte to specified SPI channel void spiSend(uint32_t chan, byte b); - // Write buffer to specified SPI channel void spiSend(uint32_t chan, const uint8_t* buf, size_t n); - // Read single byte from specified SPI channel uint8_t spiRec(uint32_t chan); diff --git a/Marlin/src/HAL/HAL_DUE/HAL_spi_Due.cpp b/Marlin/src/HAL/HAL_DUE/HAL_spi_Due.cpp index b127f1a9901b..5adc7fcf099a 100644 --- a/Marlin/src/HAL/HAL_DUE/HAL_spi_Due.cpp +++ b/Marlin/src/HAL/HAL_DUE/HAL_spi_Due.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -53,7 +53,7 @@ // Public functions // -------------------------------------------------------------------------- -#if ENABLED(DUE_SOFTWARE_SPI) +#if EITHER(DUE_SOFTWARE_SPI, FORCE_SOFT_SPI) // -------------------------------------------------------------------------- // software SPI @@ -250,7 +250,7 @@ } // all the others - static uint32_t spiDelayCyclesX4 = (F_CPU/1000000); // 4uS => 125khz + static uint32_t spiDelayCyclesX4 = (F_CPU) / 1000000; // 4uS => 125khz static uint8_t spiTransferX(uint8_t b) { // using Mode 0 int bits = 8; @@ -451,77 +451,48 @@ static pfnSpiTxBlock spiTxBlock = (pfnSpiTxBlock)spiTxBlockX; static pfnSpiRxBlock spiRxBlock = (pfnSpiRxBlock)spiRxBlockX; - #if MB(ALLIGATOR) // control SDSS pin - void spiBegin() { - SET_OUTPUT(SS_PIN); - WRITE(SS_PIN, HIGH); - SET_OUTPUT(SCK_PIN); - SET_INPUT(MISO_PIN); - SET_OUTPUT(MOSI_PIN); - } - - uint8_t spiRec() { - WRITE(SS_PIN, LOW); - WRITE(MOSI_PIN, 1); /* Output 1s 1*/ - uint8_t b = spiTransferRx(0xFF); - WRITE(SS_PIN, HIGH); - return b; - } - - void spiRead(uint8_t* buf, uint16_t nbyte) { - uint32_t todo = nbyte; - if (todo == 0) return; - - WRITE(SS_PIN, LOW); - WRITE(MOSI_PIN, 1); /* Output 1s 1*/ - spiRxBlock(buf,nbyte); - WRITE(SS_PIN, HIGH); - } - - void spiSend(uint8_t b) { - WRITE(SS_PIN, LOW); - (void) spiTransferTx(b); - WRITE(SS_PIN, HIGH); - } - - void spiSendBlock(uint8_t token, const uint8_t* buf) { - WRITE(SS_PIN, LOW); - (void) spiTransferTx(token); - spiTxBlock(buf,512); - WRITE(SS_PIN, HIGH); - - #else // let calling routine control SDSS - void spiBegin() { - SET_OUTPUT(SS_PIN); - SET_OUTPUT(SCK_PIN); - SET_INPUT(MISO_PIN); - SET_OUTPUT(MOSI_PIN); - } - - uint8_t spiRec() { - WRITE(MOSI_PIN, 1); /* Output 1s 1*/ - uint8_t b = spiTransferRx(0xFF); - return b; - } - - void spiRead(uint8_t* buf, uint16_t nbyte) { - uint32_t todo = nbyte; - if (todo == 0) return; + #if MB(ALLIGATOR) + #define _SS_WRITE(S) WRITE(SS_PIN, S) + #else + #define _SS_WRITE(S) NOOP + #endif + + void spiBegin() { + SET_OUTPUT(SS_PIN); + _SS_WRITE(HIGH); + SET_OUTPUT(SCK_PIN); + SET_INPUT(MISO_PIN); + SET_OUTPUT(MOSI_PIN); + } - WRITE(MOSI_PIN, 1); /* Output 1s 1*/ - spiRxBlock(buf,nbyte); - } + uint8_t spiRec() { + _SS_WRITE(LOW); + WRITE(MOSI_PIN, HIGH); // Output 1s 1 + uint8_t b = spiTransferRx(0xFF); + _SS_WRITE(HIGH); + return b; + } - void spiSend(uint8_t b) { - (void) spiTransferTx(b); + void spiRead(uint8_t* buf, uint16_t nbyte) { + if (nbyte) { + _SS_WRITE(LOW); + WRITE(MOSI_PIN, HIGH); // Output 1s 1 + spiRxBlock(buf, nbyte); + _SS_WRITE(HIGH); } + } - void spiSendBlock(uint8_t token, const uint8_t* buf) { - (void) spiTransferTx(token); - spiTxBlock(buf,512); - - #endif + void spiSend(uint8_t b) { + _SS_WRITE(LOW); + (void)spiTransferTx(b); + _SS_WRITE(HIGH); + } + void spiSendBlock(uint8_t token, const uint8_t* buf) { + _SS_WRITE(LOW); + (void)spiTransferTx(token); + spiTxBlock(buf, 512); + _SS_WRITE(HIGH); } /** @@ -549,7 +520,7 @@ spiRxBlock = (pfnSpiRxBlock)spiRxBlockX; break; default: - spiDelayCyclesX4 = (F_CPU/1000000) >> (6 - spiRate); + spiDelayCyclesX4 = ((F_CPU) / 1000000) >> (6 - spiRate); spiTransferTx = (pfnSpiTransfer)spiTransferX; spiTransferRx = (pfnSpiTransfer)spiTransferX; spiTxBlock = (pfnSpiTxBlock)spiTxBlockX; @@ -557,9 +528,7 @@ break; } - #if MB(ALLIGATOR) - WRITE(SS_PIN, HIGH); - #endif + _SS_WRITE(HIGH); WRITE(MOSI_PIN, HIGH); WRITE(SCK_PIN, LOW); } @@ -573,6 +542,10 @@ #else // !SOFTWARE_SPI + #define WHILE_TX(N) while ((SPI0->SPI_SR & SPI_SR_TDRE) == (N)) + #define WHILE_RX(N) while ((SPI0->SPI_SR & SPI_SR_RDRF) == (N)) + #define FLUSH_TX() do{ WHILE_RX(1) SPI0->SPI_RDR; }while(0) + #if MB(ALLIGATOR) // slave selects controlled by SPI controller @@ -640,18 +613,19 @@ SET_OUTPUT(SPI_EEPROM2_CS); SET_OUTPUT(SPI_FLASH_CS); WRITE(DAC0_SYNC, HIGH); - WRITE(SPI_EEPROM1_CS, HIGH ); - WRITE(SPI_EEPROM2_CS, HIGH ); - WRITE(SPI_FLASH_CS, HIGH ); - WRITE(SS_PIN, HIGH ); + WRITE(SPI_EEPROM1_CS, HIGH); + WRITE(SPI_EEPROM2_CS, HIGH); + WRITE(SPI_FLASH_CS, HIGH); + WRITE(SS_PIN, HIGH); - OUT_WRITE(SDSS,0); + OUT_WRITE(SDSS, LOW); PIO_Configure( g_APinDescription[SPI_PIN].pPort, g_APinDescription[SPI_PIN].ulPinType, g_APinDescription[SPI_PIN].ulPin, - g_APinDescription[SPI_PIN].ulPinConfiguration); + g_APinDescription[SPI_PIN].ulPinConfiguration + ); spiInit(1); } @@ -660,41 +634,34 @@ uint8_t spiRec() { // write dummy byte with address and end transmission flag SPI0->SPI_TDR = 0x000000FF | SPI_PCS(SPI_CHAN) | SPI_TDR_LASTXFER; - // wait for transmit register empty - while ((SPI0->SPI_SR & SPI_SR_TDRE) == 0); - // wait for receive register - while ((SPI0->SPI_SR & SPI_SR_RDRF) == 0); - // get byte from receive register + WHILE_TX(0); + WHILE_RX(0); + //DELAY_US(1U); return SPI0->SPI_RDR; } uint8_t spiRec(uint32_t chan) { - uint8_t spirec_tmp; - // wait for transmit register empty - while ((SPI0->SPI_SR & SPI_SR_TDRE) == 0); - while ((SPI0->SPI_SR & SPI_SR_RDRF) == 1) - spirec_tmp = SPI0->SPI_RDR; - UNUSED(spirec_tmp); + + WHILE_TX(0); + FLUSH_RX(); // write dummy byte with address and end transmission flag SPI0->SPI_TDR = 0x000000FF | SPI_PCS(chan) | SPI_TDR_LASTXFER; + WHILE_RX(0); - // wait for receive register - while ((SPI0->SPI_SR & SPI_SR_RDRF) == 0); - // get byte from receive register return SPI0->SPI_RDR; } // Read from SPI into buffer void spiRead(uint8_t* buf, uint16_t nbyte) { - if (nbyte-- == 0) return; - + if (!nbyte) return; + --nbyte; for (int i = 0; i < nbyte; i++) { - //while ((SPI0->SPI_SR & SPI_SR_TDRE) == 0); + //WHILE_TX(0); SPI0->SPI_TDR = 0x000000FF | SPI_PCS(SPI_CHAN); - while ((SPI0->SPI_SR & SPI_SR_RDRF) == 0); + WHILE_RX(0); buf[i] = SPI0->SPI_RDR; //DELAY_US(1U); } @@ -702,68 +669,58 @@ } // Write single byte to SPI - void spiSend(byte b) { + void spiSend(const byte b) { // write byte with address and end transmission flag SPI0->SPI_TDR = (uint32_t)b | SPI_PCS(SPI_CHAN) | SPI_TDR_LASTXFER; - // wait for transmit register empty - while ((SPI0->SPI_SR & SPI_SR_TDRE) == 0); - // wait for receive register - while ((SPI0->SPI_SR & SPI_SR_RDRF) == 0); - // clear status + WHILE_TX(0); + WHILE_RX(0); SPI0->SPI_RDR; //DELAY_US(1U); } - void spiSend(const uint8_t* buf, size_t n) { - if (n == 0) return; - for (size_t i = 0; i < n - 1; i++) { + void spiSend(const uint8_t* buf, size_t nbyte) { + if (!nbyte) return; + --nbyte; + for (size_t i = 0; i < nbyte; i++) { SPI0->SPI_TDR = (uint32_t)buf[i] | SPI_PCS(SPI_CHAN); - while ((SPI0->SPI_SR & SPI_SR_TDRE) == 0); - while ((SPI0->SPI_SR & SPI_SR_RDRF) == 0); + WHILE_TX(0); + WHILE_RX(0); SPI0->SPI_RDR; //DELAY_US(1U); } - spiSend(buf[n - 1]); + spiSend(buf[nbyte]); } void spiSend(uint32_t chan, byte b) { - uint8_t dummy_read = 0; - // wait for transmit register empty - while ((SPI0->SPI_SR & SPI_SR_TDRE) == 0); + WHILE_TX(0); // write byte with address and end transmission flag SPI0->SPI_TDR = (uint32_t)b | SPI_PCS(chan) | SPI_TDR_LASTXFER; - // wait for receive register - while ((SPI0->SPI_SR & SPI_SR_RDRF) == 0); - // clear status - while ((SPI0->SPI_SR & SPI_SR_RDRF) == 1) - dummy_read = SPI0->SPI_RDR; - UNUSED(dummy_read); + WHILE_RX(0); + FLUSH_RX(); } - void spiSend(uint32_t chan, const uint8_t* buf, size_t n) { - uint8_t dummy_read = 0; - if (n == 0) return; - for (int i = 0; i < (int)n - 1; i++) { - while ((SPI0->SPI_SR & SPI_SR_TDRE) == 0); + void spiSend(uint32_t chan, const uint8_t* buf, size_t nbyte) { + if (!nbyte) return; + --nbyte; + for (size_t i = 0; i < nbyte; i++) { + WHILE_TX(0); SPI0->SPI_TDR = (uint32_t)buf[i] | SPI_PCS(chan); - while ((SPI0->SPI_SR & SPI_SR_RDRF) == 0); - while ((SPI0->SPI_SR & SPI_SR_RDRF) == 1) - dummy_read = SPI0->SPI_RDR; - UNUSED(dummy_read); + WHILE_RX(0); + FLUSH_RX(); } - spiSend(chan, buf[n - 1]); + spiSend(chan, buf[nbyte]); } // Write from buffer to SPI void spiSendBlock(uint8_t token, const uint8_t* buf) { SPI0->SPI_TDR = (uint32_t)token | SPI_PCS(SPI_CHAN); - while ((SPI0->SPI_SR & SPI_SR_TDRE) == 0); - //while ((SPI0->SPI_SR & SPI_SR_RDRF) == 0); + WHILE_TX(0); + //WHILE_RX(0); //SPI0->SPI_RDR; for (int i = 0; i < 511; i++) { SPI0->SPI_TDR = (uint32_t)buf[i] | SPI_PCS(SPI_CHAN); - while ((SPI0->SPI_SR & SPI_SR_TDRE) == 0); - while ((SPI0->SPI_SR & SPI_SR_RDRF) == 0); + WHILE_TX(0); + WHILE_RX(0); SPI0->SPI_RDR; //DELAY_US(1U); } @@ -782,7 +739,42 @@ #define SPI_MODE_2_DUE_HW 0 #define SPI_MODE_3_DUE_HW 1 + /** + * The DUE SPI controller is set up so the upper word of the longword + * written to the transmit data register selects which SPI Chip Select + * Register is used. This allows different streams to have different SPI + * settings. + * + * In practice it's spooky. Some combinations hang the system, while others + * upset the peripheral device. + * + * SPI mode should be the same for all streams. The FYSETC_MINI_12864 gets + * upset if the clock phase changes after chip select goes active. + * + * SPI_CSR_CSAAT should be set for all streams. If not the WHILE_TX(0) + * macro returns immediately which can result in the SPI chip select going + * inactive before all the data has been sent. + * + * The TMC2130 library uses SPI0->SPI_CSR[3]. + * + * The U8G hardware SPI uses SPI0->SPI_CSR[0]. The system hangs and/or the + * FYSETC_MINI_12864 gets upset if lower baud rates are used and the SD card + * is inserted or removed. + * + * The SD card uses SPI0->SPI_CSR[3]. Efforts were made to use [1] and [2] + * but they all resulted in hangs or garbage on the LCD. + * + * The SPI controlled chip selects are NOT enabled in the GPIO controller. + * The application must control the chip select. + * + * All of the above can be avoided by defining FORCE_SOFT_SPI to force the + * display to use software SPI. + * + */ + void spiInit(uint8_t spiRate=6) { // Default to slowest rate if not specified) + // Also sets U8G SPI rate to 4MHz and the SPI mode to 3 + // 8.4 MHz, 4 MHz, 2 MHz, 1 MHz, 0.5 MHz, 0.329 MHz, 0.329 MHz constexpr int spiDivider[] = { 10, 21, 42, 84, 168, 255, 255 }; if (spiRate > 6) spiRate = 1; @@ -792,7 +784,7 @@ // Disable PIO on A26 and A27 REG_PIOA_PDR = 0x0C000000; - OUT_WRITE(SDSS, 1); + OUT_WRITE(SDSS, HIGH); // Reset SPI0 (from sam lib) SPI0->SPI_CR = SPI_CR_SPIDIS; @@ -803,48 +795,32 @@ // TMC2103 compatible setup // Master mode, no fault detection, PCS bits in data written to TDR select CSR register SPI0->SPI_MR = SPI_MR_MSTR | SPI_MR_PS | SPI_MR_MODFDIS; - // SPI mode 0, 8 Bit data transfer, baud rate - SPI0->SPI_CSR[3] = SPI_CSR_SCBR(spiDivider[spiRate]) | SPI_CSR_CSAAT | SPI_MODE_0_DUE_HW; // use same CSR as TMC2130 + // SPI mode 3, 8 Bit data transfer, baud rate + SPI0->SPI_CSR[3] = SPI_CSR_SCBR(spiDivider[spiRate]) | SPI_CSR_CSAAT | SPI_MODE_3_DUE_HW; // use same CSR as TMC2130 + SPI0->SPI_CSR[0] = SPI_CSR_SCBR(spiDivider[1]) | SPI_CSR_CSAAT | SPI_MODE_3_DUE_HW; // U8G default to 4MHz } - void spiBegin() { - spiInit(); - } + void spiBegin() { spiInit(); } static uint8_t spiTransfer(uint8_t data) { - - // Wait until tx register is empty - while( (SPI0->SPI_SR & SPI_SR_TDRE) == 0 ); - // Send data - SPI0->SPI_TDR = (uint32_t)data | 0x00070000UL; // Add TMC2130 PCS bits to every byte - - // wait for transmit register empty - while ((SPI0->SPI_SR & SPI_SR_TDRE) == 0); - - // wait for receive register - while ((SPI0->SPI_SR & SPI_SR_RDRF) == 0); - // get byte from receive register + WHILE_TX(0); + SPI0->SPI_TDR = (uint32_t)data | 0x00070000UL; // Add TMC2130 PCS bits to every byte (use SPI0->SPI_CSR[3]) + WHILE_TX(0); + WHILE_RX(0); return SPI0->SPI_RDR; } - uint8_t spiRec() { - uint8_t data = spiTransfer(0xFF); - return data; - } + uint8_t spiRec() { return (uint8_t)spiTransfer(0xFF); } void spiRead(uint8_t* buf, uint16_t nbyte) { - if (nbyte == 0) return; for (int i = 0; i < nbyte; i++) buf[i] = spiTransfer(0xFF); } - void spiSend(uint8_t data) { - spiTransfer(data); - } + void spiSend(uint8_t data) { spiTransfer(data); } - void spiSend(const uint8_t* buf, size_t n) { - if (n == 0) return; - for (uint16_t i = 0; i < n; i++) + void spiSend(const uint8_t* buf, size_t nbyte) { + for (uint16_t i = 0; i < nbyte; i++) spiTransfer(buf[i]); } diff --git a/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.cpp b/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.cpp index f5f74c0ce2b0..9d2233d9146c 100644 --- a/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.cpp +++ b/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.cpp @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com * @@ -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 46b7aaf5a4ef..a2676e0875ef 100644 --- a/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h +++ b/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 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 @@ -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/InterruptVectors_Due.cpp b/Marlin/src/HAL/HAL_DUE/InterruptVectors_Due.cpp index 97aefc98d174..446eb2884dbd 100644 --- a/Marlin/src/HAL/HAL_DUE/InterruptVectors_Due.cpp +++ b/Marlin/src/HAL/HAL_DUE/InterruptVectors_Due.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_DUE/InterruptVectors_Due.h b/Marlin/src/HAL/HAL_DUE/InterruptVectors_Due.h index a9be8e0b31fa..71de4bf52e0b 100644 --- a/Marlin/src/HAL/HAL_DUE/InterruptVectors_Due.h +++ b/Marlin/src/HAL/HAL_DUE/InterruptVectors_Due.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_DUE/MarlinSerialUSB_Due.cpp b/Marlin/src/HAL/HAL_DUE/MarlinSerialUSB_Due.cpp index b176f9d0d96a..7b1100dd9dfc 100644 --- a/Marlin/src/HAL/HAL_DUE/MarlinSerialUSB_Due.cpp +++ b/Marlin/src/HAL/HAL_DUE/MarlinSerialUSB_Due.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -114,8 +114,8 @@ bool MarlinSerialUSB::available(void) { (usb_task_cdc_isenabled() && udi_cdc_is_rx_ready()); } -void MarlinSerialUSB::flush(void) { -} +void MarlinSerialUSB::flush(void) { } +void MarlinSerialUSB::flushTX(void) { } void MarlinSerialUSB::write(const uint8_t c) { diff --git a/Marlin/src/HAL/HAL_DUE/MarlinSerialUSB_Due.h b/Marlin/src/HAL/HAL_DUE/MarlinSerialUSB_Due.h index fbba50850610..5025b822843a 100644 --- a/Marlin/src/HAL/HAL_DUE/MarlinSerialUSB_Due.h +++ b/Marlin/src/HAL/HAL_DUE/MarlinSerialUSB_Due.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -46,6 +46,7 @@ class MarlinSerialUSB { 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); diff --git a/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.cpp b/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.cpp index ef72c38270cc..4be9c43f4775 100644 --- a/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.cpp +++ b/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.h b/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.h index 1fe0d236ee57..9b03d46f284b 100644 --- a/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.h +++ b/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_DUE/SanityCheck.h b/Marlin/src/HAL/HAL_DUE/SanityCheck.h index f24233a859cb..30a5d72b25c2 100644 --- a/Marlin/src/HAL/HAL_DUE/SanityCheck.h +++ b/Marlin/src/HAL/HAL_DUE/SanityCheck.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 db1b3e39bad8..848d263b7081 100644 --- a/Marlin/src/HAL/HAL_DUE/Servo_Due.cpp +++ b/Marlin/src/HAL/HAL_DUE/Servo_Due.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 ff522fa3ab5a..292be1401fe6 100644 --- a/Marlin/src/HAL/HAL_DUE/Tone.cpp +++ b/Marlin/src/HAL/HAL_DUE/Tone.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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/endstop_interrupts.h b/Marlin/src/HAL/HAL_DUE/endstop_interrupts.h index d026abfea68a..eb4833ecd6ef 100644 --- a/Marlin/src/HAL/HAL_DUE/endstop_interrupts.h +++ b/Marlin/src/HAL/HAL_DUE/endstop_interrupts.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_DUE/fastio_Due.h b/Marlin/src/HAL/HAL_DUE/fastio_Due.h index cb713122e7b8..542469f65e75 100644 --- a/Marlin/src/HAL/HAL_DUE/fastio_Due.h +++ b/Marlin/src/HAL/HAL_DUE/fastio_Due.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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) @@ -65,7 +66,7 @@ // Write to a pin #define _WRITE_VAR(IO,V) do { \ volatile Pio* port = digitalPinToPort(IO); \ - uint32_t mask = digitalPinToBitMask(IO); \ + const uint32_t mask = digitalPinToBitMask(IO); \ if (V) port->PIO_SODR = mask; \ else port->PIO_CODR = mask; \ } while(0) @@ -73,7 +74,7 @@ // Write to a pin #define _WRITE(IO,V) do { \ volatile Pio* port = (DIO ## IO ## _WPORT); \ - uint32_t mask = MASK(DIO ## IO ## _PIN); \ + const uint32_t mask = MASK(DIO ## IO ## _PIN); \ if (V) port->PIO_SODR = mask; \ else port->PIO_CODR = mask; \ } while(0) @@ -81,48 +82,113 @@ // Toggle a pin #define _TOGGLE(IO) _WRITE(IO, !READ(IO)) -// Set pin as input -#define _SET_INPUT(IO) do{ \ - pmc_enable_periph_clk(g_APinDescription[IO].ulPeripheralId); \ - PIO_Configure(digitalPinToPort(IO), PIO_INPUT, digitalPinToBitMask(IO), 0); \ -}while(0) +#if MB(PRINTRBOARD_G2) + + #include "G2_pins.h" + + // Set pin as input + #define _SET_INPUT(IO) do{ \ + pmc_enable_periph_clk(G2_g_APinDescription[IO].ulPeripheralId); \ + PIO_Configure((DIO ## IO ## _WPORT), PIO_INPUT, MASK(DIO ## IO ## _PIN), 0); \ + }while(0) + + // Set pin as output + #define _SET_OUTPUT(IO) do{ \ + uint32_t mask = MASK(G2_g_APinDescription[IO].ulPeripheralId); \ + if ((PMC->PMC_PCSR0 & mask) != (mask)) PMC->PMC_PCER0 = mask; \ + volatile Pio* port = (DIO ## IO ## _WPORT); \ + mask = MASK(DIO ## IO ## _PIN); \ + if (_READ(IO)) port->PIO_SODR = mask; \ + else port->PIO_CODR = mask; \ + port->PIO_IDR = mask; \ + const uint32_t pin_config = G2_g_APinDescription[IO].ulPinConfiguration; \ + if (pin_config & PIO_PULLUP) port->PIO_PUER = mask; \ + else port->PIO_PUDR = mask; \ + if (pin_config & PIO_OPENDRAIN) port->PIO_MDER = mask; \ + else port->PIO_MDDR = mask; \ + port->PIO_PER = mask; \ + port->PIO_OER = mask; \ + g_pinStatus[IO] = (g_pinStatus[IO] & 0xF0) | PIN_STATUS_DIGITAL_OUTPUT; \ + }while(0) + + /** + * Set pin as output with comments + * #define _SET_OUTPUT(IO) do{ \ + * uint32_t mask = MASK(G2_g_APinDescription[IO].ulPeripheralId); \ + * if ((PMC->PMC_PCSR0 & mask ) != (mask)) PMC->PMC_PCER0 = mask; \ // enable PIO clock if not already enabled + * + * volatile Pio* port = (DIO ## IO ## _WPORT); \ + * const uint32_t mask = MASK(DIO ## IO ## _PIN); \ + * if (_READ(IO)) port->PIO_SODR = mask; \ // set output to match input BEFORE setting direction or will glitch the output + * else port->PIO_CODR = mask; \ + * + * port->PIO_IDR = mask; \ // disable interrupt + * + * uint32_t pin_config = G2_g_APinDescription[IO].ulPinConfiguration; \ + * if (pin_config & PIO_PULLUP) pPio->PIO_PUER = mask; \ // enable pullup if necessary + * else pPio->PIO_PUDR = mask; \ + * + * if (pin_config & PIO_OPENDRAIN) port->PIO_MDER = mask; \ // Enable multi-drive if necessary + * else port->PIO_MDDR = mask; \ + * + * port->PIO_PER = mask; \ + * port->PIO_OER = mask; \ // set to output + * + * g_pinStatus[IO] = (g_pinStatus[IO] & 0xF0) | PIN_STATUS_DIGITAL_OUTPUT; \ + * }while(0) + */ -// Set pin as output -#define _SET_OUTPUT(IO) do{ \ - pmc_enable_periph_clk(g_APinDescription[IO].ulPeripheralId); \ - PIO_Configure(digitalPinToPort(IO), _READ(IO) ? PIO_OUTPUT_1 : PIO_OUTPUT_0, digitalPinToBitMask(IO), g_APinDescription[IO].ulPinConfiguration); \ - g_pinStatus[IO] = (g_pinStatus[IO] & 0xF0) | PIN_STATUS_DIGITAL_OUTPUT;\ -}while(0) +#else + + // Set pin as input + #define _SET_INPUT(IO) do{ \ + pmc_enable_periph_clk(g_APinDescription[IO].ulPeripheralId); \ + PIO_Configure(digitalPinToPort(IO), PIO_INPUT, digitalPinToBitMask(IO), 0); \ + }while(0) + + // Set pin as output + #define _SET_OUTPUT(IO) do{ \ + pmc_enable_periph_clk(g_APinDescription[IO].ulPeripheralId); \ + PIO_Configure(digitalPinToPort(IO), _READ(IO) ? PIO_OUTPUT_1 : PIO_OUTPUT_0, digitalPinToBitMask(IO), g_APinDescription[IO].ulPinConfiguration); \ + g_pinStatus[IO] = (g_pinStatus[IO] & 0xF0) | PIN_STATUS_DIGITAL_OUTPUT; \ + }while(0) +#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 @@ -243,29 +309,33 @@ #define DIO33_PIN 1 #define DIO33_WPORT PIOC -#define DIO34_PIN 2 -#define DIO34_WPORT PIOC +#if !MB(PRINTRBOARD_G2) // normal DUE pin mapping + + #define DIO34_PIN 2 + #define DIO34_WPORT PIOC + + #define DIO35_PIN 3 + #define DIO35_WPORT PIOC -#define DIO35_PIN 3 -#define DIO35_WPORT PIOC + #define DIO36_PIN 4 + #define DIO36_WPORT PIOC -#define DIO36_PIN 4 -#define DIO36_WPORT PIOC + #define DIO37_PIN 5 + #define DIO37_WPORT PIOC -#define DIO37_PIN 5 -#define DIO37_WPORT PIOC + #define DIO38_PIN 6 + #define DIO38_WPORT PIOC -#define DIO38_PIN 6 -#define DIO38_WPORT PIOC + #define DIO39_PIN 7 + #define DIO39_WPORT PIOC -#define DIO39_PIN 7 -#define DIO39_WPORT PIOC + #define DIO40_PIN 8 + #define DIO40_WPORT PIOC -#define DIO40_PIN 8 -#define DIO40_WPORT PIOC + #define DIO41_PIN 9 + #define DIO41_WPORT PIOC -#define DIO41_PIN 9 -#define DIO41_WPORT PIOC +#endif // !PRINTRBOARD_G2 #define DIO42_PIN 19 #define DIO42_WPORT PIOA @@ -418,6 +488,7 @@ #define DIO91_WPORT PIOB #if ARDUINO_SAM_ARCHIM + #define DIO92_PIN 11 #define DIO92_WPORT PIOC @@ -468,7 +539,9 @@ #define DIO108_PIN 9 #define DIO108_WPORT PIOB -#else + +#else // !ARDUINO_SAM_ARCHIM + #define DIO92_PIN 5 #define DIO92_WPORT PIOA @@ -495,4 +568,5 @@ #define DIO100_PIN 11 #define DIO100_WPORT PIOC -#endif + +#endif // !ARDUINO_SAM_ARCHIM diff --git a/Marlin/src/HAL/HAL_DUE/persistent_store_eeprom.cpp b/Marlin/src/HAL/HAL_DUE/persistent_store_eeprom.cpp index e7ff4f9c815d..4d788acae6c9 100644 --- a/Marlin/src/HAL/HAL_DUE/persistent_store_eeprom.cpp +++ b/Marlin/src/HAL/HAL_DUE/persistent_store_eeprom.cpp @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com * Copyright (c) 2016 Victor Perez victor_pv@hotmail.com @@ -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; @@ -52,9 +52,9 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui // so only write bytes that have changed! if (v != eeprom_read_byte(p)) { eeprom_write_byte(p, v); + delay(2); if (eeprom_read_byte(p) != v) { - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM(MSG_ERR_EEPROM_WRITE); + SERIAL_ECHO_MSG(MSG_ERR_EEPROM_WRITE); return true; } } diff --git a/Marlin/src/HAL/HAL_DUE/pinsDebug.h b/Marlin/src/HAL/HAL_DUE/pinsDebug.h index 691830b873af..9d8657705240 100644 --- a/Marlin/src/HAL/HAL_DUE/pinsDebug.h +++ b/Marlin/src/HAL/HAL_DUE/pinsDebug.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2018 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -63,15 +63,16 @@ #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) #define PRINT_PIN(p) do {sprintf_P(buffer, PSTR("%02d"), p); SERIAL_ECHO(buffer);} while (0) #define GET_ARRAY_PIN(p) pin_array[p].pin +#define GET_ARRAY_IS_DIGITAL(p) pin_array[p].is_digital #define VALID_PIN(pin) (pin >= 0 && pin < (int8_t)NUMBER_PINS_TOTAL ? 1 : 0) #define DIGITAL_PIN_TO_ANALOG_PIN(p) int(p - analogInputToDigitalPin(0)) -#define IS_ANALOG(P) (((P) >= analogInputToDigitalPin(0)) && ((P) <= analogInputToDigitalPin(NUM_ANALOG_INPUTS - 1))) +#define IS_ANALOG(P) WITHIN(P, char(analogInputToDigitalPin(0)), char(analogInputToDigitalPin(NUM_ANALOG_INPUTS - 1))) #define pwm_status(pin) (((g_pinStatus[pin] & 0xF) == PIN_STATUS_PWM) && \ ((g_APinDescription[pin].ulPinAttribute & PIN_ATTR_PWM) == PIN_ATTR_PWM)) #define MULTI_NAME_PAD 14 // space needed to be pretty if not first name assigned to a pin @@ -85,15 +86,11 @@ bool GET_PINMODE(int8_t pin) { // 1: output, 0: input || pwm_status(pin)); } -bool GET_ARRAY_IS_DIGITAL(int8_t pin) { - uint8_t pin_status = g_pinStatus[pin] & 0xF; - return !(pin_status == PIN_STATUS_ANALOG); -} void pwm_details(int32_t pin) { if (pwm_status(pin)) { uint32_t chan = g_APinDescription[pin].ulPWMChannel; - SERIAL_PROTOCOLPAIR("PWM = ", PWM_INTERFACE->PWM_CH_NUM[chan].PWM_CDTY); + SERIAL_ECHOPAIR("PWM = ", PWM_INTERFACE->PWM_CH_NUM[chan].PWM_CDTY); } } @@ -187,4 +184,4 @@ void pwm_details(int32_t pin) { * ID | PB11 * VBOF | PB10 * - */ \ No newline at end of file + */ diff --git a/Marlin/src/HAL/HAL_DUE/spi_pins.h b/Marlin/src/HAL/HAL_DUE/spi_pins.h index 8f4f987155c6..c805b0c1eaba 100644 --- a/Marlin/src/HAL/HAL_DUE/spi_pins.h +++ b/Marlin/src/HAL/HAL_DUE/spi_pins.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_shared_hw_spi.cpp b/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_shared_hw_spi.cpp index c62f6a06ece7..ba7700150f5c 100644 --- a/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_shared_hw_spi.cpp +++ b/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_shared_hw_spi.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017, 2018 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -95,7 +95,7 @@ void u8g_SetPILevel_DUE_hw_spi(u8g_t *u8g, uint8_t pin_index, uint8_t level) { } uint8_t u8g_com_HAL_DUE_shared_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) { - switch(msg) { + switch (msg) { case U8G_COM_MSG_STOP: break; diff --git a/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp b/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp index 968f63241ce9..3cef880bcaba 100644 --- a/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp +++ b/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -64,15 +64,14 @@ #include "../shared/Delay.h" void u8g_SetPIOutput_DUE(u8g_t *u8g, uint8_t pin_index) { - PIO_Configure(g_APinDescription[u8g->pin_list[pin_index]].pPort, PIO_OUTPUT_1, - g_APinDescription[u8g->pin_list[pin_index]].ulPin, g_APinDescription[u8g->pin_list[pin_index]].ulPinConfiguration); // OUTPUT + PIO_Configure(g_APinDescription[u8g->pin_list[pin_index]].pPort, PIO_OUTPUT_1, + g_APinDescription[u8g->pin_list[pin_index]].ulPin, g_APinDescription[u8g->pin_list[pin_index]].ulPinConfiguration); // OUTPUT } void u8g_SetPILevel_DUE(u8g_t *u8g, uint8_t pin_index, uint8_t level) { volatile Pio* port = g_APinDescription[u8g->pin_list[pin_index]].pPort; uint32_t mask = g_APinDescription[u8g->pin_list[pin_index]].ulPin; - if (level) port->PIO_SODR = mask; - else port->PIO_CODR = mask; + if (level) port->PIO_SODR = mask; else port->PIO_CODR = mask; } Pio *SCK_pPio, *MOSI_pPio; @@ -95,26 +94,15 @@ static void spiSend_sw_DUE(uint8_t val) { // 800KHz static uint8_t rs_last_state = 255; static void u8g_com_DUE_st7920_write_byte_sw_spi(uint8_t rs, uint8_t val) { - uint8_t i; - - if ( rs != rs_last_state) { // time to send a command/data byte + if (rs != rs_last_state) { // time to send a command/data byte rs_last_state = rs; - - if ( rs == 0 ) - /* command */ - spiSend_sw_DUE(0x0F8); - else - /* data */ - spiSend_sw_DUE(0x0FA); - + spiSend_sw_DUE(rs ? 0x0FA : 0x0F8); // Command or Data DELAY_US(40); // give the controller some time to process the data: 20 is bad, 30 is OK, 40 is safe } - - spiSend_sw_DUE(val & 0x0F0); + spiSend_sw_DUE(val & 0xF0); spiSend_sw_DUE(val << 4); } - uint8_t u8g_com_HAL_DUE_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) { switch (msg) { case U8G_COM_MSG_INIT: @@ -180,6 +168,42 @@ uint8_t u8g_com_HAL_DUE_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_va return 1; } -#endif // HAS_GRAPHICAL_LCD +#if ENABLED(LIGHTWEIGHT_UI) + #include "../../lcd/ultralcd.h" + #include "../shared/HAL_ST7920.h" + + #define ST7920_CS_PIN LCD_PINS_RS + + #if DOGM_SPI_DELAY_US > 0 + #define U8G_DELAY() DELAY_US(DOGM_SPI_DELAY_US) + #else + #define U8G_DELAY() DELAY_US(10) + #endif + + void ST7920_cs() { + WRITE(ST7920_CS_PIN, HIGH); + U8G_DELAY(); + } + + void ST7920_ncs() { + WRITE(ST7920_CS_PIN, LOW); + } + + void ST7920_set_cmd() { + spiSend_sw_DUE(0xF8); + DELAY_US(40); + } + void ST7920_set_dat() { + spiSend_sw_DUE(0xFA); + DELAY_US(40); + } + + void ST7920_write_byte(const uint8_t val) { + spiSend_sw_DUE(val & 0xF0); + spiSend_sw_DUE(val << 4); + } +#endif // LIGHTWEIGHT_UI + +#endif // HAS_GRAPHICAL_LCD #endif // ARDUINO_ARCH_SAM diff --git a/Marlin/src/HAL/HAL_DUE/usb/sd_mmc_spi_mem.cpp b/Marlin/src/HAL/HAL_DUE/usb/sd_mmc_spi_mem.cpp index cdb81b24892f..468e9ee45db7 100644 --- a/Marlin/src/HAL/HAL_DUE/usb/sd_mmc_spi_mem.cpp +++ b/Marlin/src/HAL/HAL_DUE/usb/sd_mmc_spi_mem.cpp @@ -19,7 +19,7 @@ void sd_mmc_spi_mem_init(void) { } Ctrl_status sd_mmc_spi_test_unit_ready(void) { - if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.flag.cardOK) + if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isDetected()) return CTRL_NO_PRESENT; return CTRL_GOOD; } @@ -27,7 +27,7 @@ Ctrl_status sd_mmc_spi_test_unit_ready(void) { // NOTE: This function is defined as returning the address of the last block // in the card, which is cardSize() - 1 Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector) { - if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.flag.cardOK) + if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isDetected()) return CTRL_NO_PRESENT; *nb_sector = card.getSd2Card().cardSize() - 1; return CTRL_GOOD; @@ -42,7 +42,7 @@ bool sd_mmc_spi_wr_protect(void) { } bool sd_mmc_spi_removal(void) { - if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.flag.cardOK) + if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isDetected()) return true; return false; } @@ -61,13 +61,16 @@ uint8_t sector_buf[SD_MMC_BLOCK_SIZE]; // #define DEBUG_MMC Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) { - if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.flag.cardOK) + if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isDetected()) return CTRL_NO_PRESENT; #ifdef DEBUG_MMC + { char buffer[80]; - sprintf(buffer, "SDRD: %d @ 0x%08x\n", nb_sector, addr); - SERIAL_PROTOCOL_P(0, buffer); + sprintf_P(buffer, PSTR("SDRD: %d @ 0x%08x\n"), nb_sector, addr); + PORT_REDIRECT(0); + SERIAL_ECHO(buffer); + } #endif // Start reading @@ -95,13 +98,16 @@ Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) { } Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector) { - if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.flag.cardOK) + if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isDetected()) return CTRL_NO_PRESENT; #ifdef DEBUG_MMC + { char buffer[80]; - sprintf(buffer, "SDWR: %d @ 0x%08x\n", nb_sector, addr); - SERIAL_PROTOCOL_P(0, buffer); + sprintf_P(buffer, PSTR("SDWR: %d @ 0x%08x\n"), nb_sector, addr); + PORT_REDIRECT(0); + SERIAL_ECHO(buffer); + } #endif if (!card.getSd2Card().writeStart(addr, nb_sector)) diff --git a/Marlin/src/HAL/HAL_DUE/watchdog_Due.cpp b/Marlin/src/HAL/HAL_DUE/watchdog_Due.cpp index 3467fdd9422f..2bf8080b769b 100644 --- a/Marlin/src/HAL/HAL_DUE/watchdog_Due.cpp +++ b/Marlin/src/HAL/HAL_DUE/watchdog_Due.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_DUE/watchdog_Due.h b/Marlin/src/HAL/HAL_DUE/watchdog_Due.h index c75875e2ea74..07187bfe6b57 100644 --- a/Marlin/src/HAL/HAL_DUE/watchdog_Due.h +++ b/Marlin/src/HAL/HAL_DUE/watchdog_Due.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_ESP32/FlushableHardwareSerial.cpp b/Marlin/src/HAL/HAL_ESP32/FlushableHardwareSerial.cpp new file mode 100644 index 000000000000..6b1277b20493 --- /dev/null +++ b/Marlin/src/HAL/HAL_ESP32/FlushableHardwareSerial.cpp @@ -0,0 +1,33 @@ +/** + * 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 "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 000000000000..082fa7df0406 --- /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 f928d635f79f..53966de55e56 100644 --- a/Marlin/src/HAL/HAL_ESP32/HAL.cpp +++ b/Marlin/src/HAL/HAL_ESP32/HAL.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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,19 +93,31 @@ 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 } void HAL_clear_reset_source(void) { } -uint8_t HAL_get_reset_source (void) { +uint8_t HAL_get_reset_source(void) { return rtc_get_reset_reason(1); } @@ -111,12 +133,16 @@ int freeMemory() { // -------------------------------------------------------------------------- // ADC // -------------------------------------------------------------------------- -#define ADC1_CHANNEL(pin) ADC1_GPIO##pin_CHANNEL +#define ADC1_CHANNEL(pin) ADC1_GPIO ## pin ## _CHANNEL adc1_channel_t get_channel(int pin) { switch (pin) { - case 36: return ADC1_GPIO36_CHANNEL; - case 39: return ADC1_GPIO39_CHANNEL; + case 39: return ADC1_CHANNEL(39); + case 36: return ADC1_CHANNEL(36); + case 35: return ADC1_CHANNEL(35); + case 34: return ADC1_CHANNEL(34); + case 33: return ADC1_CHANNEL(33); + case 32: return ADC1_CHANNEL(32); } return ADC1_CHANNEL_MAX; @@ -125,14 +151,21 @@ adc1_channel_t get_channel(int pin) { void HAL_adc_init() { // Configure ADC adc1_config_width(ADC_WIDTH_12Bit); - adc1_config_channel_atten(get_channel(36), ADC_ATTEN_11db); adc1_config_channel_atten(get_channel(39), ADC_ATTEN_11db); + adc1_config_channel_atten(get_channel(36), ADC_ATTEN_11db); + adc1_config_channel_atten(get_channel(35), ADC_ATTEN_11db); + adc1_config_channel_atten(get_channel(34), ADC_ATTEN_11db); + adc1_config_channel_atten(get_channel(33), ADC_ATTEN_11db); + adc1_config_channel_atten(get_channel(32), ADC_ATTEN_11db); + + // Note that adc2 is shared with the WiFi module, which has higher priority, so the conversion may fail. + // That's why we're not setting it up here. // Calculate ADC characteristics i.e. gain and offset factors esp_adc_cal_characterize(ADC_UNIT_1, ADC_ATTEN_DB_11, ADC_WIDTH_BIT_12, V_REF, &characteristics); } -void HAL_adc_start_conversion (uint8_t adc_pin) { +void HAL_adc_start_conversion(uint8_t adc_pin) { uint32_t mv; esp_adc_cal_get_voltage((adc_channel_t)get_channel(adc_pin), &characteristics, &mv); diff --git a/Marlin/src/HAL/HAL_ESP32/HAL.h b/Marlin/src/HAL/HAL_ESP32/HAL.h index a9f9afbffcdb..16859263b2e0 100644 --- a/Marlin/src/HAL/HAL_ESP32/HAL.h +++ b/Marlin/src/HAL/HAL_ESP32/HAL.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 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 @@ -30,30 +30,45 @@ #include +// these are going to be re-defined in Arduino.h #undef DISABLED +#undef M_PI #undef _BV #include +// revert back to the correct (old) definition #undef DISABLED -#define DISABLED(b) (!_CAT(SWITCH_ENABLED_, b)) +#define DISABLED(V...) DO(DIS,&&,V) +// re-define in case Arduino.h has been skipped due to earlier inclusion (i.e. in Marlin\src\HAL\HAL_ESP32\i2s.cpp) +#define _BV(b) (1UL << (b)) #include "../shared/math_32bit.h" #include "../shared/HAL_SPI.h" #include "fastio_ESP32.h" #include "watchdog_ESP32.h" +#include "i2s.h" #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) @@ -87,7 +102,7 @@ extern uint16_t HAL_adc_result; void HAL_clear_reset_source (void); // reset reason -uint8_t HAL_get_reset_source (void); +uint8_t HAL_get_reset_source(void); void _delay_ms(int delay); @@ -110,7 +125,7 @@ void HAL_adc_init(void); #define HAL_READ_ADC() HAL_adc_result #define HAL_ADC_READY() true -void HAL_adc_start_conversion (uint8_t adc_pin); +void HAL_adc_start_conversion(uint8_t adc_pin); #define GET_PIN_MAP_PIN(index) index #define GET_PIN_MAP_INDEX(pin) pin diff --git a/Marlin/src/HAL/HAL_ESP32/HAL_spi_ESP32.cpp b/Marlin/src/HAL/HAL_ESP32/HAL_spi_ESP32.cpp index c93227822d05..d48b14d6103b 100644 --- a/Marlin/src/HAL/HAL_ESP32/HAL_spi_ESP32.cpp +++ b/Marlin/src/HAL/HAL_ESP32/HAL_spi_ESP32.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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.cpp b/Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.cpp index f3d444af0c58..39ca18fcea1c 100644 --- a/Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.cpp +++ b/Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -113,7 +113,7 @@ void HAL_timer_start(const uint8_t timer_num, uint32_t frequency) { const tTimerConfig timer = TimerConfig[timer_num]; timer_config_t config; - config.divider = STEPPER_TIMER_PRESCALE; + config.divider = timer.divider; config.counter_dir = TIMER_COUNT_UP; config.counter_en = TIMER_PAUSE; config.alarm_en = TIMER_ALARM_EN; diff --git a/Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.h b/Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.h index e8afd83bb8e6..7fbaa5222dda 100644 --- a/Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.h +++ b/Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -43,9 +43,15 @@ typedef uint64_t hal_timer_t; #define HAL_TIMER_RATE APB_CLK_FREQ // frequency of timer peripherals -#define STEPPER_TIMER_PRESCALE 40 -#define STEPPER_TIMER_RATE (HAL_TIMER_RATE / STEPPER_TIMER_PRESCALE) // frequency of stepper timer, 2MHz -#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs +#if ENABLED(I2S_STEPPER_STREAM) + #define STEPPER_TIMER_PRESCALE 1 + #define STEPPER_TIMER_RATE 250000 // 250khz, 4us pulses of i2s word clock + #define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs // wrong would be 0.25 +#else + #define STEPPER_TIMER_PRESCALE 40 + #define STEPPER_TIMER_RATE (HAL_TIMER_RATE / STEPPER_TIMER_PRESCALE) // frequency of stepper timer, 2MHz + #define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs +#endif #define STEP_TIMER_MIN_INTERVAL 8 // minimum time in µs between stepper interrupts @@ -63,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 a96f665151e7..f911d84ce099 100644 --- a/Marlin/src/HAL/HAL_ESP32/SanityCheck.h +++ b/Marlin/src/HAL/HAL_ESP32/SanityCheck.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 000000000000..bdc804dacf24 --- /dev/null +++ b/Marlin/src/HAL/HAL_ESP32/WebSocketSerial.cpp @@ -0,0 +1,153 @@ +/** + * 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 ENABLED(WIFISUPPORT) + +#include "WebSocketSerial.h" +#include "wifi.h" +#include + +WebSocketSerial webSocketSerial; +AsyncWebSocket ws("/ws"); // TODO Move inside the class. + +// RingBuffer impl + +#define NEXT_INDEX(I, SIZE) ((I + 1) & (ring_buffer_pos_t)(SIZE - 1)) + +RingBuffer::RingBuffer(ring_buffer_pos_t size) + : data(new uint8_t[size]), + read_index(0), + write_index(0), + size(size) +{} + +RingBuffer::~RingBuffer() { delete[] data; } + +ring_buffer_pos_t RingBuffer::write(const uint8_t c) { + const ring_buffer_pos_t n = NEXT_INDEX(write_index, size); + + if (n != read_index) { + this->data[write_index] = c; + write_index = n; + return 1; + } + + // TODO: buffer is full, handle? + return 0; +} + +ring_buffer_pos_t RingBuffer::write(const uint8_t *buffer, ring_buffer_pos_t size) { + ring_buffer_pos_t written = 0; + for (ring_buffer_pos_t i = 0; i < size; i++) { + written += write(buffer[i]); + } + return written; +} + +int RingBuffer::available(void) { + return (size - read_index + write_index) & (size - 1); +} + +int RingBuffer::peek(void) { + return available() ? data[read_index] : -1; +} + +int RingBuffer::read(void) { + if (available()) { + const int ret = data[read_index]; + read_index = NEXT_INDEX(read_index, size); + return ret; + } + return -1; +} + +ring_buffer_pos_t RingBuffer::read(uint8_t *buffer) { + ring_buffer_pos_t len = available(); + + for(ring_buffer_pos_t i = 0; read_index != write_index; i++) { + buffer[i] = data[read_index]; + read_index = NEXT_INDEX(read_index, size); + } + + return len; +} + +void RingBuffer::flush(void) { read_index = write_index; } + +// WebSocketSerial impl +WebSocketSerial::WebSocketSerial() + : rx_buffer(RingBuffer(RX_BUFFER_SIZE)), + tx_buffer(RingBuffer(TX_BUFFER_SIZE)) +{} + +void WebSocketSerial::begin(const long baud_setting) { + ws.onEvent([this](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) + this->rx_buffer.write(data, len); + } + } + }); + server.addHandler(&ws); +} + +void WebSocketSerial::end() { } +int WebSocketSerial::peek(void) { return rx_buffer.peek(); } +int WebSocketSerial::read(void) { return rx_buffer.read(); } +int WebSocketSerial::available(void) { return rx_buffer.available(); } +void WebSocketSerial::flush(void) { rx_buffer.flush(); } + +size_t WebSocketSerial::write(const uint8_t c) { + size_t ret = tx_buffer.write(c); + + if (ret && c == '\n') { + uint8_t tmp[TX_BUFFER_SIZE]; + ring_buffer_pos_t size = tx_buffer.read(tmp); + ws.textAll(tmp, size); + } + + return ret; +} + +size_t WebSocketSerial::write(const uint8_t* buffer, size_t size) { + size_t written = 0; + for(size_t i = 0; i < size; i++) { + written += write(buffer[i]); + } + return written; +} + +void WebSocketSerial::flushTX(void) { + // No need to do anything as there's no benefit to sending partial lines over the websocket connection. +} + +#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 000000000000..610058755583 --- /dev/null +++ b/Marlin/src/HAL/HAL_ESP32/WebSocketSerial.h @@ -0,0 +1,84 @@ +/** + * 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/MarlinConfig.h" + +#include "Stream.h" + +#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 + +typedef uint16_t ring_buffer_pos_t; + +class RingBuffer { + uint8_t *data; + ring_buffer_pos_t size, read_index, write_index; + +public: + RingBuffer(ring_buffer_pos_t size); + ~RingBuffer(); + + int available(void); + int peek(void); + int read(void); + ring_buffer_pos_t read(uint8_t *buffer); + void flush(void); + ring_buffer_pos_t write(const uint8_t c); + ring_buffer_pos_t write(const uint8_t* buffer, ring_buffer_pos_t size); +}; + +class WebSocketSerial: public Stream { + RingBuffer rx_buffer; + RingBuffer tx_buffer; + +public: + WebSocketSerial(); + void begin(const long); + void end(); + int available(void); + int peek(void); + int read(void); + void flush(void); + void flushTX(void); + size_t write(const uint8_t c); + size_t write(const uint8_t* buffer, size_t size); + + operator bool() { return true; } + + #if ENABLED(SERIAL_STATS_DROPPED_RX) + FORCE_INLINE uint32_t dropped() { return 0; } + #endif + + #if ENABLED(SERIAL_STATS_MAX_RX_QUEUED) + FORCE_INLINE int rxMaxEnqueued() { return 0; } + #endif +}; + +extern WebSocketSerial webSocketSerial; diff --git a/Marlin/src/HAL/HAL_ESP32/endstop_interrupts.h b/Marlin/src/HAL/HAL_ESP32/endstop_interrupts.h index 9a325f30a7cd..d4c8cbd4902a 100644 --- a/Marlin/src/HAL/HAL_ESP32/endstop_interrupts.h +++ b/Marlin/src/HAL/HAL_ESP32/endstop_interrupts.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h b/Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h index 8459a151cc3a..b71ca784181f 100644 --- a/Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h +++ b/Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -21,38 +21,59 @@ */ #pragma once +#include "i2s.h" + /** * Utility functions */ -// set pin as input -#define _SET_INPUT(IO) pinMode(IO, INPUT) +// I2S expander pin mapping. +#define IS_I2S_EXPANDER_PIN(IO) TEST(IO, 7) +#define I2S_EXPANDER_PIN_INDEX(IO) (IO & 0x7F) + +// Set pin as input +#define _SET_INPUT(IO) pinMode(IO, INPUT) -// set pin as output -#define _SET_OUTPUT(IO) pinMode(IO, OUTPUT) +// Set pin as 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) +// Set pin as input with pullup mode +#define _PULLUP(IO, v) pinMode(IO, v ? INPUT_PULLUP : INPUT) // Read a pin wrapper -#define READ(IO) digitalRead(IO) +#define READ(IO) (IS_I2S_EXPANDER_PIN(IO) ? i2s_state(I2S_EXPANDER_PIN_INDEX(IO)) : digitalRead(IO)) // Write to a pin wrapper -#define WRITE(IO, v) digitalWrite(IO, v) +#define WRITE(IO, v) (IS_I2S_EXPANDER_PIN(IO) ? i2s_write(I2S_EXPANDER_PIN_INDEX(IO), v) : digitalWrite(IO, v)) + +// Set pin as input wrapper +#define SET_INPUT(IO) _SET_INPUT(IO) -// set pin as input wrapper -#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 input with pullup wrapper -#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); }while(0) -// set pin as output wrapper -#define SET_OUTPUT(IO) do{ _SET_OUTPUT(IO); WRITE(IO, LOW); }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) + +// PWM outputs +#define PWM_PIN(P) (P < 34) // NOTE Pins >= 34 are input only on ESP32, so they can't be used for output. +#define USEABLE_HARDWARE_PWM(P) (!IS_I2S_EXPANDER_PIN(P) && PWM_PIN(P)) + +// Toggle pin value +#define TOGGLE(IO) WRITE(IO, !READ(IO)) + // -// ports and functions +// Ports and functions // // UART diff --git a/Marlin/src/HAL/HAL_ESP32/i2s.cpp b/Marlin/src/HAL/HAL_ESP32/i2s.cpp new file mode 100644 index 000000000000..0345889e0767 --- /dev/null +++ b/Marlin/src/HAL/HAL_ESP32/i2s.cpp @@ -0,0 +1,331 @@ +/** + * 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 + +// replace that with the proper imports, then cleanup workarounds in Marlin\src\HAL\HAL_ESP32\HAL.h +#include +// revert back to the correct definition +#undef DISABLED +#define DISABLED(V...) DO(DIS,&&,V) + +#include "i2s.h" +#include "../../core/macros.h" +#include "driver/periph_ctrl.h" +#include "rom/lldesc.h" +#include "soc/i2s_struct.h" +#include "freertos/queue.h" +#include "../../module/stepper.h" + +#define DMA_BUF_COUNT 8 // number of DMA buffers to store data +#define DMA_BUF_LEN 4092 // maximum size in bytes +#define I2S_SAMPLE_SIZE 4 // 4 bytes, 32 bits per sample +#define DMA_SAMPLE_COUNT DMA_BUF_LEN / I2S_SAMPLE_SIZE // number of samples per buffer + +typedef enum { + I2S_NUM_0 = 0x0, /*!< I2S 0*/ + I2S_NUM_1 = 0x1, /*!< I2S 1*/ + I2S_NUM_MAX, +} i2s_port_t; + +typedef struct { + uint32_t **buffers; + uint32_t *current; + uint32_t rw_pos; + lldesc_t **desc; + xQueueHandle queue; +} i2s_dma_t; + +static portMUX_TYPE i2s_spinlock[I2S_NUM_MAX] = {portMUX_INITIALIZER_UNLOCKED, portMUX_INITIALIZER_UNLOCKED}; +static i2s_dev_t* I2S[I2S_NUM_MAX] = {&I2S0, &I2S1}; +static i2s_dma_t dma; + +// output value +uint32_t i2s_port_data; + +#define I2S_ENTER_CRITICAL() portENTER_CRITICAL(&i2s_spinlock[i2s_num]) +#define I2S_EXIT_CRITICAL() portEXIT_CRITICAL(&i2s_spinlock[i2s_num]) + +static inline void gpio_matrix_out_check(uint32_t gpio, uint32_t signal_idx, bool out_inv, bool oen_inv) { + //if pin = -1, do not need to configure + if (gpio != -1) { + PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[gpio], PIN_FUNC_GPIO); + gpio_set_direction((gpio_num_t)gpio, (gpio_mode_t)GPIO_MODE_DEF_OUTPUT); + gpio_matrix_out(gpio, signal_idx, out_inv, oen_inv); + } +} + +static esp_err_t i2s_reset_fifo(i2s_port_t i2s_num) { + I2S_ENTER_CRITICAL(); + I2S[i2s_num]->conf.rx_fifo_reset = 1; + I2S[i2s_num]->conf.rx_fifo_reset = 0; + I2S[i2s_num]->conf.tx_fifo_reset = 1; + I2S[i2s_num]->conf.tx_fifo_reset = 0; + I2S_EXIT_CRITICAL(); + + return ESP_OK; +} + +esp_err_t i2s_start(i2s_port_t i2s_num) { + //start DMA link + I2S_ENTER_CRITICAL(); + i2s_reset_fifo(i2s_num); + + //reset dma + I2S[i2s_num]->lc_conf.in_rst = 1; + I2S[i2s_num]->lc_conf.in_rst = 0; + I2S[i2s_num]->lc_conf.out_rst = 1; + I2S[i2s_num]->lc_conf.out_rst = 0; + + I2S[i2s_num]->conf.tx_reset = 1; + I2S[i2s_num]->conf.tx_reset = 0; + I2S[i2s_num]->conf.rx_reset = 1; + I2S[i2s_num]->conf.rx_reset = 0; + + I2S[i2s_num]->int_clr.val = 0xFFFFFFFF; + I2S[i2s_num]->out_link.start = 1; + I2S[i2s_num]->conf.tx_start = 1; + I2S_EXIT_CRITICAL(); + + return ESP_OK; +} + +esp_err_t i2s_stop(i2s_port_t i2s_num) { + I2S_ENTER_CRITICAL(); + I2S[i2s_num]->out_link.stop = 1; + I2S[i2s_num]->conf.tx_start = 0; + + I2S[i2s_num]->int_clr.val = I2S[i2s_num]->int_st.val; //clear pending interrupt + I2S_EXIT_CRITICAL(); + + return ESP_OK; +} + +static void IRAM_ATTR i2s_intr_handler_default(void *arg) { + int dummy; + lldesc_t *finish_desc; + portBASE_TYPE high_priority_task_awoken = pdFALSE; + + if (I2S0.int_st.out_eof) { + // Get the descriptor of the last item in the linkedlist + finish_desc = (lldesc_t*) I2S0.out_eof_des_addr; + + // If the queue is full it's because we have an underflow, + // more than buf_count isr without new data, remove the front buffer + if (xQueueIsQueueFullFromISR(dma.queue)) + xQueueReceiveFromISR(dma.queue, &dummy, &high_priority_task_awoken); + + xQueueSendFromISR(dma.queue, (void *)(&finish_desc->buf), &high_priority_task_awoken); + } + + if (high_priority_task_awoken == pdTRUE) portYIELD_FROM_ISR(); + + // clear interrupt + I2S0.int_clr.val = I2S0.int_st.val; //clear pending interrupt +} + +void stepperTask(void* parameter) { + uint32_t i, remaining = 0; + + while (1) { + xQueueReceive(dma.queue, &dma.current, portMAX_DELAY); + dma.rw_pos = 0; + + for (i = 0; i < DMA_SAMPLE_COUNT; i++) { + // Fill with the port data post pulse_phase until the next step + if (remaining) { + i2s_push_sample(); + remaining--; + } + else { + Stepper::stepper_pulse_phase_isr(); + remaining = Stepper::stepper_block_phase_isr(); + } + } + } +} + +int i2s_init() { + periph_module_enable(PERIPH_I2S0_MODULE); + + /** + * Each i2s transfer will take + * fpll = PLL_D2_CLK -- clka_en = 0 + * + * fi2s = fpll / N + b/a -- N = clkm_div_num + * fi2s = 160MHz / 2 + * fi2s = 80MHz + * + * fbclk = fi2s / M -- M = tx_bck_div_num + * fbclk = 80MHz / 2 + * fbclk = 40MHz + * + * fwclk = fbclk / 32 + * + * for fwclk = 250kHz (4uS pulse time) + * N = 10 + * M = 20 + */ + + // Allocate the array of pointers to the buffers + dma.buffers = (uint32_t **)malloc(sizeof(uint32_t*) * DMA_BUF_COUNT); + if (dma.buffers == NULL) return -1; + + // Allocate each buffer that can be used by the DMA controller + for (int buf_idx = 0; buf_idx < DMA_BUF_COUNT; buf_idx++) { + dma.buffers[buf_idx] = (uint32_t*) heap_caps_calloc(1, DMA_BUF_LEN, MALLOC_CAP_DMA); + if (dma.buffers[buf_idx] == NULL) return -1; + } + + // Allocate the array of DMA descriptors + dma.desc = (lldesc_t**) malloc(sizeof(lldesc_t*) * DMA_BUF_COUNT); + if (dma.desc == NULL) return -1; + + // Allocate each DMA descriptor that will be used by the DMA controller + for (int buf_idx = 0; buf_idx < DMA_BUF_COUNT; buf_idx++) { + dma.desc[buf_idx] = (lldesc_t*) heap_caps_malloc(sizeof(lldesc_t), MALLOC_CAP_DMA); + if (dma.desc[buf_idx] == NULL) return -1; + } + + // Initialize + for (int buf_idx = 0; buf_idx < DMA_BUF_COUNT; buf_idx++) { + dma.desc[buf_idx]->owner = 1; + dma.desc[buf_idx]->eof = 1; // set to 1 will trigger the interrupt + dma.desc[buf_idx]->sosf = 0; + dma.desc[buf_idx]->length = DMA_BUF_LEN; + dma.desc[buf_idx]->size = DMA_BUF_LEN; + dma.desc[buf_idx]->buf = (uint8_t *) dma.buffers[buf_idx]; + dma.desc[buf_idx]->offset = 0; + dma.desc[buf_idx]->empty = (uint32_t)((buf_idx < (DMA_BUF_COUNT - 1)) ? (dma.desc[buf_idx + 1]) : dma.desc[0]); + } + + dma.queue = xQueueCreate(DMA_BUF_COUNT, sizeof(uint32_t *)); + + // Set the first DMA descriptor + I2S0.out_link.addr = (uint32_t)dma.desc[0]; + + // stop i2s + i2s_stop(I2S_NUM_0); + + // configure I2S data port interface. + i2s_reset_fifo(I2S_NUM_0); + + //reset i2s + I2S0.conf.tx_reset = 1; + I2S0.conf.tx_reset = 0; + I2S0.conf.rx_reset = 1; + I2S0.conf.rx_reset = 0; + + //reset dma + I2S0.lc_conf.in_rst = 1; + I2S0.lc_conf.in_rst = 0; + I2S0.lc_conf.out_rst = 1; + I2S0.lc_conf.out_rst = 0; + + //Enable and configure DMA + I2S0.lc_conf.check_owner = 0; + I2S0.lc_conf.out_loop_test = 0; + I2S0.lc_conf.out_auto_wrback = 0; + I2S0.lc_conf.out_data_burst_en = 0; + I2S0.lc_conf.outdscr_burst_en = 0; + I2S0.lc_conf.out_no_restart_clr = 0; + I2S0.lc_conf.indscr_burst_en = 0; + I2S0.lc_conf.out_eof_mode = 1; + + I2S0.conf2.lcd_en = 0; + I2S0.conf2.camera_en = 0; + I2S0.pdm_conf.pcm2pdm_conv_en = 0; + I2S0.pdm_conf.pdm2pcm_conv_en = 0; + + I2S0.fifo_conf.dscr_en = 0; + + I2S0.conf_chan.tx_chan_mod = 0; + I2S0.fifo_conf.tx_fifo_mod = 0; + I2S0.conf.tx_mono = 0; + + I2S0.conf_chan.rx_chan_mod = 0; + I2S0.fifo_conf.rx_fifo_mod = 0; + I2S0.conf.rx_mono = 0; + + I2S0.fifo_conf.dscr_en = 1; //connect dma to fifo + + I2S0.conf.tx_start = 0; + I2S0.conf.rx_start = 0; + + I2S0.conf.tx_msb_right = 1; + I2S0.conf.tx_right_first = 1; + + I2S0.conf.tx_slave_mod = 0; // Master + I2S0.fifo_conf.tx_fifo_mod_force_en = 1; + + I2S0.pdm_conf.rx_pdm_en = 0; + I2S0.pdm_conf.tx_pdm_en = 0; + + I2S0.conf.tx_short_sync = 0; + I2S0.conf.rx_short_sync = 0; + I2S0.conf.tx_msb_shift = 0; + I2S0.conf.rx_msb_shift = 0; + + // set clock + I2S0.clkm_conf.clka_en = 0; // Use PLL/2 as reference + I2S0.clkm_conf.clkm_div_num = 10; // minimum value of 2, reset value of 4, max 256 + I2S0.clkm_conf.clkm_div_a = 0; // 0 at reset, what about divide by 0? (not an issue) + I2S0.clkm_conf.clkm_div_b = 0; // 0 at reset + + // fbck = fi2s / tx_bck_div_num + I2S0.sample_rate_conf.tx_bck_div_num = 2; // minimum value of 2 defaults to 6 + + // Enable TX interrupts + I2S0.int_ena.out_eof = 1; + I2S0.int_ena.out_dscr_err = 0; + I2S0.int_ena.out_total_eof = 0; + I2S0.int_ena.out_done = 0; + + // Allocate and Enable the I2S interrupt + intr_handle_t i2s_isr_handle; + esp_intr_alloc(ETS_I2S0_INTR_SOURCE, 0, i2s_intr_handler_default, NULL, &i2s_isr_handle); + esp_intr_enable(i2s_isr_handle); + + // Create the task that will feed the buffer + xTaskCreate(stepperTask, "StepperTask", 10000, NULL, 1, NULL); + + // Route the i2s pins to the appropriate GPIO + gpio_matrix_out_check(I2S_DATA, I2S0O_DATA_OUT23_IDX, 0, 0); + gpio_matrix_out_check(I2S_BCK, I2S0O_BCK_OUT_IDX, 0, 0); + gpio_matrix_out_check(I2S_WS, I2S0O_WS_OUT_IDX, 0, 0); + + // Start the I2S peripheral + return i2s_start(I2S_NUM_0); +} + +void i2s_write(uint8_t pin, uint8_t val) { + SET_BIT_TO(i2s_port_data, pin, val); +} + +uint8_t i2s_state(uint8_t pin) { + return TEST(i2s_port_data, pin); +} + +void i2s_push_sample() { + dma.current[dma.rw_pos++] = i2s_port_data; +} + +#endif // ARDUINO_ARCH_ESP32 diff --git a/Marlin/src/HAL/HAL_ESP32/i2s.h b/Marlin/src/HAL/HAL_ESP32/i2s.h new file mode 100644 index 000000000000..fbe7b2419ac3 --- /dev/null +++ b/Marlin/src/HAL/HAL_ESP32/i2s.h @@ -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 . + * + */ +#pragma once + +// current value of the outputs provided over i2s +extern uint32_t i2s_port_data; + +int i2s_init(); + +uint8_t i2s_state(uint8_t pin); + +void i2s_write(uint8_t pin, uint8_t val); + +void i2s_push_sample(); + +// pin definitions + +#define I2S_WS 25 +#define I2S_BCK 26 +#define I2S_DATA 27 diff --git a/Marlin/src/HAL/HAL_ESP32/ota.cpp b/Marlin/src/HAL/HAL_ESP32/ota.cpp index b7fd1bb5c472..40ec1ab8754b 100644 --- a/Marlin/src/HAL/HAL_ESP32/ota.cpp +++ b/Marlin/src/HAL/HAL_ESP32/ota.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 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 @@ -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/ota.h b/Marlin/src/HAL/HAL_ESP32/ota.h index 0fa33b532ead..80e04e123db1 100644 --- a/Marlin/src/HAL/HAL_ESP32/ota.h +++ b/Marlin/src/HAL/HAL_ESP32/ota.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 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 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 000000000000..795edf678144 --- /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/servotimers.h b/Marlin/src/HAL/HAL_ESP32/servotimers.h index 98b0b3c54eb7..0604ca0a2595 100644 --- a/Marlin/src/HAL/HAL_ESP32/servotimers.h +++ b/Marlin/src/HAL/HAL_ESP32/servotimers.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_ESP32/spi_pins.h b/Marlin/src/HAL/HAL_ESP32/spi_pins.h index 48e20a0442e3..4ef6d14ec311 100644 --- a/Marlin/src/HAL/HAL_ESP32/spi_pins.h +++ b/Marlin/src/HAL/HAL_ESP32/spi_pins.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ */ #pragma once -#define SS_PIN 5 +#define SS_PIN SDSS #define SCK_PIN 18 #define MISO_PIN 19 #define MOSI_PIN 23 diff --git a/Marlin/src/HAL/HAL_ESP32/spiffs.cpp b/Marlin/src/HAL/HAL_ESP32/spiffs.cpp new file mode 100644 index 000000000000..c960f386d403 --- /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 000000000000..e1573340cda6 --- /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/watchdog_ESP32.cpp b/Marlin/src/HAL/HAL_ESP32/watchdog_ESP32.cpp index 07e00e95b472..b1c98cb55c05 100644 --- a/Marlin/src/HAL/HAL_ESP32/watchdog_ESP32.cpp +++ b/Marlin/src/HAL/HAL_ESP32/watchdog_ESP32.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_ESP32/watchdog_ESP32.h b/Marlin/src/HAL/HAL_ESP32/watchdog_ESP32.h index df80ebc84c5e..6ee92a73eca0 100644 --- a/Marlin/src/HAL/HAL_ESP32/watchdog_ESP32.h +++ b/Marlin/src/HAL/HAL_ESP32/watchdog_ESP32.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_ESP32/web.cpp b/Marlin/src/HAL/HAL_ESP32/web.cpp new file mode 100644 index 000000000000..cb06cfc7e442 --- /dev/null +++ b/Marlin/src/HAL/HAL_ESP32/web.cpp @@ -0,0 +1,45 @@ +/** + * 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 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 000000000000..4173fd91b0f1 --- /dev/null +++ b/Marlin/src/HAL/HAL_ESP32/web.h @@ -0,0 +1,24 @@ +/** + * 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 + +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 000000000000..9fb5459ae07a --- /dev/null +++ b/Marlin/src/HAL/HAL_ESP32/wifi.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 . + * + */ + +#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 000000000000..7be40ef9006c --- /dev/null +++ b/Marlin/src/HAL/HAL_ESP32/wifi.h @@ -0,0 +1,30 @@ +/** + * 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 + +extern AsyncWebServer server; + +#define DEFAULT_WIFI_HOSTNAME "marlin" + +void wifi_init(); diff --git a/Marlin/src/HAL/HAL_LINUX/HAL.cpp b/Marlin/src/HAL/HAL_LINUX/HAL.cpp new file mode 100644 index 000000000000..3d2dd5cd8254 --- /dev/null +++ b/Marlin/src/HAL/HAL_LINUX/HAL.cpp @@ -0,0 +1,82 @@ +/** + * 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 __PLAT_LINUX__ + +#include "../../inc/MarlinConfig.h" +#include "../shared/Delay.h" + +HalSerial usb_serial; + +// U8glib required functions +extern "C" void u8g_xMicroDelay(uint16_t val) { + DELAY_US(val); +} +extern "C" void u8g_MicroDelay(void) { + u8g_xMicroDelay(1); +} +extern "C" void u8g_10MicroDelay(void) { + u8g_xMicroDelay(10); +} +extern "C" void u8g_Delay(uint16_t val) { + delay(val); +} +//************************// + +// return free heap space +int freeMemory() { + return 0; +} + +// -------------------------------------------------------------------------- +// ADC +// -------------------------------------------------------------------------- + +void HAL_adc_init(void) { + +} + +void HAL_adc_enable_channel(int ch) { + +} + +uint8_t active_ch = 0; +void HAL_adc_start_conversion(const uint8_t ch) { + active_ch = ch; +} + +bool HAL_adc_finished(void) { + return true; +} + +uint16_t HAL_adc_get_result(void) { + pin_t pin = analogInputToDigitalPin(active_ch); + if (!VALID_PIN(pin)) return 0; + uint16_t data = ((Gpio::get(pin) >> 2) & 0x3FF); + return data; // return 10bit value as Marlin expects +} + +void HAL_pwm_init(void) { + +} + +#endif // __PLAT_LINUX__ diff --git a/Marlin/src/HAL/HAL_LINUX/HAL.h b/Marlin/src/HAL/HAL_LINUX/HAL.h new file mode 100644 index 000000000000..1057fae99521 --- /dev/null +++ b/Marlin/src/HAL/HAL_LINUX/HAL.h @@ -0,0 +1,109 @@ +/** + * Marlin 3D Printer Firmware + * + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com + * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +#define CPU_32_BIT + +// -------------------------------------------------------------------------- +// Includes +// -------------------------------------------------------------------------- + +#define F_CPU 100000000 +#define SystemCoreClock F_CPU +#include +#include +#include + +#undef min +#undef max + +#include + +void _printf (const char *format, ...); +void _putc(uint8_t c); +uint8_t _getc(); + +//extern "C" volatile uint32_t _millis; + +//arduino: Print.h +#define DEC 10 +#define HEX 16 +#define OCT 8 +#define BIN 2 +//arduino: binary.h (weird defines) +#define B01 1 +#define B10 2 + +#include "hardware/Clock.h" + +#include + +#include "../shared/math_32bit.h" +#include "../shared/HAL_SPI.h" +#include "fastio.h" +#include "watchdog.h" +#include "HAL_timers.h" +#include "serial.h" + +extern HalSerial usb_serial; +#define MYSERIAL0 usb_serial +#define NUM_SERIAL 1 + +#define ST7920_DELAY_1 DELAY_NS(600) +#define ST7920_DELAY_2 DELAY_NS(750) +#define ST7920_DELAY_3 DELAY_NS(750) + +// +// Interrupts +// +#define CRITICAL_SECTION_START +#define CRITICAL_SECTION_END +#define ISRS_ENABLED() +#define ENABLE_ISRS() +#define DISABLE_ISRS() + +//Utility functions +int freeMemory(void); + +// SPI: Extended functions which take a channel number (hardware SPI only) +/** Write single byte to specified SPI channel */ +void spiSend(uint32_t chan, byte b); +/** Write buffer to specified SPI channel */ +void spiSend(uint32_t chan, const uint8_t* buf, size_t n); +/** Read single byte from specified SPI channel */ +uint8_t spiRec(uint32_t chan); + +// ADC +#define HAL_ANALOG_SELECT(pin) HAL_adc_enable_channel(pin) +#define HAL_START_ADC(pin) HAL_adc_start_conversion(pin) +#define HAL_READ_ADC() HAL_adc_get_result() +#define HAL_ADC_READY() true + +void HAL_adc_init(void); +void HAL_adc_enable_channel(int pin); +void HAL_adc_start_conversion(const uint8_t adc_pin); +uint16_t HAL_adc_get_result(void); + +/* ---------------- Delay in cycles */ +FORCE_INLINE static void DELAY_CYCLES(uint64_t x) { + Clock::delayCycles(x); +} diff --git a/Marlin/src/HAL/HAL_LINUX/HAL_timers.cpp b/Marlin/src/HAL/HAL_LINUX/HAL_timers.cpp new file mode 100644 index 000000000000..f7b46725af03 --- /dev/null +++ b/Marlin/src/HAL/HAL_LINUX/HAL_timers.cpp @@ -0,0 +1,73 @@ +/** + * Marlin 3D Printer Firmware + * + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com + * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#ifdef __PLAT_LINUX__ + +#include "hardware/Timer.h" + +#include "../../inc/MarlinConfig.h" +#include "HAL_timers.h" + +/** + * Use POSIX signals to attempt to emulate Interrupts + * This has many limitations and is not fit for the purpose + */ + +HAL_STEP_TIMER_ISR(); +HAL_TEMP_TIMER_ISR(); + +Timer timers[2]; + +void HAL_timer_init(void) { + timers[0].init(0, STEPPER_TIMER_RATE, TIMER0_IRQHandler); + timers[1].init(1, TEMP_TIMER_RATE, TIMER1_IRQHandler); +} + +void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) { + timers[timer_num].start(frequency); +} + +void HAL_timer_enable_interrupt(const uint8_t timer_num) { + timers[timer_num].enable(); +} + +void HAL_timer_disable_interrupt(const uint8_t timer_num) { + timers[timer_num].disable(); +} + +bool HAL_timer_interrupt_enabled(const uint8_t timer_num) { + return timers[timer_num].enabled(); +} + +void HAL_timer_set_compare(const uint8_t timer_num, const hal_timer_t compare) { + timers[timer_num].setCompare(compare); +} + +hal_timer_t HAL_timer_get_compare(const uint8_t timer_num) { + return timers[timer_num].getCompare(); +} + +hal_timer_t HAL_timer_get_count(const uint8_t timer_num) { + return timers[timer_num].getCount(); +} + +#endif // __PLAT_LINUX__ diff --git a/Marlin/src/HAL/HAL_LINUX/HAL_timers.h b/Marlin/src/HAL/HAL_LINUX/HAL_timers.h new file mode 100644 index 000000000000..9505fc568a5c --- /dev/null +++ b/Marlin/src/HAL/HAL_LINUX/HAL_timers.h @@ -0,0 +1,91 @@ +/** + * Marlin 3D Printer Firmware + * + * Copyright (C) 2019 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 + +/** + * HAL timers for Linux X86_64 + */ + +// -------------------------------------------------------------------------- +// Includes +// -------------------------------------------------------------------------- + +#include + +// -------------------------------------------------------------------------- +// Defines +// -------------------------------------------------------------------------- + +#define FORCE_INLINE __attribute__((always_inline)) inline + +typedef uint32_t hal_timer_t; +#define HAL_TIMER_TYPE_MAX 0xFFFFFFFF + +#define HAL_TIMER_RATE ((SystemCoreClock) / 4) // frequency of timers peripherals + +#define STEP_TIMER_NUM 0 // Timer Index for Stepper +#define TEMP_TIMER_NUM 1 // Timer Index for Temperature +#define PULSE_TIMER_NUM STEP_TIMER_NUM + +#define TEMP_TIMER_RATE 1000000 +#define TEMP_TIMER_FREQUENCY 1000 // temperature interrupt frequency + +#define STEPPER_TIMER_RATE HAL_TIMER_RATE // frequency of stepper timer (HAL_TIMER_RATE / STEPPER_TIMER_PRESCALE) +#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs +#define STEPPER_TIMER_PRESCALE (CYCLES_PER_MICROSECOND / STEPPER_TIMER_TICKS_PER_US) + +#define PULSE_TIMER_RATE STEPPER_TIMER_RATE // frequency of pulse timer +#define PULSE_TIMER_PRESCALE STEPPER_TIMER_PRESCALE +#define PULSE_TIMER_TICKS_PER_US STEPPER_TIMER_TICKS_PER_US + +#define ENABLE_STEPPER_DRIVER_INTERRUPT() HAL_timer_enable_interrupt(STEP_TIMER_NUM) +#define DISABLE_STEPPER_DRIVER_INTERRUPT() HAL_timer_disable_interrupt(STEP_TIMER_NUM) +#define STEPPER_ISR_ENABLED() HAL_timer_interrupt_enabled(STEP_TIMER_NUM) + +#define ENABLE_TEMPERATURE_INTERRUPT() HAL_timer_enable_interrupt(TEMP_TIMER_NUM) +#define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM) + +#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_IRQn + + +void HAL_timer_init(void); +void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency); + +void HAL_timer_set_compare(const uint8_t timer_num, const hal_timer_t compare); +hal_timer_t HAL_timer_get_compare(const uint8_t timer_num); +hal_timer_t HAL_timer_get_count(const uint8_t timer_num); +FORCE_INLINE static void HAL_timer_restrain(const uint8_t timer_num, const uint16_t interval_ticks) { + const hal_timer_t mincmp = HAL_timer_get_count(timer_num) + interval_ticks; + if (HAL_timer_get_compare(timer_num) < mincmp) HAL_timer_set_compare(timer_num, mincmp); +} + +void HAL_timer_enable_interrupt(const uint8_t timer_num); +void HAL_timer_disable_interrupt(const uint8_t timer_num); +bool HAL_timer_interrupt_enabled(const uint8_t timer_num); + +#define HAL_timer_isr_prologue(TIMER_NUM) +#define HAL_timer_isr_epilogue(TIMER_NUM) diff --git a/Marlin/src/HAL/HAL_LINUX/SanityCheck.h b/Marlin/src/HAL/HAL_LINUX/SanityCheck.h new file mode 100644 index 000000000000..0b4322512f41 --- /dev/null +++ b/Marlin/src/HAL/HAL_LINUX/SanityCheck.h @@ -0,0 +1,71 @@ +/** + * 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 . + * + */ + +/** + * Test X86_64 configuration values for errors at compile-time. + */ + +#if ENABLED(SPINDLE_LASER_ENABLE) + #if !PIN_EXISTS(SPINDLE_LASER_ENA) + #error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENA_PIN." + #elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR) + #error "SPINDLE_DIR_PIN not defined." + #elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM) + #if !PWM_PIN(SPINDLE_LASER_PWM_PIN) + #error "SPINDLE_LASER_PWM_PIN not assigned to a PWM pin." + #elif !(SPINDLE_LASER_PWM_PIN == 4 || SPINDLE_LASER_PWM_PIN == 6 || SPINDLE_LASER_PWM_PIN == 11) + #error "SPINDLE_LASER_PWM_PIN must use SERVO0, SERVO1 or SERVO3 connector" + #elif SPINDLE_LASER_POWERUP_DELAY < 1 + #error "SPINDLE_LASER_POWERUP_DELAY must be greater than 0." + #elif SPINDLE_LASER_POWERDOWN_DELAY < 1 + #error "SPINDLE_LASER_POWERDOWN_DELAY must be greater than 0." + #elif !defined(SPINDLE_LASER_PWM_INVERT) + #error "SPINDLE_LASER_PWM_INVERT missing." + #elif !defined(SPEED_POWER_SLOPE) || !defined(SPEED_POWER_INTERCEPT) || !defined(SPEED_POWER_MIN) || !defined(SPEED_POWER_MAX) + #error "SPINDLE_LASER_PWM equation constant(s) missing." + #elif PIN_EXISTS(CASE_LIGHT) && SPINDLE_LASER_PWM_PIN == CASE_LIGHT_PIN + #error "SPINDLE_LASER_PWM_PIN is used by CASE_LIGHT_PIN." + #elif PIN_EXISTS(E0_AUTO_FAN) && SPINDLE_LASER_PWM_PIN == E0_AUTO_FAN_PIN + #error "SPINDLE_LASER_PWM_PIN is used by E0_AUTO_FAN_PIN." + #elif PIN_EXISTS(E1_AUTO_FAN) && SPINDLE_LASER_PWM_PIN == E1_AUTO_FAN_PIN + #error "SPINDLE_LASER_PWM_PIN is used by E1_AUTO_FAN_PIN." + #elif PIN_EXISTS(E2_AUTO_FAN) && SPINDLE_LASER_PWM_PIN == E2_AUTO_FAN_PIN + #error "SPINDLE_LASER_PWM_PIN is used by E2_AUTO_FAN_PIN." + #elif PIN_EXISTS(E3_AUTO_FAN) && SPINDLE_LASER_PWM_PIN == E3_AUTO_FAN_PIN + #error "SPINDLE_LASER_PWM_PIN is used by E3_AUTO_FAN_PIN." + #elif PIN_EXISTS(E4_AUTO_FAN) && SPINDLE_LASER_PWM_PIN == E4_AUTO_FAN_PIN + #error "SPINDLE_LASER_PWM_PIN is used by E4_AUTO_FAN_PIN." + #elif PIN_EXISTS(FAN) && SPINDLE_LASER_PWM_PIN == FAN_PIN + #error "SPINDLE_LASER_PWM_PIN is used FAN_PIN." + #elif PIN_EXISTS(FAN1) && SPINDLE_LASER_PWM_PIN == FAN1_PIN + #error "SPINDLE_LASER_PWM_PIN is used FAN1_PIN." + #elif PIN_EXISTS(FAN2) && SPINDLE_LASER_PWM_PIN == FAN2_PIN + #error "SPINDLE_LASER_PWM_PIN is used FAN2_PIN." + #elif PIN_EXISTS(CONTROLLERFAN) && SPINDLE_LASER_PWM_PIN == CONTROLLERFAN_PIN + #error "SPINDLE_LASER_PWM_PIN is used by CONTROLLERFAN_PIN." + #endif + #endif +#endif // SPINDLE_LASER_ENABLE + +#if ENABLED(FAST_PWM_FAN) + #error "FAST_PWM_FAN is not yet implemented for this platform." +#endif diff --git a/Marlin/src/HAL/HAL_LINUX/arduino.cpp b/Marlin/src/HAL/HAL_LINUX/arduino.cpp new file mode 100644 index 000000000000..408c96153d5c --- /dev/null +++ b/Marlin/src/HAL/HAL_LINUX/arduino.cpp @@ -0,0 +1,116 @@ +/** + * 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 __PLAT_LINUX__ + +#include +#include "../../inc/MarlinConfig.h" +#include "hardware/Clock.h" +#include "../shared/Delay.h" + +// Interrupts +void cli(void) { } // Disable +void sei(void) { } // Enable + +// Time functions +void _delay_ms(const int delay_ms) { + delay(delay_ms); +} + +uint32_t millis() { + return (uint32_t)Clock::millis(); +} + +// This is required for some Arduino libraries we are using +void delayMicroseconds(uint32_t us) { + Clock::delayMicros(us); +} + +extern "C" void delay(const int msec) { + Clock::delayMillis(msec); +} + +// IO functions +// As defined by Arduino INPUT(0x0), OUTPUT(0x1), INPUT_PULLUP(0x2) +void pinMode(const pin_t pin, const uint8_t mode) { + if (!VALID_PIN(pin)) return; + Gpio::setMode(pin, mode); +} + +void digitalWrite(pin_t pin, uint8_t pin_status) { + if (!VALID_PIN(pin)) return; + Gpio::set(pin, pin_status); +} + +bool digitalRead(pin_t pin) { + if (!VALID_PIN(pin)) return false; + return Gpio::get(pin); +} + +void analogWrite(pin_t pin, int pwm_value) { // 1 - 254: pwm_value, 0: LOW, 255: HIGH + if (!VALID_PIN(pin)) return; + Gpio::set(pin, pwm_value); +} + +uint16_t analogRead(pin_t adc_pin) { + if (!VALID_PIN(DIGITAL_PIN_TO_ANALOG_PIN(adc_pin))) return 0; + return Gpio::get(DIGITAL_PIN_TO_ANALOG_PIN(adc_pin)); +} + +// ************************** +// Persistent Config Storage +// ************************** + +void eeprom_write_byte(unsigned char *pos, unsigned char value) { + +} + +unsigned char eeprom_read_byte(uint8_t * pos) { return '\0'; } + +void eeprom_read_block(void *__dst, const void *__src, size_t __n) { } + +void eeprom_update_block(const void *__src, void *__dst, size_t __n) { } + +char *dtostrf (double __val, signed char __width, unsigned char __prec, char *__s) { + char format_string[20]; + snprintf(format_string, 20, "%%%d.%df", __width, __prec); + sprintf(__s, format_string, __val); + return __s; +} + +int32_t random(int32_t max) { + return rand() % max; +} + +int32_t random(int32_t min, int32_t max) { + return min + rand() % (max - min); +} + +void randomSeed(uint32_t value) { + srand(value); +} + +int map(uint16_t x, uint16_t in_min, uint16_t in_max, uint16_t out_min, uint16_t out_max) { + return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; +} + +#endif // __PLAT_LINUX__ diff --git a/Marlin/src/HAL/HAL_LINUX/fastio.h b/Marlin/src/HAL/HAL_LINUX/fastio.h new file mode 100644 index 000000000000..8eae771a4fd6 --- /dev/null +++ b/Marlin/src/HAL/HAL_LINUX/fastio.h @@ -0,0 +1,129 @@ +/** + * 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 + +/** + * Fast I/O Routines for X86_64 + */ + +#include +#include + +#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 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) + +/** + * Magic I/O routines + * + * Now you can simply SET_OUTPUT(STEP); WRITE(STEP, HIGH); WRITE(STEP, LOW); + * + * Why double up on these macros? see http://gcc.gnu.org/onlinedocs/cpp/Stringification.html + */ + +/// Read a pin +#define _READ(IO) READ_PIN(IO) + +/// Write to a pin +#define _WRITE_VAR(IO,V) digitalWrite(IO,V) + +#define _WRITE(IO,V) WRITE_PIN(IO,V) + +/// toggle a pin +#define _TOGGLE(IO) _WRITE(IO, !READ(IO)) + +/// set pin as input +#define _SET_INPUT(IO) SET_DIR_INPUT(IO) + +/// set pin as output +#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) + +/// set pin as input with pulldown mode +#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 _IS_INPUT(IO) (LPC1768_PIN_PIN(IO) >= 0) + +/// check if pin is an output +#define _IS_OUTPUT(IO) (LPC1768_PIN_PIN(IO) >= 0) + +// 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 _HAS_TIMER(IO) true // could be LPC1768_PIN_PWM(IO), but there +// hg42: could be this: +// #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) + +/// Write to a pin wrapper +#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) + +/// set pin as input wrapper +#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 input with pulldown wrapper +#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) +// set pin as PWM +#define SET_PWM(IO) SET_OUTPUT(IO) + +/// check if pin is an input wrapper +#define IS_INPUT(IO) _IS_INPUT(IO) +/// check if pin is an output wrapper +#define IS_OUTPUT(IO) _IS_OUTPUT(IO) + +/// check if pin is a timer (wrapper) +#define HAS_TIMER(IO) _HAS_TIMER(IO) + +// Shorthand +#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/gcode/bedlevel/ubl/M49.cpp b/Marlin/src/HAL/HAL_LINUX/hardware/Clock.cpp similarity index 67% rename from Marlin/src/gcode/bedlevel/ubl/M49.cpp rename to Marlin/src/HAL/HAL_LINUX/hardware/Clock.cpp index b83ffad61b62..961f5c5d984d 100644 --- a/Marlin/src/gcode/bedlevel/ubl/M49.cpp +++ b/Marlin/src/HAL/HAL_LINUX/hardware/Clock.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -20,21 +20,13 @@ * */ -/** - * M49.cpp - Toggle the G26 debug flag - */ +#ifdef __PLAT_LINUX__ #include "../../../inc/MarlinConfig.h" +#include "Clock.h" -#if ENABLED(G26_MESH_VALIDATION) - -#include "../../gcode.h" -#include "../../../feature/bedlevel/bedlevel.h" - -void GcodeSuite::M49() { - g26_debug_flag ^= true; - SERIAL_PROTOCOLPGM("G26 Debug: "); - serialprintPGM(g26_debug_flag ? PSTR("On\n") : PSTR("Off\n")); -} +std::chrono::nanoseconds Clock::startup = std::chrono::high_resolution_clock::now().time_since_epoch(); +uint32_t Clock::frequency = F_CPU; +double Clock::time_multiplier = 1.0; -#endif // G26_MESH_VALIDATION +#endif // __PLAT_LINUX__ diff --git a/Marlin/src/HAL/HAL_LINUX/hardware/Clock.h b/Marlin/src/HAL/HAL_LINUX/hardware/Clock.h new file mode 100644 index 000000000000..e3dafe250abf --- /dev/null +++ b/Marlin/src/HAL/HAL_LINUX/hardware/Clock.h @@ -0,0 +1,89 @@ +/** + * 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 +#include + +class Clock { +public: + static uint64_t ticks(uint32_t frequency = Clock::frequency) { + return (Clock::nanos() - Clock::startup.count()) / (1000000000ULL / frequency); + } + + static uint64_t nanosToTicks(uint64_t ns, uint32_t frequency = Clock::frequency) { + return ns / (1000000000ULL / frequency); + } + + // Time acceleration compensated + static uint64_t ticksToNanos(uint64_t tick, uint32_t frequency = Clock::frequency) { + return (tick * (1000000000ULL / frequency)) / Clock::time_multiplier; + } + + static void setFrequency(uint32_t freq) { + Clock::frequency = freq; + } + + // Time Acceleration compensated + static uint64_t nanos() { + auto now = std::chrono::high_resolution_clock::now().time_since_epoch(); + return (now.count() - Clock::startup.count()) * Clock::time_multiplier; + } + + static uint64_t micros() { + return Clock::nanos() / 1000; + } + + static uint64_t millis() { + return Clock::micros() / 1000; + } + + static double seconds() { + return Clock::nanos() / 1000000000.0; + } + + static void delayCycles(uint64_t cycles) { + std::this_thread::sleep_for(std::chrono::nanoseconds( (1000000000L / frequency) * cycles) / Clock::time_multiplier ); + } + + static void delayMicros(uint64_t micros) { + std::this_thread::sleep_for(std::chrono::microseconds( micros ) / Clock::time_multiplier); + } + + static void delayMillis(uint64_t millis) { + std::this_thread::sleep_for(std::chrono::milliseconds( millis ) / Clock::time_multiplier); + } + + static void delaySeconds(double secs) { + std::this_thread::sleep_for(std::chrono::duration(secs * 1000) / Clock::time_multiplier); + } + + // Will reduce timer resolution increasing likelihood of overflows + static void setTimeMultiplier(double tm) { + Clock::time_multiplier = tm; + } + +private: + static std::chrono::nanoseconds startup; + static uint32_t frequency; + static double time_multiplier; +}; diff --git a/Marlin/src/HAL/HAL_LINUX/hardware/Gpio.cpp b/Marlin/src/HAL/HAL_LINUX/hardware/Gpio.cpp new file mode 100644 index 000000000000..0aeeb9c67431 --- /dev/null +++ b/Marlin/src/HAL/HAL_LINUX/hardware/Gpio.cpp @@ -0,0 +1,30 @@ +/** + * 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 __PLAT_LINUX__ + +#include "Gpio.h" + +pin_data Gpio::pin_map[Gpio::pin_count+1] = {}; +IOLogger* Gpio::logger = nullptr; + +#endif // __PLAT_LINUX__ diff --git a/Marlin/src/HAL/HAL_LINUX/hardware/Gpio.h b/Marlin/src/HAL/HAL_LINUX/hardware/Gpio.h new file mode 100644 index 000000000000..a53ad029c474 --- /dev/null +++ b/Marlin/src/HAL/HAL_LINUX/hardware/Gpio.h @@ -0,0 +1,141 @@ +/** + * 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 "Clock.h" +#include "../../../inc/MarlinConfigPre.h" +#include + +typedef int16_t pin_type; + +struct GpioEvent { + enum Type { + NOP, + FALL, + RISE, + SET_VALUE, + SETM, + SETD + }; + uint64_t timestamp; + pin_type pin_id; + GpioEvent::Type event; + + GpioEvent(uint64_t timestamp, pin_type pin_id, GpioEvent::Type event){ + this->timestamp = timestamp; + this->pin_id = pin_id; + this->event = event; + } +}; + +class IOLogger { +public: + virtual ~IOLogger(){}; + virtual void log(GpioEvent ev) = 0; +}; + +class Peripheral { +public: + virtual ~Peripheral(){}; + virtual void interrupt(GpioEvent ev) = 0; + virtual void update() = 0; +}; + +struct pin_data { + uint8_t dir; + uint8_t mode; + uint16_t value; + Peripheral* cb; +}; + +class Gpio { +public: + + static const pin_type pin_count = 255; + static pin_data pin_map[pin_count+1]; + + static bool valid_pin(pin_type pin) { + return pin >= 0 && pin <= pin_count; + } + + static void set(pin_type pin) { + set(pin, 1); + } + + static void set(pin_type pin, uint16_t value) { + if (!valid_pin(pin)) return; + GpioEvent::Type evt_type = value > 1 ? GpioEvent::SET_VALUE : value > pin_map[pin].value ? GpioEvent::RISE : value < pin_map[pin].value ? GpioEvent::FALL : GpioEvent::NOP; + pin_map[pin].value = value; + GpioEvent evt(Clock::nanos(), pin, evt_type); + if (pin_map[pin].cb != nullptr) { + pin_map[pin].cb->interrupt(evt); + } + if (Gpio::logger != nullptr) Gpio::logger->log(evt); + } + + static uint16_t get(pin_type pin) { + if (!valid_pin(pin)) return 0; + return pin_map[pin].value; + } + + static void clear(pin_type pin) { + set(pin, 0); + } + + static void setMode(pin_type pin, uint8_t value) { + if (!valid_pin(pin)) return; + pin_map[pin].mode = value; + GpioEvent evt(Clock::nanos(), pin, GpioEvent::Type::SETM); + if (pin_map[pin].cb != nullptr) pin_map[pin].cb->interrupt(evt); + if (Gpio::logger != nullptr) Gpio::logger->log(evt); + } + + static uint8_t getMode(pin_type pin) { + if (!valid_pin(pin)) return 0; + return pin_map[pin].mode; + } + + static void setDir(pin_type pin, uint8_t value) { + if (!valid_pin(pin)) return; + pin_map[pin].dir = value; + GpioEvent evt(Clock::nanos(), pin, GpioEvent::Type::SETD); + if (pin_map[pin].cb != nullptr) pin_map[pin].cb->interrupt(evt); + if (Gpio::logger != nullptr) Gpio::logger->log(evt); + } + + static uint8_t getDir(pin_type pin) { + if (!valid_pin(pin)) return 0; + return pin_map[pin].dir; + } + + static void attachPeripheral(pin_type pin, Peripheral* per) { + if (!valid_pin(pin)) return; + pin_map[pin].cb = per; + } + + static void attachLogger(IOLogger* logger) { + Gpio::logger = logger; + } + +private: + static IOLogger* logger; +}; diff --git a/Marlin/src/HAL/HAL_LINUX/hardware/Heater.cpp b/Marlin/src/HAL/HAL_LINUX/hardware/Heater.cpp new file mode 100644 index 000000000000..0e2f94c356b0 --- /dev/null +++ b/Marlin/src/HAL/HAL_LINUX/hardware/Heater.cpp @@ -0,0 +1,61 @@ +/** + * 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 __PLAT_LINUX__ + +#include "Clock.h" +#include +#include "../../../inc/MarlinConfig.h" + +#include "Heater.h" + +Heater::Heater(pin_t heater, pin_t adc) { + heater_state = 0; + room_temp_raw = 150; + last = Clock::micros(); + heater_pin = heater; + adc_pin = adc; + heat = 0.0; +} + +Heater::~Heater() { +} + +void Heater::update() { + // crude pwm read and cruder heat simulation + auto now = Clock::micros(); + double delta = (now - last); + if (delta > 1000 ) { + heater_state = pwmcap.update(0xFFFF * Gpio::pin_map[heater_pin].value); + last = now; + heat += (heater_state - heat) * (delta / 1000000000.0); + + if (heat < room_temp_raw) heat = room_temp_raw; + Gpio::pin_map[analogInputToDigitalPin(adc_pin)].value = 0xFFFF - (uint16_t)heat; + } +} + +void Heater::interrupt(GpioEvent ev) { + // ununsed +} + +#endif // __PLAT_LINUX__ diff --git a/Marlin/src/HAL/HAL_LINUX/hardware/Heater.h b/Marlin/src/HAL/HAL_LINUX/hardware/Heater.h new file mode 100644 index 000000000000..90e9da21dfbe --- /dev/null +++ b/Marlin/src/HAL/HAL_LINUX/hardware/Heater.h @@ -0,0 +1,47 @@ +/** + * 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 "Gpio.h" + +struct LowpassFilter { + uint64_t data_delay = 0; + uint16_t update(uint16_t value) { + data_delay = data_delay - (data_delay >> 6) + value; + return (uint16_t)(data_delay >> 6); + } +}; + +class Heater: public Peripheral { +public: + Heater(pin_t heater, pin_t adc); + virtual ~Heater(); + void interrupt(GpioEvent ev); + void update(); + + pin_t heater_pin, adc_pin; + uint16_t room_temp_raw; + uint16_t heater_state; + LowpassFilter pwmcap; + double heat; + uint64_t last; +}; diff --git a/Marlin/src/HAL/HAL_LINUX/hardware/IOLoggerCSV.cpp b/Marlin/src/HAL/HAL_LINUX/hardware/IOLoggerCSV.cpp new file mode 100644 index 000000000000..8fc2dc95c58b --- /dev/null +++ b/Marlin/src/HAL/HAL_LINUX/hardware/IOLoggerCSV.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 . + * + */ + +#ifdef __PLAT_LINUX__ + +#include "IOLoggerCSV.h" + +IOLoggerCSV::IOLoggerCSV(std::string filename) { + file.open(filename); +} + +IOLoggerCSV::~IOLoggerCSV() { + file.close(); +} + +void IOLoggerCSV::log(GpioEvent ev) { + std::lock_guard lock(vector_lock); + events.push_back(ev); //minimal impact to signal handler +} + +void IOLoggerCSV::flush() { + { std::lock_guard lock(vector_lock); + while (!events.empty()) { + file << events.front().timestamp << ", "<< events.front().pin_id << ", " << events.front().event << std::endl; + events.pop_front(); + } + } + file.flush(); +} + +#endif // __PLAT_LINUX__ diff --git a/Marlin/src/HAL/HAL_LINUX/hardware/IOLoggerCSV.h b/Marlin/src/HAL/HAL_LINUX/hardware/IOLoggerCSV.h new file mode 100644 index 000000000000..61cce9c106cc --- /dev/null +++ b/Marlin/src/HAL/HAL_LINUX/hardware/IOLoggerCSV.h @@ -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 . + * + */ +#pragma once + +#include +#include +#include +#include "Gpio.h" + +class IOLoggerCSV: public IOLogger { +public: + IOLoggerCSV(std::string filename); + virtual ~IOLoggerCSV(); + void flush(); + void log(GpioEvent ev); + +private: + std::ofstream file; + std::list events; + std::mutex vector_lock; +}; diff --git a/Marlin/src/HAL/HAL_LINUX/hardware/LinearAxis.cpp b/Marlin/src/HAL/HAL_LINUX/hardware/LinearAxis.cpp new file mode 100644 index 000000000000..c50390d7369a --- /dev/null +++ b/Marlin/src/HAL/HAL_LINUX/hardware/LinearAxis.cpp @@ -0,0 +1,66 @@ +/** + * 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 __PLAT_LINUX__ + +#include +#include +#include "Clock.h" +#include "LinearAxis.h" + +LinearAxis::LinearAxis(pin_type enable, pin_type dir, pin_type step, pin_type end_min, pin_type end_max) { + enable_pin = enable; + dir_pin = dir; + step_pin = step; + min_pin = end_min; + max_pin = end_max; + + min_position = 50; + max_position = (200*80) + min_position; + position = rand() % ((max_position - 40) - min_position) + (min_position + 20); + last_update = Clock::nanos(); + + Gpio::attachPeripheral(step_pin, this); + +} + +LinearAxis::~LinearAxis() { + +} + +void LinearAxis::update() { + +} + +void LinearAxis::interrupt(GpioEvent ev) { + if (ev.pin_id == step_pin && !Gpio::pin_map[enable_pin].value){ + if (ev.event == GpioEvent::RISE) { + last_update = ev.timestamp; + 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); + } + } +} + +#endif // __PLAT_LINUX__ diff --git a/Marlin/src/HAL/HAL_LINUX/hardware/LinearAxis.h b/Marlin/src/HAL/HAL_LINUX/hardware/LinearAxis.h new file mode 100644 index 000000000000..0e3b4b7503af --- /dev/null +++ b/Marlin/src/HAL/HAL_LINUX/hardware/LinearAxis.h @@ -0,0 +1,45 @@ +/** + * 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 +#include "Gpio.h" + +class LinearAxis: public Peripheral { +public: + LinearAxis(pin_type enable, pin_type dir, pin_type step, pin_type end_min, pin_type end_max); + virtual ~LinearAxis(); + void update(); + void interrupt(GpioEvent ev); + + pin_type enable_pin; + pin_type dir_pin; + pin_type step_pin; + pin_type min_pin; + pin_type max_pin; + + int32_t position; + int32_t min_position; + int32_t max_position; + uint64_t last_update; + +}; diff --git a/Marlin/src/HAL/HAL_LINUX/hardware/Timer.cpp b/Marlin/src/HAL/HAL_LINUX/hardware/Timer.cpp new file mode 100644 index 000000000000..10f725ae6861 --- /dev/null +++ b/Marlin/src/HAL/HAL_LINUX/hardware/Timer.cpp @@ -0,0 +1,118 @@ +/** + * 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 __PLAT_LINUX__ + +#include "Timer.h" +#include + +Timer::Timer() { + active = false; + compare = 0; + frequency = 0; + overruns = 0; + timerid = 0; + cbfn = nullptr; + period = 0; + start_time = 0; + avg_error = 0; +} + +Timer::~Timer() { + timer_delete(timerid); +} + +void Timer::init(uint32_t sig_id, uint32_t sim_freq, callback_fn* fn) { + struct sigaction sa; + struct sigevent sev; + + frequency = sim_freq; + cbfn = fn; + + sa.sa_flags = SA_SIGINFO; + sa.sa_sigaction = Timer::handler; + sigemptyset(&sa.sa_mask); + if (sigaction(SIGRTMIN, &sa, NULL) == -1) { + return; // todo: handle error + } + + sigemptyset(&mask); + sigaddset(&mask, SIGRTMIN); + + disable(); + + sev.sigev_notify = SIGEV_SIGNAL; + sev.sigev_signo = SIGRTMIN; + sev.sigev_value.sival_ptr = (void*)this; + if (timer_create(CLOCK_REALTIME, &sev, &timerid) == -1) { + return; // todo: handle error + } +} + +void Timer::start(uint32_t frequency) { + setCompare(this->frequency / frequency); + //printf("timer(%ld) started\n", getID()); +} + +void Timer::enable() { + if (sigprocmask(SIG_UNBLOCK, &mask, NULL) == -1) { + return; // todo: handle error + } + active = true; + //printf("timer(%ld) enabled\n", getID()); +} + +void Timer::disable() { + if (sigprocmask(SIG_SETMASK, &mask, NULL) == -1) { + return; // todo: handle error + } + active = false; +} + +void Timer::setCompare(uint32_t compare) { + uint32_t nsec_offset = 0; + if (active) { + nsec_offset = Clock::nanos() - this->start_time; // calculate how long the timer would have been running for + nsec_offset = nsec_offset < 1000 ? nsec_offset : 0; // constrain, this shouldn't be needed but apparently Marlin enables interrupts on the stepper timer before initialising it, todo: investigate ?bug? + } + this->compare = compare; + uint64_t ns = Clock::ticksToNanos(compare, frequency) - nsec_offset; + struct itimerspec its; + its.it_value.tv_sec = ns / 1000000000; + its.it_value.tv_nsec = ns % 1000000000; + its.it_interval.tv_sec = its.it_value.tv_sec; + its.it_interval.tv_nsec = its.it_value.tv_nsec; + + if (timer_settime(timerid, 0, &its, NULL) == -1) { + printf("timer(%ld) failed, compare: %d(%ld)\n", getID(), compare, its.it_value.tv_nsec); + return; // todo: handle error + } + //printf("timer(%ld) started, compare: %d(%d)\n", getID(), compare, its.it_value.tv_nsec); + this->period = its.it_value.tv_nsec; + this->start_time = Clock::nanos(); +} + +uint32_t Timer::getCount() { + return Clock::nanosToTicks(Clock::nanos() - this->start_time, frequency); +} + +#endif // __PLAT_LINUX__ diff --git a/Marlin/src/HAL/HAL_LINUX/hardware/Timer.h b/Marlin/src/HAL/HAL_LINUX/hardware/Timer.h new file mode 100644 index 000000000000..6aadbcbcb136 --- /dev/null +++ b/Marlin/src/HAL/HAL_LINUX/hardware/Timer.h @@ -0,0 +1,76 @@ +/** + * 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 +#include +#include +#include +#include +#include + +#include "Clock.h" + +class Timer { +public: + Timer(); + virtual ~Timer(); + + typedef void (callback_fn)(); + + void init(uint32_t sig_id, uint32_t sim_freq, callback_fn* fn); + void start(uint32_t frequency); + void enable(); + bool enabled() {return active;} + void disable(); + void setCompare(uint32_t compare); + uint32_t getCount(); + uint32_t getCompare() {return compare;} + uint32_t getOverruns() {return overruns;} + uint32_t getAvgError() {return avg_error;} + + intptr_t getID() { + return (*(intptr_t*)timerid); + } + + static void handler(int sig, siginfo_t *si, void *uc){ + Timer* _this = (Timer*)si->si_value.sival_ptr; + _this->avg_error += (Clock::nanos() - _this->start_time) - _this->period; //high_resolution_clock is also limited in precision, but best we have + _this->avg_error /= 2; //very crude precision analysis (actually within +-500ns usually) + _this->start_time = Clock::nanos(); // wrap + _this->cbfn(); + _this->overruns += timer_getoverrun(_this->timerid); // even at 50Khz this doesn't stay zero, again demonstrating the limitations + // using a realtime linux kernel would help somewhat + } + +private: + bool active; + uint32_t compare; + uint32_t frequency; + uint32_t overruns; + timer_t timerid; + sigset_t mask; + callback_fn* cbfn; + uint64_t period; + uint64_t avg_error; + uint64_t start_time; +}; diff --git a/Marlin/src/HAL/HAL_LINUX/include/Arduino.h b/Marlin/src/HAL/HAL_LINUX/include/Arduino.h new file mode 100644 index 000000000000..60f14cc44fb1 --- /dev/null +++ b/Marlin/src/HAL/HAL_LINUX/include/Arduino.h @@ -0,0 +1,125 @@ +/** + * 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 +#include +#include +#include + +#include + +#define HIGH 0x01 +#define LOW 0x00 + +#define INPUT 0x00 +#define OUTPUT 0x01 +#define INPUT_PULLUP 0x02 +#define INPUT_PULLDOWN 0x03 + +#define LSBFIRST 0 +#define MSBFIRST 1 + +#define CHANGE 0x02 +#define FALLING 0x03 +#define RISING 0x04 + +#define E2END 0xFFF // EEPROM end address + +typedef uint8_t byte; +#define PROGMEM +#define PSTR(v) (v) +#define PGM_P const char * + +// Used for libraries, preprocessor, and constants +#define min(a,b) ((a)<(b)?(a):(b)) +#define max(a,b) ((a)>(b)?(a):(b)) +#define abs(x) ((x)>0?(x):-(x)) + +#ifndef isnan + #define isnan std::isnan +#endif +#ifndef isinf + #define isinf std::isinf +#endif + +#define sq(v) ((v) * (v)) +#define square(v) sq(v) +#define constrain(value, arg_min, arg_max) ((value) < (arg_min) ? (arg_min) :((value) > (arg_max) ? (arg_max) : (value))) + +//Interrupts +void cli(void); // Disable +void sei(void); // Enable +void attachInterrupt(uint32_t pin, void (*callback)(void), uint32_t mode); +void detachInterrupt(uint32_t pin); +extern "C" void GpioEnableInt(uint32_t port, uint32_t pin, uint32_t mode); +extern "C" void GpioDisableInt(uint32_t port, uint32_t pin); + +// Program Memory +#define pgm_read_ptr(addr) (*((void**)(addr))) +#define pgm_read_byte_near(addr) (*((uint8_t*)(addr))) +#define pgm_read_float_near(addr) (*((float*)(addr))) +#define pgm_read_word_near(addr) (*((uint16_t*)(addr))) +#define pgm_read_dword_near(addr) (*((uint32_t*)(addr))) +#define pgm_read_byte(addr) pgm_read_byte_near(addr) +#define pgm_read_float(addr) pgm_read_float_near(addr) +#define pgm_read_word(addr) pgm_read_word_near(addr) +#define pgm_read_dword(addr) pgm_read_dword_near(addr) + +using std::memcpy; +#define memcpy_P memcpy +#define sprintf_P sprintf +#define strstr_P strstr +#define strncpy_P strncpy +#define vsnprintf_P vsnprintf +#define strcpy_P strcpy +#define snprintf_P snprintf +#define strlen_P strlen + +// Time functions +extern "C" { + void delay(const int milis); +} +void _delay_ms(const int delay); +void delayMicroseconds(unsigned long); +uint32_t millis(); + +//IO functions +void pinMode(const pin_t, const uint8_t); +void digitalWrite(pin_t, uint8_t); +bool digitalRead(pin_t); +void analogWrite(pin_t, int); +uint16_t analogRead(pin_t); + +// EEPROM +void eeprom_write_byte(unsigned char *pos, unsigned char value); +unsigned char eeprom_read_byte(unsigned char *pos); +void eeprom_read_block (void *__dst, const void *__src, size_t __n); +void eeprom_update_block (const void *__src, void *__dst, size_t __n); + +int32_t random(int32_t); +int32_t random(int32_t, int32_t); +void randomSeed(uint32_t); + +char *dtostrf (double __val, signed char __width, unsigned char __prec, char *__s); + +int map(uint16_t x, uint16_t in_min, uint16_t in_max, uint16_t out_min, uint16_t out_max); diff --git a/Marlin/src/HAL/HAL_LINUX/include/pinmapping.cpp b/Marlin/src/HAL/HAL_LINUX/include/pinmapping.cpp new file mode 100644 index 000000000000..dca18a676b60 --- /dev/null +++ b/Marlin/src/HAL/HAL_LINUX/include/pinmapping.cpp @@ -0,0 +1,70 @@ +/** + * 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 __PLAT_LINUX__ + +#include + +#include "../../../gcode/parser.h" + +uint8_t analog_offset = NUM_DIGITAL_PINS - NUM_ANALOG_INPUTS; + +// Get the digital pin for an analog index +pin_t analogInputToDigitalPin(const int8_t p) { + return (WITHIN(p, 0, NUM_ANALOG_INPUTS) ? analog_offset + p : P_NC); +} + +// Return the index of a pin number +int16_t GET_PIN_MAP_INDEX(const pin_t pin) { + return pin; +} + +// Test whether the pin is valid +bool VALID_PIN(const pin_t p) { + return WITHIN(p, 0, NUM_DIGITAL_PINS); +} + +// Get the analog index for a digital pin +int8_t DIGITAL_PIN_TO_ANALOG_PIN(const pin_t p) { + return (WITHIN(p, analog_offset, NUM_DIGITAL_PINS) ? p - analog_offset : P_NC); +} + +// Test whether the pin is PWM +bool PWM_PIN(const pin_t p) { + return false; +} + +// Test whether the pin is interruptable +bool INTERRUPT_PIN(const pin_t p) { + return false; +} + +// Get the pin number at the given index +pin_t GET_PIN_MAP_PIN(const int16_t ind) { + return ind; +} + +int16_t PARSED_PIN_INDEX(const char code, const int16_t dval) { + return parser.intval(code, dval); +} + +#endif // __PLAT_LINUX__ diff --git a/Marlin/src/HAL/HAL_LINUX/include/pinmapping.h b/Marlin/src/HAL/HAL_LINUX/include/pinmapping.h new file mode 100644 index 000000000000..effc464c73c3 --- /dev/null +++ b/Marlin/src/HAL/HAL_LINUX/include/pinmapping.h @@ -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 . + * + */ +#pragma once + +#include "../../../inc/MarlinConfigPre.h" + +#include +#include "../hardware/Gpio.h" + +typedef pin_type pin_t; + +#define P_NC -1 +constexpr uint16_t NUM_DIGITAL_PINS = Gpio::pin_count; +constexpr uint8_t NUM_ANALOG_INPUTS = 16; + +#define HAL_SENSITIVE_PINS + +// Get the digital pin for an analog index +pin_t analogInputToDigitalPin(const int8_t p); + +// Return the index of a pin number +int16_t GET_PIN_MAP_INDEX(const pin_t pin); + +// Test whether the pin is valid +bool VALID_PIN(const pin_t p); + +// Get the analog index for a digital pin +int8_t DIGITAL_PIN_TO_ANALOG_PIN(const pin_t p); + +// Test whether the pin is PWM +bool PWM_PIN(const pin_t p); + +// Test whether the pin is interruptable +bool INTERRUPT_PIN(const pin_t p); + +// Get the pin number at the given index +pin_t GET_PIN_MAP_PIN(const int16_t ind); + +// Parse a G-code word into a pin index +int16_t PARSED_PIN_INDEX(const char code, const int16_t dval); diff --git a/Marlin/src/HAL/HAL_LINUX/include/serial.h b/Marlin/src/HAL/HAL_LINUX/include/serial.h new file mode 100644 index 000000000000..9b439de98589 --- /dev/null +++ b/Marlin/src/HAL/HAL_LINUX/include/serial.h @@ -0,0 +1,207 @@ +/** + * 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" +#if ENABLED(EMERGENCY_PARSER) + #include "../../../feature/emergency_parser.h" +#endif + +#include +#include + +/** + * Generic RingBuffer + * T type of the buffer array + * S size of the buffer (must be power of 2) + * + */ +template class RingBuffer { +public: + RingBuffer() { index_read = index_write = 0; } + uint32_t available() volatile { return index_write - index_read; } + uint32_t free() volatile { return buffer_size - available(); } + bool empty() volatile { return index_read == index_write; } + bool full() volatile { return available() == buffer_size; } + void clear() volatile { index_read = index_write = 0; } + + bool peek(T *value) volatile { + if (value == 0 || available() == 0) + return false; + *value = buffer[mask(index_read)]; + return true; + } + + int read() volatile { + if (empty()) return -1; + return buffer[mask(index_read++)]; + } + + bool write(T value) volatile { + if (full()) return false; + buffer[mask(index_write++)] = value; + return true; + } + +private: + uint32_t mask(uint32_t val) volatile { + return buffer_mask & val; + } + + static const uint32_t buffer_size = S; + static const uint32_t buffer_mask = buffer_size - 1; + volatile T buffer[buffer_size]; + volatile uint32_t index_write; + volatile uint32_t index_read; +}; + +class HalSerial { +public: + + #if ENABLED(EMERGENCY_PARSER) + EmergencyParser::State emergency_state; + #endif + + HalSerial() { host_connected = true; } + + void begin(int32_t baud) { + } + + int peek() { + uint8_t value; + return receive_buffer.peek(&value) ? value : -1; + } + + int read() { return receive_buffer.read(); } + + size_t write(char c) { + if (!host_connected) return 0; + while (!transmit_buffer.free()); + return transmit_buffer.write(c); + } + + operator bool() { return host_connected; } + + uint16_t available() { + return (uint16_t)receive_buffer.available(); + } + + void flush() { receive_buffer.clear(); } + + uint8_t availableForWrite(void){ + return transmit_buffer.free() > 255 ? 255 : (uint8_t)transmit_buffer.free(); + } + + void flushTX(void){ + if (host_connected) + while (transmit_buffer.available()) { /* nada */ } + } + + void printf(const char *format, ...) { + static char buffer[256]; + va_list vArgs; + va_start(vArgs, format); + int length = vsnprintf((char *) buffer, 256, (char const *) format, vArgs); + va_end(vArgs); + if (length > 0 && length < 256) { + if (host_connected) { + for (int i = 0; i < length;) { + if (transmit_buffer.write(buffer[i])) { + ++i; + } + } + } + } + } + + #define DEC 10 + #define HEX 16 + #define OCT 8 + #define BIN 2 + + void print_bin(uint32_t value, uint8_t num_digits) { + uint32_t mask = 1 << (num_digits -1); + for (uint8_t i = 0; i < num_digits; i++) { + if (!(i % 4) && i) write(' '); + if (!(i % 16) && i) write(' '); + if (value & mask) write('1'); + else write('0'); + value <<= 1; + } + } + + void print(const char value[]) { printf("%s" , value); } + void print(char value, int nbase = 0) { + if (nbase == BIN) print_bin(value, 8); + else if (nbase == OCT) printf("%3o", value); + else if (nbase == HEX) printf("%2X", value); + else if (nbase == DEC ) printf("%d", value); + else printf("%c" , value); + } + void print(unsigned char value, int nbase = 0) { + if (nbase == BIN) print_bin(value, 8); + else if (nbase == OCT) printf("%3o", value); + else if (nbase == HEX) printf("%2X", value); + else printf("%u" , value); + } + void print(int value, int nbase = 0) { + if (nbase == BIN) print_bin(value, 16); + else if (nbase == OCT) printf("%6o", value); + else if (nbase == HEX) printf("%4X", value); + else printf("%d", value); + } + void print(unsigned int value, int nbase = 0) { + if (nbase == BIN) print_bin(value, 16); + else if (nbase == OCT) printf("%6o", value); + else if (nbase == HEX) printf("%4X", value); + else printf("%u" , value); + } + void print(long value, int nbase = 0) { + if (nbase == BIN) print_bin(value, 32); + else if (nbase == OCT) printf("%11o", value); + else if (nbase == HEX) printf("%8X", value); + else printf("%ld" , value); + } + void print(unsigned long value, int nbase = 0) { + if (nbase == BIN) print_bin(value, 32); + else if (nbase == OCT) printf("%11o", value); + else if (nbase == HEX) printf("%8X", value); + else printf("%lu" , value); + } + void print(float value, int round = 6) { printf("%f" , value); } + void print(double value, int round = 6) { printf("%f" , value); } + + void println(const char value[]) { printf("%s\n" , value); } + void println(char value, int nbase = 0) { print(value, nbase); println(); } + void println(unsigned char value, int nbase = 0) { print(value, nbase); println(); } + void println(int value, int nbase = 0) { print(value, nbase); println(); } + void println(unsigned int value, int nbase = 0) { print(value, nbase); println(); } + void println(long value, int nbase = 0) { print(value, nbase); println(); } + void println(unsigned long value, int nbase = 0) { print(value, nbase); println(); } + void println(float value, int round = 6) { printf("%f\n" , value); } + void println(double value, int round = 6) { printf("%f\n" , value); } + void println(void) { print('\n'); } + + volatile RingBuffer receive_buffer; + volatile RingBuffer transmit_buffer; + volatile bool host_connected; +}; diff --git a/Marlin/src/HAL/HAL_LINUX/main.cpp b/Marlin/src/HAL/HAL_LINUX/main.cpp new file mode 100644 index 000000000000..71aab05b1ed9 --- /dev/null +++ b/Marlin/src/HAL/HAL_LINUX/main.cpp @@ -0,0 +1,137 @@ +/** + * Marlin 3D Printer Firmware + * + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#ifdef __PLAT_LINUX__ + +extern void setup(); +extern void loop(); + +#include + +#include +#include + +#include "../../inc/MarlinConfig.h" +#include +#include +#include "../shared/Delay.h" +#include "hardware/IOLoggerCSV.h" +#include "hardware/Heater.h" +#include "hardware/LinearAxis.h" + +// simple stdout / stdin implementation for fake serial port +void write_serial_thread() { + for (;;) { + for (std::size_t i = usb_serial.transmit_buffer.available(); i > 0; i--) { + fputc(usb_serial.transmit_buffer.read(), stdout); + } + std::this_thread::yield(); + } +} + +void read_serial_thread() { + char buffer[255] = {}; + for (;;) { + std::size_t len = MIN(usb_serial.receive_buffer.free(), 254U); + if (fgets(buffer, len, stdin)) + for (std::size_t i = 0; i < strlen(buffer); i++) + usb_serial.receive_buffer.write(buffer[i]); + std::this_thread::yield(); + } +} + +void simulation_loop() { + Heater hotend(HEATER_0_PIN, TEMP_0_PIN); + Heater bed(HEATER_BED_PIN, TEMP_BED_PIN); + LinearAxis x_axis(X_ENABLE_PIN, X_DIR_PIN, X_STEP_PIN, X_MIN_PIN, X_MAX_PIN); + LinearAxis y_axis(Y_ENABLE_PIN, Y_DIR_PIN, Y_STEP_PIN, Y_MIN_PIN, Y_MAX_PIN); + LinearAxis z_axis(Z_ENABLE_PIN, Z_DIR_PIN, Z_STEP_PIN, Z_MIN_PIN, Z_MAX_PIN); + LinearAxis extruder0(E0_ENABLE_PIN, E0_DIR_PIN, E0_STEP_PIN, P_NC, P_NC); + + //#define GPIO_LOGGING // Full GPIO and Positional Logging + + #ifdef GPIO_LOGGING + IOLoggerCSV logger("all_gpio_log.csv"); + Gpio::attachLogger(&logger); + + std::ofstream position_log; + position_log.open("axis_position_log.csv"); + + int32_t x,y,z; + #endif + + for (;;) { + + hotend.update(); + bed.update(); + + x_axis.update(); + y_axis.update(); + z_axis.update(); + extruder0.update(); + + #ifdef GPIO_LOGGING + if (x_axis.position != x || y_axis.position != y || z_axis.position != z) { + uint64_t update = MAX3(x_axis.last_update, y_axis.last_update, z_axis.last_update); + position_log << update << ", " << x_axis.position << ", " << y_axis.position << ", " << z_axis.position << std::endl; + position_log.flush(); + x = x_axis.position; + y = y_axis.position; + z = z_axis.position; + } + // flush the logger + logger.flush(); + #endif + + std::this_thread::yield(); + } +} + +int main(void) { + std::thread write_serial (write_serial_thread); + std::thread read_serial (read_serial_thread); + + #if NUM_SERIAL > 0 + MYSERIAL0.begin(BAUDRATE); + SERIAL_PRINTF("x86_64 Initialised\n"); + SERIAL_FLUSHTX(); + #endif + + Clock::setFrequency(F_CPU); + Clock::setTimeMultiplier(1.0); // some testing at 10x + + HAL_timer_init(); + + std::thread simulation (simulation_loop); + + DELAY_US(10000); + + setup(); + for (;;) { + loop(); + std::this_thread::yield(); + } + + simulation.join(); + write_serial.join(); + read_serial.join(); +} + +#endif // __PLAT_LINUX__ diff --git a/Marlin/src/HAL/HAL_LINUX/persistent_store_impl.cpp b/Marlin/src/HAL/HAL_LINUX/persistent_store_impl.cpp new file mode 100644 index 000000000000..5e0b4a4f2898 --- /dev/null +++ b/Marlin/src/HAL/HAL_LINUX/persistent_store_impl.cpp @@ -0,0 +1,101 @@ +/** + * 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 __PLAT_LINUX__ + +#include "../../inc/MarlinConfig.h" + +#if ENABLED(EEPROM_SETTINGS) + +#include "../shared/persistent_store_api.h" +#include + +uint8_t buffer[E2END]; +char filename[] = "eeprom.dat"; + +bool PersistentStore::access_start() { + const char eeprom_erase_value = 0xFF; + FILE * eeprom_file = fopen(filename, "rb"); + if (eeprom_file == NULL) return false; + + fseek(eeprom_file, 0L, SEEK_END); + std::size_t file_size = ftell(eeprom_file); + + if (file_size < E2END) { + memset(buffer + file_size, eeprom_erase_value, E2END - file_size); + } + else { + fseek(eeprom_file, 0L, SEEK_SET); + fread(buffer, sizeof(uint8_t), sizeof(buffer), eeprom_file); + } + + fclose(eeprom_file); + return true; +} + +bool PersistentStore::access_finish() { + FILE * eeprom_file = fopen(filename, "wb"); + if (eeprom_file == NULL) return false; + fwrite(buffer, sizeof(uint8_t), sizeof(buffer), eeprom_file); + fclose(eeprom_file); + return true; +} + +bool PersistentStore::write_data(int &pos, const uint8_t *value, const size_t size, uint16_t *crc) { + std::size_t bytes_written = 0; + + for (std::size_t i = 0; i < size; i++) { + buffer[pos+i] = value[i]; + bytes_written ++; + } + + crc16(crc, value, size); + pos = pos + size; + return (bytes_written != size); // return true for any error +} + +bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uint16_t *crc, const bool writing/*=true*/) { + std::size_t bytes_read = 0; + if (writing) { + for (std::size_t i = 0; i < size; i++) { + value[i] = buffer[pos+i]; + bytes_read ++; + } + crc16(crc, value, size); + } + else { + uint8_t temp[size]; + for (std::size_t i = 0; i < size; i++) { + temp[i] = buffer[pos+i]; + bytes_read ++; + } + crc16(crc, temp, size); + } + + pos = pos + size; + return bytes_read != size; // return true for any error +} + +size_t PersistentStore::capacity() { return 4096; } // 4KiB of Emulated EEPROM + +#endif // EEPROM_SETTINGS +#endif // __PLAT_LINUX__ diff --git a/Marlin/src/HAL/HAL_LINUX/pinsDebug.h b/Marlin/src/HAL/HAL_LINUX/pinsDebug.h new file mode 100644 index 000000000000..cead56c30ab4 --- /dev/null +++ b/Marlin/src/HAL/HAL_LINUX/pinsDebug.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 . + * + */ + +/** + * Support routines for X86_64 + */ + +/** + * Translation of routines & variables used by pinsDebug.h + */ + +#define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS +#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 PRINT_PORT(p) +#define GET_ARRAY_PIN(p) pin_array[p].pin +#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) +#define PRINT_PIN(p) do {sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer);} while (0) +#define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin + +// active ADC function/mode/code values for PINSEL registers +constexpr int8_t ADC_pin_mode(pin_t pin) { + return (-1); +} + +int8_t get_pin_mode(pin_t pin) { + if (!VALID_PIN(pin)) return -1; + return 0; +} + +bool GET_PINMODE(pin_t pin) { + int8_t pin_mode = get_pin_mode(pin); + if (pin_mode == -1 || pin_mode == ADC_pin_mode(pin)) // found an invalid pin or active analog pin + return false; + + return (Gpio::getMode(pin) != 0); //input/output state +} + +bool GET_ARRAY_IS_DIGITAL(pin_t pin) { + return (!IS_ANALOG(pin) || get_pin_mode(pin) != ADC_pin_mode(pin)); +} diff --git a/Marlin/src/HAL/HAL_LINUX/servo_private.h b/Marlin/src/HAL/HAL_LINUX/servo_private.h new file mode 100644 index 000000000000..c0e0a0c710ce --- /dev/null +++ b/Marlin/src/HAL/HAL_LINUX/servo_private.h @@ -0,0 +1,80 @@ +/** + * 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 + +/** + * servo.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2 + * Copyright (c) 2009 Michael Margolis. All right reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * Based on "servo.h - Interrupt driven Servo library for Arduino using 16 bit timers - + * Version 2 Copyright (c) 2009 Michael Margolis. All right reserved. + * + * The only modification was to update/delete macros to match the LPC176x. + * + */ + +#include + +// Macros +//values in microseconds +#define MIN_PULSE_WIDTH 544 // the shortest pulse sent to a servo +#define MAX_PULSE_WIDTH 2400 // the longest pulse sent to a servo +#define DEFAULT_PULSE_WIDTH 1500 // default pulse width when servo is attached +#define REFRESH_INTERVAL 20000 // minimum time to refresh servos in microseconds + +#define MAX_SERVOS 4 + +#define INVALID_SERVO 255 // flag indicating an invalid servo index + + +// Types + +typedef struct { + uint8_t nbr : 8 ; // a pin number from 0 to 254 (255 signals invalid pin) + uint8_t isActive : 1 ; // true if this channel is enabled, pin not pulsed if false +} ServoPin_t; + +typedef struct { + ServoPin_t Pin; + unsigned int pulse_width; // pulse width in microseconds +} ServoInfo_t; + +// Global variables + +extern uint8_t ServoCount; +extern ServoInfo_t servo_info[MAX_SERVOS]; diff --git a/Marlin/src/HAL/HAL_LINUX/spi_pins.h b/Marlin/src/HAL/HAL_LINUX/spi_pins.h new file mode 100644 index 000000000000..fe510ddcff55 --- /dev/null +++ b/Marlin/src/HAL/HAL_LINUX/spi_pins.h @@ -0,0 +1,53 @@ +/** + * 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 "src/core/macros.h" + +#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 + // spiBeginTransaction. +#endif + +/** onboard SD card */ +//#define SCK_PIN P0_07 +//#define MISO_PIN P0_08 +//#define MOSI_PIN P0_09 +//#define SS_PIN P0_06 +/** external */ +#ifndef SCK_PIN + #define SCK_PIN 50 +#endif +#ifndef MISO_PIN + #define MISO_PIN 51 +#endif +#ifndef MOSI_PIN + #define MOSI_PIN 52 +#endif +#ifndef SS_PIN + #define SS_PIN 53 +#endif +#ifndef SDSS + #define SDSS SS_PIN +#endif diff --git a/Marlin/src/HAL/HAL_LINUX/watchdog.cpp b/Marlin/src/HAL/HAL_LINUX/watchdog.cpp new file mode 100644 index 000000000000..a70eb82b9893 --- /dev/null +++ b/Marlin/src/HAL/HAL_LINUX/watchdog.cpp @@ -0,0 +1,46 @@ +/** + * 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 __PLAT_LINUX__ + +#include "../../inc/MarlinConfig.h" + +#if ENABLED(USE_WATCHDOG) + +#include "watchdog.h" + +void watchdog_init(void) {} + +void HAL_clear_reset_source(void) {} + +uint8_t HAL_get_reset_source(void) { + return RST_POWER_ON; +} + +void watchdog_reset() {} + +#else + void HAL_clear_reset_source(void) {} + uint8_t HAL_get_reset_source(void) { return RST_POWER_ON; } +#endif // USE_WATCHDOG + +#endif // __PLAT_LINUX__ diff --git a/Marlin/src/HAL/HAL_LINUX/watchdog.h b/Marlin/src/HAL/HAL_LINUX/watchdog.h new file mode 100644 index 000000000000..26a9f499fd30 --- /dev/null +++ b/Marlin/src/HAL/HAL_LINUX/watchdog.h @@ -0,0 +1,34 @@ +/** + * 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 + +#define RST_POWER_ON 1 +#define RST_EXTERNAL 2 +#define RST_BROWN_OUT 4 +#define RST_WATCHDOG 8 + +#define WDT_TIMEOUT 4000000 // 4 second timeout + +void watchdog_init(void); +void watchdog_reset(void); +void HAL_clear_reset_source(void); +uint8_t HAL_get_reset_source(void); diff --git a/Marlin/src/HAL/HAL_LPC1768/DebugMonitor_LPC1768.cpp b/Marlin/src/HAL/HAL_LPC1768/DebugMonitor_LPC1768.cpp index c992925bf016..998e56b6defc 100644 --- a/Marlin/src/HAL/HAL_LPC1768/DebugMonitor_LPC1768.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/DebugMonitor_LPC1768.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -206,7 +206,7 @@ void HardFault_HandlerC(unsigned long *sp, unsigned long lr, unsigned long cause // Reset controller NVIC_SystemReset(); - while(1) { watchdog_init(); } + for (;;) watchdog_init(); } extern "C" { diff --git a/Marlin/src/HAL/HAL_LPC1768/HAL.cpp b/Marlin/src/HAL/HAL_LPC1768/HAL.cpp index 020a1660b39c..ac242ca4ab7a 100644 --- a/Marlin/src/HAL/HAL_LPC1768/HAL.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/HAL.cpp @@ -1,22 +1,24 @@ -/* ************************************************************************** - - 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 . -****************************************************************************/ +/** + * 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 @@ -50,11 +52,17 @@ 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) { + NVIC_SystemReset(); } #endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/HAL_LPC1768/HAL.h b/Marlin/src/HAL/HAL_LPC1768/HAL.h index 689105f109fb..12d73c6713ec 100644 --- a/Marlin/src/HAL/HAL_LPC1768/HAL.h +++ b/Marlin/src/HAL/HAL_LPC1768/HAL.h @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com * @@ -147,6 +147,9 @@ using FilteredADC = LPC176x::ADC; #define HAL_READ_ADC() FilteredADC::get_result() #define HAL_ADC_READY() FilteredADC::finished_conversion() +// A grace period for the ADC readings to stabilize before they start causing thermal protection errors. +#define THERMAL_PROTECTION_GRACE_PERIOD 500 + // Parse a G-code word into a pin index int16_t PARSED_PIN_INDEX(const char code, const int16_t dval); // P0.6 thru P0.9 are for the onboard SD card @@ -154,3 +157,22 @@ int16_t PARSED_PIN_INDEX(const char code, const int16_t dval); #define HAL_IDLETASK 1 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_spi.cpp b/Marlin/src/HAL/HAL_LPC1768/HAL_spi.cpp index 2765bb553a56..31dc9c4da04f 100644 --- a/Marlin/src/HAL/HAL_LPC1768/HAL_spi.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/HAL_spi.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -62,9 +62,7 @@ #include "SoftwareSPI.h" - // -------------------------------------------------------------------------- // Software SPI - // -------------------------------------------------------------------------- static uint8_t SPI_speed = 0; @@ -80,46 +78,29 @@ SPI_speed = swSpiInit(spiRate, SCK_PIN, MOSI_PIN); } - uint8_t spiRec() { - uint8_t b = spiTransfer(0xFF); - return b; - } + uint8_t spiRec() { return spiTransfer(0xFF); } void spiRead(uint8_t*buf, uint16_t nbyte) { - if (nbyte == 0) return; - for (int i = 0; i < nbyte; i++) { + for (int i = 0; i < nbyte; i++) buf[i] = spiTransfer(0xFF); - } } - void spiSend(uint8_t b) { - uint8_t response = spiTransfer(b); - UNUSED(response); - } + void spiSend(uint8_t b) { (void)spiTransfer(b); } - void spiSend(const uint8_t* buf, size_t n) { - uint8_t response; - if (n == 0) return; - for (uint16_t i = 0; i < n; i++) { - response = spiTransfer(buf[i]); - } - UNUSED(response); + void spiSend(const uint8_t* buf, size_t nbyte) { + for (uint16_t i = 0; i < nbyte; i++) + (void)spiTransfer(buf[i]); } void spiSendBlock(uint8_t token, const uint8_t* buf) { - uint8_t response; - response = spiTransfer(token); - - for (uint16_t i = 0; i < 512; i++) { - response = spiTransfer(buf[i]); - } - UNUSED(response); - WRITE(SS_PIN, HIGH); + (void)spiTransfer(token); + for (uint16_t i = 0; i < 512; i++) + (void)spiTransfer(buf[i]); } #else - // hardware SPI + // Hardware SPI #include #include @@ -186,7 +167,6 @@ SSP_Init(LPC_SSPn, &HW_SPI_init); // puts the values into the proper bits in the SSP0 registers } - static uint8_t doio(uint8_t b) { /* send and receive a single byte */ SSP_SendData(LPC_SSPn, b & 0x00FF); @@ -194,39 +174,26 @@ return SSP_ReceiveData(LPC_SSPn) & 0x00FF; } - void spiSend(uint8_t b) { - doio(b); - } - + void spiSend(uint8_t b) { doio(b); } - void spiSend(const uint8_t* buf, size_t n) { - if (n == 0) return; - for (uint16_t i = 0; i < n; i++) { - doio(buf[i]); - } + void spiSend(const uint8_t* buf, size_t nbyte) { + for (uint16_t i = 0; i < nbyte; i++) doio(buf[i]); } void spiSend(uint32_t chan, byte b) { } - void spiSend(uint32_t chan, const uint8_t* buf, size_t n) { + void spiSend(uint32_t chan, const uint8_t* buf, size_t nbyte) { } // Read single byte from SPI - uint8_t spiRec() { - return doio(0xff); - } + uint8_t spiRec() { return doio(0xFF); } - uint8_t spiRec(uint32_t chan) { - return 0; - } + uint8_t spiRec(uint32_t chan) { return 0; } // Read from SPI into buffer - void spiRead(uint8_t*buf, uint16_t nbyte) { - if (nbyte == 0) return; - for (int i = 0; i < nbyte; i++) { - buf[i] = doio(0xff); - } + void spiRead(uint8_t *buf, uint16_t nbyte) { + for (uint16_t i = 0; i < nbyte; i++) buf[i] = doio(0xFF); } static uint8_t spiTransfer(uint8_t b) { @@ -235,13 +202,9 @@ // Write from buffer to SPI void spiSendBlock(uint8_t token, const uint8_t* buf) { - uint8_t response; - response = spiTransfer(token); - - for (uint16_t i = 0; i < 512; i++) { - response = spiTransfer(buf[i]); - } - UNUSED(response); + (void)spiTransfer(token); + for (uint16_t i = 0; i < 512; i++) + (void)spiTransfer(buf[i]); } /** Begin SPI transaction, set clock, bit order, data mode */ @@ -256,27 +219,24 @@ void SPIClass::begin() { spiBegin(); } void SPIClass::beginTransaction(SPISettings cfg) { uint8_t spiRate; - switch(cfg.spiRate()) { - case 8000000: spiRate=0 ;break; - case 4000000: spiRate=1 ;break; - case 2000000: spiRate=2 ;break; - case 1000000: spiRate=3 ;break; - case 500000: spiRate=4 ;break; - case 250000: spiRate=5 ;break; - case 125000: spiRate=6 ;break; - default: spiRate=2; break; + switch (cfg.spiRate()) { + case 8000000: spiRate = 0; break; + case 4000000: spiRate = 1; break; + case 2000000: spiRate = 2; break; + case 1000000: spiRate = 3; break; + case 500000: spiRate = 4; break; + case 250000: spiRate = 5; break; + case 125000: spiRate = 6; break; + default: spiRate = 2; break; } spiInit(spiRate); } -uint8_t SPIClass::transfer(uint8_t B) { - return spiTransfer(B); -} -uint16_t SPIClass::transfer16(uint16_t data) { - uint16_t buffer; - buffer = transfer((data>>8) & 0xFF) << 8; - buffer |= transfer(data & 0xFF) && 0xFF; - return buffer; +uint8_t SPIClass::transfer(const uint8_t B) { return spiTransfer(B); } + +uint16_t SPIClass::transfer16(const uint16_t data) { + return (transfer((data >> 8) & 0xFF) << 8) + | (transfer(data & 0xFF) & 0xFF); } SPIClass SPI; diff --git a/Marlin/src/HAL/HAL_LPC1768/HAL_timers.cpp b/Marlin/src/HAL/HAL_LPC1768/HAL_timers.cpp index 3714fe1a3998..26427bbacc43 100644 --- a/Marlin/src/HAL/HAL_LPC1768/HAL_timers.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/HAL_timers.cpp @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com * diff --git a/Marlin/src/HAL/HAL_LPC1768/HAL_timers.h b/Marlin/src/HAL/HAL_LPC1768/HAL_timers.h index 360a0f5c2121..e90cdf2488aa 100644 --- a/Marlin/src/HAL/HAL_LPC1768/HAL_timers.h +++ b/Marlin/src/HAL/HAL_LPC1768/HAL_timers.h @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 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 @@ -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/MarlinSerial.cpp b/Marlin/src/HAL/HAL_LPC1768/MarlinSerial.cpp index 248e9007f1a0..589c65e03e2c 100644 --- a/Marlin/src/HAL/HAL_LPC1768/MarlinSerial.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/MarlinSerial.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_LPC1768/MarlinSerial.h b/Marlin/src/HAL/HAL_LPC1768/MarlinSerial.h index 7f95be356946..ca59a5b72193 100644 --- a/Marlin/src/HAL/HAL_LPC1768/MarlinSerial.h +++ b/Marlin/src/HAL/HAL_LPC1768/MarlinSerial.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -54,9 +54,7 @@ class MarlinSerial : public HardwareSerial { emergency_parser.update(emergency_state, c); return true; // do not discard character } - #endif - #if ENABLED(EMERGENCY_PARSER) EmergencyParser::State emergency_state; #endif }; diff --git a/Marlin/src/HAL/HAL_LPC1768/MarlinServo.h b/Marlin/src/HAL/HAL_LPC1768/MarlinServo.h index c535ea6ff53f..925e5a7e456d 100644 --- a/Marlin/src/HAL/HAL_LPC1768/MarlinServo.h +++ b/Marlin/src/HAL/HAL_LPC1768/MarlinServo.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_LPC1768/SanityCheck.h b/Marlin/src/HAL/HAL_LPC1768/SanityCheck.h index f18efe60ec3b..2338b34ee350 100644 --- a/Marlin/src/HAL/HAL_LPC1768/SanityCheck.h +++ b/Marlin/src/HAL/HAL_LPC1768/SanityCheck.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -25,8 +25,8 @@ */ #if ENABLED(SPINDLE_LASER_ENABLE) - #if !PIN_EXISTS(SPINDLE_LASER_ENABLE) - #error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENABLE_PIN." + #if !PIN_EXISTS(SPINDLE_LASER_ENA) + #error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENA_PIN." #elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR) #error "SPINDLE_DIR_PIN not defined." #elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM) @@ -66,12 +66,7 @@ #endif #endif // SPINDLE_LASER_ENABLE -#if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) && HAS_DRIVER(TMC2130) && DISABLED(TMC_USE_SW_SPI) \ - && (MB(RAMPS_14_RE_ARM_EFB) \ - || MB(RAMPS_14_RE_ARM_EEB) \ - || MB(RAMPS_14_RE_ARM_EFF) \ - || MB(RAMPS_14_RE_ARM_EEF) \ - || MB(RAMPS_14_RE_ARM_SF)) +#if IS_RE_ARM_BOARD && ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) && HAS_DRIVER(TMC2130) && DISABLED(TMC_USE_SW_SPI) #error "Re-ARM with REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER and TMC2130 require TMC_USE_SW_SPI" #endif diff --git a/Marlin/src/HAL/HAL_LPC1768/endstop_interrupts.h b/Marlin/src/HAL/HAL_LPC1768/endstop_interrupts.h index 3d0b472d1e80..d853962e0cbe 100644 --- a/Marlin/src/HAL/HAL_LPC1768/endstop_interrupts.h +++ b/Marlin/src/HAL/HAL_LPC1768/endstop_interrupts.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm 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 000000000000..5e3c2ae6cbf5 --- /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 75ea85acc2c4..49f8ec13c35c 100644 --- a/Marlin/src/HAL/HAL_LPC1768/fastio.h +++ b/Marlin/src/HAL/HAL_LPC1768/fastio.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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/include/SPI.h b/Marlin/src/HAL/HAL_LPC1768/include/SPI.h index 2515634236a2..edffb1556e88 100644 --- a/Marlin/src/HAL/HAL_LPC1768/include/SPI.h +++ b/Marlin/src/HAL/HAL_LPC1768/include/SPI.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.c b/Marlin/src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.c index 6c46c89b0c2e..ae088ed250df 100644 --- a/Marlin/src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.c +++ b/Marlin/src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.c @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.h b/Marlin/src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.h index ac547b08b119..9fba04c03cc9 100644 --- a/Marlin/src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.h +++ b/Marlin/src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_LPC1768/main.cpp b/Marlin/src/HAL/HAL_LPC1768/main.cpp index c4aea39660d6..cc74eedc1bd9 100644 --- a/Marlin/src/HAL/HAL_LPC1768/main.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/main.cpp @@ -1,3 +1,24 @@ +/** + * 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 @@ -98,7 +119,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 @@ -106,7 +127,7 @@ void HAL_idletask(void) { // the disk if Marlin has it mounted. Unfortuately there is currently no way // to unmount the disk from the LCD menu. // if (IS_SD_PRINTING() || IS_SD_FILE_OPEN()) - if (card.flag.cardOK) + if (card.isDetected()) MSC_Aquire_Lock(); else MSC_Release_Lock(); diff --git a/Marlin/src/HAL/HAL_LPC1768/persistent_store_api.h b/Marlin/src/HAL/HAL_LPC1768/persistent_store_api.h index fb659b396cc7..c3c6f672548f 100644 --- a/Marlin/src/HAL/HAL_LPC1768/persistent_store_api.h +++ b/Marlin/src/HAL/HAL_LPC1768/persistent_store_api.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -21,4 +21,4 @@ */ #include "../shared/persistent_store_api.h" -#define FLASH_EEPROM +#define FLASH_EEPROM_EMULATION diff --git a/Marlin/src/HAL/HAL_LPC1768/persistent_store_flash.cpp b/Marlin/src/HAL/HAL_LPC1768/persistent_store_flash.cpp index e08da2090495..4b02544e1ba0 100644 --- a/Marlin/src/HAL/HAL_LPC1768/persistent_store_flash.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/persistent_store_flash.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -43,7 +43,7 @@ #include "persistent_store_api.h" #include "../../inc/MarlinConfig.h" -#if ENABLED(FLASH_EEPROM) +#if ENABLED(FLASH_EEPROM_EMULATION) extern "C" { #include "lpc17xx_iap.h" @@ -54,7 +54,7 @@ extern "C" { #define EEPROM_SIZE (4096) #define SECTOR_SIZE (32768) #define EEPROM_SLOTS (SECTOR_SIZE/EEPROM_SIZE) -#define EEPROM_ERASE (0xff) +#define EEPROM_ERASE (0xFF) #define SLOT_ADDRESS(sector, slot) (((uint8_t *)SECTOR_START(sector)) + slot * EEPROM_SIZE) static uint8_t ram_eeprom[EEPROM_SIZE] __attribute__((aligned(4))) = {0}; @@ -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); @@ -126,6 +127,6 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t size_t PersistentStore::capacity() { return EEPROM_SIZE; } -#endif // FLASH_EEPROM +#endif // FLASH_EEPROM_EMULATION #endif // EEPROM_SETTINGS #endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/HAL_LPC1768/persistent_store_sdcard.cpp b/Marlin/src/HAL/HAL_LPC1768/persistent_store_sdcard.cpp index 5731333ed2c3..7f8bfe2f0270 100644 --- a/Marlin/src/HAL/HAL_LPC1768/persistent_store_sdcard.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/persistent_store_sdcard.cpp @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com * Copyright (c) 2016 Victor Perez victor_pv@hotmail.com @@ -29,7 +29,7 @@ #include "../../inc/MarlinConfig.h" #include "persistent_store_api.h" -#if DISABLED(FLASH_EEPROM) +#if DISABLED(FLASH_EEPROM_EMULATION) #include #include @@ -80,23 +80,23 @@ bool PersistentStore::access_finish() { // to see errors that are happening in read_data / write_data static void debug_rw(const bool write, int &pos, const uint8_t *value, const size_t size, const FRESULT s, const size_t total=0) { PGM_P const rw_str = write ? PSTR("write") : PSTR("read"); - SERIAL_PROTOCOLCHAR(' '); + SERIAL_CHAR(' '); serialprintPGM(rw_str); - SERIAL_PROTOCOLPAIR("_data(", pos); - SERIAL_PROTOCOLPAIR(",", (int)value); - SERIAL_PROTOCOLPAIR(",", (int)size); - SERIAL_PROTOCOLLNPGM(", ...)"); + SERIAL_ECHOPAIR("_data(", pos); + SERIAL_ECHOPAIR(",", (int)value); + SERIAL_ECHOPAIR(",", (int)size); + SERIAL_ECHOLNPGM(", ...)"); if (total) { - SERIAL_PROTOCOLPGM(" f_"); + SERIAL_ECHOPGM(" f_"); serialprintPGM(rw_str); - SERIAL_PROTOCOLPAIR("()=", (int)s); - SERIAL_PROTOCOLPAIR("\n size=", size); - SERIAL_PROTOCOLPGM("\n bytes_"); + SERIAL_ECHOPAIR("()=", (int)s); + SERIAL_ECHOPAIR("\n size=", size); + SERIAL_ECHOPGM("\n bytes_"); serialprintPGM(write ? PSTR("written=") : PSTR("read=")); - SERIAL_PROTOCOLLN(total); + SERIAL_ECHOLN(total); } else - SERIAL_PROTOCOLLNPAIR(" f_lseek()=", (int)s); + SERIAL_ECHOLNPAIR(" f_lseek()=", (int)s); } // File function return codes for type FRESULT. This goes away soon, but @@ -178,6 +178,6 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uin size_t PersistentStore::capacity() { return 4096; } // 4KiB of Emulated EEPROM -#endif // !FLASH_EEPROM +#endif // !FLASH_EEPROM_EMULATION #endif // EEPROM_SETTINGS #endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/HAL_LPC1768/pinsDebug.h b/Marlin/src/HAL/HAL_LPC1768/pinsDebug.h index 1ee7f44d69e7..af3d7c92e704 100644 --- a/Marlin/src/HAL/HAL_LPC1768/pinsDebug.h +++ b/Marlin/src/HAL/HAL_LPC1768/pinsDebug.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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/spi_pins.h b/Marlin/src/HAL/HAL_LPC1768/spi_pins.h index 0ea045a150b6..c0a072851e1d 100644 --- a/Marlin/src/HAL/HAL_LPC1768/spi_pins.h +++ b/Marlin/src/HAL/HAL_LPC1768/spi_pins.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g/HAL_LCD_I2C_routines.c b/Marlin/src/HAL/HAL_LPC1768/u8g/HAL_LCD_I2C_routines.c index 12e8b459903c..1e3cb04987a7 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g/HAL_LCD_I2C_routines.c +++ b/Marlin/src/HAL/HAL_LPC1768/u8g/HAL_LCD_I2C_routines.c @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g/HAL_LCD_I2C_routines.h b/Marlin/src/HAL/HAL_LPC1768/u8g/HAL_LCD_I2C_routines.h index 5f7337316abc..296858fa282a 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g/HAL_LCD_I2C_routines.h +++ b/Marlin/src/HAL/HAL_LPC1768/u8g/HAL_LCD_I2C_routines.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g/HAL_LCD_defines.h b/Marlin/src/HAL/HAL_LPC1768/u8g/HAL_LCD_defines.h index fc7d3a1e4927..2deb09465709 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g/HAL_LCD_defines.h +++ b/Marlin/src/HAL/HAL_LPC1768/u8g/HAL_LCD_defines.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g/HAL_LCD_delay.h b/Marlin/src/HAL/HAL_LPC1768/u8g/HAL_LCD_delay.h index 28c950ae49bb..d329c1853799 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g/HAL_LCD_delay.h +++ b/Marlin/src/HAL/HAL_LPC1768/u8g/HAL_LCD_delay.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g/HAL_LCD_pin_routines.c b/Marlin/src/HAL/HAL_LPC1768/u8g/HAL_LCD_pin_routines.c index 57073d9a04ad..4c8708495f13 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g/HAL_LCD_pin_routines.c +++ b/Marlin/src/HAL/HAL_LPC1768/u8g/HAL_LCD_pin_routines.c @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -45,12 +45,11 @@ #define OUTPUT 1 #define INPUT_PULLUP 2 - uint8_t LPC1768_PIN_PORT(const uint8_t pin); uint8_t LPC1768_PIN_PIN(const uint8_t pin); #ifdef __cplusplus - extern "C" { + extern "C" { #endif // I/O functions @@ -63,22 +62,21 @@ void pinMode_LCD(uint8_t pin, uint8_t mode) { PINSEL_FUNC_0, PINSEL_PINMODE_TRISTATE, PINSEL_PINMODE_NORMAL }; - switch(mode) { - case INPUT: - LPC_GPIO(LPC1768_PIN_PORT(pin))->FIODIR &= ~LPC_PIN(LPC1768_PIN_PIN(pin)); - PINSEL_ConfigPin(&config); - break; - case OUTPUT: - LPC_GPIO(LPC1768_PIN_PORT(pin))->FIODIR |= LPC_PIN(LPC1768_PIN_PIN(pin)); - PINSEL_ConfigPin(&config); - break; - case INPUT_PULLUP: - LPC_GPIO(LPC1768_PIN_PORT(pin))->FIODIR &= ~LPC_PIN(LPC1768_PIN_PIN(pin)); - config.Pinmode = PINSEL_PINMODE_PULLUP; - PINSEL_ConfigPin(&config); - break; - default: - break; + switch (mode) { + case INPUT: + LPC_GPIO(LPC1768_PIN_PORT(pin))->FIODIR &= ~LPC_PIN(LPC1768_PIN_PIN(pin)); + PINSEL_ConfigPin(&config); + break; + case OUTPUT: + LPC_GPIO(LPC1768_PIN_PORT(pin))->FIODIR |= LPC_PIN(LPC1768_PIN_PIN(pin)); + PINSEL_ConfigPin(&config); + break; + case INPUT_PULLUP: + LPC_GPIO(LPC1768_PIN_PORT(pin))->FIODIR &= ~LPC_PIN(LPC1768_PIN_PIN(pin)); + config.Pinmode = PINSEL_PINMODE_PULLUP; + PINSEL_ConfigPin(&config); + break; + default: break; } } @@ -105,7 +103,6 @@ uint8_t u8g_GetPinLevel(uint8_t pin) { return (uint32_t)LPC_GPIO(LPC1768_PIN_PORT(pin))->FIOPIN & LPC_PIN(LPC1768_PIN_PIN(pin)) ? 1 : 0; } - #ifdef __cplusplus } #endif diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g/HAL_LCD_pin_routines.h b/Marlin/src/HAL/HAL_LPC1768/u8g/HAL_LCD_pin_routines.h index 5a900ac45c46..3c89d4e987b3 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g/HAL_LCD_pin_routines.h +++ b/Marlin/src/HAL/HAL_LPC1768/u8g/HAL_LCD_pin_routines.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_hw_spi.cpp b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_hw_spi.cpp index 554f945892c3..65de10dea748 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_hw_spi.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_hw_spi.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm 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 cf6284bdf248..58631a1e1795 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 @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 @@ -95,9 +93,8 @@ uint8_t u8g_com_ssd_I2C_start_sequence(u8g_t *u8g) { if (u8g->pin_list[U8G_PI_SET_A0] == 0) return 1; /* setup bus, might be a repeated start */ - if (u8g_i2c_start(I2C_SLA) == 0) - return 0; - if (u8g->pin_list[U8G_PI_A0_STATE] == 0 ) { + if (u8g_i2c_start(I2C_SLA) == 0) return 0; + if (u8g->pin_list[U8G_PI_A0_STATE] == 0) { if (u8g_i2c_send_byte(I2C_CMD_MODE) == 0) return 0; } else if (u8g_i2c_send_byte(I2C_DATA_MODE) == 0) @@ -108,7 +105,7 @@ uint8_t u8g_com_ssd_I2C_start_sequence(u8g_t *u8g) { } uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) { - switch(msg) { + switch (msg) { case U8G_COM_MSG_INIT: //u8g_com_arduino_digital_write(u8g, U8G_PI_SCL, HIGH); //u8g_com_arduino_digital_write(u8g, U8G_PI_SDA, HIGH); @@ -140,8 +137,11 @@ uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_v case U8G_COM_MSG_WRITE_BYTE: //u8g->pin_list[U8G_PI_SET_A0] = 1; - //if (u8g_com_arduino_ssd_start_sequence(u8g) == 0) - // return u8g_i2c_stop(), 0; + if (u8g_com_ssd_I2C_start_sequence(u8g) == 0) { + u8g_i2c_stop(); + return 0; + } + if (u8g_i2c_send_byte(arg_val) == 0) { u8g_i2c_stop(); return 0; @@ -189,9 +189,6 @@ uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_v case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */ u8g->pin_list[U8G_PI_A0_STATE] = arg_val; u8g->pin_list[U8G_PI_SET_A0] = 1; /* force a0 to set again */ - - u8g_i2c_start(0); // send slave address and write bit - u8g_i2c_send_byte(arg_val ? 0x40 : 0x80); // Write to ? Graphics DRAM mode : Command mode break; } // switch diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_ssd_sw_i2c.cpp under construction b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_ssd_sw_i2c.cpp under construction index 80eeb50a8c9c..8b2cab7b0a95 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_ssd_sw_i2c.cpp under construction +++ b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_ssd_sw_i2c.cpp under construction @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_st7920_hw_spi.cpp b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_st7920_hw_spi.cpp index 9139f1b8d895..3a9ffa8e239a 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_st7920_hw_spi.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_st7920_hw_spi.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -80,32 +80,25 @@ static uint8_t rs_last_state = 255; static void u8g_com_LPC1768_st7920_write_byte_hw_spi(uint8_t rs, uint8_t val) { - if ( rs != rs_last_state) { // time to send a command/data byte + if (rs != rs_last_state) { // Time to send a command/data byte rs_last_state = rs; - - if ( rs == 0 ) - /* command */ - spiSend(0x0F8); - else - /* data */ - spiSend(0x0FA); - - DELAY_US(40); // give the controller some time to process the data: 20 is bad, 30 is OK, 40 is safe + spiSend(rs ? 0x0FA : 0x0F8); // Send data or command + DELAY_US(40); // Give the controller some time: 20 is bad, 30 is OK, 40 is safe } - spiSend(val & 0x0F0); + spiSend(val & 0xF0); spiSend(val << 4); } uint8_t u8g_com_HAL_LPC1768_ST7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) { - switch(msg) { + switch (msg) { case U8G_COM_MSG_INIT: u8g_SetPILevel(u8g, U8G_PI_CS, 0); u8g_SetPIOutput(u8g, U8G_PI_CS); u8g_Delay(5); spiBegin(); - spiInit(SPI_EIGHTH_SPEED); // ST7920 max speed is about 1.1 MHz - u8g->pin_list[U8G_PI_A0_STATE] = 0; /* inital RS state: command mode */ + spiInit(SPI_EIGHTH_SPEED); // ST7920 max speed is about 1.1 MHz + u8g->pin_list[U8G_PI_A0_STATE] = 0; // initial RS state: command mode break; case U8G_COM_MSG_STOP: @@ -115,12 +108,12 @@ uint8_t u8g_com_HAL_LPC1768_ST7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t ar u8g_SetPILevel(u8g, U8G_PI_RESET, arg_val); break; - case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */ + case U8G_COM_MSG_ADDRESS: // Define cmd (arg_val = 0) or data mode (arg_val = 1) u8g->pin_list[U8G_PI_A0_STATE] = arg_val; break; case U8G_COM_MSG_CHIP_SELECT: - u8g_SetPILevel(u8g, U8G_PI_CS, arg_val); //note: the st7920 has an active high chip select + u8g_SetPILevel(u8g, U8G_PI_CS, arg_val); // Note: the ST7920 has an active high chip-select break; case U8G_COM_MSG_WRITE_BYTE: diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_st7920_sw_spi.cpp b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_st7920_sw_spi.cpp index 652ad543935a..0931f7858adc 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_st7920_sw_spi.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_st7920_sw_spi.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -68,31 +68,21 @@ static pin_t SCK_pin_ST7920_HAL, MOSI_pin_ST7920_HAL_HAL; static uint8_t SPI_speed = 0; -static uint8_t rs_last_state = 255; static void u8g_com_LPC1768_st7920_write_byte_sw_spi(uint8_t rs, uint8_t val) { - - if (rs != rs_last_state) { // time to send a command/data byte + static uint8_t rs_last_state = 255; + if (rs != rs_last_state) { + // Transfer Data (FA) or Command (F8) + swSpiTransfer(rs ? 0x0FA : 0x0F8, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL); rs_last_state = rs; - - if (rs == 0) - /* command */ - swSpiTransfer(0x0F8, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL); - else - /* data */ - swSpiTransfer(0x0FA, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL); - - DELAY_US(40); // give the controller some time to process the data: 20 is bad, 30 is OK, 40 is safe + DELAY_US(40); // Give the controller time to process the data: 20 is bad, 30 is OK, 40 is safe } - swSpiTransfer(val & 0x0F0, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL); swSpiTransfer(val << 4, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL); } -uint8_t u8g_com_HAL_LPC1768_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) -{ - switch(msg) - { +uint8_t u8g_com_HAL_LPC1768_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) { + switch (msg) { case U8G_COM_MSG_INIT: SCK_pin_ST7920_HAL = u8g->pin_list[U8G_PI_SCK]; MOSI_pin_ST7920_HAL_HAL = u8g->pin_list[U8G_PI_MOSI]; diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_sw_spi.cpp b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_sw_spi.cpp index a00c45b30557..e851284ad55f 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_sw_spi.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_sw_spi.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -65,14 +65,80 @@ #undef SPI_SPEED #define SPI_SPEED 2 // About 2 MHz +#include +#include +#include + +#include + +uint8_t swSpiTransfer_mode_0(uint8_t b, const uint8_t spi_speed, const pin_t sck_pin, const pin_t miso_pin, const pin_t mosi_pin ) { + + for (uint8_t i = 0; i < 8; i++) { + if (spi_speed == 0) { + gpio_set(mosi_pin, !!(b & 0x80)); + gpio_set(sck_pin, HIGH); + b <<= 1; + if (miso_pin >= 0 && gpio_get(miso_pin)) b |= 1; + gpio_set(sck_pin, LOW); + } + else { + const uint8_t state = (b & 0x80) ? HIGH : LOW; + for (uint8_t j = 0; j < spi_speed; j++) + gpio_set(mosi_pin, state); + + for (uint8_t j = 0; j < spi_speed + (miso_pin >= 0 ? 0 : 1); j++) + gpio_set(sck_pin, HIGH); + + b <<= 1; + if (miso_pin >= 0 && gpio_get(miso_pin)) b |= 1; + + for (uint8_t j = 0; j < spi_speed; j++) + gpio_set(sck_pin, LOW); + } + } + + return b; +} + +uint8_t swSpiTransfer_mode_3(uint8_t b, const uint8_t spi_speed, const pin_t sck_pin, const pin_t miso_pin, const pin_t mosi_pin ) { + + for (uint8_t i = 0; i < 8; i++) { + const uint8_t state = (b & 0x80) ? HIGH : LOW; + if (spi_speed == 0) { + gpio_set(sck_pin, LOW); + gpio_set(mosi_pin, state); + gpio_set(mosi_pin, state); // need some setup time + gpio_set(sck_pin, HIGH); + } + else { + for (uint8_t j = 0; j < spi_speed + (miso_pin >= 0 ? 0 : 1); j++) + gpio_set(sck_pin, LOW); + + for (uint8_t j = 0; j < spi_speed; j++) + gpio_set(mosi_pin, state); + + for (uint8_t j = 0; j < spi_speed; j++) + gpio_set(sck_pin, HIGH); + } + b <<= 1; + if (miso_pin >= 0 && gpio_get(miso_pin)) b |= 1; + } + + return b; +} + static uint8_t SPI_speed = 0; static void u8g_sw_spi_HAL_LPC1768_shift_out(uint8_t dataPin, uint8_t clockPin, uint8_t val) { - swSpiTransfer(val, SPI_speed, clockPin, -1, dataPin); + #if ENABLED(FYSETC_MINI_12864) + swSpiTransfer_mode_3(val, SPI_speed, clockPin, -1, dataPin); + #else + swSpiTransfer_mode_0(val, SPI_speed, clockPin, -1, dataPin); + #endif } uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) { - switch(msg) { + switch (msg) { case U8G_COM_MSG_INIT: u8g_SetPIOutput(u8g, U8G_PI_SCK); u8g_SetPIOutput(u8g, U8G_PI_MOSI); diff --git a/Marlin/src/HAL/HAL_LPC1768/upload_extra_script.py b/Marlin/src/HAL/HAL_LPC1768/upload_extra_script.py index aa24cacc45f7..59c5f5143643 100644 --- a/Marlin/src/HAL/HAL_LPC1768/upload_extra_script.py +++ b/Marlin/src/HAL/HAL_LPC1768/upload_extra_script.py @@ -10,18 +10,16 @@ import os import platform current_OS = platform.system() +Import("env") -#env_vars = subprocess.check_output('platformio run -t envdump') -#env_vars = env_vars.split('\n') -#for env in env_vars: -# print env -#exit(0) - -build_type = os.environ.get("BUILD_TYPE", 'Not Set') -if build_type == 'upload' or build_type == 'traceback' or build_type == 'Not Set' : +def detect_error(e): + print '\nUnable to find destination disk (' + e + ')\n' \ + 'Please select it in platformio.ini using the upload_port keyword ' \ + '(https://docs.platformio.org/en/latest/projectconf/section_env_upload.html)\n' \ + 'or copy the firmware (.pioenvs/' + env.get('PIOENV') + '/firmware.bin) manually to the appropriate disk\n' +try: if current_OS == 'Windows': - # # platformio.ini will accept this for a Windows upload port designation: 'upload_port = L:' # Windows - doesn't care about the disk's name, only cares about the drive letter @@ -30,119 +28,114 @@ # # get all drives on this computer # - import subprocess - - driveStr = subprocess.check_output("fsutil fsinfo drives") # typical result (string): 'Drives: C:\ D:\ E:\ F:\ G:\ H:\ I:\ J:\ K:\ L:\ M:\ Y:\ Z:\' - driveStr = driveStr.strip().lstrip('Drives: ') # typical result (string): 'C:\ D:\ E:\ F:\ G:\ H:\ I:\ J:\ K:\ L:\ M:\ Y:\ Z:\' - drives = driveStr.split() # typical result (array of stings): ['C:\\', 'D:\\', 'E:\\', 'F:\\', 'G:\\', 'H:\\', 'I:\\', 'J:\\', 'K:\\', 'L:\\', 'M:\\', 'Y:\\', 'Z:\\'] + # typical result (string): 'Drives: C:\ D:\ E:\ F:\ G:\ H:\ I:\ J:\ K:\ L:\ M:\ Y:\ Z:\' + driveStr = subprocess.check_output("fsutil fsinfo drives") + # typical result (string): 'C:\ D:\ E:\ F:\ G:\ H:\ I:\ J:\ K:\ L:\ M:\ Y:\ Z:\' + driveStr = driveStr.strip().lstrip('Drives: ') + # typical result (array of stings): ['C:\\', 'D:\\', 'E:\\', 'F:\\', + # 'G:\\', 'H:\\', 'I:\\', 'J:\\', 'K:\\', 'L:\\', 'M:\\', 'Y:\\', 'Z:\\'] + drives = driveStr.split() upload_disk = 'Disk not found' target_file_found = False target_drive_found = False for drive in drives: - final_drive_name = drive.strip().rstrip('\\') # typical result (string): 'C:' - try: - volume_info = subprocess.check_output('cmd /C dir ' + final_drive_name, stderr=subprocess.STDOUT) - except Exception as e: - continue - else: - if target_drive in volume_info and target_file_found == False: # set upload if not found target file yet - target_drive_found = True - upload_disk = final_drive_name - if target_filename in volume_info: - if target_file_found == False: - upload_disk = final_drive_name - target_file_found = True + final_drive_name = drive.strip().rstrip('\\') # typical result (string): 'C:' + try: + volume_info = subprocess.check_output('cmd /C dir ' + final_drive_name, stderr=subprocess.STDOUT) + except Exception as e: + continue + else: + if target_drive in volume_info and target_file_found == False: # set upload if not found target file yet + target_drive_found = True + upload_disk = final_drive_name + if target_filename in volume_info: + if target_file_found == False: + upload_disk = final_drive_name + target_file_found = True # # set upload_port to drive if found # if target_file_found == True or target_drive_found == True: - Import("env") - env.Replace( - UPLOAD_PORT = upload_disk - ) - print 'upload disk: ' , upload_disk + env.Replace( + UPLOAD_PORT=upload_disk + ) + print 'upload disk: ', upload_disk else: - print '\nUnable to find destination disk. File must be copied manually. \n' - - - if current_OS == 'Linux': + detect_error('Autodetect Error') + elif current_OS == 'Linux': # # platformio.ini will accept this for a Linux upload port designation: 'upload_port = /media/media_name/drive' # - upload_disk = 'Disk not found' target_file_found = False target_drive_found = False medias = os.listdir('/media') # for media in medias: - drives = os.listdir('/media/' + media) # - if target_drive in drives and target_file_found == False: # set upload if not found target file yet - target_drive_found = True - upload_disk = '/media/' + media + '/' + target_drive + '/' - for drive in drives: - try: - files = os.listdir('/media/' + media + '/' + drive ) - except: - continue - else: - if target_filename in files: - if target_file_found == False: - upload_disk = '/media/' + media + '/' + drive + '/' - target_file_found = True + drives = os.listdir('/media/' + media) # + if target_drive in drives and target_file_found == False: # set upload if not found target file yet + target_drive_found = True + upload_disk = '/media/' + media + '/' + target_drive + '/' + for drive in drives: + try: + files = os.listdir('/media/' + media + '/' + drive) + except: + continue + else: + if target_filename in files: + if target_file_found == False: + upload_disk = '/media/' + media + '/' + drive + '/' + target_file_found = True # # set upload_port to drive if found # if target_file_found == True or target_drive_found == True: - Import("env") - env.Replace( - UPLOAD_FLAGS = "-P$UPLOAD_PORT", - UPLOAD_PORT = upload_disk - ) - print 'upload disk: ' , upload_disk + env.Replace( + UPLOAD_FLAGS="-P$UPLOAD_PORT", + UPLOAD_PORT=upload_disk + ) + print 'upload disk: ', upload_disk else: - print '\nUnable to find destination disk. File must be copied manually. \n' - - - if current_OS == 'Darwin': # MAC + detect_error('Autodetect Error') + elif current_OS == 'Darwin': # MAC # # platformio.ini will accept this for a OSX upload port designation: 'upload_port = /media/media_name/drive' # - - import os upload_disk = 'Disk not found' - drives = os.listdir('/Volumes') # human readable names + drives = os.listdir('/Volumes') # human readable names target_file_found = False target_drive_found = False if target_drive in drives and target_file_found == False: # set upload if not found target file yet - target_drive_found = True - upload_disk = '/Volumes/' + target_drive + '/' + target_drive_found = True + upload_disk = '/Volumes/' + target_drive + '/' for drive in drives: - try: - filenames = os.listdir('/Volumes/' + drive + '/') # will get an error if the drive is protected - except: - continue - else: - if target_filename in filenames: - if target_file_found == False: - upload_disk = '/Volumes/' + drive + '/' - target_file_found = True + try: + filenames = os.listdir('/Volumes/' + drive + '/') # will get an error if the drive is protected + except: + continue + else: + if target_filename in filenames: + if target_file_found == False: + upload_disk = '/Volumes/' + drive + '/' + target_file_found = True # # set upload_port to drive if found # if target_file_found == True or target_drive_found == True: - Import("env") - env.Replace( - UPLOAD_PORT = upload_disk - ) - print '\nupload disk: ' , upload_disk, '\n' + env.Replace( + UPLOAD_PORT=upload_disk + ) + print '\nupload disk: ', upload_disk, '\n' else: - print '\nUnable to find destination disk. File must be copied manually. \n' + detect_error('Autodetect Error') + +except Exception as e: + detect_error(str(e)) diff --git a/Marlin/src/HAL/HAL_LPC1768/watchdog.cpp b/Marlin/src/HAL/HAL_LPC1768/watchdog.cpp index 913735636ffd..4418cc2364e3 100644 --- a/Marlin/src/HAL/HAL_LPC1768/watchdog.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/watchdog.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -74,8 +74,10 @@ void watchdog_reset() { #else - void HAL_clear_reset_source(void) {} - uint8_t HAL_get_reset_source(void) { return RST_POWER_ON; } +void watchdog_init(void) {} +void watchdog_reset(void) {} +void HAL_clear_reset_source(void) {} +uint8_t HAL_get_reset_source(void) { return RST_POWER_ON; } #endif // USE_WATCHDOG diff --git a/Marlin/src/HAL/HAL_LPC1768/watchdog.h b/Marlin/src/HAL/HAL_LPC1768/watchdog.h index f185a99cddb2..26a9f499fd30 100644 --- a/Marlin/src/HAL/HAL_LPC1768/watchdog.h +++ b/Marlin/src/HAL/HAL_LPC1768/watchdog.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_STM32/HAL.cpp b/Marlin/src/HAL/HAL_STM32/HAL.cpp index 1bddf77f48a4..881168a12922 100644 --- a/Marlin/src/HAL/HAL_STM32/HAL.cpp +++ b/Marlin/src/HAL/HAL_STM32/HAL.cpp @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com * Copyright (c) 2017 Victor Perez @@ -21,7 +21,8 @@ * */ -#ifdef ARDUINO_ARCH_STM32 +#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) + // -------------------------------------------------------------------------- // Includes @@ -35,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 @@ -117,7 +120,7 @@ void HAL_init(void) { void HAL_clear_reset_source(void) { __HAL_RCC_CLEAR_RESET_FLAGS(); } -uint8_t HAL_get_reset_source (void) { +uint8_t HAL_get_reset_source(void) { if (__HAL_RCC_GET_FLAG(RCC_FLAG_IWDGRST) != RESET) return RST_WATCHDOG; if (__HAL_RCC_GET_FLAG(RCC_FLAG_SFTRST) != RESET) return RST_SOFTWARE; if (__HAL_RCC_GET_FLAG(RCC_FLAG_PINRST) != RESET) return RST_EXTERNAL; diff --git a/Marlin/src/HAL/HAL_STM32/HAL.h b/Marlin/src/HAL/HAL_STM32/HAL.h index 9542d8c404a8..d08a49587f3c 100644 --- a/Marlin/src/HAL/HAL_STM32/HAL.h +++ b/Marlin/src/HAL/HAL_STM32/HAL.h @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com * Copyright (c) 2017 Victor Perez @@ -24,10 +24,6 @@ #define CPU_32_BIT -#ifndef vsnprintf_P - #define vsnprintf_P vsnprintf -#endif - // -------------------------------------------------------------------------- // Includes // -------------------------------------------------------------------------- @@ -46,8 +42,6 @@ #include "fastio_STM32.h" #include "watchdog_STM32.h" -#include "HAL_timers_STM32.h" - // -------------------------------------------------------------------------- // Defines // -------------------------------------------------------------------------- @@ -105,7 +99,7 @@ #define NUM_SERIAL 1 #endif -#define _BV(b) (1 << (b)) +#include "HAL_timers_STM32.h" /** * TODO: review this to return 1 for pins that are not analog input @@ -171,18 +165,21 @@ void HAL_init(void); void HAL_clear_reset_source (void); /** reset reason */ -uint8_t HAL_get_reset_source (void); +uint8_t HAL_get_reset_source(void); void _delay_ms(const int delay); extern "C" char* _sbrk(int incr); -static int freeMemory() { +static inline int freeMemory() { volatile char top; return &top - reinterpret_cast(_sbrk(0)); } +// // SPI: Extended functions which take a channel number (hardware SPI only) +// + /** Write single byte to specified SPI channel */ void spiSend(uint32_t chan, byte b); /** Write buffer to specified SPI channel */ @@ -190,18 +187,19 @@ void spiSend(uint32_t chan, const uint8_t* buf, size_t n); /** Read single byte from specified SPI channel */ uint8_t spiRec(uint32_t chan); - +// // EEPROM +// -/** - * Wire library should work for i2c eeproms. - */ +// Wire library should work for i2c EEPROMs void eeprom_write_byte(uint8_t *pos, unsigned char value); uint8_t eeprom_read_byte(uint8_t *pos); void eeprom_read_block (void *__dst, const void *__src, size_t __n); void eeprom_update_block (const void *__src, void *__dst, size_t __n); +// // ADC +// #define HAL_ANALOG_SELECT(pin) pinMode(pin, INPUT) diff --git a/Marlin/src/HAL/HAL_STM32/HAL_Servo_STM32.cpp b/Marlin/src/HAL/HAL_STM32/HAL_Servo_STM32.cpp index 2b08ab31446d..1f22767e2784 100644 --- a/Marlin/src/HAL/HAL_STM32/HAL_Servo_STM32.cpp +++ b/Marlin/src/HAL/HAL_STM32/HAL_Servo_STM32.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -20,7 +20,8 @@ * along with this program. If not, see . * */ -#ifdef ARDUINO_ARCH_STM32 +#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) + #include "../../inc/MarlinConfig.h" diff --git a/Marlin/src/HAL/HAL_STM32/HAL_Servo_STM32.h b/Marlin/src/HAL/HAL_STM32/HAL_Servo_STM32.h index 0aa93ba9f51b..6805c48a54a3 100644 --- a/Marlin/src/HAL/HAL_STM32/HAL_Servo_STM32.h +++ b/Marlin/src/HAL/HAL_STM32/HAL_Servo_STM32.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_STM32/HAL_spi_STM32.cpp b/Marlin/src/HAL/HAL_STM32/HAL_spi_STM32.cpp index 597305fa06a0..86cdb578111c 100644 --- a/Marlin/src/HAL/HAL_STM32/HAL_spi_STM32.cpp +++ b/Marlin/src/HAL/HAL_STM32/HAL_spi_STM32.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -20,7 +20,8 @@ * along with this program. If not, see . * */ -#ifdef ARDUINO_ARCH_STM32 +#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) + // -------------------------------------------------------------------------- // Includes @@ -115,10 +116,9 @@ uint8_t spiRec(void) { */ void spiRead(uint8_t* buf, uint16_t nbyte) { if (nbyte == 0) return; + memset(buf, 0xFF, nbyte); SPI.beginTransaction(spiConfig); - for (int i = 0; i < nbyte; i++) { - buf[i] = SPI.transfer(0xFF); - } + SPI.transfer(buf, nbyte); SPI.endTransaction(); } @@ -144,9 +144,10 @@ void spiSend(uint8_t b) { * @details Use DMA */ void spiSendBlock(uint8_t token, const uint8_t* buf) { + uint8_t rxBuf[512]; SPI.beginTransaction(spiConfig); SPI.transfer(token); - SPI.transfer((uint8_t*)buf, (uint8_t*)0, 512); + SPI.transfer((uint8_t*)buf, &rxBuf, 512); SPI.endTransaction(); } diff --git a/Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.cpp b/Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.cpp index 23a1e3bf15aa..28d8d095c74b 100644 --- a/Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.cpp +++ b/Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.cpp @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com * @@ -19,7 +19,8 @@ * along with this program. If not, see . * */ -#ifdef ARDUINO_ARCH_STM32 +#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) + // -------------------------------------------------------------------------- // Includes diff --git a/Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.h b/Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.h index 4c353b478a0d..e92da9a5c8b0 100644 --- a/Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.h +++ b/Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.h @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com * Copyright (c) 2017 Victor Perez * @@ -26,6 +26,7 @@ // -------------------------------------------------------------------------- #include +#include "../../inc/MarlinConfig.h" // -------------------------------------------------------------------------- // Defines @@ -136,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 f434a51cbb7f..6c6ede24b48d 100644 --- a/Marlin/src/HAL/HAL_STM32/SanityCheck.h +++ b/Marlin/src/HAL/HAL_STM32/SanityCheck.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -25,8 +25,8 @@ * Test Re-ARM specific configuration values for errors at compile-time. */ #if ENABLED(SPINDLE_LASER_ENABLE) - #if !PIN_EXISTS(SPINDLE_LASER_ENABLE) - #error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENABLE_PIN." + #if !PIN_EXISTS(SPINDLE_LASER_ENA) + #error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENA_PIN." #elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR) #error "SPINDLE_DIR_PIN not defined." #elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM) @@ -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/endstop_interrupts.h b/Marlin/src/HAL/HAL_STM32/endstop_interrupts.h index e4a243b43edf..23eca4bab7db 100644 --- a/Marlin/src/HAL/HAL_STM32/endstop_interrupts.h +++ b/Marlin/src/HAL/HAL_STM32/endstop_interrupts.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_STM32/fastio_STM32.cpp b/Marlin/src/HAL/HAL_STM32/fastio_STM32.cpp index e1824ed181bb..3ee075cf26e3 100644 --- a/Marlin/src/HAL/HAL_STM32/fastio_STM32.cpp +++ b/Marlin/src/HAL/HAL_STM32/fastio_STM32.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -20,7 +20,7 @@ * along with this program. If not, see . * */ -#ifdef ARDUINO_ARCH_STM32 +#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) #include "../../inc/MarlinConfig.h" diff --git a/Marlin/src/HAL/HAL_STM32/fastio_STM32.h b/Marlin/src/HAL/HAL_STM32/fastio_STM32.h index be45dab925f7..bd2edb449571 100644 --- a/Marlin/src/HAL/HAL_STM32/fastio_STM32.h +++ b/Marlin/src/HAL/HAL_STM32/fastio_STM32.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -43,9 +43,12 @@ void FastIO_init(); // Must be called before using fast io macros // Defines // -------------------------------------------------------------------------- -#define _BV(b) (1 << (b)) #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])) ; \ @@ -73,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 IS_INPUT(IO) +#define IS_OUTPUT(IO) +#define HAS_TIMER(IO) digitalPinHasPWM(IO) -#define GET_INPUT(IO) -#define GET_OUTPUT(IO) -#define GET_TIMER(IO) +#define PWM_PIN(P) HAS_TIMER(P) +#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P) -#define PWM_PIN(p) digitalPinHasPWM(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 31715ac664a3..a6c50f0f7de1 100644 --- a/Marlin/src/HAL/HAL_STM32/persistent_store_impl.cpp +++ b/Marlin/src/HAL/HAL_STM32/persistent_store_impl.cpp @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com * Copyright (c) 2016 Victor Perez victor_pv@hotmail.com @@ -20,7 +20,7 @@ * along with this program. If not, see . * */ -#ifdef ARDUINO_ARCH_STM32 +#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) #include "../../inc/MarlinConfig.h" @@ -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,15 +55,14 @@ 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; if (v != eeprom_read_byte(p)) { eeprom_write_byte(p, v); if (eeprom_read_byte(p) != v) { - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM(MSG_ERR_EEPROM_WRITE); + SERIAL_ECHO_MSG(MSG_ERR_EEPROM_WRITE); return true; } } @@ -77,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 @@ -88,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) @@ -106,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_STM32/spi_pins.h b/Marlin/src/HAL/HAL_STM32/spi_pins.h index 1136a78c22c1..ba325b48e4ad 100644 --- a/Marlin/src/HAL/HAL_STM32/spi_pins.h +++ b/Marlin/src/HAL/HAL_STM32/spi_pins.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/Marlin/src/HAL/HAL_STM32/watchdog_STM32.cpp b/Marlin/src/HAL/HAL_STM32/watchdog_STM32.cpp index 7b049f155122..e47de649536f 100644 --- a/Marlin/src/HAL/HAL_STM32/watchdog_STM32.cpp +++ b/Marlin/src/HAL/HAL_STM32/watchdog_STM32.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -20,7 +20,7 @@ * */ -#ifdef ARDUINO_ARCH_STM32 +#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) #include "../../inc/MarlinConfig.h" diff --git a/Marlin/src/HAL/HAL_STM32/watchdog_STM32.h b/Marlin/src/HAL/HAL_STM32/watchdog_STM32.h index e860d1679333..bd3598c0bbf8 100644 --- a/Marlin/src/HAL/HAL_STM32/watchdog_STM32.h +++ b/Marlin/src/HAL/HAL_STM32/watchdog_STM32.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL.cpp b/Marlin/src/HAL/HAL_STM32F1/HAL.cpp index 95dbb0a502dd..1534a35756da 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL.cpp +++ b/Marlin/src/HAL/HAL_STM32F1/HAL.cpp @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com * Copyright (c) 2017 Victor Perez @@ -33,6 +33,7 @@ #include "HAL.h" #include +#include "../../inc/MarlinConfig.h" // -------------------------------------------------------------------------- // Externals @@ -43,7 +44,7 @@ // -------------------------------------------------------------------------- #define __I -#define __IO +#define __IO volatile typedef struct { __I uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ @@ -91,7 +92,9 @@ // -------------------------------------------------------------------------- // Public Variables // -------------------------------------------------------------------------- -USBSerial SerialUSB; +#ifdef SERIAL_USB + USBSerial SerialUSB; +#endif uint16_t HAL_adc_result; @@ -100,12 +103,18 @@ uint16_t HAL_adc_result; // -------------------------------------------------------------------------- STM32ADC adc(ADC1); -uint8 adc_pins[] = { +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 + TEMP_1_PIN, #endif #if HAS_TEMP_ADC_2 TEMP_2_PIN, @@ -116,8 +125,8 @@ uint8 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, @@ -175,6 +190,23 @@ static void NVIC_SetPriorityGrouping(uint32_t PriorityGroup) { // Public functions // -------------------------------------------------------------------------- +// +// Leave PA11/PA12 intact if USBSerial is not used +// +#if SERIAL_USB + namespace wirish { namespace priv { + #if SERIAL_PORT > 0 + #if SERIAL_PORT2 + #if SERIAL_PORT2 > 0 + void board_setup_usb(void) {} + #endif + #else + void board_setup_usb(void) {} + #endif + #endif + } } +#endif + void HAL_init(void) { NVIC_SetPriorityGrouping(0x3); } @@ -250,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 @@ -262,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 e3c81ecb5b86..66c4cba59e77 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL.h +++ b/Marlin/src/HAL/HAL_STM32F1/HAL.h @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com * Copyright (c) 2017 Victor Perez @@ -47,50 +47,73 @@ #include "../shared/math_32bit.h" #include "../shared/HAL_SPI.h" -#include "fastio_Stm32f1.h" -#include "watchdog_Stm32f1.h" - -#include "HAL_timers_Stm32f1.h" +#include "fastio_STM32F1.h" +#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()) @@ -159,10 +186,10 @@ extern uint16_t HAL_adc_result; #define __bss_end __bss_end__ /** clear reset reason */ -void HAL_clear_reset_source (void); +void HAL_clear_reset_source(void); /** reset reason */ -uint8_t HAL_get_reset_source (void); +uint8_t HAL_get_reset_source(void); void _delay_ms(const int delay); @@ -180,12 +207,21 @@ static int freeMemory() { return top; } */ + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-function" + static int freeMemory() { volatile char top; return &top - reinterpret_cast(_sbrk(0)); } +#pragma GCC diagnostic pop + +// // SPI: Extended functions which take a channel number (hardware SPI only) +// + /** Write single byte to specified SPI channel */ void spiSend(uint32_t chan, byte b); /** Write buffer to specified SPI channel */ @@ -193,19 +229,22 @@ void spiSend(uint32_t chan, const uint8_t* buf, size_t n); /** Read single byte from specified SPI channel */ uint8_t spiRec(uint32_t chan); - +// // EEPROM +// /** - * TODO: Write all this eeprom stuff. Can emulate eeprom in flash as last resort. - * Wire library should work for i2c eeproms. + * TODO: Write all this EEPROM stuff. Can emulate EEPROM in flash as last resort. + * Wire library should work for i2c EEPROMs. */ void eeprom_write_byte(uint8_t *pos, unsigned char value); uint8_t eeprom_read_byte(uint8_t *pos); -void eeprom_read_block (void *__dst, const void *__src, size_t __n); -void eeprom_update_block (const void *__src, void *__dst, size_t __n); +void eeprom_read_block(void *__dst, const void *__src, size_t __n); +void eeprom_update_block(const void *__src, void *__dst, size_t __n); +// // ADC +// #define HAL_ANALOG_SELECT(pin) pinMode(pin, INPUT_ANALOG); diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL_Servo_Stm32f1.cpp b/Marlin/src/HAL/HAL_STM32F1/HAL_Servo_STM32F1.cpp similarity index 83% rename from Marlin/src/HAL/HAL_STM32F1/HAL_Servo_Stm32f1.cpp rename to Marlin/src/HAL/HAL_STM32F1/HAL_Servo_STM32F1.cpp index 60cdfbf2f34b..f8fc315ba059 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL_Servo_Stm32f1.cpp +++ b/Marlin/src/HAL/HAL_STM32F1/HAL_Servo_STM32F1.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -29,7 +29,7 @@ uint8_t ServoCount; //=0 -#include "HAL_Servo_Stm32f1.h" +#include "HAL_Servo_STM32F1.h" //#include "Servo.h" @@ -52,14 +52,14 @@ uint8_t ServoCount; //=0 #define TAU_USEC (TAU_MSEC * 1000) #define TAU_CYC (TAU_MSEC * CYC_MSEC) #define SERVO_PRESCALER (TAU_CYC / MAX_OVERFLOW + 1) -#define SERVO_OVERFLOW ((uint16)round((double)TAU_CYC / SERVO_PRESCALER)) +#define SERVO_OVERFLOW ((uint16_t)round((double)TAU_CYC / SERVO_PRESCALER)) // Unit conversions -#define US_TO_COMPARE(us) ((uint16)map((us), 0, TAU_USEC, 0, SERVO_OVERFLOW)) -#define COMPARE_TO_US(c) ((uint32)map((c), 0, SERVO_OVERFLOW, 0, TAU_USEC)) -#define ANGLE_TO_US(a) ((uint16)(map((a), this->minAngle, this->maxAngle, \ +#define US_TO_COMPARE(us) ((uint16_t)map((us), 0, TAU_USEC, 0, SERVO_OVERFLOW)) +#define COMPARE_TO_US(c) ((uint32_t)map((c), 0, SERVO_OVERFLOW, 0, TAU_USEC)) +#define ANGLE_TO_US(a) ((uint16_t)(map((a), this->minAngle, this->maxAngle, \ SERVO_DEFAULT_MIN_PW, SERVO_DEFAULT_MAX_PW))) -#define US_TO_ANGLE(us) ((int16)(map((us), SERVO_DEFAULT_MIN_PW, SERVO_DEFAULT_MAX_PW, \ +#define US_TO_ANGLE(us) ((int16_t)(map((us), SERVO_DEFAULT_MIN_PW, SERVO_DEFAULT_MAX_PW, \ this->minAngle, this->maxAngle))) libServo::libServo() { @@ -74,7 +74,7 @@ bool libServo::attach(const int32_t pin, const int32_t minAngle, const int32_t m this->maxAngle = maxAngle; timer_dev *tdev = PIN_MAP[this->pin].timer_device; - uint8 tchan = PIN_MAP[this->pin].timer_channel; + uint8_t tchan = PIN_MAP[this->pin].timer_channel; pinMode(this->pin, PWM); pwmWrite(this->pin, 0); @@ -97,7 +97,7 @@ bool libServo::detach() { int32_t libServo::read() const { if (this->attached()) { timer_dev *tdev = PIN_MAP[this->pin].timer_device; - uint8 tchan = PIN_MAP[this->pin].timer_channel; + uint8_t tchan = PIN_MAP[this->pin].timer_channel; return US_TO_ANGLE(COMPARE_TO_US(timer_get_compare(tdev, tchan))); } return 0; diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL_Servo_Stm32f1.h b/Marlin/src/HAL/HAL_STM32F1/HAL_Servo_STM32F1.h similarity index 96% rename from Marlin/src/HAL/HAL_STM32F1/HAL_Servo_Stm32f1.h rename to Marlin/src/HAL/HAL_STM32F1/HAL_Servo_STM32F1.h index 668378388cd7..ac83f086ee5f 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL_Servo_Stm32f1.h +++ b/Marlin/src/HAL/HAL_STM32F1/HAL_Servo_STM32F1.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.cpp b/Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.cpp new file mode 100644 index 000000000000..d7aa3ccd2084 --- /dev/null +++ b/Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.cpp @@ -0,0 +1,279 @@ +/** + * 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 + * Copyright (C) 2017 Victor Perez + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#if defined(ARDUINO_ARCH_STM32F1) && (defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY)) + +#include "HAL_sdio_STM32F1.h" + +SDIO_CardInfoTypeDef SdCard; + +bool SDIO_Init(void) { + uint32_t count = 0U; + SdCard.CardType = SdCard.CardVersion = SdCard.Class = SdCard.RelCardAdd = SdCard.BlockNbr = SdCard.BlockSize = SdCard.LogBlockNbr = SdCard.LogBlockSize = 0; + + sdio_begin(); + sdio_set_dbus_width(SDIO_CLKCR_WIDBUS_1BIT); + + dma_init(SDIO_DMA_DEV); + dma_disable(SDIO_DMA_DEV, SDIO_DMA_CHANNEL); + dma_set_priority(SDIO_DMA_DEV, SDIO_DMA_CHANNEL, DMA_PRIORITY_VERY_HIGH); + + if (!SDIO_CmdGoIdleState()) return false; + if (!SDIO_CmdGoIdleState()) return false; /* Hotplugged cards tends to miss first CMD0, so give them a second chance. */ + + SdCard.CardVersion = SDIO_CmdOperCond() ? CARD_V2_X : CARD_V1_X; + + do { + if (count++ == SDMMC_MAX_VOLT_TRIAL) return false; + SDIO_CmdAppOperCommand(SdCard.CardVersion == CARD_V2_X ? SDMMC_HIGH_CAPACITY : SDMMC_STD_CAPACITY); + } while ((SDIO_GetResponse(SDIO_RESP1) & 0x80000000) == 0); + + SdCard.CardType = (SDIO_GetResponse(SDIO_RESP1) & SDMMC_HIGH_CAPACITY) ? CARD_SDHC_SDXC : CARD_SDSC; + + if (!SDIO_CmdSendCID()) return false; + if (!SDIO_CmdSetRelAdd(&SdCard.RelCardAdd)) return false; /* Send CMD3 SET_REL_ADDR with argument 0. SD Card publishes its RCA. */ + if (!SDIO_CmdSendCSD(SdCard.RelCardAdd << 16U)) return false; + + SdCard.Class = (SDIO_GetResponse(SDIO_RESP2) >> 20U); + + if (SdCard.CardType == CARD_SDHC_SDXC) { + SdCard.LogBlockNbr = SdCard.BlockNbr = (((SDIO_GetResponse(SDIO_RESP2) & 0x0000003FU) << 26U) | ((SDIO_GetResponse(SDIO_RESP3) & 0xFFFF0000U) >> 6U)) + 1024; + SdCard.LogBlockSize = SdCard.BlockSize = 512U; + } + else { + SdCard.BlockNbr = ((((SDIO_GetResponse(SDIO_RESP2) & 0x000003FFU) << 2U ) | ((SDIO_GetResponse(SDIO_RESP3) & 0xC0000000U) >> 30U)) + 1U) * (4U << ((SDIO_GetResponse(SDIO_RESP3) & 0x00038000U) >> 15U)); + SdCard.BlockSize = 1U << ((SDIO_GetResponse(SDIO_RESP2) >> 16) & 0x0FU); + SdCard.LogBlockNbr = (SdCard.BlockNbr) * ((SdCard.BlockSize) / 512U); + SdCard.LogBlockSize = 512U; + } + + if (!SDIO_CmdSelDesel(SdCard.RelCardAdd << 16U)) return false; + if (!SDIO_CmdAppSetClearCardDetect(SdCard.RelCardAdd << 16U)) return false; + if (!SDIO_CmdAppSetBusWidth(SdCard.RelCardAdd << 16U, 2)) return false; + + sdio_set_dbus_width(SDIO_CLKCR_WIDBUS_4BIT); + sdio_set_clock(SDIO_CLOCK); + return true; +} + +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 + + if (SdCard.CardType != CARD_SDHC_SDXC) { blockAddress *= 512U; } + + dma_setup_transfer(SDIO_DMA_DEV, SDIO_DMA_CHANNEL, &SDIO->FIFO, DMA_SIZE_32BITS, data, DMA_SIZE_32BITS, DMA_MINC_MODE); + dma_set_num_transfers(SDIO_DMA_DEV, SDIO_DMA_CHANNEL, 128); + dma_clear_isr_bits(SDIO_DMA_DEV, SDIO_DMA_CHANNEL); + dma_enable(SDIO_DMA_DEV, SDIO_DMA_CHANNEL); + + sdio_setup_transfer(SDIO_DATA_TIMEOUT * (F_CPU / 1000U), 512, SDIO_BLOCKSIZE_512 | SDIO_DCTRL_DMAEN | SDIO_DCTRL_DTEN | SDIO_DIR_RX); + + if (!SDIO_CmdReadSingleBlock(blockAddress)) { + SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS); + dma_disable(SDIO_DMA_DEV, SDIO_DMA_CHANNEL); + return false; + } + + while (!SDIO_GET_FLAG(SDIO_STA_DATAEND | SDIO_STA_TRX_ERROR_FLAGS)) {} + + 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; + } + SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS | SDIO_ICR_DATA_FLAGS); + 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; + if ((0x03 & (uint32_t)data)) return false; // misaligned data + + if (SdCard.CardType != CARD_SDHC_SDXC) { blockAddress *= 512U; } + + dma_setup_transfer(SDIO_DMA_DEV, SDIO_DMA_CHANNEL, &SDIO->FIFO, DMA_SIZE_32BITS, (volatile void *) data, DMA_SIZE_32BITS, DMA_MINC_MODE | DMA_FROM_MEM); + dma_set_num_transfers(SDIO_DMA_DEV, SDIO_DMA_CHANNEL, 128); + dma_clear_isr_bits(SDIO_DMA_DEV, SDIO_DMA_CHANNEL); + dma_enable(SDIO_DMA_DEV, SDIO_DMA_CHANNEL); + + if (!SDIO_CmdWriteSingleBlock(blockAddress)) { + dma_disable(SDIO_DMA_DEV, SDIO_DMA_CHANNEL); + return false; + } + + sdio_setup_transfer(SDIO_DATA_TIMEOUT * (F_CPU / 1000U), 512U, SDIO_BLOCKSIZE_512 | SDIO_DCTRL_DMAEN | SDIO_DCTRL_DTEN); + + while (!SDIO_GET_FLAG(SDIO_STA_DATAEND | SDIO_STA_TRX_ERROR_FLAGS)) {} + + dma_disable(SDIO_DMA_DEV, SDIO_DMA_CHANNEL); + + if (SDIO_GET_FLAG(SDIO_STA_TRX_ERROR_FLAGS)) { + SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS | SDIO_ICR_DATA_FLAGS); + return false; + } + + SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS | SDIO_ICR_DATA_FLAGS); + + uint32_t timeout = millis() + SDIO_WRITE_TIMEOUT; + while (timeout > millis()) { + if (SDIO_GetCardState() == SDIO_CARD_TRANSFER) { + return true; + } + } + return false; +} + +inline uint32_t SDIO_GetCardState(void) { return SDIO_CmdSendStatus(SdCard.RelCardAdd << 16U) ? (SDIO_GetResponse(SDIO_RESP1) >> 9U) & 0x0FU : SDIO_CARD_ERROR; } + +// -------------------------------------------------------------------------- +// SD Commands and Responses +// -------------------------------------------------------------------------- + +void SDIO_SendCommand(uint16_t command, uint32_t argument) { SDIO->ARG = argument; SDIO->CMD = (uint32_t)(SDIO_CMD_CPSMEN | command); } +uint8_t SDIO_GetCommandResponse(void) { return (uint8_t)(SDIO->RESPCMD); } +uint32_t SDIO_GetResponse(uint32_t response) { return SDIO->RESP[response]; } + +bool SDIO_CmdGoIdleState(void) { SDIO_SendCommand(CMD0_GO_IDLE_STATE, 0); return SDIO_GetCmdError(); } +bool SDIO_CmdSendCID(void) { SDIO_SendCommand(CMD2_ALL_SEND_CID, 0); return SDIO_GetCmdResp2(); } +bool SDIO_CmdSetRelAdd(uint32_t *rca) { SDIO_SendCommand(CMD3_SET_REL_ADDR, 0); return SDIO_GetCmdResp6(SDMMC_CMD_SET_REL_ADDR, rca); } +bool SDIO_CmdSelDesel(uint32_t address) { SDIO_SendCommand(CMD7_SEL_DESEL_CARD, address); return SDIO_GetCmdResp1(SDMMC_CMD_SEL_DESEL_CARD); } +bool SDIO_CmdOperCond(void) { SDIO_SendCommand(CMD8_HS_SEND_EXT_CSD, SDMMC_CHECK_PATTERN); return SDIO_GetCmdResp7(); } +bool SDIO_CmdSendCSD(uint32_t argument) { SDIO_SendCommand(CMD9_SEND_CSD, argument); return SDIO_GetCmdResp2(); } +bool SDIO_CmdSendStatus(uint32_t argument) { SDIO_SendCommand(CMD13_SEND_STATUS, argument); return SDIO_GetCmdResp1(SDMMC_CMD_SEND_STATUS); } +bool SDIO_CmdReadSingleBlock(uint32_t address) { SDIO_SendCommand(CMD17_READ_SINGLE_BLOCK, address); return SDIO_GetCmdResp1(SDMMC_CMD_READ_SINGLE_BLOCK); } +bool SDIO_CmdWriteSingleBlock(uint32_t address) { SDIO_SendCommand(CMD24_WRITE_SINGLE_BLOCK, address); return SDIO_GetCmdResp1(SDMMC_CMD_WRITE_SINGLE_BLOCK); } +bool SDIO_CmdAppCommand(uint32_t rsa) { SDIO_SendCommand(CMD55_APP_CMD, rsa); return SDIO_GetCmdResp1(SDMMC_CMD_APP_CMD); } + +bool SDIO_CmdAppSetBusWidth(uint32_t rsa, uint32_t argument) { + if (!SDIO_CmdAppCommand(rsa)) return false; + SDIO_SendCommand(ACMD6_APP_SD_SET_BUSWIDTH, argument); + return SDIO_GetCmdResp2(); +} + +bool SDIO_CmdAppOperCommand(uint32_t sdType) { + if (!SDIO_CmdAppCommand(0)) return false; + SDIO_SendCommand(ACMD41_SD_APP_OP_COND , SDMMC_VOLTAGE_WINDOW_SD | sdType); + return SDIO_GetCmdResp3(); +} + +bool SDIO_CmdAppSetClearCardDetect(uint32_t rsa) { + if (!SDIO_CmdAppCommand(rsa)) return false; + SDIO_SendCommand(ACMD42_SD_APP_SET_CLR_CARD_DETECT, 0); + return SDIO_GetCmdResp2(); +} + +// Wait until given flags are unset or till timeout +#define SDIO_WAIT(FLAGS) do{ \ + uint32_t count = 1 + (SDIO_CMDTIMEOUT) * ((F_CPU) / 8U / 1000U); \ + do { if (!--count) return false; } while (!SDIO_GET_FLAG(FLAGS)); \ +}while(0) + +bool SDIO_GetCmdError(void) { + SDIO_WAIT(SDIO_STA_CMDSENT); + + SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS); + return true; +} + +bool SDIO_GetCmdResp1(uint8_t command) { + SDIO_WAIT(SDIO_STA_CCRCFAIL | SDIO_STA_CMDREND | SDIO_STA_CTIMEOUT); + + if (SDIO_GET_FLAG(SDIO_STA_CCRCFAIL | SDIO_STA_CTIMEOUT)) { + SDIO_CLEAR_FLAG(SDIO_STA_CCRCFAIL | SDIO_STA_CTIMEOUT); + return false; + } + if (SDIO_GetCommandResponse() != command) return false; + + SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS); + return (SDIO_GetResponse(SDIO_RESP1) & SDMMC_OCR_ERRORBITS) == SDMMC_ALLZERO; +} + +bool SDIO_GetCmdResp2(void) { + SDIO_WAIT(SDIO_STA_CCRCFAIL | SDIO_STA_CMDREND | SDIO_STA_CTIMEOUT); + + if (SDIO_GET_FLAG(SDIO_STA_CCRCFAIL | SDIO_STA_CTIMEOUT)) { + SDIO_CLEAR_FLAG(SDIO_STA_CCRCFAIL | SDIO_STA_CTIMEOUT); + return false; + } + + SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS); + return true; +} + +bool SDIO_GetCmdResp3(void) { + SDIO_WAIT(SDIO_STA_CCRCFAIL | SDIO_STA_CMDREND | SDIO_STA_CTIMEOUT); + + if (SDIO_GET_FLAG(SDIO_STA_CTIMEOUT)) { + SDIO_CLEAR_FLAG(SDIO_STA_CTIMEOUT); + return false; + } + + SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS); + return true; +} + +bool SDIO_GetCmdResp6(uint8_t command, uint32_t *rca) { + SDIO_WAIT(SDIO_STA_CCRCFAIL | SDIO_STA_CMDREND | SDIO_STA_CTIMEOUT); + + if (SDIO_GET_FLAG(SDIO_STA_CCRCFAIL | SDIO_STA_CTIMEOUT)) { + SDIO_CLEAR_FLAG(SDIO_STA_CCRCFAIL | SDIO_STA_CTIMEOUT); + return false; + } + if (SDIO_GetCommandResponse() != command) return false; + + SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS); + if (SDIO_GetResponse(SDIO_RESP1) & (SDMMC_R6_GENERAL_UNKNOWN_ERROR | SDMMC_R6_ILLEGAL_CMD | SDMMC_R6_COM_CRC_FAILED)) return false; + + *rca = SDIO_GetResponse(SDIO_RESP1) >> 16; + return true; +} + +bool SDIO_GetCmdResp7(void) { + SDIO_WAIT(SDIO_STA_CCRCFAIL | SDIO_STA_CMDREND | SDIO_STA_CTIMEOUT); + + if (SDIO_GET_FLAG(SDIO_STA_CTIMEOUT)) { + SDIO_CLEAR_FLAG(SDIO_STA_CTIMEOUT); + return false; + } + + if (SDIO_GET_FLAG(SDIO_STA_CMDREND)) { SDIO_CLEAR_FLAG(SDIO_STA_CMDREND); } + return true; +} + +#endif // ARDUINO_ARCH_STM32F1 && (STM32_HIGH_DENSITY || STM32_XL_DENSITY) diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.h b/Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.h new file mode 100644 index 000000000000..86c1355456c9 --- /dev/null +++ b/Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.h @@ -0,0 +1,152 @@ +/** + * Marlin 3D Printer Firmware + * + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com + * Copyright (c) 2017 Victor Perez + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +// -------------------------------------------------------------------------- +// Includes +// -------------------------------------------------------------------------- + +#include "Arduino.h" +#include "libmaple/sdio.h" +#include "libmaple/dma.h" + +// -------------------------------------------------------------------------- +// Defines +// -------------------------------------------------------------------------- + +#define SDMMC_CMD_GO_IDLE_STATE ((uint8_t)0) /* Resets the SD memory card. */ +#define SDMMC_CMD_ALL_SEND_CID ((uint8_t)2) /* Asks any card connected to the host to send the CID numbers on the CMD line. */ +#define SDMMC_CMD_SET_REL_ADDR ((uint8_t)3) /* Asks the card to publish a new relative address (RCA). */ +#define SDMMC_CMD_SEL_DESEL_CARD ((uint8_t)7) /* Selects the card by its own relative address and gets deselected by any other address */ +#define SDMMC_CMD_HS_SEND_EXT_CSD ((uint8_t)8) /* Sends SD Memory Card interface condition, which includes host supply voltage information and asks the card whether card supports voltage. */ +#define SDMMC_CMD_SEND_CSD ((uint8_t)9) /* Addressed card sends its card specific data (CSD) on the CMD line. */ +#define SDMMC_CMD_SEND_STATUS ((uint8_t)13) /*!< Addressed card sends its status register. */ +#define SDMMC_CMD_READ_SINGLE_BLOCK ((uint8_t)17) /* Reads single block of size selected by SET_BLOCKLEN in case of SDSC, and a block of fixed 512 bytes in case of SDHC and SDXC. */ +#define SDMMC_CMD_WRITE_SINGLE_BLOCK ((uint8_t)24) /* Writes single block of size selected by SET_BLOCKLEN in case of SDSC, and a block of fixed 512 bytes in case of SDHC and SDXC. */ +#define SDMMC_CMD_APP_CMD ((uint8_t)55) /* Indicates to the card that the next command is an application specific command rather than a standard command. */ + +#define SDMMC_ACMD_APP_SD_SET_BUSWIDTH ((uint8_t)6) /* (ACMD6) Defines the data bus width to be used for data transfer. The allowed data bus widths are given in SCR register. */ +#define SDMMC_ACMD_SD_APP_OP_COND ((uint8_t)41) /* (ACMD41) Sends host capacity support information (HCS) and asks the accessed card to send its operating condition register (OCR) content in the response on the CMD line. */ +#define SDMMC_ACMD_SD_APP_SET_CLR_CARD_DETECT ((uint8_t)42) /* (ACMD42) Connect/Disconnect the 50 KOhm pull-up resistor on CD/DAT3 (pin 1) of the card */ + +#define CMD0_GO_IDLE_STATE (uint16_t)(SDMMC_CMD_GO_IDLE_STATE | SDIO_CMD_WAIT_NO_RESP) +#define CMD2_ALL_SEND_CID (uint16_t)(SDMMC_CMD_ALL_SEND_CID | SDIO_CMD_WAIT_LONG_RESP) +#define CMD3_SET_REL_ADDR (uint16_t)(SDMMC_CMD_SET_REL_ADDR | SDIO_CMD_WAIT_SHORT_RESP) +#define CMD7_SEL_DESEL_CARD (uint16_t)(SDMMC_CMD_SEL_DESEL_CARD | SDIO_CMD_WAIT_SHORT_RESP) +#define CMD8_HS_SEND_EXT_CSD (uint16_t)(SDMMC_CMD_HS_SEND_EXT_CSD | SDIO_CMD_WAIT_SHORT_RESP) +#define CMD9_SEND_CSD (uint16_t)(SDMMC_CMD_SEND_CSD | SDIO_CMD_WAIT_LONG_RESP) +#define CMD13_SEND_STATUS (uint16_t)(SDMMC_CMD_SEND_STATUS | SDIO_CMD_WAIT_SHORT_RESP) +#define CMD17_READ_SINGLE_BLOCK (uint16_t)(SDMMC_CMD_READ_SINGLE_BLOCK | SDIO_CMD_WAIT_SHORT_RESP) +#define CMD24_WRITE_SINGLE_BLOCK (uint16_t)(SDMMC_CMD_WRITE_SINGLE_BLOCK | SDIO_CMD_WAIT_SHORT_RESP) +#define CMD55_APP_CMD (uint16_t)(SDMMC_CMD_APP_CMD | SDIO_CMD_WAIT_SHORT_RESP) + +#define ACMD6_APP_SD_SET_BUSWIDTH (uint16_t)(SDMMC_ACMD_APP_SD_SET_BUSWIDTH | SDIO_CMD_WAIT_SHORT_RESP) +#define ACMD41_SD_APP_OP_COND (uint16_t)(SDMMC_ACMD_SD_APP_OP_COND | SDIO_CMD_WAIT_SHORT_RESP) +#define ACMD42_SD_APP_SET_CLR_CARD_DETECT (uint16_t)(SDMMC_ACMD_SD_APP_SET_CLR_CARD_DETECT | SDIO_CMD_WAIT_SHORT_RESP) + + +#define SDMMC_ALLZERO 0x00000000U +#define SDMMC_OCR_ERRORBITS 0xFDFFE008U + +#define SDMMC_R6_GENERAL_UNKNOWN_ERROR 0x00002000U +#define SDMMC_R6_ILLEGAL_CMD 0x00004000U +#define SDMMC_R6_COM_CRC_FAILED 0x00008000U + +#define SDMMC_VOLTAGE_WINDOW_SD 0x80100000U +#define SDMMC_HIGH_CAPACITY 0x40000000U +#define SDMMC_STD_CAPACITY 0x00000000U +#define SDMMC_CHECK_PATTERN 0x000001AAU + +#define SDIO_TRANSFER_MODE_BLOCK 0x00000000U +#define SDIO_DPSM_ENABLE 0x00000001U +#define SDIO_TRANSFER_DIR_TO_CARD 0x00000000U +#define SDIO_DATABLOCK_SIZE_512B 0x00000090U +#define SDIO_TRANSFER_DIR_TO_SDIO 0x00000100U +#define SDIO_DMA_ENABLE 0x00001000U + +#define CARD_V1_X 0x00000000U +#define CARD_V2_X 0x00000001U +#define CARD_SDSC 0x00000000U +#define CARD_SDHC_SDXC 0x00000001U + +#define SDIO_RESP1 0 +#define SDIO_RESP2 1 +#define SDIO_RESP3 2 +#define SDIO_RESP4 3 + +#define SDIO_GET_FLAG(__FLAG__) !!((SDIO->STA) & (__FLAG__)) +#define SDIO_CLEAR_FLAG(__FLAG__) (SDIO->ICR = (__FLAG__)) + +#define SDMMC_MAX_VOLT_TRIAL 0x00000FFFU +#define SDIO_CARD_TRANSFER 0x00000004U /* Card is in transfer state */ +#define SDIO_CARD_ERROR 0x000000FFU /* Card response Error */ +#define SDIO_CMDTIMEOUT 200U /* Command send and response timeout */ +#define SDIO_DATA_TIMEOUT 100U /* Read data transfer timeout */ +#define SDIO_WRITE_TIMEOUT 200U /* Write data transfer timeout */ + +#define SDIO_CLOCK 18000000 /* 18 MHz */ + +// -------------------------------------------------------------------------- +// Types +// -------------------------------------------------------------------------- + +typedef struct { + uint32_t CardType; // Card Type + uint32_t CardVersion; // Card version + uint32_t Class; // Class of the card class + uint32_t RelCardAdd; // Relative Card Address + uint32_t BlockNbr; // Card Capacity in blocks + uint32_t BlockSize; // One block size in bytes + uint32_t LogBlockNbr; // Card logical Capacity in blocks + uint32_t LogBlockSize; // Logical block size in bytes +} SDIO_CardInfoTypeDef; + +// -------------------------------------------------------------------------- +// Public functions +// -------------------------------------------------------------------------- + +inline uint32_t SDIO_GetCardState(void); + +bool SDIO_CmdGoIdleState(void); +bool SDIO_CmdSendCID(void); +bool SDIO_CmdSetRelAdd(uint32_t *rca); +bool SDIO_CmdSelDesel(uint32_t address); +bool SDIO_CmdOperCond(void); +bool SDIO_CmdSendCSD(uint32_t argument); +bool SDIO_CmdSendStatus(uint32_t argument); +bool SDIO_CmdReadSingleBlock(uint32_t address); +bool SDIO_CmdWriteSingleBlock(uint32_t address); +bool SDIO_CmdAppCommand(uint32_t rsa); + +bool SDIO_CmdAppSetBusWidth(uint32_t rsa, uint32_t argument); +bool SDIO_CmdAppOperCommand(uint32_t sdType); +bool SDIO_CmdAppSetClearCardDetect(uint32_t rsa); + +void SDIO_SendCommand(uint16_t command, uint32_t argument); +uint8_t SDIO_GetCommandResponse(void); +uint32_t SDIO_GetResponse(uint32_t response); +bool SDIO_GetCmdError(void); +bool SDIO_GetCmdResp1(uint8_t command); +bool SDIO_GetCmdResp2(void); +bool SDIO_GetCmdResp3(void); +bool SDIO_GetCmdResp6(uint8_t command, uint32_t *rca); +bool SDIO_GetCmdResp7(void); diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL_spi_Stm32f1.cpp b/Marlin/src/HAL/HAL_STM32F1/HAL_spi_STM32F1.cpp similarity index 85% rename from Marlin/src/HAL/HAL_STM32F1/HAL_spi_Stm32f1.cpp rename to Marlin/src/HAL/HAL_STM32F1/HAL_spi_STM32F1.cpp index 02314a346cd2..cbc6c7fe1a86 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL_spi_Stm32f1.cpp +++ b/Marlin/src/HAL/HAL_STM32F1/HAL_spi_STM32F1.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -86,7 +86,7 @@ void spiBegin() { } /** - * @brief Initializes SPI port to required speed rate and transfer mode (MSB, SPI MODE 0) + * @brief Initialize SPI port to required speed rate and transfer mode (MSB, SPI MODE 0) * * @param spiRate Rate as declared in HAL.h (speed do not match AVR) * @return Nothing @@ -104,12 +104,12 @@ void spiInit(uint8_t spiRate) { case SPI_SPEED_6: clock = SPI_CLOCK_DIV64; break; default: clock = SPI_CLOCK_DIV2; // Default from the SPI library } - spiConfig = SPISettings(clock, MSBFIRST, SPI_MODE3); + spiConfig = SPISettings(clock, MSBFIRST, SPI_MODE0); SPI.begin(); } /** - * @brief Receives a single byte from the SPI port. + * @brief Receive a single byte from the SPI port. * * @return Byte received * @@ -123,7 +123,7 @@ uint8_t spiRec(void) { } /** - * @brief Receives a number of bytes from the SPI port to a buffer + * @brief Receive a number of bytes from the SPI port to a buffer * * @param buf Pointer to starting address of buffer to write to. * @param nbyte Number of bytes to receive. @@ -133,12 +133,12 @@ uint8_t spiRec(void) { */ void spiRead(uint8_t* buf, uint16_t nbyte) { SPI.beginTransaction(spiConfig); - SPI.dmaTransfer(0, const_cast(buf), nbyte); + SPI.dmaTransfer(0, const_cast(buf), nbyte); SPI.endTransaction(); } /** - * @brief Sends a single byte on SPI port + * @brief Send a single byte on SPI port * * @param b Byte to send * @@ -161,11 +161,20 @@ void spiSend(uint8_t b) { void spiSendBlock(uint8_t token, const uint8_t* buf) { SPI.beginTransaction(spiConfig); SPI.send(token); - SPI.dmaSend(const_cast(buf), 512); + SPI.dmaSend(const_cast(buf), 512); SPI.endTransaction(); } -/** Begin SPI transaction, set clock, bit order, data mode */ +/** + * @brief Begin SPI transaction, set clock, bit order, data mode + * + * @param spiClock Clock setting + * @param bitOrder Bit Order setting + * @param dataMode Data Mode setting + * @return Nothing + * + * @details Uses an SPI Config via SPISettings + */ void spiBeginTransaction(uint32_t spiClock, uint8_t bitOrder, uint8_t dataMode) { spiConfig = SPISettings(spiClock, (BitOrder)bitOrder, dataMode); SPI.beginTransaction(spiConfig); diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.cpp b/Marlin/src/HAL/HAL_STM32F1/HAL_timers_STM32F1.cpp similarity index 96% rename from Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.cpp rename to Marlin/src/HAL/HAL_STM32F1/HAL_timers_STM32F1.cpp index 5c9f5e893e7d..8b235c004a89 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.cpp +++ b/Marlin/src/HAL/HAL_STM32F1/HAL_timers_STM32F1.cpp @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com * @@ -32,7 +32,7 @@ #include "HAL.h" -#include "HAL_timers_Stm32f1.h" +#include "HAL_timers_STM32F1.h" // -------------------------------------------------------------------------- // Externals @@ -119,7 +119,7 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) { case STEP_TIMER_NUM: timer_pause(STEP_TIMER_DEV); timer_set_count(STEP_TIMER_DEV, 0); - timer_set_prescaler(STEP_TIMER_DEV, (uint16)(STEPPER_TIMER_PRESCALE - 1)); + timer_set_prescaler(STEP_TIMER_DEV, (uint16_t)(STEPPER_TIMER_PRESCALE - 1)); timer_set_reload(STEP_TIMER_DEV, 0xFFFF); timer_set_compare(STEP_TIMER_DEV, STEP_TIMER_CHAN, MIN(HAL_TIMER_TYPE_MAX, (STEPPER_TIMER_RATE / frequency))); timer_attach_interrupt(STEP_TIMER_DEV, STEP_TIMER_CHAN, stepTC_Handler); @@ -130,7 +130,7 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) { case TEMP_TIMER_NUM: timer_pause(TEMP_TIMER_DEV); timer_set_count(TEMP_TIMER_DEV, 0); - timer_set_prescaler(TEMP_TIMER_DEV, (uint16)(TEMP_TIMER_PRESCALE - 1)); + timer_set_prescaler(TEMP_TIMER_DEV, (uint16_t)(TEMP_TIMER_PRESCALE - 1)); timer_set_reload(TEMP_TIMER_DEV, 0xFFFF); timer_set_compare(TEMP_TIMER_DEV, TEMP_TIMER_CHAN, MIN(HAL_TIMER_TYPE_MAX, ((F_CPU / TEMP_TIMER_PRESCALE) / frequency))); timer_attach_interrupt(TEMP_TIMER_DEV, TEMP_TIMER_CHAN, tempTC_Handler); @@ -157,7 +157,7 @@ void HAL_timer_disable_interrupt(const uint8_t timer_num) { } } -static inline bool timer_irq_enabled(const timer_dev * const dev, const uint8 interrupt) { +static inline bool timer_irq_enabled(const timer_dev * const dev, const uint8_t interrupt) { return bool(*bb_perip(&(dev->regs).adv->DIER, interrupt)); } diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.h b/Marlin/src/HAL/HAL_STM32F1/HAL_timers_STM32F1.h similarity index 97% rename from Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.h rename to Marlin/src/HAL/HAL_STM32F1/HAL_timers_STM32F1.h index 9610bb5533bd..b17d8a44d3b6 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.h +++ b/Marlin/src/HAL/HAL_STM32F1/HAL_timers_STM32F1.h @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com * Copyright (c) 2017 Victor Perez * @@ -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/stm32f1_flag_script.py b/Marlin/src/HAL/HAL_STM32F1/STM32F1_flag_script.py similarity index 96% rename from Marlin/src/HAL/HAL_STM32F1/stm32f1_flag_script.py rename to Marlin/src/HAL/HAL_STM32F1/STM32F1_flag_script.py index 0610ce132a9d..ce5a06674185 100644 --- a/Marlin/src/HAL/HAL_STM32F1/stm32f1_flag_script.py +++ b/Marlin/src/HAL/HAL_STM32F1/STM32F1_flag_script.py @@ -17,7 +17,7 @@ "--specs=nano.specs", "--specs=nosys.specs", - "-IMarlin/src/HAL", + "-IMarlin/src/HAL/HAL_STM32F1", "-MMD", "-MP", diff --git a/Marlin/src/HAL/HAL_STM32F1/SanityCheck.h b/Marlin/src/HAL/HAL_STM32F1/SanityCheck.h index 40917f03fe43..c1470ca51ea3 100644 --- a/Marlin/src/HAL/HAL_STM32F1/SanityCheck.h +++ b/Marlin/src/HAL/HAL_STM32F1/SanityCheck.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -28,8 +28,8 @@ * Test Re-ARM specific configuration values for errors at compile-time. */ #if ENABLED(SPINDLE_LASER_ENABLE) - #if !PIN_EXISTS(SPINDLE_LASER_ENABLE) - #error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENABLE_PIN." + #if !PIN_EXISTS(SPINDLE_LASER_ENA) + #error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENA_PIN." #elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR) #error "SPINDLE_DIR_PIN not defined." #elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM) @@ -70,3 +70,11 @@ #if ENABLED(EMERGENCY_PARSER) #error "EMERGENCY_PARSER is not yet implemented for STM32F1. Disable EMERGENCY_PARSER to continue." #endif + +#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 70d5ead7233a..000000000000 --- 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/endstop_interrupts.h b/Marlin/src/HAL/HAL_STM32F1/endstop_interrupts.h index 50d012796891..85437c511ddc 100644 --- a/Marlin/src/HAL/HAL_STM32F1/endstop_interrupts.h +++ b/Marlin/src/HAL/HAL_STM32F1/endstop_interrupts.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_STM32F1/fastio_Stm32f1.h b/Marlin/src/HAL/HAL_STM32F1/fastio_STM32F1.h similarity index 70% rename from Marlin/src/HAL/HAL_STM32F1/fastio_Stm32f1.h rename to Marlin/src/HAL/HAL_STM32F1/fastio_STM32F1.h index 237ffb0b3520..3994b3268a41 100644 --- a/Marlin/src/HAL/HAL_STM32F1/fastio_Stm32f1.h +++ b/Marlin/src/HAL/HAL_STM32F1/fastio_STM32F1.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 ad29a1be47db..aa03474d2bb9 100644 --- a/Marlin/src/HAL/HAL_STM32F1/persistent_store_flash.cpp +++ b/Marlin/src/HAL/HAL_STM32F1/persistent_store_flash.cpp @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com * Copyright (c) 2016 Victor Perez victor_pv@hotmail.com @@ -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 757d62fd591d..2b184cdc4cea 100644 --- a/Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp +++ b/Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com * Copyright (c) 2016 Victor Perez victor_pv@hotmail.com @@ -41,7 +41,7 @@ char HAL_STM32F1_eeprom_content[HAL_STM32F1_EEPROM_SIZE]; char eeprom_filename[] = "eeprom.dat"; bool PersistentStore::access_start() { - if (!card.flag.cardOK) return false; + if (!card.isDetected()) return false; int16_t bytes_read = 0; constexpr char eeprom_zero = 0xFF; card.openFile(eeprom_filename, true); @@ -54,15 +54,15 @@ bool PersistentStore::access_start() { } bool PersistentStore::access_finish() { - if (!card.flag.cardOK) return false; - card.openFile(eeprom_filename, true); + if (!card.isDetected()) return false; + 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); } bool PersistentStore::write_data(int &pos, const uint8_t *value, const size_t size, uint16_t *crc) { - for (int i = 0; i < size; i++) + for (size_t i = 0; i < size; i++) HAL_STM32F1_eeprom_content[pos + i] = value[i]; crc16(crc, value, size); pos += size; @@ -70,7 +70,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, const size_t si } bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uint16_t *crc, const bool writing/*=true*/) { - for (int i = 0; i < size; i++) { + for (size_t i = 0; i < size; i++) { uint8_t c = HAL_STM32F1_eeprom_content[pos + i]; if (writing) value[i] = c; crc16(crc, &c, 1); diff --git a/Marlin/src/HAL/HAL_STM32F1/spi_pins.h b/Marlin/src/HAL/HAL_STM32F1/spi_pins.h index b2fc2c345dc7..97005a309eb2 100644 --- a/Marlin/src/HAL/HAL_STM32F1/spi_pins.h +++ b/Marlin/src/HAL/HAL_STM32F1/spi_pins.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/Marlin/src/HAL/HAL_STM32F1/u8g_com_stm32duino_fsmc.cpp b/Marlin/src/HAL/HAL_STM32F1/u8g_com_stm32duino_fsmc.cpp new file mode 100644 index 000000000000..1d2153d20852 --- /dev/null +++ b/Marlin/src/HAL/HAL_STM32F1/u8g_com_stm32duino_fsmc.cpp @@ -0,0 +1,270 @@ +/** + * 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 . + * + */ + +/** + * u8g_com_stm32duino_fsmc.cpp + * + * Communication interface for FSMC + */ + +#if defined(ARDUINO_ARCH_STM32F1) && (defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY)) + +#include "../../inc/MarlinConfig.h" + +#if HAS_GRAPHICAL_LCD + +#include "U8glib.h" +#include "libmaple/fsmc.h" +#include "libmaple/gpio.h" +#include "boards.h" + +#define LCD_READ_ID 0x04 /* Read display identification information */ + +/* Timing configuration */ +#define FSMC_ADDRESS_SETUP_TIME 15 // AddressSetupTime +#define FSMC_DATA_SETUP_TIME 15 // DataSetupTime + +void LCD_IO_Init(uint8_t cs, uint8_t rs); +void LCD_IO_WriteData(uint16_t RegValue); +void LCD_IO_WriteReg(uint8_t Reg); +uint32_t LCD_IO_ReadData(uint16_t RegValue, uint8_t ReadSize); + +static uint8_t msgInitCount = 2; // Ignore all messages until 2nd U8G_COM_MSG_INIT + +uint8_t u8g_com_stm32duino_fsmc_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) { + if (msgInitCount) { + if (msg == U8G_COM_MSG_INIT) msgInitCount--; + if (msgInitCount) return -1; + } + + static uint8_t isCommand; + + switch (msg) { + case U8G_COM_MSG_STOP: + break; + case U8G_COM_MSG_INIT: + u8g_SetPIOutput(u8g, U8G_PI_RESET); + + LCD_IO_Init(u8g->pin_list[U8G_PI_CS], u8g->pin_list[U8G_PI_A0]); + u8g_Delay(100); + + if (arg_ptr != NULL) + *((uint32_t *)arg_ptr) = LCD_IO_ReadData(LCD_READ_ID, 3); + + isCommand = 0; + break; + + case U8G_COM_MSG_ADDRESS: // define cmd (arg_val = 0) or data mode (arg_val = 1) + isCommand = arg_val == 0 ? 1 : 0; + break; + + case U8G_COM_MSG_RESET: + u8g_SetPILevel(u8g, U8G_PI_RESET, arg_val); + break; + + case U8G_COM_MSG_WRITE_BYTE: + if (isCommand) + LCD_IO_WriteReg(arg_val); + else + LCD_IO_WriteData((uint16_t)arg_val); + break; + + case U8G_COM_MSG_WRITE_SEQ: + + for (uint8_t i = 0; i < arg_val; i += 2) + LCD_IO_WriteData(*(uint16_t *)(((uint32_t)arg_ptr) + i)); + break; + } + return 1; +} + +/** + * FSMC LCD IO + */ +#define __ASM __asm +#define __STATIC_INLINE static inline + +__attribute__((always_inline)) __STATIC_INLINE void __DSB(void) { + __ASM volatile ("dsb 0xF":::"memory"); +} + +#define FSMC_CS_NE1 PD7 + +#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; + +typedef struct { + __IO uint16_t REG; + __IO uint16_t RAM; +} LCD_CONTROLLER_TypeDef; + +LCD_CONTROLLER_TypeDef *LCD; + +void LCD_IO_Init(uint8_t cs, uint8_t rs) { + uint32_t controllerAddress; + + if (fsmcInit) return; + fsmcInit = 1; + + switch (cs) { + case FSMC_CS_NE1: controllerAddress = (uint32_t)FSMC_NOR_PSRAM_REGION1; 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) { + #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; + case FSMC_RS_A19: _ORADDR(20); break; + case FSMC_RS_A20: _ORADDR(21); break; + case FSMC_RS_A21: _ORADDR(22); break; + case FSMC_RS_A22: _ORADDR(23); break; + case FSMC_RS_A23: _ORADDR(24); break; + #ifdef STM32_XL_DENSITY + case FSMC_RS_A24: _ORADDR(25); break; + case FSMC_RS_A25: _ORADDR(26); break; + #endif + default: return; + } + + rcc_clk_enable(RCC_FSMC); + + gpio_set_mode(GPIOD, 14, GPIO_AF_OUTPUT_PP); // FSMC_D00 + gpio_set_mode(GPIOD, 15, GPIO_AF_OUTPUT_PP); // FSMC_D01 + gpio_set_mode(GPIOD, 0, GPIO_AF_OUTPUT_PP); // FSMC_D02 + gpio_set_mode(GPIOD, 1, GPIO_AF_OUTPUT_PP); // FSMC_D03 + gpio_set_mode(GPIOE, 7, GPIO_AF_OUTPUT_PP); // FSMC_D04 + gpio_set_mode(GPIOE, 8, GPIO_AF_OUTPUT_PP); // FSMC_D05 + gpio_set_mode(GPIOE, 9, GPIO_AF_OUTPUT_PP); // FSMC_D06 + gpio_set_mode(GPIOE, 10, GPIO_AF_OUTPUT_PP); // FSMC_D07 + gpio_set_mode(GPIOE, 11, GPIO_AF_OUTPUT_PP); // FSMC_D08 + gpio_set_mode(GPIOE, 12, GPIO_AF_OUTPUT_PP); // FSMC_D09 + gpio_set_mode(GPIOE, 13, GPIO_AF_OUTPUT_PP); // FSMC_D10 + gpio_set_mode(GPIOE, 14, GPIO_AF_OUTPUT_PP); // FSMC_D11 + gpio_set_mode(GPIOE, 15, GPIO_AF_OUTPUT_PP); // FSMC_D12 + gpio_set_mode(GPIOD, 8, GPIO_AF_OUTPUT_PP); // FSMC_D13 + gpio_set_mode(GPIOD, 9, GPIO_AF_OUTPUT_PP); // FSMC_D14 + gpio_set_mode(GPIOD, 10, GPIO_AF_OUTPUT_PP); // FSMC_D15 + + gpio_set_mode(GPIOD, 4, GPIO_AF_OUTPUT_PP); // FSMC_NOE + gpio_set_mode(GPIOD, 5, GPIO_AF_OUTPUT_PP); // FSMC_NWE + + gpio_set_mode(PIN_MAP[cs].gpio_device, PIN_MAP[cs].gpio_bit, GPIO_AF_OUTPUT_PP); //FSMC_CS_NEx + gpio_set_mode(PIN_MAP[rs].gpio_device, PIN_MAP[rs].gpio_bit, GPIO_AF_OUTPUT_PP); //FSMC_RS_Ax + + FSMC_NOR_PSRAM4_BASE->BCR = FSMC_BCR_WREN | FSMC_BCR_MTYP_SRAM | FSMC_BCR_MWID_16BITS | FSMC_BCR_MBKEN; + FSMC_NOR_PSRAM4_BASE->BTR = (FSMC_DATA_SETUP_TIME << 8) | FSMC_ADDRESS_SETUP_TIME; + + afio_remap(AFIO_REMAP_FSMC_NADV); + + LCD = (LCD_CONTROLLER_TypeDef*)controllerAddress; +} + +void LCD_IO_WriteData(uint16_t RegValue) { + LCD->RAM = RegValue; + __DSB(); +} + +void LCD_IO_WriteReg(uint8_t Reg) { + LCD->REG = (uint16_t)Reg; + __DSB(); +} + +uint32_t LCD_IO_ReadData(uint16_t RegValue, uint8_t ReadSize) { + volatile uint32_t data; + LCD->REG = (uint16_t)RegValue; + __DSB(); + + data = LCD->RAM; // dummy read + data = LCD->RAM & 0x00FF; + + while (--ReadSize) { + data <<= 8; + data |= (LCD->RAM & 0x00FF); + } + return (uint32_t)data; +} + +#endif // HAS_GRAPHICAL_LCD + +#endif // ARDUINO_ARCH_STM32F1 && (STM32_HIGH_DENSITY || STM32_XL_DENSITY) diff --git a/Marlin/src/HAL/HAL_STM32F1/watchdog_Stm32f1.cpp b/Marlin/src/HAL/HAL_STM32F1/watchdog_STM32F1.cpp similarity index 86% rename from Marlin/src/HAL/HAL_STM32F1/watchdog_Stm32f1.cpp rename to Marlin/src/HAL/HAL_STM32F1/watchdog_STM32F1.cpp index 101ad5ca5e3f..0cbfb7fa5e3a 100644 --- a/Marlin/src/HAL/HAL_STM32F1/watchdog_Stm32f1.cpp +++ b/Marlin/src/HAL/HAL_STM32F1/watchdog_STM32F1.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -31,7 +31,14 @@ #if ENABLED(USE_WATCHDOG) #include -#include "watchdog_Stm32f1.h" +#include "watchdog_STM32F1.h" + +void watchdog_reset() { + #if PIN_EXISTS(LED) + TOGGLE(LED_PIN); // heartbeat indicator + #endif + iwdg_feed(); +} void watchdogSetup(void) { // do whatever. don't remove this function. diff --git a/Marlin/src/HAL/HAL_STM32F1/watchdog_Stm32f1.h b/Marlin/src/HAL/HAL_STM32F1/watchdog_STM32F1.h similarity index 85% rename from Marlin/src/HAL/HAL_STM32F1/watchdog_Stm32f1.h rename to Marlin/src/HAL/HAL_STM32F1/watchdog_STM32F1.h index d34efdc0a2bb..db62d4448b85 100644 --- a/Marlin/src/HAL/HAL_STM32F1/watchdog_Stm32f1.h +++ b/Marlin/src/HAL/HAL_STM32F1/watchdog_STM32F1.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -27,8 +27,6 @@ #include -#include "../../inc/MarlinConfig.h" - /** * The watchdog clock is 40Khz. We need a 4 seconds interval, so use a /256 preescaler and * 625 reload value (counts down to 0) @@ -43,9 +41,4 @@ void watchdog_init(); // Reset watchdog. MUST be called at least every 4 seconds after the // first watchdog_init or STM32F1 will reset. -inline void watchdog_reset() { - #if PIN_EXISTS(LED) - TOGGLE(LED_PIN); // heart beat indicator - #endif - iwdg_feed(); -} +void watchdog_reset(); diff --git a/Marlin/src/HAL/HAL_STM32F4/EEPROM_Emul/eeprom_emul.cpp b/Marlin/src/HAL/HAL_STM32F4/EEPROM_Emul/eeprom_emul.cpp index c13d428187f1..8bae46777d3d 100644 --- a/Marlin/src/HAL/HAL_STM32F4/EEPROM_Emul/eeprom_emul.cpp +++ b/Marlin/src/HAL/HAL_STM32F4/EEPROM_Emul/eeprom_emul.cpp @@ -47,7 +47,7 @@ /** @addtogroup EEPROM_Emulation * @{ */ -#if defined(STM32GENERIC) && (defined(STM32F4) || defined(STM32F4xx)) +#if defined(STM32GENERIC) && (defined(STM32F4)) /* Includes ------------------------------------------------------------------*/ #include "eeprom_emul.h" diff --git a/Marlin/src/HAL/HAL_STM32F4/EEPROM_Emul/eeprom_emul.h b/Marlin/src/HAL/HAL_STM32F4/EEPROM_Emul/eeprom_emul.h index a3e93503d81b..fe0da6387b7c 100644 --- a/Marlin/src/HAL/HAL_STM32F4/EEPROM_Emul/eeprom_emul.h +++ b/Marlin/src/HAL/HAL_STM32F4/EEPROM_Emul/eeprom_emul.h @@ -1,50 +1,48 @@ -/** - ****************************************************************************** - * @file EEPROM/EEPROM_Emulation/inc/eeprom.h - * @author MCD Application Team - * @version V1.2.6 - * @date 04-November-2016 - * @brief This file contains all the functions prototypes for the EEPROM - * emulation firmware library. - ****************************************************************************** - * @attention - * - *

© Copyright � 2016 STMicroelectronics International N.V. - * All rights reserved.

- * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted, provided that the following conditions are met: - * - * 1. Redistribution of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. 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. - * 3. Neither the name of STMicroelectronics nor the names of other - * contributors to this software may be used to endorse or promote products - * derived from this software without specific written permission. - * 4. This software, including modifications and/or derivative works of this - * software, must execute solely and exclusively on microcontroller or - * microprocessor devices manufactured by or for STMicroelectronics. - * 5. Redistribution and use of this software other than as permitted under - * this license is void and will automatically terminate your rights under - * this license. - * - * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY - * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT - * SHALL STMICROELECTRONICS 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. - * - ****************************************************************************** - */ +/****************************************************************************** + * @file eeprom_emul.h + * @author MCD Application Team + * @version V1.2.6 + * @date 04-November-2016 + * @brief This file contains all the functions prototypes for the EEPROM + * emulation firmware library. + ****************************************************************************** + * @attention + * + *

© Copyright � 2016 STMicroelectronics International N.V. + * All rights reserved.

+ * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted, provided that the following conditions are met: + * + * 1. Redistribution of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. 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. + * 3. Neither the name of STMicroelectronics nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific written permission. + * 4. This software, including modifications and/or derivative works of this + * software, must execute solely and exclusively on microcontroller or + * microprocessor devices manufactured by or for STMicroelectronics. + * 5. Redistribution and use of this software other than as permitted under + * this license is void and will automatically terminate your rights under + * this license. + * + * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY + * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT + * SHALL STMICROELECTRONICS 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. + * + ******************************************************************************/ #pragma once // -------------------------------------------------------------------------- diff --git a/Marlin/src/HAL/HAL_STM32F4/EmulatedEeprom.cpp b/Marlin/src/HAL/HAL_STM32F4/EmulatedEeprom.cpp index 7d45ef18d06b..1f3d753448a4 100644 --- a/Marlin/src/HAL/HAL_STM32F4/EmulatedEeprom.cpp +++ b/Marlin/src/HAL/HAL_STM32F4/EmulatedEeprom.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ * */ -#if defined(STM32GENERIC) && (defined(STM32F4) || defined(STM32F4xx)) +#if defined(STM32GENERIC) && (defined(STM32F4)) /** * Description: functions for I2C connected external EEPROM. @@ -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 // STM32F4 || STM32F4xx +#endif // EEPROM_SETTINGS && (!I2C_EEPROM && !SPI_EEPROM) +#endif // STM32GENERIC && STM32F4 diff --git a/Marlin/src/HAL/HAL_STM32F4/HAL.cpp b/Marlin/src/HAL/HAL_STM32F4/HAL.cpp index 56823ccc8357..5840a525b66a 100644 --- a/Marlin/src/HAL/HAL_STM32F4/HAL.cpp +++ b/Marlin/src/HAL/HAL_STM32F4/HAL.cpp @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com * Copyright (c) 2017 Victor Perez @@ -21,7 +21,7 @@ * */ -#if defined(STM32GENERIC) && (defined(STM32F4) || defined(STM32F4xx)) +#if defined(STM32GENERIC) && defined(STM32F4) // -------------------------------------------------------------------------- // Includes @@ -79,7 +79,7 @@ void sei(void) { interrupts(); } void HAL_clear_reset_source(void) { __HAL_RCC_CLEAR_RESET_FLAGS(); } -uint8_t HAL_get_reset_source (void) { +uint8_t HAL_get_reset_source(void) { if (__HAL_RCC_GET_FLAG(RCC_FLAG_IWDGRST) != RESET) return RST_WATCHDOG; if (__HAL_RCC_GET_FLAG(RCC_FLAG_SFTRST) != RESET) return RST_SOFTWARE; @@ -130,4 +130,4 @@ uint16_t HAL_adc_get_result(void) { return HAL_adc_result; } -#endif // STM32F4 || STM32F4xx +#endif // // STM32GENERIC && STM32F4 diff --git a/Marlin/src/HAL/HAL_STM32F4/HAL.h b/Marlin/src/HAL/HAL_STM32F4/HAL.h index 2b2dd09ba2b4..c41fe05f60a7 100644 --- a/Marlin/src/HAL/HAL_STM32F4/HAL.h +++ b/Marlin/src/HAL/HAL_STM32F4/HAL.h @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com * Copyright (c) 2017 Victor Perez @@ -170,7 +170,7 @@ extern uint16_t HAL_adc_result; void HAL_clear_reset_source (void); /** reset reason */ -uint8_t HAL_get_reset_source (void); +uint8_t HAL_get_reset_source(void); void _delay_ms(const int delay); @@ -195,7 +195,10 @@ static int freeMemory() { return &top - reinterpret_cast(_sbrk(0)); } +// // SPI: Extended functions which take a channel number (hardware SPI only) +// + /** Write single byte to specified SPI channel */ void spiSend(uint32_t chan, byte b); /** Write buffer to specified SPI channel */ @@ -203,18 +206,22 @@ void spiSend(uint32_t chan, const uint8_t* buf, size_t n); /** Read single byte from specified SPI channel */ uint8_t spiRec(uint32_t chan); +// // EEPROM +// /** - * TODO: Write all this eeprom stuff. Can emulate eeprom in flash as last resort. - * Wire library should work for i2c eeproms. + * TODO: Write all this EEPROM stuff. Can emulate EEPROM in flash as last resort. + * Wire library should work for i2c EEPROMs. */ void eeprom_write_byte(uint8_t *pos, unsigned char value); uint8_t eeprom_read_byte(uint8_t *pos); void eeprom_read_block (void *__dst, const void *__src, size_t __n); void eeprom_update_block (const void *__src, void *__dst, size_t __n); +// // ADC +// #define HAL_ANALOG_SELECT(pin) pinMode(pin, INPUT) diff --git a/Marlin/src/HAL/HAL_STM32F4/HAL_Servo_STM32F4.cpp b/Marlin/src/HAL/HAL_STM32F4/HAL_Servo_STM32F4.cpp index 9d9c722e58e2..bfe03f5d905e 100644 --- a/Marlin/src/HAL/HAL_STM32F4/HAL_Servo_STM32F4.cpp +++ b/Marlin/src/HAL/HAL_STM32F4/HAL_Servo_STM32F4.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -21,7 +21,7 @@ * */ -#if defined(STM32GENERIC) && (defined(STM32F4) || defined(STM32F4xx)) +#if defined(STM32GENERIC) && defined(STM32F4) #include "../../inc/MarlinConfig.h" @@ -50,4 +50,4 @@ void libServo::move(const int value) { } #endif // HAS_SERVOS -#endif // STM32F4 || STM32F4xx +#endif // STM32GENERIC && STM32F4 diff --git a/Marlin/src/HAL/HAL_STM32F4/HAL_Servo_STM32F4.h b/Marlin/src/HAL/HAL_STM32F4/HAL_Servo_STM32F4.h index 5daf90ab8d61..0b92a44efc2f 100644 --- a/Marlin/src/HAL/HAL_STM32F4/HAL_Servo_STM32F4.h +++ b/Marlin/src/HAL/HAL_STM32F4/HAL_Servo_STM32F4.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_STM32F4/HAL_spi_STM32F4.cpp b/Marlin/src/HAL/HAL_STM32F4/HAL_spi_STM32F4.cpp index 34582c30ade6..6c3926db6530 100644 --- a/Marlin/src/HAL/HAL_STM32F4/HAL_spi_STM32F4.cpp +++ b/Marlin/src/HAL/HAL_STM32F4/HAL_spi_STM32F4.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -30,7 +30,7 @@ * Adapted to the STM32F4 HAL */ -#if defined(STM32GENERIC) && (defined(STM32F4) || defined(STM32F4xx)) +#if defined(STM32GENERIC) && defined(STM32F4) // -------------------------------------------------------------------------- // Includes @@ -173,4 +173,4 @@ void spiSendBlock(uint8_t token, const uint8_t* buf) { #endif // SOFTWARE_SPI -#endif // STM32F4 || STM32F4xx +#endif // STM32GENERIC && STM32F4 diff --git a/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.cpp b/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.cpp index 6a23090a24ca..4783736b20d2 100644 --- a/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.cpp +++ b/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.cpp @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com * @@ -20,7 +20,7 @@ * */ -#if defined(STM32GENERIC) && (defined(STM32F4) || defined(STM32F4xx)) +#if defined(STM32GENERIC) && defined(STM32F4) // -------------------------------------------------------------------------- // Includes @@ -156,4 +156,4 @@ bool HAL_timer_interrupt_enabled(const uint8_t timer_num) { return false; } -#endif // STM32F4 || STM32F4xx +#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 d2c1156542ca..a4c2ba6f44b3 100644 --- a/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.h +++ b/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.h @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com * Copyright (c) 2017 Victor Perez * @@ -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 605eb9cb1589..441daf925731 100644 --- a/Marlin/src/HAL/HAL_STM32F4/SanityCheck.h +++ b/Marlin/src/HAL/HAL_STM32F4/SanityCheck.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -24,8 +24,8 @@ * Test Re-ARM specific configuration values for errors at compile-time. */ #if ENABLED(SPINDLE_LASER_ENABLE) - #if !PIN_EXISTS(SPINDLE_LASER_ENABLE) - #error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENABLE_PIN." + #if !PIN_EXISTS(SPINDLE_LASER_ENA) + #error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENA_PIN." #elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR) #error "SPINDLE_DIR_PIN not defined." #elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM) @@ -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/endstop_interrupts.h b/Marlin/src/HAL/HAL_STM32F4/endstop_interrupts.h index e4a243b43edf..23eca4bab7db 100644 --- a/Marlin/src/HAL/HAL_STM32F4/endstop_interrupts.h +++ b/Marlin/src/HAL/HAL_STM32F4/endstop_interrupts.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_STM32F4/fastio_STM32F4.h b/Marlin/src/HAL/HAL_STM32F4/fastio_STM32F4.h index 61de5306cc6e..bac5bdabca81 100644 --- a/Marlin/src/HAL/HAL_STM32F4/fastio_STM32F4.h +++ b/Marlin/src/HAL/HAL_STM32F4/fastio_STM32F4.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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_STM32F4/persistent_store_eeprom.cpp b/Marlin/src/HAL/HAL_STM32F4/persistent_store_eeprom.cpp index 648c29768715..b67c76c4c104 100644 --- a/Marlin/src/HAL/HAL_STM32F4/persistent_store_eeprom.cpp +++ b/Marlin/src/HAL/HAL_STM32F4/persistent_store_eeprom.cpp @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com * Copyright (c) 2016 Victor Perez victor_pv@hotmail.com @@ -21,7 +21,7 @@ * */ -#if defined(STM32GENERIC) && (defined(STM32F4) || defined(STM32F4xx)) +#if defined(STM32GENERIC) && defined(STM32F4) #include "../shared/persistent_store_api.h" @@ -41,8 +41,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui if (v != eeprom_read_byte(p)) { eeprom_write_byte(p, v); if (eeprom_read_byte(p) != v) { - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM(MSG_ERR_EEPROM_WRITE); + SERIAL_ECHO_MSG(MSG_ERR_EEPROM_WRITE); return true; } } @@ -67,4 +66,4 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t size_t PersistentStore::capacity() { return E2END + 1; } #endif // EEPROM_SETTINGS -#endif // STM32F4 || STM32F4xx +#endif // STM32GENERIC && STM32F4 diff --git a/Marlin/src/HAL/HAL_STM32F4/spi_pins.h b/Marlin/src/HAL/HAL_STM32F4/spi_pins.h index 577b36aeb852..e18e12278d8e 100644 --- a/Marlin/src/HAL/HAL_STM32F4/spi_pins.h +++ b/Marlin/src/HAL/HAL_STM32F4/spi_pins.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/Marlin/src/HAL/HAL_STM32F4/watchdog_STM32F4.cpp b/Marlin/src/HAL/HAL_STM32F4/watchdog_STM32F4.cpp index dd4d4391c620..fd2f309515c8 100644 --- a/Marlin/src/HAL/HAL_STM32F4/watchdog_STM32F4.cpp +++ b/Marlin/src/HAL/HAL_STM32F4/watchdog_STM32F4.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -20,7 +20,7 @@ * */ -#if defined(STM32GENERIC) && (defined(STM32F4) || defined(STM32F4xx)) +#if defined(STM32GENERIC) && defined(STM32F4) #include "../../inc/MarlinConfig.h" @@ -54,4 +54,4 @@ #endif // USE_WATCHDOG -#endif // STM32F4 || STM32F4xx +#endif // STM32GENERIC && STM32F4 diff --git a/Marlin/src/HAL/HAL_STM32F4/watchdog_STM32F4.h b/Marlin/src/HAL/HAL_STM32F4/watchdog_STM32F4.h index cff0cf469b63..4076c2b03a9f 100644 --- a/Marlin/src/HAL/HAL_STM32F4/watchdog_STM32F4.h +++ b/Marlin/src/HAL/HAL_STM32F4/watchdog_STM32F4.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_STM32F7/EEPROM_Emul/eeprom_emul.h b/Marlin/src/HAL/HAL_STM32F7/EEPROM_Emul/eeprom_emul.h index 441ff1bae1d5..8cffdbef7779 100644 --- a/Marlin/src/HAL/HAL_STM32F7/EEPROM_Emul/eeprom_emul.h +++ b/Marlin/src/HAL/HAL_STM32F7/EEPROM_Emul/eeprom_emul.h @@ -1,50 +1,48 @@ -/** - ****************************************************************************** - * @file EEPROM/EEPROM_Emulation/inc/eeprom.h - * @author MCD Application Team - * @version V1.2.6 - * @date 04-November-2016 - * @brief This file contains all the functions prototypes for the EEPROM - * emulation firmware library. - ****************************************************************************** - * @attention - * - *

© Copyright © 2016 STMicroelectronics International N.V. - * All rights reserved.

- * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted, provided that the following conditions are met: - * - * 1. Redistribution of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. 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. - * 3. Neither the name of STMicroelectronics nor the names of other - * contributors to this software may be used to endorse or promote products - * derived from this software without specific written permission. - * 4. This software, including modifications and/or derivative works of this - * software, must execute solely and exclusively on microcontroller or - * microprocessor devices manufactured by or for STMicroelectronics. - * 5. Redistribution and use of this software other than as permitted under - * this license is void and will automatically terminate your rights under - * this license. - * - * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY - * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT - * SHALL STMICROELECTRONICS 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. - * - ****************************************************************************** - */ +/****************************************************************************** + * @file eeprom_emul.h + * @author MCD Application Team + * @version V1.2.6 + * @date 04-November-2016 + * @brief This file contains all the functions prototypes for the EEPROM + * emulation firmware library. + ****************************************************************************** + * @attention + * + *

© Copyright © 2016 STMicroelectronics International N.V. + * All rights reserved.

+ * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted, provided that the following conditions are met: + * + * 1. Redistribution of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. 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. + * 3. Neither the name of STMicroelectronics nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific written permission. + * 4. This software, including modifications and/or derivative works of this + * software, must execute solely and exclusively on microcontroller or + * microprocessor devices manufactured by or for STMicroelectronics. + * 5. Redistribution and use of this software other than as permitted under + * this license is void and will automatically terminate your rights under + * this license. + * + * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY + * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT + * SHALL STMICROELECTRONICS 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. + * + *****************************************************************************/ #pragma once // -------------------------------------------------------------------------- diff --git a/Marlin/src/HAL/HAL_STM32F7/EmulatedEeprom.cpp b/Marlin/src/HAL/HAL_STM32F7/EmulatedEeprom.cpp index 1da5fb486ba9..7f9118ee9cae 100644 --- a/Marlin/src/HAL/HAL_STM32F7/EmulatedEeprom.cpp +++ b/Marlin/src/HAL/HAL_STM32F7/EmulatedEeprom.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/Marlin/src/HAL/HAL_STM32F7/HAL.cpp b/Marlin/src/HAL/HAL_STM32F7/HAL.cpp index 87d3a5f30a2f..9f354f17e32c 100644 --- a/Marlin/src/HAL/HAL_STM32F7/HAL.cpp +++ b/Marlin/src/HAL/HAL_STM32F7/HAL.cpp @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com * Copyright (c) 2017 Victor Perez @@ -79,7 +79,7 @@ void sei(void) { interrupts(); } void HAL_clear_reset_source(void) { __HAL_RCC_CLEAR_RESET_FLAGS(); } -uint8_t HAL_get_reset_source (void) { +uint8_t HAL_get_reset_source(void) { if (__HAL_RCC_GET_FLAG(RCC_FLAG_IWDGRST) != RESET) return RST_WATCHDOG; diff --git a/Marlin/src/HAL/HAL_STM32F7/HAL.h b/Marlin/src/HAL/HAL_STM32F7/HAL.h index 060e2584a2a4..db7aa0391a00 100644 --- a/Marlin/src/HAL/HAL_STM32F7/HAL.h +++ b/Marlin/src/HAL/HAL_STM32F7/HAL.h @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com * Copyright (c) 2017 Victor Perez @@ -157,7 +157,7 @@ extern uint16_t HAL_adc_result; void HAL_clear_reset_source (void); /** reset reason */ -uint8_t HAL_get_reset_source (void); +uint8_t HAL_get_reset_source(void); void _delay_ms(const int delay); diff --git a/Marlin/src/HAL/HAL_STM32F7/HAL_Servo_STM32F7.cpp b/Marlin/src/HAL/HAL_STM32F7/HAL_Servo_STM32F7.cpp index 43d95e905914..40fafc432cd0 100644 --- a/Marlin/src/HAL/HAL_STM32F7/HAL_Servo_STM32F7.cpp +++ b/Marlin/src/HAL/HAL_STM32F7/HAL_Servo_STM32F7.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_STM32F7/HAL_Servo_STM32F7.h b/Marlin/src/HAL/HAL_STM32F7/HAL_Servo_STM32F7.h index f3a776365f82..1b7ee408177b 100644 --- a/Marlin/src/HAL/HAL_STM32F7/HAL_Servo_STM32F7.h +++ b/Marlin/src/HAL/HAL_STM32F7/HAL_Servo_STM32F7.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_STM32F7/HAL_spi_STM32F7.cpp b/Marlin/src/HAL/HAL_STM32F7/HAL_spi_STM32F7.cpp index 094ceda2da51..78b312470a6f 100644 --- a/Marlin/src/HAL/HAL_STM32F7/HAL_spi_STM32F7.cpp +++ b/Marlin/src/HAL/HAL_STM32F7/HAL_spi_STM32F7.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.cpp b/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.cpp index 7949af0c5553..90131903e381 100644 --- a/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.cpp +++ b/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.cpp @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com * diff --git a/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h b/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h index b5f8cb24bc53..34e56a20599b 100644 --- a/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h +++ b/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com * Copyright (c) 2017 Victor Perez * @@ -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 880f5dfed68d..8ba1f870c20e 100644 --- a/Marlin/src/HAL/HAL_STM32F7/SanityCheck.h +++ b/Marlin/src/HAL/HAL_STM32F7/SanityCheck.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -24,8 +24,8 @@ * Test Re-ARM specific configuration values for errors at compile-time. */ #if ENABLED(SPINDLE_LASER_ENABLE) - #if !PIN_EXISTS(SPINDLE_LASER_ENABLE) - #error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENABLE_PIN." + #if !PIN_EXISTS(SPINDLE_LASER_ENA) + #error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENA_PIN." #elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR) #error "SPINDLE_DIR_PIN not defined." #elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM) @@ -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 e01a0b42eda9..33418bb98162 100644 --- a/Marlin/src/HAL/HAL_STM32F7/TMC2660.cpp +++ b/Marlin/src/HAL/HAL_STM32F7/TMC2660.cpp @@ -127,7 +127,7 @@ uint8_t current_scaling = 0; * dir_pin - the pin where the direction pin is connected * step_pin - the pin where the step pin is connected */ -TMC26XStepper::TMC26XStepper(int16_t number_of_steps, int16_t cs_pin, int16_t dir_pin, int16_t step_pin, uint16_t current, uint16_t resistor) { +TMC26XStepper::TMC26XStepper(const int16_t in_steps, int16_t cs_pin, int16_t dir_pin, int16_t step_pin, uint16_t current, uint16_t resistor) { // We are not started yet started = false; @@ -165,7 +165,7 @@ TMC26XStepper::TMC26XStepper(int16_t number_of_steps, int16_t cs_pin, int16_t di // Set a nice microstepping value setMicrosteps(DEFAULT_MICROSTEPPING_VALUE); // Save the number of steps - this->number_of_steps = number_of_steps; + number_of_steps = in_steps; } @@ -176,7 +176,7 @@ TMC26XStepper::TMC26XStepper(int16_t number_of_steps, int16_t cs_pin, int16_t di void TMC26XStepper::start() { #ifdef TMC_DEBUG1 - SERIAL_ECHOPGM("\n TMC26X stepper library \n"); + SERIAL_ECHOLNPGM("\n TMC26X stepper library"); SERIAL_ECHOPAIR("\n CS pin: ", cs_pin); SERIAL_ECHOPAIR("\n DIR pin: ", dir_pin); SERIAL_ECHOPAIR("\n STEP pin: ", step_pin); @@ -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; } @@ -389,52 +389,29 @@ char TMC26XStepper::getStallGuardFilter(void) { * any value in between will be mapped to the next smaller value * 0 and 1 set the motor in full step mode */ -void TMC26XStepper::setMicrosteps(int16_t number_of_steps) { - long setting_pattern; - //poor mans log - if (number_of_steps >= 256) { - setting_pattern = 0; - microsteps = 256; - } - else if (number_of_steps >= 128) { - setting_pattern = 1; - microsteps = 128; - } - else if (number_of_steps >= 64) { - setting_pattern = 2; - microsteps = 64; - } - else if (number_of_steps >= 32) { - setting_pattern = 3; - microsteps = 32; - } - else if (number_of_steps >= 16) { - setting_pattern = 4; - microsteps = 16; - } - else if (number_of_steps >= 8) { - setting_pattern = 5; - microsteps = 8; - } - else if (number_of_steps >= 4) { - setting_pattern = 6; - microsteps = 4; - } - else if (number_of_steps >= 2) { - setting_pattern = 7; - microsteps = 2; - //1 and 0 lead to full step - } - else if (number_of_steps <= 1) { - setting_pattern = 8; - microsteps = 1; - } +void TMC26XStepper::setMicrosteps(const int16_t in_steps) { + uint16_t setting_pattern; + + if (in_steps >= 256) setting_pattern = 0; + else if (in_steps >= 128) setting_pattern = 1; + else if (in_steps >= 64) setting_pattern = 2; + else if (in_steps >= 32) setting_pattern = 3; + else if (in_steps >= 16) setting_pattern = 4; + else if (in_steps >= 8) setting_pattern = 5; + else if (in_steps >= 4) setting_pattern = 6; + else if (in_steps >= 2) setting_pattern = 7; + else if (in_steps <= 1) setting_pattern = 8; // 1 and 0 lead to full step + + microsteps = _BV(8 - setting_pattern); + #ifdef TMC_DEBUG0 // crashes //SERIAL_PRINTF("Microstepping: "); SERIAL_ECHOPAIR("\n Microstepping: ", microsteps); #endif + // Delete the old value - this->driver_control_register_value &= 0xFFFF0UL; + this->driver_control_register_value &= 0x000FFFF0UL; + // Set the new value this->driver_control_register_value |= setting_pattern; @@ -853,8 +830,8 @@ void TMC26XStepper::debugLastStatus() { uint32_t readout_config = driver_configuration_register_value & READ_SELECTION_PATTERN; const int16_t value = getReadoutValue(); if (readout_config == READ_MICROSTEP_POSTION) { - //SERIAL_PRINTF("Microstep postion phase A: "); - SERIAL_ECHOPAIR("\n Microstep postion phase A: ", value); + //SERIAL_PRINTF("Microstep position phase A: "); + SERIAL_ECHOPAIR("\n Microstep position phase A: ", value); } else if (readout_config == READ_STALL_GUARD_READING) { //SERIAL_PRINTF("Stall Guard value:"); @@ -887,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; @@ -916,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/TMC2660.h b/Marlin/src/HAL/HAL_STM32F7/TMC2660.h index 9a26b32048fd..1b44a4d5f54f 100644 --- a/Marlin/src/HAL/HAL_STM32F7/TMC2660.h +++ b/Marlin/src/HAL/HAL_STM32F7/TMC2660.h @@ -76,81 +76,79 @@ * \class TMC26XStepper * \brief Class representing a TMC26X stepper driver * - * In order to use one fo those drivers in your Arduino code you have to create an object of that class: + * To use one of these drivers in your code create an object of its class: * \code - * TMC26XStepper stepper = TMC26XStepper(200,1,2,3,500); + * TMC26XStepper tmc_stepper = TMC26XStepper(200,1,2,3,500); * \endcode * see TMC26XStepper(int16_t number_of_steps, int16_t cs_pin, int16_t dir_pin, int16_t step_pin, uint16_t rms_current) * - * Keep in mind that you need to start the driver with start() in order to get the TMC26X configured. + * Keep in mind that you need to start the driver with start() in order to configure the TMC26X. * - * The most important function is the move(). It checks if the motor has to do a step or not. - * It is important that you call move() as often as possible in your Arduino loop() routine. I suggest - * to use a very fast loop routine and always call it at the beginning or the end. + * The most important function is move(). It checks if the motor requires a step. It's important to call move() as + * often as possible in loop(). I suggest using a very fast loop routine and always call move() at the beginning or end. * - * In order to move you have to provide a movement speed with setSpeed(). The speed is a positive value setting - * the rotations per minute. + * To move you must set a movement speed with setSpeed(). The speed is a positive value, setting the RPM. * * To really move the motor you have to call step() to tell the driver to move the motor the given number - * of steps in the given direction. Positive values move the motor in one direction, negative values in the other direction. + * of steps in the given direction. Positive values move the motor in one direction, negative values in the other. * - * You can check with isMoving() if the mototr is still moving or stop it apruptely with stop(). + * You can check with isMoving() if the motor is still moving or stop it abruptly with stop(). */ class TMC26XStepper { public: /*! - * \brief creates a new represenatation of a stepper motor connected to a TMC26X stepper driver + * \brief Create a new representation of a stepper motor connected to a TMC26X stepper driver * - * This is the main constructor. If in doubt use this. You must provide all parameters as described below. + * Main constructor. If in doubt use this. All parameters must be provided as described below. * - * \param number_of_steps the number of steps the motor has per rotation. - * \param cs_pin The Arduino pin you have connected the Cient Select Pin (!CS) of the TMC26X for SPI - * \param dir_pin the number of the Arduino pin the Direction input of the TMC26X is connected - * \param step_pin the number of the Arduino pin the step pin of the TMC26X driver is connected. - * \param rms_current the maximum current to privide to the motor in mA (!). A value of 200 would send up to 200mA to the motor - * \param resistor the current sense resistor in milli Ohm, defaults to ,15 Ohm ( or 150 milli Ohm) as in the TMC260 Arduino Shield + * \param number_of_steps Number of steps the motor has per rotation. + * \param cs_pin Arduino pin connected to the Client Select Pin (!CS) of the TMC26X for SPI. + * \param dir_pin Arduino pin connected to the DIR input of the TMC26X. + * \param step_pin Arduino pin connected to the STEP pin of the TMC26X. + * \param rms_current Maximum current to provide to the motor in mA (!). A value of 200 will send up to 200mA to the motor. + * \param resistor Current sense resistor in milli-Ohm, defaults to 0.15 Ohm (or 150 milli-Ohm) as in the TMC260 Arduino Shield. * - * Keep in mind that you must also call TMC26XStepper.start() in order to configure the stepper driver for use. + * You must also call TMC26XStepper.start() to configure the stepper driver for use. * - * By default the Constant Off Time chopper is used, see TMC26XStepper.setConstantOffTimeChopper() for details. - * This should work on most motors (YMMV). You may want to configure and use the Spread Cycle Chopper, see setSpreadCycleChopper(). + * By default the Constant Off Time chopper is used. See TMC26XStepper.setConstantOffTimeChopper() for details. + * This should work on most motors (YMMV). You may want to configure and use the Spread Cycle Chopper. See setSpreadCycleChopper(). * - * By default a microstepping of 1/32th is used to provide a smooth motor run, while still giving a good progression per step. - * You can select a different stepping with setMicrosteps() to aa different value. + * By default a microstepping of 1/32 is used to provide a smooth motor run while still giving a good progression per step. + * Change stepping by sending setMicrosteps() a different value. * \sa start(), setMicrosteps() */ - TMC26XStepper(int16_t number_of_steps, int16_t cs_pin, int16_t dir_pin, int16_t step_pin, uint16_t current, uint16_t resistor=100); //resistor=150 + TMC26XStepper(const int16_t in_steps, int16_t cs_pin, int16_t dir_pin, int16_t step_pin, uint16_t current, uint16_t resistor=100); //resistor=150 /*! - * \brief configures and starts the TMC26X stepper driver. Before you called this function the stepper driver is in nonfunctional mode. + * \brief Configure and start the TMC26X stepper driver. Before this is called the stepper driver is nonfunctional. * - * This routine configures the TMC26X stepper driver for the given values via SPI. - * Most member functions are non functional if the driver has not been started. - * Therefore it is best to call this in your Arduino setup() function. + * Configure the TMC26X stepper driver for the given values via SPI. + * Most member functions are non-functional if the driver has not been started, + * therefore it is best to call this in setup(). */ void start(); /*! - * \brief resets the stepper in unconfigured mode. + * \brief Reset the stepper in unconfigured mode. * - * This routine enables you to call start again. It does not change anything - * in the internal stepper configuration or the desired configuration. - * It just marks the stepper as not yet startet. You do not have to reconfigure - * the stepper to start it again, but it is not reset to any factory settings - * this has to be configured back by yourself. + * Allows start to be called again. It doesn't change the internal stepper + * configuration or the desired configuration. It just marks the stepper as + * not-yet-started. The stepper doesn't need to be reconfigured before + * starting again, and is not reset to any factory settings. + * It must be reset intentionally. * (Hint: Normally you do not need this function) */ void un_start(); /*! - * \brief Sets the rotation speed in revolutions per minute. - * \param whatSpeed the desired speed in rotations per minute. + * \brief Set the rotation speed in RPM. + * \param whatSpeed the desired speed in RPM. */ void setSpeed(uint16_t whatSpeed); /*! - * \brief reads out the currently selected speed in revolutions per minute. + * \brief Report the currently selected speed in RPM. * \sa setSpeed() */ uint16_t getSpeed(void); @@ -158,89 +156,86 @@ class TMC26XStepper { /*! * \brief Set the number of microsteps in 2^i values (rounded) up to 256 * - * This method set's the number of microsteps per step in 2^i interval. - * This means you can select 1, 2, 4, 16, 32, 64, 128 or 256 as valid microsteps. - * If you give any other value it will be rounded to the next smaller number (3 would give a microstepping of 2). + * This method sets the number of microsteps per step in 2^i interval. + * It accepts 1, 2, 4, 16, 32, 64, 128 or 256 as valid microsteps. + * Other values will be rounded down to the next smaller value (e.g., 3 gives a microstepping of 2). * You can always check the current microstepping with getMicrosteps(). */ - void setMicrosteps(int16_t number_of_steps); + void setMicrosteps(const int16_t in_steps); /*! - * \brief returns the effective current number of microsteps selected. + * \brief Return the effective current number of microsteps selected. * - * This function always returns the effective number of microsteps. - * This can be a bit different than the micro steps set in setMicrosteps() since it is rounded to 2^i. + * Always returns the effective number of microsteps. + * This may be different from the micro-steps set in setMicrosteps() since it is rounded to 2^i. * * \sa setMicrosteps() */ int16_t getMicrosteps(void); /*! - * \brief Initiate a movement for the given number of steps. Positive numbers move in one, negative numbers in the other direction. + * \brief Initiate a movement with the given number of steps. Positive values move in one direction, negative in the other. * * \param number_of_steps The number of steps to move the motor. * \return 0 if the motor was not moving and moves now. -1 if the motor is moving and the new steps could not be set. * - * If the previous movement is not finished yet the function will return -1 and not change the steps to move the motor. - * If the motor does not move it return 0 + * If the previous movement is incomplete the function returns -1 and doesn't change the steps to move the motor. + * If the motor does not move it returns 0. * - * The direction of the movement is indicated by the sign of the steps parameter. It is not determinable if positive values are right - * or left This depends on the internal construction of the motor and how you connected it to the stepper driver. + * The movement direction is determined by the sign of the steps parameter. The motor direction in machine space + * cannot be determined, as it depends on the construction of the motor and how it functions in the drive system. * - * You can always verify with isMoving() or even use stop() to stop the motor before giving it new step directions. + * For safety, verify with isMoving() or even use stop() to stop the motor before giving it new step directions. * \sa isMoving(), getStepsLeft(), stop() */ char step(int16_t number_of_steps); /*! - * \brief Central movement method, must be called as often as possible in the lopp function and is very fast. + * \brief Central movement method. Must be called as often as possible in the loop function and is very fast. * - * This routine checks if the motor still has to move, if the waiting delay has passed to send a new step command to the motor - * and manages the number of steps yet to move to fulfill the current move command. + * Check if the motor still has to move and whether the wait-to-step interval has expired, and manages the + * number of steps remaining to fulfill the current move command. * - * This function is implemented to be as fast as possible to call it as often as possible in your loop routine. - * The more regurlarly you call this function the better. In both senses of 'regularly': Calling it as often as - * possible is not a bad idea and if you even manage that the intervals you call this function are not too irregular helps too. + * This function is implemented to be as fast as possible, so call it as often as possible in your loop. + * It should be invoked with as frequently and with as much regularity as possible. * - * You can call this routine even if you know that the motor is not moving. It introduces just a very small penalty in your code. - * You must not call isMoving() to determine if you need to call this function, since taht is done internally already and only - * slows down you code. + * This can be called even when the motor is known not to be moving. It will simply return. * - * How often you call this function directly influences your top moving speed for the motor. It may be a good idea to call this - * from a timer overflow interrupt to ensure proper calling. + * The frequency with which this function is called determines the top stepping speed of the motor. + * It is recommended to call this using a hardware timer to ensure regular invocation. * \sa step() */ char move(void); /*! - * \brief checks if the motor still has to move to fulfill the last movement command. + * \brief Check whether the last movement command is done. * \return 0 if the motor stops, -1 if the motor is moving. * - * This method can be used to determine if the motor is ready for new movements. + * Used to determine if the motor is ready for new movements. *\sa step(), move() */ char isMoving(void); /*! * \brief Get the number of steps left in the current movement. - * \return The number of steps left in the movement. This number is always positive. + * \return The number of steps left in the movement. Always positive. */ uint16_t getStepsLeft(void); /*! - * \brief Stops the motor regardless if it moves or not. + * \brief Stop the motor immediately. * \return -1 if the motor was moving and is really stoped or 0 if it was not moving at all. * - * This method directly and apruptely stops the motor and may be used as an emergency stop. + * This method directly and abruptly stops the motor and may be used as an emergency stop. */ char stop(void); /*! - * \brief Sets and configure the classical Constant Off Timer Chopper - * \param constant_off_time The off time setting controls the minimum chopper frequency. For most applications an off time within the range of 5μs to 20μs will fit. Setting this parameter to zero completely disables all driver transistors and the motor can free-wheel. 0: chopper off, 1:15: off time setting (1 will work with minimum blank time of 24 clocks) - * \param blank_time Selects the comparator blank time. This time needs to safely cover the switching event and the duration of the ringing on the sense resistor. For most low current drivers, a setting of 1 or 2 is good. For high current applications with large MOSFETs, a setting of 2 or 3 will be required. 0 (min setting) … (3) amx setting + * \brief Set and configure the classical Constant Off Timer Chopper + * \param constant_off_time The off time setting controls the minimum chopper frequency. For most applications an off time within the range of 5μs to 20μs will fit. Setting this parameter to zero completely disables all driver transistors and the motor can free-wheel. 0: chopper off, 1:15: off time setting (1 will work with minimum blank time of 24 clocks) + * \param blank_time Comparator blank time. This duration needs to safely cover the duration of the switching event and the ringing on the sense resistor. For most low current drivers, a setting of 1 or 2 is good. For high current applications with large MOSFETs, a setting of 2 or 3 will be required. 0 (min setting) … (3) amx setting * \param fast_decay_time_setting Fast decay time setting. Controls the portion of fast decay for each chopper cycle. 0: slow decay only, 1…15: duration of fast decay phase - * \param sine_wave_offset Sine wave offset. Controls the sine wave offset. A positive offset corrects for zero crossing error. -3…-1: negative offset, 0: no offset,1…12: positive offset + * \param sine_wave_offset Sine wave offset. Controls the sine wave offset. A positive offset corrects for zero crossing error. -3…-1: negative offset, 0: no offset,1…12: positive offset * \param use_curreent_comparator Selects usage of the current comparator for termination of the fast decay cycle. If current comparator is enabled, it terminates the fast decay cycle in case the current reaches a higher negative value than the actual positive value. (0 disable, -1 enable). * * The classic constant off time chopper uses a fixed portion of fast decay following each on phase. diff --git a/Marlin/src/HAL/HAL_STM32F7/endstop_interrupts.h b/Marlin/src/HAL/HAL_STM32F7/endstop_interrupts.h index e4a243b43edf..23eca4bab7db 100644 --- a/Marlin/src/HAL/HAL_STM32F7/endstop_interrupts.h +++ b/Marlin/src/HAL/HAL_STM32F7/endstop_interrupts.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h b/Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h index 08f244c7917f..50b071ff303d 100644 --- a/Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h +++ b/Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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_STM32F7/persistent_store_eeprom.cpp b/Marlin/src/HAL/HAL_STM32F7/persistent_store_eeprom.cpp index 50bf09a9a386..4990213cfc54 100644 --- a/Marlin/src/HAL/HAL_STM32F7/persistent_store_eeprom.cpp +++ b/Marlin/src/HAL/HAL_STM32F7/persistent_store_eeprom.cpp @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com * Copyright (c) 2016 Victor Perez victor_pv@hotmail.com @@ -41,8 +41,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui if (v != eeprom_read_byte(p)) { eeprom_write_byte(p, v); if (eeprom_read_byte(p) != v) { - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM(MSG_ERR_EEPROM_WRITE); + SERIAL_ECHO_MSG(MSG_ERR_EEPROM_WRITE); return true; } } diff --git a/Marlin/src/HAL/HAL_STM32F7/spi_pins.h b/Marlin/src/HAL/HAL_STM32F7/spi_pins.h index 9301f4dd8c40..527325d6f4c7 100644 --- a/Marlin/src/HAL/HAL_STM32F7/spi_pins.h +++ b/Marlin/src/HAL/HAL_STM32F7/spi_pins.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/Marlin/src/HAL/HAL_STM32F7/watchdog_STM32F7.cpp b/Marlin/src/HAL/HAL_STM32F7/watchdog_STM32F7.cpp index 0b0031a2362d..659e4448f35f 100644 --- a/Marlin/src/HAL/HAL_STM32F7/watchdog_STM32F7.cpp +++ b/Marlin/src/HAL/HAL_STM32F7/watchdog_STM32F7.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_STM32F7/watchdog_STM32F7.h b/Marlin/src/HAL/HAL_STM32F7/watchdog_STM32F7.h index cff0cf469b63..4076c2b03a9f 100644 --- a/Marlin/src/HAL/HAL_STM32F7/watchdog_STM32F7.h +++ b/Marlin/src/HAL/HAL_STM32F7/watchdog_STM32F7.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_TEENSY31_32/HAL.cpp b/Marlin/src/HAL/HAL_TEENSY31_32/HAL.cpp index db757b17efdd..fa80cd5ba99b 100644 --- a/Marlin/src/HAL/HAL_TEENSY31_32/HAL.cpp +++ b/Marlin/src/HAL/HAL_TEENSY31_32/HAL.cpp @@ -1,22 +1,24 @@ -/* ************************************************************************** - - 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 . -****************************************************************************/ +/** + * 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 . + * + */ /** diff --git a/Marlin/src/HAL/HAL_TEENSY31_32/HAL.h b/Marlin/src/HAL/HAL_TEENSY31_32/HAL.h index ce40eb24e0ac..81b011b186d9 100644 --- a/Marlin/src/HAL/HAL_TEENSY31_32/HAL.h +++ b/Marlin/src/HAL/HAL_TEENSY31_32/HAL.h @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com * diff --git a/Marlin/src/HAL/HAL_TEENSY31_32/HAL_Servo_Teensy.h b/Marlin/src/HAL/HAL_TEENSY31_32/HAL_Servo_Teensy.h index c18d96ae12b7..687aaa39ec5d 100644 --- a/Marlin/src/HAL/HAL_TEENSY31_32/HAL_Servo_Teensy.h +++ b/Marlin/src/HAL/HAL_TEENSY31_32/HAL_Servo_Teensy.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_TEENSY31_32/HAL_spi_Teensy.cpp b/Marlin/src/HAL/HAL_TEENSY31_32/HAL_spi_Teensy.cpp index ab7176aee6da..331703dc55cc 100644 --- a/Marlin/src/HAL/HAL_TEENSY31_32/HAL_spi_Teensy.cpp +++ b/Marlin/src/HAL/HAL_TEENSY31_32/HAL_spi_Teensy.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_TEENSY31_32/HAL_timers_Teensy.cpp b/Marlin/src/HAL/HAL_TEENSY31_32/HAL_timers_Teensy.cpp index aff44d448615..fccba9e6ac57 100644 --- a/Marlin/src/HAL/HAL_TEENSY31_32/HAL_timers_Teensy.cpp +++ b/Marlin/src/HAL/HAL_TEENSY31_32/HAL_timers_Teensy.cpp @@ -1,22 +1,24 @@ -/* ************************************************************************** - - 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 . -****************************************************************************/ +/** + * 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 . + * + */ /** @@ -69,7 +71,7 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) { } void HAL_timer_enable_interrupt(const uint8_t timer_num) { - switch(timer_num) { + switch (timer_num) { case 0: NVIC_ENABLE_IRQ(IRQ_FTM0); break; case 1: NVIC_ENABLE_IRQ(IRQ_FTM1); break; } @@ -96,7 +98,7 @@ bool HAL_timer_interrupt_enabled(const uint8_t timer_num) { } void HAL_timer_isr_prologue(const uint8_t timer_num) { - switch(timer_num) { + switch (timer_num) { case 0: FTM0_CNT = 0x0000; FTM0_SC &= ~FTM_SC_TOF; // Clear FTM Overflow flag 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 7a50b04c2d41..79a854126ecd 100644 --- a/Marlin/src/HAL/HAL_TEENSY31_32/HAL_timers_Teensy.h +++ b/Marlin/src/HAL/HAL_TEENSY31_32/HAL_timers_Teensy.h @@ -1,7 +1,7 @@ /* ************************************************************************** Marlin 3D Printer Firmware - Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com @@ -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 777f3834a60d..9ecf5e35f525 100644 --- a/Marlin/src/HAL/HAL_TEENSY31_32/SanityCheck.h +++ b/Marlin/src/HAL/HAL_TEENSY31_32/SanityCheck.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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/endstop_interrupts.h b/Marlin/src/HAL/HAL_TEENSY31_32/endstop_interrupts.h index 353fd853f30d..ad0235179b1f 100644 --- a/Marlin/src/HAL/HAL_TEENSY31_32/endstop_interrupts.h +++ b/Marlin/src/HAL/HAL_TEENSY31_32/endstop_interrupts.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_TEENSY31_32/fastio_Teensy.h b/Marlin/src/HAL/HAL_TEENSY31_32/fastio_Teensy.h index 6dc5c14a987e..928cd758e74e 100644 --- a/Marlin/src/HAL/HAL_TEENSY31_32/fastio_Teensy.h +++ b/Marlin/src/HAL/HAL_TEENSY31_32/fastio_Teensy.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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_TEENSY31_32/persistent_store_impl.cpp b/Marlin/src/HAL/HAL_TEENSY31_32/persistent_store_impl.cpp index 71908bc1cd03..d746dc9730a5 100644 --- a/Marlin/src/HAL/HAL_TEENSY31_32/persistent_store_impl.cpp +++ b/Marlin/src/HAL/HAL_TEENSY31_32/persistent_store_impl.cpp @@ -21,8 +21,7 @@ bool write_data(int &pos, const uint8_t *value, uint16_t size, uint16_t *crc) { if (v != eeprom_read_byte(p)) { eeprom_write_byte(p, v); if (eeprom_read_byte(p) != v) { - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM(MSG_ERR_EEPROM_WRITE); + SERIAL_ECHO_MSG(MSG_ERR_EEPROM_WRITE); return true; } } diff --git a/Marlin/src/HAL/HAL_TEENSY31_32/spi_pins.h b/Marlin/src/HAL/HAL_TEENSY31_32/spi_pins.h index 6a468682e845..cfc9a2d14e60 100644 --- a/Marlin/src/HAL/HAL_TEENSY31_32/spi_pins.h +++ b/Marlin/src/HAL/HAL_TEENSY31_32/spi_pins.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_TEENSY31_32/watchdog_Teensy.cpp b/Marlin/src/HAL/HAL_TEENSY31_32/watchdog_Teensy.cpp index 47774b3ac2fe..07505140e84a 100644 --- a/Marlin/src/HAL/HAL_TEENSY31_32/watchdog_Teensy.cpp +++ b/Marlin/src/HAL/HAL_TEENSY31_32/watchdog_Teensy.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_TEENSY31_32/watchdog_Teensy.h b/Marlin/src/HAL/HAL_TEENSY31_32/watchdog_Teensy.h index 2b8ec00a1d4e..d0b7d030e90e 100644 --- a/Marlin/src/HAL/HAL_TEENSY31_32/watchdog_Teensy.h +++ b/Marlin/src/HAL/HAL_TEENSY31_32/watchdog_Teensy.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/HAL.cpp b/Marlin/src/HAL/HAL_TEENSY35_36/HAL.cpp index dba27279ae56..c4d6b3cf5496 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/HAL.cpp +++ b/Marlin/src/HAL/HAL_TEENSY35_36/HAL.cpp @@ -1,22 +1,24 @@ -/* ************************************************************************** - - 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 . -****************************************************************************/ +/** + * 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 . + * + */ /** * Description: HAL for Teensy35 (MK64FX512) diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/HAL.h b/Marlin/src/HAL/HAL_TEENSY35_36/HAL.h index 4cbf8bfec9a2..99fc31aff537 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/HAL.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/HAL.h @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com * @@ -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_Servo_Teensy.h b/Marlin/src/HAL/HAL_TEENSY35_36/HAL_Servo_Teensy.h index e53b5c679640..d02cdc9f7468 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/HAL_Servo_Teensy.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/HAL_Servo_Teensy.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.cpp b/Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.cpp index d31d9ddf671d..471d823da5c4 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.cpp +++ b/Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.cpp @@ -1,22 +1,24 @@ -/* ************************************************************************** - - 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 . -****************************************************************************/ +/** + * 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 . + * + */ /** @@ -70,7 +72,7 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) { } void HAL_timer_enable_interrupt(const uint8_t timer_num) { - switch(timer_num) { + switch (timer_num) { case 0: NVIC_ENABLE_IRQ(IRQ_FTM0); break; case 1: NVIC_ENABLE_IRQ(IRQ_FTM1); break; } @@ -97,7 +99,7 @@ bool HAL_timer_interrupt_enabled(const uint8_t timer_num) { } void HAL_timer_isr_prologue(const uint8_t timer_num) { - switch(timer_num) { + switch (timer_num) { case 0: FTM0_CNT = 0x0000; FTM0_SC &= ~FTM_SC_TOF; // Clear FTM Overflow flag 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 29b157c15667..fed256452a71 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com * @@ -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 c8a9ee9bdf15..597a3638dae8 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/SanityCheck.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/SanityCheck.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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/endstop_interrupts.h b/Marlin/src/HAL/HAL_TEENSY35_36/endstop_interrupts.h index 79a19fdbea3e..7327dc1a92ca 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/endstop_interrupts.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/endstop_interrupts.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/fastio_Teensy.h b/Marlin/src/HAL/HAL_TEENSY35_36/fastio_Teensy.h index 43a4c5a786bb..b9ddd957c141 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/fastio_Teensy.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/fastio_Teensy.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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/HAL_TEENSY35_36/persistent_store_eeprom.cpp b/Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_eeprom.cpp index 7a1fa0e44c3f..ad5ed361ae2b 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_eeprom.cpp +++ b/Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_eeprom.cpp @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com * Copyright (c) 2016 Victor Perez victor_pv@hotmail.com @@ -42,8 +42,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui if (v != eeprom_read_byte(p)) { eeprom_write_byte(p, v); if (eeprom_read_byte(p) != v) { - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM(MSG_ERR_EEPROM_WRITE); + SERIAL_ECHO_MSG(MSG_ERR_EEPROM_WRITE); return true; } } diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_impl.cpp b/Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_impl.cpp index c0c9dc268431..29b4653b3eac 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_impl.cpp +++ b/Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_impl.cpp @@ -21,8 +21,7 @@ bool write_data(int &pos, const uint8_t *value, uint16_t size, uint16_t *crc) { if (v != eeprom_read_byte(p)) { eeprom_write_byte(p, v); if (eeprom_read_byte(p) != v) { - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM(MSG_ERR_EEPROM_WRITE); + SERIAL_ECHO_MSG(MSG_ERR_EEPROM_WRITE); return true; } } diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/pinsDebug.h b/Marlin/src/HAL/HAL_TEENSY35_36/pinsDebug.h index 2d4182170099..cb472aff01eb 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/pinsDebug.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/pinsDebug.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -53,16 +53,16 @@ #define IS_ANALOG(P) ((P) >= analogInputToDigitalPin(0) && (P) <= analogInputToDigitalPin(9)) || ((P) >= analogInputToDigitalPin(12) && (P) <= analogInputToDigitalPin(20)) void HAL_print_analog_pin(char buffer[], int8_t pin) { - if (pin <= 23) sprintf(buffer, "(A%2d) ", int(pin - 14)); - else if (pin <= 39) sprintf(buffer, "(A%2d) ", int(pin - 19)); + if (pin <= 23) sprintf_P(buffer, PSTR("(A%2d) "), int(pin - 14)); + else if (pin <= 39) sprintf_P(buffer, PSTR("(A%2d) "), int(pin - 19)); } void HAL_analog_pin_state(char buffer[], int8_t pin) { - if (pin <= 23) sprintf(buffer, "Analog in =% 5d", analogRead(pin - 14)); - else if (pin <= 39) sprintf(buffer, "Analog in =% 5d", analogRead(pin - 19)); + if (pin <= 23) sprintf_P(buffer, PSTR("Analog in =% 5d"), analogRead(pin - 14)); + else if (pin <= 39) sprintf_P(buffer, PSTR("Analog in =% 5d"), analogRead(pin - 19)); } -#define PWM_PRINT(V) do{ sprintf(buffer, "PWM: %4d", 22); SERIAL_ECHO(buffer); }while(0) +#define PWM_PRINT(V) do{ sprintf_P(buffer, PSTR("PWM: %4d"), 22); SERIAL_ECHO(buffer); }while(0) #define FTM_CASE(N,Z) \ case FTM##N##_CH##Z##_PIN: \ if (FTM##N##_C##Z##V) { \ @@ -76,7 +76,7 @@ void HAL_analog_pin_state(char buffer[], int8_t pin) { */ bool HAL_pwm_status(int8_t pin) { char buffer[20]; // for the sprintf statements - switch(pin) { + switch (pin) { FTM_CASE(0,0); FTM_CASE(0,1); FTM_CASE(0,2); @@ -102,7 +102,7 @@ bool HAL_pwm_status(int8_t pin) { default: return false; } - SERIAL_PROTOCOLPGM(" "); + SERIAL_ECHOPGM(" "); } static void HAL_pwm_details(uint8_t pin) { /* TODO */ } diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/spi_pins.h b/Marlin/src/HAL/HAL_TEENSY35_36/spi_pins.h index fb4cbc140b07..152d6b4c2197 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/spi_pins.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/spi_pins.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/watchdog_Teensy.cpp b/Marlin/src/HAL/HAL_TEENSY35_36/watchdog_Teensy.cpp index 0c15824742c6..46605473a1d0 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/watchdog_Teensy.cpp +++ b/Marlin/src/HAL/HAL_TEENSY35_36/watchdog_Teensy.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/watchdog_Teensy.h b/Marlin/src/HAL/HAL_TEENSY35_36/watchdog_Teensy.h index 69c422e1600a..ba0916976ceb 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/watchdog_Teensy.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/watchdog_Teensy.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/platforms.h b/Marlin/src/HAL/platforms.h index c1e0e9f8e652..f5042b9fed03 100644 --- a/Marlin/src/HAL/platforms.h +++ b/Marlin/src/HAL/platforms.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -41,6 +41,8 @@ #define HAL_PLATFORM HAL_STM32 #elif defined(ARDUINO_ARCH_ESP32) #define HAL_PLATFORM HAL_ESP32 +#elif defined(__PLAT_LINUX__) + #define HAL_PLATFORM HAL_LINUX #else #error "Unsupported Platform!" #endif diff --git a/Marlin/src/HAL/shared/Delay.h b/Marlin/src/HAL/shared/Delay.h index 9e25cbd5115a..bab7d7471ea9 100644 --- a/Marlin/src/HAL/shared/Delay.h +++ b/Marlin/src/HAL/shared/Delay.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -158,6 +158,10 @@ } } +#elif defined(__PLAT_LINUX__) + + // specified inside platform + #else #error "Unsupported MCU architecture" diff --git a/Marlin/src/HAL/shared/HAL_SPI.h b/Marlin/src/HAL/shared/HAL_SPI.h index cc2304fc57c0..43dd2100767b 100644 --- a/Marlin/src/HAL/shared/HAL_SPI.h +++ b/Marlin/src/HAL/shared/HAL_SPI.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/shared/HAL_ST7920.h b/Marlin/src/HAL/shared/HAL_ST7920.h new file mode 100644 index 000000000000..9af1286c7a5d --- /dev/null +++ b/Marlin/src/HAL/shared/HAL_ST7920.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 . + * + */ +#pragma once + +/** + * HAL/HAL_ST7920.h + * For the HALs that provide direct access to the ST7920 display + * (bypassing U8G), it will allow the LIGHTWEIGHT_UI to operate. + */ + +#if HAS_GRAPHICAL_LCD && ENABLED(LIGHTWEIGHT_UI) + void ST7920_cs(); + void ST7920_ncs(); + void ST7920_set_cmd(); + void ST7920_set_dat(); + void ST7920_write_byte(const uint8_t data); +#endif \ No newline at end of file diff --git a/Marlin/src/HAL/shared/HAL_spi_L6470.cpp b/Marlin/src/HAL/shared/HAL_spi_L6470.cpp new file mode 100644 index 000000000000..ecd808fe46ee --- /dev/null +++ b/Marlin/src/HAL/shared/HAL_spi_L6470.cpp @@ -0,0 +1,128 @@ +/** + * 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 . + * + */ + +/** + * Software L6470 SPI functions originally from Arduino Sd2Card Library + * Copyright (C) 2009 by William Greiman + */ + +#include "../../inc/MarlinConfig.h" + +#if HAS_DRIVER(L6470) + +#include "Delay.h" + +#include "../../core/serial.h" +#include "../../libs/L6470/L6470_Marlin.h" + +// Make sure GCC optimizes this file. +// Note that this line triggers a bug in GCC which is fixed by casting. +// See the note below. +#pragma GCC optimize (3) + +// run at ~4Mhz +uint8_t L6470_SpiTransfer_Mode_0(uint8_t b) { // using Mode 0 + for (uint8_t bits = 8; bits--;) { + WRITE(L6470_CHAIN_MOSI_PIN, b & 0x80); + b <<= 1; // little setup time + + WRITE(L6470_CHAIN_SCK_PIN, HIGH); + DELAY_NS(125); // 10 cycles @ 84mhz + + b |= (READ(L6470_CHAIN_MISO_PIN) != 0); + + WRITE(L6470_CHAIN_SCK_PIN, LOW); + DELAY_NS(125); // 10 cycles @ 84mhz + } + return b; +} + +uint8_t L6470_SpiTransfer_Mode_3(uint8_t b) { // using Mode 3 + for (uint8_t bits = 8; bits--;) { + WRITE(L6470_CHAIN_SCK_PIN, LOW); + WRITE(L6470_CHAIN_MOSI_PIN, b & 0x80); + + DELAY_NS(125); // 10 cycles @ 84mhz + + WRITE(L6470_CHAIN_SCK_PIN, HIGH); + + b <<= 1; // little setup time + b |= (READ(L6470_CHAIN_MISO_PIN) != 0); + } + + DELAY_NS(125); // 10 cycles @ 84mhz + return b; +} + +/** + * The following are weak-linked and defined as do-nothing + * functions by the L6470-Arduino library. They must be + * defined by the client (Marlin) to provide an SPI interface. + */ + +uint8_t L6470_transfer(uint8_t data, int16_t ss_pin, const uint8_t chain_position) { + uint8_t data_out = 0; + + // first device in chain has data sent last + 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) + uint8_t temp = L6470_SpiTransfer_Mode_3(uint8_t(i == chain_position ? data : dSPIN_NOP)); + ENABLE_ISRS(); // enable interrupts + if (i == chain_position) data_out = temp; + } + + extDigitalWrite(ss_pin, HIGH); + return data_out; +} + +void L6470_transfer(uint8_t L6470_buf[], const uint8_t length) { + // first device in chain has data sent last + + if (spi_active) { // interrupted SPI transfer so need to + WRITE(L6470_CHAIN_SS_PIN, HIGH); // guarantee min high of 650nS + DELAY_US(1); + } + + WRITE(L6470_CHAIN_SS_PIN, LOW); + for (uint8_t i = length; i >= 1; i--) + L6470_SpiTransfer_Mode_3(uint8_t(L6470_buf[i])); + WRITE(L6470_CHAIN_SS_PIN, HIGH); +} + +void L6470_spi_init() { + OUT_WRITE(L6470_CHAIN_SS_PIN, HIGH); + OUT_WRITE(L6470_CHAIN_SCK_PIN, HIGH); + OUT_WRITE(L6470_CHAIN_MOSI_PIN, HIGH); + SET_INPUT(L6470_CHAIN_MISO_PIN); + + #if PIN_EXISTS(L6470_BUSY) + SET_INPUT(L6470_BUSY_PIN); + #endif + + OUT_WRITE(L6470_CHAIN_MOSI_PIN, HIGH); +} + +#pragma GCC reset_options + +#endif // HAS_DRIVER(L6470) diff --git a/Marlin/src/HAL/shared/I2cEeprom.cpp b/Marlin/src/HAL/shared/I2cEeprom.cpp index 02a201c9ef4a..ef2ff8222fee 100644 --- a/Marlin/src/HAL/shared/I2cEeprom.cpp +++ b/Marlin/src/HAL/shared/I2cEeprom.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -87,7 +87,7 @@ void eeprom_write_byte(uint8_t *pos, unsigned char value) { eeprom_init(); - Wire.beginTransmission(eeprom_device_address); + Wire.beginTransmission(I2C_ADDRESS(eeprom_device_address)); Wire.write((int)(eeprom_address >> 8)); // MSB Wire.write((int)(eeprom_address & 0xFF)); // LSB Wire.write(value); @@ -103,7 +103,7 @@ void eeprom_write_byte(uint8_t *pos, unsigned char value) { void eeprom_update_block(const void *pos, void* eeprom_address, size_t n) { eeprom_init(); - Wire.beginTransmission(eeprom_device_address); + Wire.beginTransmission(I2C_ADDRESS(eeprom_device_address)); Wire.write((int)((unsigned)eeprom_address >> 8)); // MSB Wire.write((int)((unsigned)eeprom_address & 0xFF)); // LSB Wire.endTransmission(); @@ -115,7 +115,7 @@ void eeprom_update_block(const void *pos, void* eeprom_address, size_t n) { flag |= Wire.read() ^ ptr[c]; if (flag) { - Wire.beginTransmission(eeprom_device_address); + Wire.beginTransmission(I2C_ADDRESS(eeprom_device_address)); Wire.write((int)((unsigned)eeprom_address >> 8)); // MSB Wire.write((int)((unsigned)eeprom_address & 0xFF)); // LSB Wire.write((uint8_t*)pos, n); @@ -133,7 +133,7 @@ uint8_t eeprom_read_byte(uint8_t *pos) { eeprom_init(); - Wire.beginTransmission(eeprom_device_address); + Wire.beginTransmission(I2C_ADDRESS(eeprom_device_address)); Wire.write((int)(eeprom_address >> 8)); // MSB Wire.write((int)(eeprom_address & 0xFF)); // LSB Wire.endTransmission(); @@ -145,7 +145,7 @@ uint8_t eeprom_read_byte(uint8_t *pos) { void eeprom_read_block(void* pos, const void* eeprom_address, size_t n) { eeprom_init(); - Wire.beginTransmission(eeprom_device_address); + Wire.beginTransmission(I2C_ADDRESS(eeprom_device_address)); Wire.write((int)((unsigned)eeprom_address >> 8)); // MSB Wire.write((int)((unsigned)eeprom_address & 0xFF)); // LSB Wire.endTransmission(); diff --git a/Marlin/src/HAL/shared/MarlinSerial.h b/Marlin/src/HAL/shared/MarlinSerial.h index 10d55e92db41..89c501af479e 100644 --- a/Marlin/src/HAL/shared/MarlinSerial.h +++ b/Marlin/src/HAL/shared/MarlinSerial.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/shared/SpiEeprom.cpp b/Marlin/src/HAL/shared/SpiEeprom.cpp index d63f52fb3885..525c8c0a7dbd 100644 --- a/Marlin/src/HAL/shared/SpiEeprom.cpp +++ b/Marlin/src/HAL/shared/SpiEeprom.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/shared/backtrace/backtrace.cpp b/Marlin/src/HAL/shared/backtrace/backtrace.cpp index 95f1fc0b0fc0..ba1b2326e9a7 100644 --- a/Marlin/src/HAL/shared/backtrace/backtrace.cpp +++ b/Marlin/src/HAL/shared/backtrace/backtrace.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -88,8 +88,7 @@ void backtrace(void) { btf.pc = pc | 1; // Force Thumb, as CORTEX only support it // Perform a backtrace - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM("Backtrace:"); + SERIAL_ERROR_MSG("Backtrace:"); int ctr = 0; UnwindStart(&btf, &UnwCallbacks, &ctr); } diff --git a/Marlin/src/HAL/shared/backtrace/backtrace.h b/Marlin/src/HAL/shared/backtrace/backtrace.h index 37a567189c24..5e00bec94fd9 100644 --- a/Marlin/src/HAL/shared/backtrace/backtrace.h +++ b/Marlin/src/HAL/shared/backtrace/backtrace.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/shared/backtrace/unwarm.h b/Marlin/src/HAL/shared/backtrace/unwarm.h index 9594ed95d79e..3128e354cc72 100644 --- a/Marlin/src/HAL/shared/backtrace/unwarm.h +++ b/Marlin/src/HAL/shared/backtrace/unwarm.h @@ -103,7 +103,7 @@ typedef struct { * Macros **************************************************************************/ -#define M_IsOriginValid(v) (((v) & 0x7F) ? true : false) +#define M_IsOriginValid(v) !!((v) & 0x7F) #define M_Origin2Str(v) ((v) ? "VALID" : "INVALID") #ifdef UNW_DEBUG diff --git a/Marlin/src/HAL/shared/backtrace/unwarm_arm.cpp b/Marlin/src/HAL/shared/backtrace/unwarm_arm.cpp index be43b22392f4..3c9c5aaeec76 100644 --- a/Marlin/src/HAL/shared/backtrace/unwarm_arm.cpp +++ b/Marlin/src/HAL/shared/backtrace/unwarm_arm.cpp @@ -32,23 +32,17 @@ * \retval false This is not a data-processing instruction, */ static bool isDataProc(uint32_t instr) { - uint8_t opcode = (instr & 0x01E00000) >> 21; - bool S = (instr & 0x00100000) ? true : false; - - if ((instr & 0xFC000000) != 0xE0000000) { - return false; - } - else if (!S && opcode >= 8 && opcode <= 11) { - /* TST, TEQ, CMP and CMN all require S to be set */ - return false; - } - else - return true; + if ((instr & 0xFC000000) != 0xE0000000) return false; + + /* TST, TEQ, CMP and CMN all require S to be set */ + bool S = !!(instr & 0x00100000); + if (!S && opcode >= 8 && opcode <= 11) return false; + + return true; } UnwResult UnwStartArm(UnwState * const state) { - bool found = false; uint16_t t = UNW_MAX_INSTR_COUNT; @@ -56,9 +50,8 @@ UnwResult UnwStartArm(UnwState * const state) { uint32_t instr; /* Attempt to read the instruction */ - if (!state->cb->readW(state->regData[15].v, &instr)) { + if (!state->cb->readW(state->regData[15].v, &instr)) return UNWIND_IREAD_W_FAIL; - } UnwPrintd4("A %x %x %08x:", state->regData[13].v, state->regData[15].v, instr); @@ -103,31 +96,20 @@ UnwResult UnwStartArm(UnwState * const state) { } /* Determine the return mode */ - if (state->regData[rn].v & 0x1) { - - /* Branching to THUMB */ + if (state->regData[rn].v & 0x1) /* Branching to THUMB */ return UnwStartThumb(state); - } - else { - - /* Branch to ARM */ - /* Account for the auto-increment which isn't needed */ - state->regData[15].v -= 4; - } + /* Branch to ARM */ + /* Account for the auto-increment which isn't needed */ + state->regData[15].v -= 4; } /* Branch */ else if ((instr & 0xFF000000) == 0xEA000000) { - int32_t offset = (instr & 0x00FFFFFF); - - /* Shift value */ - offset = offset << 2; + int32_t offset = (instr & 0x00FFFFFF) << 2; /* Sign extend if needed */ - if (offset & 0x02000000) { - offset |= 0xFC000000; - } + if (offset & 0x02000000) offset |= 0xFC000000; UnwPrintd2("B %d\n", offset); @@ -142,11 +124,12 @@ UnwResult UnwStartArm(UnwState * const state) { /* MRS */ else if ((instr & 0xFFBF0FFF) == 0xE10F0000) { -#ifdef UNW_DEBUG - bool R = (instr & 0x00400000) ? true : false; -#endif + #ifdef UNW_DEBUG + const bool R = !!(instr & 0x00400000); + #else + constexpr bool R = false; + #endif uint8_t rd = (instr & 0x0000F000) >> 12; - UnwPrintd4("MRS r%d,%s\t; r%d invalidated", rd, R ? "SPSR" : "CPSR", rd); /* Status registers untracked */ @@ -154,11 +137,10 @@ UnwResult UnwStartArm(UnwState * const state) { } /* MSR */ else if ((instr & 0xFFB0F000) == 0xE120F000) { -#ifdef UNW_DEBUG - bool R = (instr & 0x00400000) ? true : false; + #ifdef UNW_DEBUG + UnwPrintd2("MSR %s_?, ???", (instr & 0x00400000) ? "SPSR" : "CPSR"); + #endif - UnwPrintd2("MSR %s_?, ???", R ? "SPSR" : "CPSR"); -#endif /* Status registers untracked. * Potentially this could change processor mode and switch * banked registers r8-r14. Most likely is that r13 (sp) will @@ -170,18 +152,18 @@ UnwResult UnwStartArm(UnwState * const state) { } /* Data processing */ else if (isDataProc(instr)) { - bool I = (instr & 0x02000000) ? true : false; + bool I = !!(instr & 0x02000000); uint8_t opcode = (instr & 0x01E00000) >> 21; -#ifdef UNW_DEBUG - bool S = (instr & 0x00100000) ? true : false; -#endif + #ifdef UNW_DEBUG + bool S = !!(instr & 0x00100000); + #endif uint8_t rn = (instr & 0x000F0000) >> 16; uint8_t rd = (instr & 0x0000F000) >> 12; uint16_t operand2 = (instr & 0x00000FFF); uint32_t op2val; int op2origin; - switch(opcode) { + switch (opcode) { case 0: UnwPrintd4("AND%s r%d,r%d,", S ? "S" : "", rd, rn); break; case 1: UnwPrintd4("EOR%s r%d,r%d,", S ? "S" : "", rd, rn); break; case 2: UnwPrintd4("SUB%s r%d,r%d,", S ? "S" : "", rd, rn); break; @@ -217,26 +199,23 @@ UnwResult UnwStartArm(UnwState * const state) { /* Register and shift */ uint8_t rm = (operand2 & 0x000F); - uint8_t regShift = (operand2 & 0x0010) ? true : false; + uint8_t regShift = !!(operand2 & 0x0010); uint8_t shiftType = (operand2 & 0x0060) >> 5; uint32_t shiftDist; -#ifdef UNW_DEBUG - const char * const shiftMnu[4] = { "LSL", "LSR", "ASR", "ROR" }; -#endif + #ifdef UNW_DEBUG + const char * const shiftMnu[4] = { "LSL", "LSR", "ASR", "ROR" }; + #endif UnwPrintd2("r%d ", rm); /* Get the shift distance */ if (regShift) { - uint8_t rs = (operand2 & 0x0F00) >> 8; if (operand2 & 0x00800) { - UnwPrintd1("\nError: Bit should be zero\n"); return UNWIND_ILLEGAL_INSTR; } else if (rs == 15) { - UnwPrintd1("\nError: Cannot use R15 with register shift\n"); return UNWIND_ILLEGAL_INSTR; } @@ -250,46 +229,33 @@ UnwResult UnwStartArm(UnwState * const state) { else { shiftDist = (operand2 & 0x0F80) >> 7; op2origin = REG_VAL_FROM_CONST; - - if (shiftDist) { - UnwPrintd3("%s #%d", shiftMnu[shiftType], shiftDist); - } + if (shiftDist) UnwPrintd3("%s #%d", shiftMnu[shiftType], shiftDist); UnwPrintd3("\t; r%d %s", rm, M_Origin2Str(state->regData[rm].o)); } /* Apply the shift type to the source register */ - switch(shiftType) { + switch (shiftType) { case 0: /* logical left */ op2val = state->regData[rm].v << shiftDist; break; case 1: /* logical right */ - if (!regShift && shiftDist == 0) { - shiftDist = 32; - } - + if (!regShift && shiftDist == 0) shiftDist = 32; op2val = state->regData[rm].v >> shiftDist; break; case 2: /* arithmetic right */ - if (!regShift && shiftDist == 0) { - shiftDist = 32; - } + if (!regShift && shiftDist == 0) shiftDist = 32; if (state->regData[rm].v & 0x80000000) { - /* Register shifts maybe greater than 32 */ - if (shiftDist >= 32) { + if (shiftDist >= 32) op2val = 0xFFFFFFFF; - } - else { - op2val = state->regData[rm].v >> shiftDist; - op2val |= 0xFFFFFFFF << (32 - shiftDist); - } + else + op2val = (state->regData[rm].v >> shiftDist) | (0xFFFFFFFF << (32 - shiftDist)); } - else { + else op2val = state->regData[rm].v >> shiftDist; - } break; case 3: /* rotate right */ @@ -317,19 +283,14 @@ UnwResult UnwStartArm(UnwState * const state) { } /* Decide the data origin */ - if (M_IsOriginValid(op2origin) && - M_IsOriginValid(state->regData[rm].o)) { - - op2origin = state->regData[rm].o; - op2origin |= REG_VAL_ARITHMETIC; - } - else { + if (M_IsOriginValid(op2origin) && M_IsOriginValid(state->regData[rm].o)) + op2origin = REG_VAL_ARITHMETIC | state->regData[rm].o; + else op2origin = REG_VAL_INVALID; - } } /* Propagate register validity */ - switch(opcode) { + switch (opcode) { case 0: /* AND: Rd := Op1 AND Op2 */ case 1: /* EOR: Rd := Op1 EOR Op2 */ case 2: /* SUB: Rd:= Op1 - Op2 */ @@ -374,14 +335,11 @@ UnwResult UnwStartArm(UnwState * const state) { * to specify the shift amount the PC will be 12 bytes * ahead. */ - if (!I && (operand2 & 0x0010)) - state->regData[rn].v += 12; - else - state->regData[rn].v += 8; + state->regData[rn].v += ((!I && (operand2 & 0x0010)) ? 12 : 8); } /* Compute values */ - switch(opcode) { + switch (opcode) { case 0: /* AND: Rd := Op1 AND Op2 */ state->regData[rd].v = state->regData[rn].v & op2val; break; @@ -429,12 +387,8 @@ UnwResult UnwStartArm(UnwState * const state) { } /* Remove the prefetch offset from the PC */ - if (rd != 15 && rn == 15) { - if (!I && (operand2 & 0x0010)) - state->regData[rn].v -= 12; - else - state->regData[rn].v -= 8; - } + if (rd != 15 && rn == 15) + state->regData[rn].v -= ((!I && (operand2 & 0x0010)) ? 12 : 8); } /* Block Data Transfer @@ -442,26 +396,25 @@ UnwResult UnwStartArm(UnwState * const state) { */ else if ((instr & 0xFE000000) == 0xE8000000) { - bool P = (instr & 0x01000000) ? true : false; - bool U = (instr & 0x00800000) ? true : false; - bool S = (instr & 0x00400000) ? true : false; - bool W = (instr & 0x00200000) ? true : false; - bool L = (instr & 0x00100000) ? true : false; + bool P = !!(instr & 0x01000000), + U = !!(instr & 0x00800000), + S = !!(instr & 0x00400000), + W = !!(instr & 0x00200000), + L = !!(instr & 0x00100000); uint16_t baseReg = (instr & 0x000F0000) >> 16; uint16_t regList = (instr & 0x0000FFFF); uint32_t addr = state->regData[baseReg].v; bool addrValid = M_IsOriginValid(state->regData[baseReg].o); int8_t r; -#ifdef UNW_DEBUG - /* Display the instruction */ - if (L) { - UnwPrintd6("LDM%c%c r%d%s, {reglist}%s\n", P ? 'E' : 'F', U ? 'D' : 'A', baseReg, W ? "!" : "", S ? "^" : ""); - } - else { - UnwPrintd6("STM%c%c r%d%s, {reglist}%s\n", !P ? 'E' : 'F', !U ? 'D' : 'A', baseReg, W ? "!" : "", S ? "^" : ""); - } -#endif + #ifdef UNW_DEBUG + /* Display the instruction */ + if (L) + UnwPrintd6("LDM%c%c r%d%s, {reglist}%s\n", P ? 'E' : 'F', U ? 'D' : 'A', baseReg, W ? "!" : "", S ? "^" : ""); + else + UnwPrintd6("STM%c%c r%d%s, {reglist}%s\n", !P ? 'E' : 'F', !U ? 'D' : 'A', baseReg, W ? "!" : "", S ? "^" : ""); + #endif + /* S indicates that banked registers (untracked) are used, unless * this is a load including the PC when the S-bit indicates that * that CPSR is loaded from SPSR (also untracked, but ignored). @@ -489,44 +442,35 @@ UnwResult UnwStartArm(UnwState * const state) { /* Check if the register is to be transferred */ if (regList & (0x01 << r)) { - if (P) - addr += U ? 4 : -4; + if (P) addr += U ? 4 : -4; if (L) { if (addrValid) { - if (!UnwMemReadRegister(state, addr, &state->regData[r])) { + if (!UnwMemReadRegister(state, addr, &state->regData[r])) return UNWIND_DREAD_W_FAIL; - } /* Update the origin if read via the stack pointer */ - if (M_IsOriginValid(state->regData[r].o) && baseReg == 13) { + if (M_IsOriginValid(state->regData[r].o) && baseReg == 13) state->regData[r].o = REG_VAL_FROM_STACK; - } UnwPrintd5(" R%d = 0x%08x\t; r%d %s\n",r,state->regData[r].v,r, M_Origin2Str(state->regData[r].o)); } else { - /* Invalidate the register as the base reg was invalid */ state->regData[r].o = REG_VAL_INVALID; - UnwPrintd2(" R%d = ???\n", r); } } else { - if (addrValid) { - if (!UnwMemWriteRegister(state, state->regData[13].v, &state->regData[r])) { - return UNWIND_DWRITE_W_FAIL; - } - } + if (addrValid && !UnwMemWriteRegister(state, state->regData[13].v, &state->regData[r])) + return UNWIND_DWRITE_W_FAIL; UnwPrintd2(" R%d = 0x%08x\n", r); } - if (!P) - addr += U ? 4 : -4; + if (!P) addr += U ? 4 : -4; } /* Check the next register */ @@ -535,8 +479,7 @@ UnwResult UnwStartArm(UnwState * const state) { } while (r >= 0 && r <= 15); /* Check the writeback bit */ - if (W) - state->regData[baseReg].v = addr; + if (W) state->regData[baseReg].v = addr; /* Check if the PC was loaded */ if (L && (regList & (0x01 << 15))) { @@ -547,9 +490,8 @@ UnwResult UnwStartArm(UnwState * const state) { } else { /* Store the return address */ - if (!UnwReportRetAddr(state, state->regData[15].v)) { + if (!UnwReportRetAddr(state, state->regData[15].v)) return UNWIND_TRUNCATED; - } UnwPrintd2(" Return PC=0x%x", state->regData[15].v); @@ -585,9 +527,7 @@ UnwResult UnwStartArm(UnwState * const state) { /* Garbage collect the memory hash (used only for the stack) */ UnwMemHashGC(state); - t--; - if (t == 0) - return UNWIND_EXHAUSTED; + if (--t == 0) return UNWIND_EXHAUSTED; } while (!found); diff --git a/Marlin/src/HAL/shared/backtrace/unwarm_thumb.cpp b/Marlin/src/HAL/shared/backtrace/unwarm_thumb.cpp index 29efb1309668..d5449f863e08 100644 --- a/Marlin/src/HAL/shared/backtrace/unwarm_thumb.cpp +++ b/Marlin/src/HAL/shared/backtrace/unwarm_thumb.cpp @@ -25,17 +25,11 @@ * \param value The value to sign extend. * \return The signed-11 bit value stored in a 16bit data type. */ -static int32_t signExtend11(uint16_t value) { - - if(value & 0x400) { - value |= 0xFFFFF800; - } - - return value; +static int32_t signExtend11(const uint16_t value) { + return (value & 0x400) ? value | 0xFFFFF800 : value; } UnwResult UnwStartThumb(UnwState * const state) { - bool found = false; uint16_t t = UNW_MAX_INSTR_COUNT; uint32_t lastJumpAddr = 0; // Last JUMP address, to try to detect infinite loops @@ -45,20 +39,19 @@ UnwResult UnwStartThumb(UnwState * const state) { uint16_t instr; /* Attempt to read the instruction */ - if(!state->cb->readH(state->regData[15].v & (~0x1), &instr)) { + if (!state->cb->readH(state->regData[15].v & (~0x1), &instr)) return UNWIND_IREAD_H_FAIL; - } UnwPrintd4("T %x %x %04x:", state->regData[13].v, state->regData[15].v, instr); /* Check that the PC is still on Thumb alignment */ - if(!(state->regData[15].v & 0x1)) { + if (!(state->regData[15].v & 0x1)) { UnwPrintd1("\nError: PC misalignment\n"); return UNWIND_INCONSISTENT; } /* Check that the SP and PC have not been invalidated */ - if(!M_IsOriginValid(state->regData[13].o) || !M_IsOriginValid(state->regData[15].o)) { + if (!M_IsOriginValid(state->regData[13].o) || !M_IsOriginValid(state->regData[15].o)) { UnwPrintd1("\nError: PC or SP invalidated\n"); return UNWIND_INCONSISTENT; } @@ -73,9 +66,8 @@ UnwResult UnwStartThumb(UnwState * const state) { state->regData[15].v += 2; /* Attempt to read the 2nd part of the instruction */ - if(!state->cb->readH(state->regData[15].v & (~0x1), &instr2)) { + if (!state->cb->readH(state->regData[15].v & (~0x1), &instr2)) return UNWIND_IREAD_H_FAIL; - } UnwPrintd3(" %x %04x:", state->regData[15].v, instr2); @@ -84,26 +76,25 @@ UnwResult UnwStartThumb(UnwState * const state) { * PUSH and POP */ if ((instr & 0xFE6F) == 0xE82D) { - bool L = (instr & 0x10) ? true : false; + bool L = !!(instr & 0x10); uint16_t rList = instr2; - if(L) { + if (L) { uint8_t r; /* Load from memory: POP */ UnwPrintd1("POP {Rlist}\n"); /* Load registers from stack */ - for(r = 0; r < 16; r++) { - if(rList & (0x1 << r)) { + for (r = 0; r < 16; r++) { + if (rList & (0x1 << r)) { /* Read the word */ - if(!UnwMemReadRegister(state, state->regData[13].v, &state->regData[r])) { + if (!UnwMemReadRegister(state, state->regData[13].v, &state->regData[r])) return UNWIND_DREAD_W_FAIL; - } /* Alter the origin to be from the stack if it was valid */ - if(M_IsOriginValid(state->regData[r].o)) { + if (M_IsOriginValid(state->regData[r].o)) { state->regData[r].o = REG_VAL_FROM_STACK; @@ -114,7 +105,7 @@ UnwResult UnwStartThumb(UnwState * const state) { * the caller was from Thumb. This would allow return * by BX for interworking APCS. */ - if((state->regData[15].v & 0x1) == 0) { + if ((state->regData[15].v & 0x1) == 0) { UnwPrintd2("Warning: Return address not to Thumb: 0x%08x\n", state->regData[15].v); /* Pop into the PC will not switch mode */ @@ -122,9 +113,8 @@ UnwResult UnwStartThumb(UnwState * const state) { } /* Store the return address */ - if(!UnwReportRetAddr(state, state->regData[15].v)) { + if (!UnwReportRetAddr(state, state->regData[15].v)) return UNWIND_TRUNCATED; - } /* Now have the return address */ UnwPrintd2(" Return PC=%x\n", state->regData[15].v); @@ -155,15 +145,14 @@ UnwResult UnwStartThumb(UnwState * const state) { /* Store to memory: PUSH */ UnwPrintd1("PUSH {Rlist}"); - for(r = 15; r >= 0; r--) { - if(rList & (0x1 << r)) { + for (r = 15; r >= 0; r--) { + if (rList & (0x1 << r)) { UnwPrintd4("\n r%d = 0x%08x\t; %s", r, state->regData[r].v, M_Origin2Str(state->regData[r].o)); state->regData[13].v -= 4; - if(!UnwMemWriteRegister(state, state->regData[13].v, &state->regData[r])) { + if (!UnwMemWriteRegister(state, state->regData[13].v, &state->regData[r])) return UNWIND_DWRITE_W_FAIL; - } } } } @@ -180,9 +169,8 @@ UnwResult UnwStartThumb(UnwState * const state) { state->regData[13].v -= 4; - if(!UnwMemWriteRegister(state, state->regData[13].v, &state->regData[r])) { + if (!UnwMemWriteRegister(state, state->regData[13].v, &state->regData[r])) return UNWIND_DWRITE_W_FAIL; - } } /* * POP register @@ -194,12 +182,11 @@ UnwResult UnwStartThumb(UnwState * const state) { UnwPrintd2("POP {R%d}\n", r); /* Read the word */ - if(!UnwMemReadRegister(state, state->regData[13].v, &state->regData[r])) { + if (!UnwMemReadRegister(state, state->regData[13].v, &state->regData[r])) return UNWIND_DREAD_W_FAIL; - } /* Alter the origin to be from the stack if it was valid */ - if(M_IsOriginValid(state->regData[r].o)) { + if (M_IsOriginValid(state->regData[r].o)) { state->regData[r].o = REG_VAL_FROM_STACK; @@ -210,7 +197,7 @@ UnwResult UnwStartThumb(UnwState * const state) { * the caller was from Thumb. This would allow return * by BX for interworking APCS. */ - if((state->regData[15].v & 0x1) == 0) { + if ((state->regData[15].v & 0x1) == 0) { UnwPrintd2("Warning: Return address not to Thumb: 0x%08x\n", state->regData[15].v); /* Pop into the PC will not switch mode */ @@ -218,9 +205,8 @@ UnwResult UnwStartThumb(UnwState * const state) { } /* Store the return address */ - if(!UnwReportRetAddr(state, state->regData[15].v)) { + if (!UnwReportRetAddr(state, state->regData[15].v)) return UNWIND_TRUNCATED; - } /* Now have the return address */ UnwPrintd2(" Return PC=%x\n", state->regData[15].v); @@ -255,7 +241,7 @@ UnwResult UnwStartThumb(UnwState * const state) { * the switch clauses */ uint8_t rn = instr & 0xF; - bool H = (instr2 & 0x10) ? true : false; + bool H = !!(instr2 & 0x10); UnwPrintd5("TB%c [r%d,r%d%s]\n", H ? 'H' : 'B', rn, (instr2 & 0xF), H ? ",LSL #1" : ""); @@ -263,15 +249,14 @@ UnwResult UnwStartThumb(UnwState * const state) { if (rn == 15) { if (H) { uint16_t rv; - if(!state->cb->readH((state->regData[15].v & (~1)) + 2, &rv)) { + if (!state->cb->readH((state->regData[15].v & (~1)) + 2, &rv)) return UNWIND_DREAD_H_FAIL; - } state->regData[15].v += rv * 2; - } else { + } + else { uint8_t rv; - if(!state->cb->readB((state->regData[15].v & (~1)) + 2, &rv)) { + if (!state->cb->readB((state->regData[15].v & (~1)) + 2, &rv)) return UNWIND_DREAD_B_FAIL; - } state->regData[15].v += rv * 2; } } @@ -355,12 +340,11 @@ UnwResult UnwStartThumb(UnwState * const state) { UnwPrintd2(" Return PC=%x", state->regData[15].v); /* Report the return address, including mode bit */ - if(!UnwReportRetAddr(state, state->regData[15].v)) { + if (!UnwReportRetAddr(state, state->regData[15].v)) return UNWIND_TRUNCATED; - } /* Determine the new mode */ - if(state->regData[15].v & 0x1) { + if (state->regData[15].v & 0x1) { /* Branching to THUMB */ /* Account for the auto-increment which isn't needed */ @@ -411,10 +395,10 @@ UnwResult UnwStartThumb(UnwState * const state) { * PC-relative load * LDR Rd,[PC, #+/-imm] */ - else if((instr & 0xFF7F) == 0xF85F) { + else if ((instr & 0xFF7F) == 0xF85F) { uint8_t rt = (instr2 & 0xF000) >> 12; uint8_t imm12 = (instr2 & 0x0FFF); - bool A = (instr & 0x80) ? true : false; + bool A = !!(instr & 0x80); uint32_t address; /* Compute load address, adding a word to account for prefetch */ @@ -424,9 +408,8 @@ UnwResult UnwStartThumb(UnwState * const state) { UnwPrintd4("LDR r%d,[PC #%c0x%08x]", rt, A?'+':'-', address); - if(!UnwMemReadRegister(state, address, &state->regData[rt])) { + if (!UnwMemReadRegister(state, address, &state->regData[rt])) return UNWIND_DREAD_W_FAIL; - } } /* * LDR immediate. @@ -441,11 +424,11 @@ UnwResult UnwStartThumb(UnwState * const state) { /* If destination is PC and we don't know the source value, then fail */ if (!M_IsOriginValid(state->regData[rn].o)) { state->regData[rt].o = state->regData[rn].o; - } else { + } + else { uint32_t address = state->regData[rn].v + imm12; - if(!UnwMemReadRegister(state, address, &state->regData[rt])) { + if (!UnwMemReadRegister(state, address, &state->regData[rt])) return UNWIND_DREAD_W_FAIL; - } } } /* @@ -459,31 +442,20 @@ UnwResult UnwStartThumb(UnwState * const state) { uint8_t rn = (instr & 0xF); uint8_t rt = (instr2 & 0xF000) >> 12; uint16_t imm8 = (instr2 & 0xFF); - bool P = (instr2 & 0x400) ? true : false; - bool U = (instr2 & 0x200) ? true : false; - bool W = (instr2 & 0x100) ? true : false; + bool P = !!(instr2 & 0x400); + bool U = !!(instr2 & 0x200); + bool W = !!(instr2 & 0x100); - if (!M_IsOriginValid(state->regData[rn].o)) { + if (!M_IsOriginValid(state->regData[rn].o)) state->regData[rt].o = state->regData[rn].o; - } else { - uint32_t offaddress = state->regData[rn].v + imm8; - if (U) offaddress += imm8; - else offaddress -= imm8; - - uint32_t address; - if (P) { - address = offaddress; - } else { - address = state->regData[rn].v; - } + else { + uint32_t offaddress = state->regData[rn].v + (U ? imm8 + imm8 : 0), + address = P ? offaddress : state->regData[rn].v; - if(!UnwMemReadRegister(state, address, &state->regData[rt])) { + if (!UnwMemReadRegister(state, address, &state->regData[rt])) return UNWIND_DREAD_W_FAIL; - } - if (W) { - state->regData[rn].v = offaddress; - } + if (W) state->regData[rn].v = offaddress; } } /* @@ -493,30 +465,28 @@ UnwResult UnwStartThumb(UnwState * const state) { * Where Rt is PC, Rn value is known, Rm is not known or unknown */ else if ((instr & 0xFFF0) == 0xF850 && (instr2 & 0x0FC0) == 0x0000) { - uint8_t rn = (instr & 0xF); - uint8_t rt = (instr2 & 0xF000) >> 12; - uint8_t rm = (instr2 & 0xF); - uint8_t imm2 = (instr2 & 0x30) >> 4; + const uint8_t rn = (instr & 0xF), + rt = (instr2 & 0xF000) >> 12, + rm = (instr2 & 0xF), + imm2 = (instr2 & 0x30) >> 4; - if (!M_IsOriginValid(state->regData[rn].o) || - !M_IsOriginValid(state->regData[rm].o)) { + if (!M_IsOriginValid(state->regData[rn].o) || !M_IsOriginValid(state->regData[rm].o)) { /* If Rt is PC, and Rn is known, then do an exception and assume Rm equals 0 => This takes the first case in a switch() */ if (rt == 15 && M_IsOriginValid(state->regData[rn].o)) { uint32_t address = state->regData[rn].v; - if(!UnwMemReadRegister(state, address, &state->regData[rt])) { + if (!UnwMemReadRegister(state, address, &state->regData[rt])) return UNWIND_DREAD_W_FAIL; - } - } else { - /* Propagate unknown value */ - state->regData[rt].o = state->regData[rn].o; } - } else { + else /* Propagate unknown value */ + state->regData[rt].o = state->regData[rn].o; + + } + else { uint32_t address = state->regData[rn].v + (state->regData[rm].v << imm2); - if(!UnwMemReadRegister(state, address, &state->regData[rt])) { + if (!UnwMemReadRegister(state, address, &state->regData[rt])) return UNWIND_DREAD_W_FAIL; - } } } else { @@ -533,14 +503,14 @@ UnwResult UnwStartThumb(UnwState * const state) { * LSR Rd, Rs, #Offset5 * ASR Rd, Rs, #Offset5 */ - else if((instr & 0xE000) == 0x0000 && (instr & 0x1800) != 0x1800) { + else if ((instr & 0xE000) == 0x0000 && (instr & 0x1800) != 0x1800) { bool signExtend; - uint8_t op = (instr & 0x1800) >> 11; - uint8_t offset5 = (instr & 0x07C0) >> 6; - uint8_t rs = (instr & 0x0038) >> 3; - uint8_t rd = (instr & 0x0007); + const uint8_t op = (instr & 0x1800) >> 11, + offset5 = (instr & 0x07C0) >> 6, + rs = (instr & 0x0038) >> 3, + rd = (instr & 0x0007); - switch(op) { + switch (op) { case 0: /* LSL */ UnwPrintd6("LSL r%d, r%d, #%d\t; r%d %s", rd, rs, offset5, rs, M_Origin2Str(state->regData[rs].o)); state->regData[rd].v = state->regData[rs].v << offset5; @@ -558,11 +528,9 @@ UnwResult UnwStartThumb(UnwState * const state) { case 2: /* ASR */ UnwPrintd6("ASL r%d, r%d, #%d\t; r%d %s", rd, rs, offset5, rs, M_Origin2Str(state->regData[rs].o)); - signExtend = (state->regData[rs].v & 0x8000) ? true : false; + signExtend = !!(state->regData[rs].v & 0x8000); state->regData[rd].v = state->regData[rs].v >> offset5; - if(signExtend) { - state->regData[rd].v |= 0xFFFFFFFF << (32 - offset5); - } + if (signExtend) state->regData[rd].v |= 0xFFFFFFFF << (32 - offset5); state->regData[rd].o = state->regData[rs].o; state->regData[rd].o |= REG_VAL_ARITHMETIC; break; @@ -574,9 +542,9 @@ UnwResult UnwStartThumb(UnwState * const state) { * SUB Rd, Rs, Rn * SUB Rd, Rs, #Offset3 */ - else if((instr & 0xF800) == 0x1800) { - bool I = (instr & 0x0400) ? true : false; - bool op = (instr & 0x0200) ? true : false; + else if ((instr & 0xF800) == 0x1800) { + bool I = !!(instr & 0x0400); + bool op = !!(instr & 0x0200); uint8_t rn = (instr & 0x01C0) >> 6; uint8_t rs = (instr & 0x0038) >> 3; uint8_t rd = (instr & 0x0007); @@ -584,36 +552,24 @@ UnwResult UnwStartThumb(UnwState * const state) { /* Print decoding */ UnwPrintd6("%s r%d, r%d, %c%d\t;",op ? "SUB" : "ADD",rd, rs,I ? '#' : 'r',rn); UnwPrintd5("r%d %s, r%d %s",rd, M_Origin2Str(state->regData[rd].o),rs, M_Origin2Str(state->regData[rs].o)); - if(!I) { + if (!I) { UnwPrintd3(", r%d %s", rn, M_Origin2Str(state->regData[rn].o)); /* Perform calculation */ - if(op) { - state->regData[rd].v = state->regData[rs].v - state->regData[rn].v; - } - else { - state->regData[rd].v = state->regData[rs].v + state->regData[rn].v; - } + state->regData[rd].v = state->regData[rs].v + (op ? -state->regData[rn].v : state->regData[rn].v); /* Propagate the origin */ - if(M_IsOriginValid(state->regData[rs].o) && - M_IsOriginValid(state->regData[rn].o)) { + if (M_IsOriginValid(state->regData[rs].o) && M_IsOriginValid(state->regData[rn].o)) { state->regData[rd].o = state->regData[rs].o; state->regData[rd].o |= REG_VAL_ARITHMETIC; } - else { + else state->regData[rd].o = REG_VAL_INVALID; - } } else { /* Perform calculation */ - if(op) { - state->regData[rd].v = state->regData[rs].v - rn; - } - else { - state->regData[rd].v = state->regData[rs].v + rn; - } + state->regData[rd].v = state->regData[rs].v + (op ? -rn : rn); /* Propagate the origin */ state->regData[rd].o = state->regData[rs].o; @@ -626,13 +582,13 @@ UnwResult UnwStartThumb(UnwState * const state) { * ADD Rd, #Offset8 * SUB Rd, #Offset8 */ - else if((instr & 0xE000) == 0x2000) { + else if ((instr & 0xE000) == 0x2000) { uint8_t op = (instr & 0x1800) >> 11; uint8_t rd = (instr & 0x0700) >> 8; uint8_t offset8 = (instr & 0x00FF); - switch(op) { + switch (op) { case 0: /* MOV */ UnwPrintd3("MOV r%d, #0x%x", rd, offset8); state->regData[rd].v = offset8; @@ -675,7 +631,7 @@ UnwResult UnwStartThumb(UnwState * const state) { * BIC Rd, Rs * MVN Rd, Rs */ - else if((instr & 0xFC00) == 0x4000) { + else if ((instr & 0xFC00) == 0x4000) { uint8_t op = (instr & 0x03C0) >> 6; uint8_t rs = (instr & 0x0038) >> 3; uint8_t rd = (instr & 0x0007); @@ -688,7 +644,7 @@ UnwResult UnwStartThumb(UnwState * const state) { "ORR", "MUL", "BIC", "MVN" }; #endif /* Print the mnemonic and registers */ - switch(op) { + switch (op) { case 0: /* AND */ case 1: /* EOR */ case 2: /* LSL */ @@ -720,7 +676,7 @@ UnwResult UnwStartThumb(UnwState * const state) { } /* Perform operation */ - switch(op) { + switch (op) { case 0: /* AND */ state->regData[rd].v &= state->regData[rs].v; break; @@ -738,7 +694,7 @@ UnwResult UnwStartThumb(UnwState * const state) { break; case 4: /* ASR */ - if(state->regData[rd].v & 0x80000000) { + if (state->regData[rd].v & 0x80000000) { state->regData[rd].v >>= state->regData[rs].v; state->regData[rd].v |= 0xFFFFFFFF << (32 - state->regData[rs].v); } @@ -782,7 +738,7 @@ UnwResult UnwStartThumb(UnwState * const state) { } /* Propagate data origins */ - switch(op) { + switch (op) { case 0: /* AND */ case 1: /* EOR */ case 2: /* LSL */ @@ -792,13 +748,12 @@ UnwResult UnwStartThumb(UnwState * const state) { case 12: /* ORR */ case 13: /* MUL */ case 14: /* BIC */ - if(M_IsOriginValid(state->regData[rd].o) && M_IsOriginValid(state->regData[rs].o)) { + if (M_IsOriginValid(state->regData[rd].o) && M_IsOriginValid(state->regData[rs].o)) { state->regData[rd].o = state->regData[rs].o; state->regData[rd].o |= REG_VAL_ARITHMETIC; } - else { + else state->regData[rd].o = REG_VAL_INVALID; - } break; case 5: /* ADC */ @@ -825,7 +780,7 @@ UnwResult UnwStartThumb(UnwState * const state) { * CMP Hd, Rs * MOV Hd, Hs */ - else if((instr & 0xFC00) == 0x4400) { + else if ((instr & 0xFC00) == 0x4400) { uint8_t op = (instr & 0x0300) >> 8; bool h1 = (instr & 0x0080) ? true: false; bool h2 = (instr & 0x0040) ? true: false; @@ -833,12 +788,10 @@ UnwResult UnwStartThumb(UnwState * const state) { uint8_t rhd = (instr & 0x0007); /* Adjust the register numbers */ - if(h2) - rhs += 8; - if(h1) - rhd += 8; + if (h2) rhs += 8; + if (h1) rhd += 8; - switch(op) { + switch (op) { case 0: /* ADD */ UnwPrintd5("ADD r%d, r%d\t; r%d %s", rhd, rhs, rhs, M_Origin2Str(state->regData[rhs].o)); state->regData[rhd].v += state->regData[rhs].v; @@ -861,28 +814,25 @@ UnwResult UnwStartThumb(UnwState * const state) { UnwPrintd4("BX r%d\t; r%d %s\n", rhs, rhs, M_Origin2Str(state->regData[rhs].o)); /* Only follow BX if the data was from the stack or BX LR */ - if(rhs == 14 || state->regData[rhs].o == REG_VAL_FROM_STACK) { + if (rhs == 14 || state->regData[rhs].o == REG_VAL_FROM_STACK) { UnwPrintd2(" Return PC=0x%x\n", state->regData[rhs].v & (~0x1)); /* Report the return address, including mode bit */ - if(!UnwReportRetAddr(state, state->regData[rhs].v)) { + if (!UnwReportRetAddr(state, state->regData[rhs].v)) return UNWIND_TRUNCATED; - } /* Update the PC */ state->regData[15].v = state->regData[rhs].v; /* Determine the new mode */ - if(state->regData[rhs].v & 0x1) { + if (state->regData[rhs].v & 0x1) { /* Branching to THUMB */ /* Account for the auto-increment which isn't needed */ state->regData[15].v -= 2; } - else { - /* Branch to ARM */ + else /* Branch to ARM */ return UnwStartArm(state); - } } else { UnwPrintd4("\nError: BX to invalid register: r%d = 0x%x (%s)\n", rhs, state->regData[rhs].o, M_Origin2Str(state->regData[rhs].o)); @@ -893,7 +843,7 @@ UnwResult UnwStartThumb(UnwState * const state) { /* Format 9: PC-relative load * LDR Rd,[PC, #imm] */ - else if((instr & 0xF800) == 0x4800) { + else if ((instr & 0xF800) == 0x4800) { uint8_t rd = (instr & 0x0700) >> 8; uint8_t word8 = (instr & 0x00FF); uint32_t address; @@ -903,19 +853,18 @@ UnwResult UnwStartThumb(UnwState * const state) { UnwPrintd3("LDR r%d, 0x%08x", rd, address); - if(!UnwMemReadRegister(state, address, &state->regData[rd])) { + if (!UnwMemReadRegister(state, address, &state->regData[rd])) return UNWIND_DREAD_W_FAIL; - } } /* Format 13: add offset to Stack Pointer * ADD sp,#+imm * ADD sp,#-imm */ - else if((instr & 0xFF00) == 0xB000) { + else if ((instr & 0xFF00) == 0xB000) { uint8_t value = (instr & 0x7F) * 4; /* Check the negative bit */ - if((instr & 0x80) != 0) { + if ((instr & 0x80) != 0) { UnwPrintd2("SUB sp,#0x%x", value); state->regData[13].v -= value; } @@ -930,29 +879,27 @@ UnwResult UnwStartThumb(UnwState * const state) { * POP {Rlist} * POP {Rlist, PC} */ - else if((instr & 0xF600) == 0xB400) { - bool L = (instr & 0x0800) ? true : false; - bool R = (instr & 0x0100) ? true : false; + else if ((instr & 0xF600) == 0xB400) { + bool L = !!(instr & 0x0800); + bool R = !!(instr & 0x0100); uint8_t rList = (instr & 0x00FF); - if(L) { + if (L) { uint8_t r; /* Load from memory: POP */ UnwPrintd2("POP {Rlist%s}\n", R ? ", PC" : ""); - for(r = 0; r < 8; r++) { - if(rList & (0x1 << r)) { + for (r = 0; r < 8; r++) { + if (rList & (0x1 << r)) { /* Read the word */ - if(!UnwMemReadRegister(state, state->regData[13].v, &state->regData[r])) { + if (!UnwMemReadRegister(state, state->regData[13].v, &state->regData[r])) return UNWIND_DREAD_W_FAIL; - } /* Alter the origin to be from the stack if it was valid */ - if(M_IsOriginValid(state->regData[r].o)) { + if (M_IsOriginValid(state->regData[r].o)) state->regData[r].o = REG_VAL_FROM_STACK; - } state->regData[13].v += 4; @@ -961,14 +908,13 @@ UnwResult UnwStartThumb(UnwState * const state) { } /* Check if the PC is to be popped */ - if(R) { + if (R) { /* Get the return address */ - if(!UnwMemReadRegister(state, state->regData[13].v, &state->regData[15])) { + if (!UnwMemReadRegister(state, state->regData[13].v, &state->regData[15])) return UNWIND_DREAD_W_FAIL; - } /* Alter the origin to be from the stack if it was valid */ - if(!M_IsOriginValid(state->regData[15].o)) { + if (!M_IsOriginValid(state->regData[15].o)) { /* Return address is not valid */ UnwPrintd1("PC popped with invalid address\n"); return UNWIND_FAILURE; @@ -978,7 +924,7 @@ UnwResult UnwStartThumb(UnwState * const state) { * the caller was from Thumb. This would allow return * by BX for interworking APCS. */ - if((state->regData[15].v & 0x1) == 0) { + if ((state->regData[15].v & 0x1) == 0) { UnwPrintd2("Warning: Return address not to Thumb: 0x%08x\n", state->regData[15].v); /* Pop into the PC will not switch mode */ @@ -986,9 +932,8 @@ UnwResult UnwStartThumb(UnwState * const state) { } /* Store the return address */ - if(!UnwReportRetAddr(state, state->regData[15].v)) { + if (!UnwReportRetAddr(state, state->regData[15].v)) return UNWIND_TRUNCATED; - } /* Now have the return address */ UnwPrintd2(" Return PC=%x\n", state->regData[15].v); @@ -1008,26 +953,24 @@ UnwResult UnwStartThumb(UnwState * const state) { UnwPrintd2("PUSH {Rlist%s}", R ? ", LR" : ""); /* Check if the LR is to be pushed */ - if(R) { + if (R) { UnwPrintd3("\n lr = 0x%08x\t; %s", state->regData[14].v, M_Origin2Str(state->regData[14].o)); state->regData[13].v -= 4; /* Write the register value to memory */ - if(!UnwMemWriteRegister(state, state->regData[13].v, &state->regData[14])) { + if (!UnwMemWriteRegister(state, state->regData[13].v, &state->regData[14])) return UNWIND_DWRITE_W_FAIL; - } } - for(r = 7; r >= 0; r--) { - if(rList & (0x1 << r)) { + for (r = 7; r >= 0; r--) { + if (rList & (0x1 << r)) { UnwPrintd4("\n r%d = 0x%08x\t; %s", r, state->regData[r].v, M_Origin2Str(state->regData[r].o)); state->regData[13].v -= 4; - if(!UnwMemWriteRegister(state, state->regData[13].v, &state->regData[r])) { + if (!UnwMemWriteRegister(state, state->regData[13].v, &state->regData[r])) return UNWIND_DWRITE_W_FAIL; - } } } } @@ -1037,7 +980,7 @@ UnwResult UnwStartThumb(UnwState * const state) { * Conditional branches * Bcond */ - else if((instr & 0xF000) == 0xD000) { + else if ((instr & 0xF000) == 0xD000) { int32_t branchValue = (instr & 0xFF); if (branchValue & 0x80) branchValue |= 0xFFFFFF00; @@ -1066,7 +1009,7 @@ UnwResult UnwStartThumb(UnwState * const state) { /* Format 18: unconditional branch * B label */ - else if((instr & 0xF800) == 0xE000) { + else if ((instr & 0xF800) == 0xE000) { uint32_t v; int32_t branchValue = signExtend11(instr & 0x07FF); @@ -1106,8 +1049,7 @@ UnwResult UnwStartThumb(UnwState * const state) { UnwPrintd1("\n"); /* Should never hit the reset vector */ - if(state->regData[15].v == 0) - return UNWIND_RESET; + if (state->regData[15].v == 0) return UNWIND_RESET; /* Check next address */ state->regData[15].v += 2; @@ -1115,11 +1057,9 @@ UnwResult UnwStartThumb(UnwState * const state) { /* Garbage collect the memory hash (used only for the stack) */ UnwMemHashGC(state); - t--; - if(t == 0) - return UNWIND_EXHAUSTED; + if (--t == 0) return UNWIND_EXHAUSTED; - } while(!found); + } while (!found); return UNWIND_SUCCESS; } diff --git a/Marlin/src/HAL/shared/backtrace/unwarmmem.cpp b/Marlin/src/HAL/shared/backtrace/unwarmmem.cpp index b836841713b4..cf9ac414c4e0 100644 --- a/Marlin/src/HAL/shared/backtrace/unwarmmem.cpp +++ b/Marlin/src/HAL/shared/backtrace/unwarmmem.cpp @@ -19,7 +19,7 @@ #include "unwarmmem.h" #include "unwarm.h" -#define M_IsIdxUsed(a, v) (((a)[v >> 3] & (1 << (v & 0x7))) ? true : false) +#define M_IsIdxUsed(a, v) !!((a)[v >> 3] & (1 << (v & 0x7))) #define M_SetIdxUsed(a, v) ((a)[v >> 3] |= (1 << (v & 0x7))) #define M_ClrIdxUsed(a, v) ((a)[v >> 3] &= ~(1 << (v & 0x7))) @@ -34,11 +34,9 @@ static int16_t memHashIndex(MemData * const memData, const uint32_t addr) { do { /* Check if the element is occupied */ - if(M_IsIdxUsed(memData->used, s)) { + if (M_IsIdxUsed(memData->used, s)) { /* Check if it is occupied with the sought data */ - if(memData->a[s] == addr) { - return s; - } + if (memData->a[s] == addr) return s; } else { /* Item is free, this is where the item should be stored */ @@ -47,10 +45,8 @@ static int16_t memHashIndex(MemData * const memData, const uint32_t addr) { /* Search the next entry */ s++; - if(s > MEM_HASH_SIZE) { - s = 0; - } - } while(s != v); + if (s > MEM_HASH_SIZE) s = 0; + } while (s != v); /* Search failed, hash is full and the address not stored */ return -1; @@ -58,9 +54,9 @@ static int16_t memHashIndex(MemData * const memData, const uint32_t addr) { bool UnwMemHashRead(MemData * const memData, uint32_t addr,uint32_t * const data, bool * const tracked) { - int16_t i = memHashIndex(memData, addr); + const int16_t i = memHashIndex(memData, addr); - if(i >= 0 && M_IsIdxUsed(memData->used, i) && memData->a[i] == addr) { + if (i >= 0 && M_IsIdxUsed(memData->used, i) && memData->a[i] == addr) { *data = memData->v[i]; *tracked = M_IsIdxUsed(memData->tracked, i); return true; @@ -72,44 +68,36 @@ bool UnwMemHashRead(MemData * const memData, uint32_t addr,uint32_t * const data } bool UnwMemHashWrite(MemData * const memData, uint32_t addr, uint32_t val, bool valValid) { + const int16_t i = memHashIndex(memData, addr); + if (i < 0) return false; /* Hash full */ - int16_t i = memHashIndex(memData, addr); + /* Store the item */ + memData->a[i] = addr; + M_SetIdxUsed(memData->used, i); - if(i < 0){ - /* Hash full */ - return false; + if (valValid) { + memData->v[i] = val; + M_SetIdxUsed(memData->tracked, i); } else { - /* Store the item */ - memData->a[i] = addr; - M_SetIdxUsed(memData->used, i); - - if(valValid) - { - memData->v[i] = val; - M_SetIdxUsed(memData->tracked, i); - } - else { - #ifdef UNW_DEBUG - memData->v[i] = 0xDEADBEEF; - #endif - M_ClrIdxUsed(memData->tracked, i); - } - - return true; + #ifdef UNW_DEBUG + memData->v[i] = 0xDEADBEEF; + #endif + M_ClrIdxUsed(memData->tracked, i); } + + return true; } void UnwMemHashGC(UnwState * const state) { const uint32_t minValidAddr = state->regData[13].v; MemData * const memData = &state->memData; - uint16_t t; + uint16_t t; - for(t = 0; t < MEM_HASH_SIZE; t++) { - if(M_IsIdxUsed(memData->used, t) && (memData->a[t] < minValidAddr)) { + for (t = 0; t < MEM_HASH_SIZE; t++) { + if (M_IsIdxUsed(memData->used, t) && (memData->a[t] < minValidAddr)) { UnwPrintd3("MemHashGC: Free elem %d, addr 0x%08x\n", t, memData->a[t]); - M_ClrIdxUsed(memData->used, t); } } diff --git a/Marlin/src/HAL/shared/backtrace/unwinder.cpp b/Marlin/src/HAL/shared/backtrace/unwinder.cpp index 7c5af02cdbd4..bde58994355b 100644 --- a/Marlin/src/HAL/shared/backtrace/unwinder.cpp +++ b/Marlin/src/HAL/shared/backtrace/unwinder.cpp @@ -33,13 +33,11 @@ static int HasUnwindTableInfo(void) { } UnwResult UnwindStart(UnwindFrame* frame, const UnwindCallbacks *cb, void *data) { - if (HasUnwindTableInfo()) { - /* We have unwind information tables */ return UnwindByTableStart(frame, cb, data); - - } else { + } + else { /* We don't have unwind information tables */ UnwState state; @@ -48,12 +46,7 @@ UnwResult UnwindStart(UnwindFrame* frame, const UnwindCallbacks *cb, void *data) UnwInitState(&state, cb, data, frame->pc, frame->sp); /* Check the Thumb bit */ - if(frame->pc & 0x1) { - return UnwStartThumb(&state); - } - else { - return UnwStartArm(&state); - } + return (frame->pc & 0x1) ? UnwStartThumb(&state) : UnwStartArm(&state); } } #endif diff --git a/Marlin/src/HAL/shared/math_32bit.h b/Marlin/src/HAL/shared/math_32bit.h index 5ce51b62abbd..34642b29990d 100644 --- a/Marlin/src/HAL/shared/math_32bit.h +++ b/Marlin/src/HAL/shared/math_32bit.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/shared/persistent_store_api.cpp b/Marlin/src/HAL/shared/persistent_store_api.cpp index 230a70e85b21..e7bd107cbe48 100644 --- a/Marlin/src/HAL/shared/persistent_store_api.cpp +++ b/Marlin/src/HAL/shared/persistent_store_api.cpp @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com * Copyright (c) 2016 Victor Perez victor_pv@hotmail.com @@ -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/HAL/shared/persistent_store_api.h b/Marlin/src/HAL/shared/persistent_store_api.h index 09db6310e039..de9f1c109090 100644 --- a/Marlin/src/HAL/shared/persistent_store_api.h +++ b/Marlin/src/HAL/shared/persistent_store_api.h @@ -1,7 +1,7 @@ /** * Marlin 3D Printer Firmware * - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com * Copyright (c) 2016 Victor Perez victor_pv@hotmail.com diff --git a/Marlin/src/HAL/shared/servo.cpp b/Marlin/src/HAL/shared/servo.cpp index 7d15d76b1a74..0d276c4aa6fa 100644 --- a/Marlin/src/HAL/shared/servo.cpp +++ b/Marlin/src/HAL/shared/servo.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/shared/servo.h b/Marlin/src/HAL/shared/servo.h index 93a10aaf67c3..042c5d83cc82 100644 --- a/Marlin/src/HAL/shared/servo.h +++ b/Marlin/src/HAL/shared/servo.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/shared/servo_private.h b/Marlin/src/HAL/shared/servo_private.h index 522e4594ff29..d2d96ce000e1 100644 --- a/Marlin/src/HAL/shared/servo_private.h +++ b/Marlin/src/HAL/shared/servo_private.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp index 50957517b5ce..c6e25b5a5aea 100644 --- a/Marlin/src/Marlin.cpp +++ b/Marlin/src/Marlin.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -30,6 +30,7 @@ #include "Marlin.h" +#include "core/utility.h" #include "lcd/ultralcd.h" #include "module/motion.h" #include "module/planner.h" @@ -44,6 +45,8 @@ #include "HAL/shared/Delay.h" +#include "module/stepper_indirection.h" + #ifdef ARDUINO #include #endif @@ -54,6 +57,10 @@ #include "gcode/parser.h" #include "gcode/queue.h" +#if ENABLED(HOST_ACTION_COMMANDS) + #include "feature/host_actions.h" +#endif + #if HAS_BUZZER && DISABLED(LCD_USE_I2C_BUZZER) #include "libs/buzzer.h" #endif @@ -78,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 @@ -108,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) @@ -122,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 @@ -130,7 +141,7 @@ #include "feature/power_loss_recovery.h" #endif -#if ENABLED(FILAMENT_RUNOUT_SENSOR) +#if HAS_FILAMENT_SENSOR #include "feature/runout.h" #endif @@ -146,7 +157,7 @@ #include "feature/fanmux.h" #endif -#if DO_SWITCH_EXTRUDER || ENABLED(SWITCHING_NOZZLE) || ENABLED(PARKING_EXTRUDER) +#if DO_SWITCH_EXTRUDER || ANY(SWITCHING_NOZZLE, PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER) #include "module/tool_change.h" #endif @@ -154,33 +165,30 @@ #include "feature/controllerfan.h" #endif +#if ENABLED(PRUSA_MMU2) + #include "feature/prusa_MMU2/mmu2.h" +#endif + #if ENABLED(EXTENSIBLE_UI) #include "lcd/extensible_ui/ui_api.h" #endif +#if HAS_DRIVER(L6470) + #include "libs/L6470/L6470_Marlin.h" +#endif + bool Running = true; #if ENABLED(TEMPERATURE_UNITS_SUPPORT) TempUnit input_temp_units = TEMPUNIT_C; #endif -#if FAN_COUNT > 0 - uint8_t fan_speed[FAN_COUNT] = { 0 }; - #if ENABLED(EXTRA_FAN_SPEED) - uint8_t old_fan_speed[FAN_COUNT], new_fan_speed[FAN_COUNT]; - #endif - #if ENABLED(PROBING_FANS_OFF) - bool fans_paused; // = false; - uint8_t paused_fan_speed[FAN_COUNT] = { 0 }; - #endif -#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) @@ -192,7 +200,6 @@ millis_t max_inactive_time, // = 0 stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000UL; #if PIN_EXISTS(CHDK) - extern bool chdk_active; extern millis_t chdk_timeout; #endif @@ -218,9 +225,9 @@ void setup_powerhold() { #endif #if HAS_POWER_SWITCH #if ENABLED(PS_DEFAULT_OFF) - PSU_OFF(); + powersupply_on = true; PSU_OFF(); #else - PSU_ON(); + powersupply_on = false; PSU_ON(); #endif #endif } @@ -229,10 +236,8 @@ void setup_powerhold() { * Stepper Reset (RigidBoard, et.al.) */ #if HAS_STEPPER_RESET - void disableStepperDrivers() { - OUT_WRITE(STEPPER_RESET_PIN, LOW); // drive it down to hold in reset motor driver chips - } - void enableStepperDrivers() { SET_INPUT(STEPPER_RESET_PIN); } // set to input, which allows it to be pulled high by pullups + void disableStepperDrivers() { OUT_WRITE(STEPPER_RESET_PIN, LOW); } // Drive down to keep motor driver chips in reset + void enableStepperDrivers() { SET_INPUT(STEPPER_RESET_PIN); } // Set to input, allowing pullups to pull the pin high #endif #if ENABLED(EXPERIMENTAL_I2CBUS) && I2C_SLAVE_ADDRESS > 0 @@ -264,8 +269,7 @@ bool pin_is_protected(const pin_t pin) { } void protected_pin_err() { - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM(MSG_ERR_PROTECTED_PIN); + SERIAL_ERROR_MSG(MSG_ERR_PROTECTED_PIN); } void quickstop_stepper() { @@ -317,6 +321,102 @@ void disable_all_steppers() { disable_e_steppers(); } +#if HAS_FILAMENT_SENSOR + + void event_filament_runout() { + + #if ENABLED(ADVANCED_PAUSE_FEATURE) + if (did_pause_print) return; // Action already in progress. Purge triggered repeated runout. + #endif + + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onFilamentRunout(ExtUI::getActiveTool()); + #endif + + #if EITHER(HOST_PROMPT_SUPPORT, HOST_ACTION_COMMANDS) + const char tool = '0' + #if NUM_RUNOUT_SENSORS > 1 + + active_extruder + #endif + ; + #endif + + //action:out_of_filament + #if ENABLED(HOST_PROMPT_SUPPORT) + host_prompt_reason = PROMPT_FILAMENT_RUNOUT; + host_action_prompt_end(); + host_action_prompt_begin(PSTR("FilamentRunout T"), false); + SERIAL_CHAR(tool); + SERIAL_EOL(); + host_action_prompt_show(); + #endif + + const bool run_runout_script = !runout.host_handling; + + #if ENABLED(HOST_ACTION_COMMANDS) + if (run_runout_script + && ( strstr(FILAMENT_RUNOUT_SCRIPT, "M600") + || strstr(FILAMENT_RUNOUT_SCRIPT, "M125") + #if ENABLED(ADVANCED_PAUSE_FEATURE) + || strstr(FILAMENT_RUNOUT_SCRIPT, "M25") + #endif + ) + ) { + host_action_paused(false); + } + else { + // Legacy Repetier command for use until newer version supports standard dialog + // To be removed later when pause command also triggers dialog + #ifdef ACTION_ON_FILAMENT_RUNOUT + host_action(PSTR(ACTION_ON_FILAMENT_RUNOUT " T"), false); + SERIAL_CHAR(tool); + SERIAL_EOL(); + #endif + + host_action_pause(false); + } + SERIAL_ECHOPGM(" " ACTION_REASON_ON_FILAMENT_RUNOUT " "); + SERIAL_CHAR(tool); + SERIAL_EOL(); + #endif // HOST_ACTION_COMMANDS + + if (run_runout_script) + enqueue_and_echo_commands_P(PSTR(FILAMENT_RUNOUT_SCRIPT)); + } + +#endif // HAS_FILAMENT_SENSOR + +#if ENABLED(G29_RETRY_AND_RECOVER) + + void event_probe_failure() { + #ifdef ACTION_ON_G29_FAILURE + host_action(PSTR(ACTION_ON_G29_FAILURE)); + #endif + #ifdef G29_FAILURE_COMMANDS + gcode.process_subcommands_now_P(PSTR(G29_FAILURE_COMMANDS)); + #endif + #if ENABLED(G29_HALT_ON_FAILURE) + #ifdef ACTION_ON_CANCEL + host_action_cancel(); + #endif + kill(PSTR(MSG_ERR_PROBING_FAILED)); + #endif + } + + void event_probe_recover() { + #if ENABLED(HOST_PROMPT_SUPPORT) + host_prompt_do(PROMPT_INFO, PSTR("G29 Retrying")); + #endif + #ifdef ACTION_ON_G29_RECOVER + host_action(PSTR(ACTION_ON_G29_RECOVER)); + #endif + #ifdef G29_RECOVER_COMMANDS + gcode.process_subcommands_now_P(PSTR(G29_RECOVER_COMMANDS)); + #endif + } + +#endif + /** * Manage several activities: * - Check for Filament Runout @@ -328,10 +428,12 @@ void disable_all_steppers() { * - Check for HOME button held down * - Check if cooling fan needs to be switched on * - Check if an idle but hot extruder needs filament extruded (EXTRUDER_RUNOUT_PREVENT) + * - Pulse FET_SAFETY_PIN if it exists */ + void manage_inactivity(const bool ignore_stepper_queue/*=false*/) { - #if ENABLED(FILAMENT_RUNOUT_SENSOR) + #if HAS_FILAMENT_SENSOR runout.run(); #endif @@ -346,40 +448,46 @@ 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 #endif if (stepper_inactive_time) { + static bool already_shutdown_steppers; // = false if (planner.has_blocks_queued()) - gcode.previous_move_ms = ms; // reset_stepper_timeout to keep steppers powered + gcode.reset_stepper_timeout(); else if (MOVE_AWAY_TEST && !ignore_stepper_queue && ELAPSED(ms, gcode.previous_move_ms + stepper_inactive_time)) { - #if ENABLED(DISABLE_INACTIVE_X) - disable_X(); - #endif - #if ENABLED(DISABLE_INACTIVE_Y) - disable_Y(); - #endif - #if ENABLED(DISABLE_INACTIVE_Z) - disable_Z(); - #endif - #if ENABLED(DISABLE_INACTIVE_E) - disable_e_steppers(); - #endif - #if HAS_LCD_MENU && ENABLED(AUTO_BED_LEVELING_UBL) - if (ubl.lcd_map_control) { - ubl.lcd_map_control = false; - ui.defer_status_screen(false); - } - #endif + if (!already_shutdown_steppers) { + already_shutdown_steppers = true; // L6470 SPI will consume 99% of free time without this + #if ENABLED(DISABLE_INACTIVE_X) + disable_X(); + #endif + #if ENABLED(DISABLE_INACTIVE_Y) + disable_Y(); + #endif + #if ENABLED(DISABLE_INACTIVE_Z) + disable_Z(); + #endif + #if ENABLED(DISABLE_INACTIVE_E) + disable_e_steppers(); + #endif + #if HAS_LCD_MENU && ENABLED(AUTO_BED_LEVELING_UBL) + if (ubl.lcd_map_control) { + ubl.lcd_map_control = false; + ui.defer_status_screen(false); + } + #endif + } } + else + already_shutdown_steppers = false; } #if PIN_EXISTS(CHDK) // Check if pin should be set to LOW (after M240 set it HIGH) - if (chdk_active && ELAPSED(ms, chdk_timeout)) { - chdk_active = false; + if (chdk_timeout && ELAPSED(ms, chdk_timeout)) { + chdk_timeout = 0; WRITE(CHDK_PIN, LOW); } #endif @@ -400,8 +508,7 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) { // KILL the machine // ---------------------------------------------------------------- if (killCount >= KILL_DELAY) { - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM(MSG_KILL_BUTTON); + SERIAL_ERROR_MSG(MSG_KILL_BUTTON); kill(); } #endif @@ -507,7 +614,7 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) { } #endif // !SWITCHING_EXTRUDER - gcode.previous_move_ms = ms; // reset_stepper_timeout to keep steppers powered + gcode.reset_stepper_timeout(); } #endif // EXTRUDER_RUNOUT_PREVENT @@ -529,12 +636,26 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) { monitor_tmc_driver(); #endif + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + L6470.monitor_driver(); + #endif + // Limit check_axes_activity frequency to 10Hz static millis_t next_check_axes_ms = 0; if (ELAPSED(ms, next_check_axes_ms)) { planner.check_axes_activity(); next_check_axes_ms = ms + 100UL; } + + #if PIN_EXISTS(FET_SAFETY) + static millis_t FET_next; + if (ELAPSED(ms, FET_next)) { + FET_next = ms + FET_SAFETY_DELAY; // 2uS pulse every FET_SAFETY_DELAY mS + OUT_WRITE(FET_SAFETY_PIN, !FET_SAFETY_INVERTED); + DELAY_US(2); + WRITE(FET_SAFETY_PIN, FET_SAFETY_INVERTED); + } + #endif } /** @@ -597,6 +718,10 @@ void idle( #if ENABLED(USB_FLASH_DRIVE_SUPPORT) Sd2Card::idle(); #endif + + #if ENABLED(PRUSA_MMU2) + mmu2.mmu_loop(); + #endif } /** @@ -606,8 +731,7 @@ void idle( void kill(PGM_P const lcd_msg/*=NULL*/) { thermalManager.disable_all_heaters(); - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM(MSG_ERR_KILLED); + SERIAL_ERROR_MSG(MSG_ERR_KILLED); #if HAS_SPI_LCD || ENABLED(EXTENSIBLE_UI) ui.kill_screen(lcd_msg ? lcd_msg : PSTR(MSG_KILLED)); @@ -616,7 +740,7 @@ void kill(PGM_P const lcd_msg/*=NULL*/) { #endif #ifdef ACTION_ON_KILL - SERIAL_ECHOLNPGM("//action:" ACTION_ON_KILL); + host_action_kill(); #endif minkill(); @@ -642,11 +766,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 } /** @@ -658,13 +805,12 @@ void stop() { print_job_timer.stop(); #if ENABLED(PROBING_FANS_OFF) - if (fans_paused) fans_pause(false); // put things back the way they were + if (thermalManager.fans_paused) thermalManager.set_fans_paused(false); // put things back the way they were #endif if (IsRunning()) { Stopped_gcode_LastN = gcode_LastN; // Save last g_code for restart - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM(MSG_ERR_STOPPED); + SERIAL_ERROR_MSG(MSG_ERR_STOPPED); LCD_MESSAGEPGM(MSG_STOPPED); safe_delay(350); // allow enough time for messages to get out before stopping Running = false; @@ -695,6 +841,10 @@ void setup() { HAL_init(); #endif + #if HAS_DRIVER(L6470) + L6470.init(); // setup SPI and then init chips + #endif + #if ENABLED(MAX7219_DEBUG) max7219.init(); #endif @@ -717,7 +867,7 @@ void setup() { #endif #endif - #if ENABLED(FILAMENT_RUNOUT_SENSOR) + #if HAS_FILAMENT_SENSOR runout.setup(); #endif @@ -745,7 +895,7 @@ void setup() { #endif #endif - SERIAL_PROTOCOLLNPGM("start"); + SERIAL_ECHOLNPGM("start"); SERIAL_ECHO_START(); #if TMC_HAS_SPI @@ -781,13 +931,11 @@ void setup() { SERIAL_ECHOPGM(MSG_CONFIGURATION_VER); SERIAL_ECHOPGM(STRING_DISTRIBUTION_DATE); SERIAL_ECHOLNPGM(MSG_AUTHOR STRING_CONFIG_H_AUTHOR); - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM("Compiled: " __DATE__); + SERIAL_ECHO_MSG("Compiled: " __DATE__); #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(); @@ -797,9 +945,7 @@ void setup() { #if HAS_M206_COMMAND // Initialize current position based on home_offset - COPY(current_position, home_offset); - #else - ZERO(current_position); + LOOP_XYZ(a) current_position[a] += home_offset[a]; #endif // Vital to init stepper/planner equivalent for current_position @@ -825,17 +971,13 @@ void setup() { OUT_WRITE(PHOTOGRAPH_PIN, LOW); #endif - #if HAS_CASE_LIGHT - update_case_light(); - #endif - #if ENABLED(SPINDLE_LASER_ENABLE) - OUT_WRITE(SPINDLE_LASER_ENABLE_PIN, !SPINDLE_LASER_ENABLE_INVERT); // init spindle to off + OUT_WRITE(SPINDLE_LASER_ENA_PIN, !SPINDLE_LASER_ENABLE_INVERT); // init spindle to off #if SPINDLE_DIR_CHANGE OUT_WRITE(SPINDLE_DIR_PIN, SPINDLE_INVERT_DIR ? 255 : 0); // init rotation to clockwise (M3) #endif #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 @@ -860,7 +1002,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 @@ -880,13 +1022,11 @@ void setup() { leds.setup(); #endif - #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 ENABLED(RGBW_LED) - SET_OUTPUT(RGB_LED_W_PIN); + #if HAS_CASE_LIGHT + #if DISABLED(CASE_LIGHT_USE_NEOPIXEL) + if (PWM_PIN(CASE_LIGHT_PIN)) SET_PWM(CASE_LIGHT_PIN); else SET_OUTPUT(CASE_LIGHT_PIN); #endif + update_case_light(); #endif #if ENABLED(MK2_MULTIPLEXER) @@ -902,7 +1042,7 @@ void setup() { ui.init(); ui.reset_status(); - #if ENABLED(SHOW_BOOTSCREEN) + #if HAS_SPI_LCD && ENABLED(SHOW_BOOTSCREEN) ui.show_bootscreen(); #endif @@ -911,7 +1051,7 @@ void setup() { #endif #if ENABLED(BLTOUCH) - bltouch_init(); + bltouch.init(); #endif #if ENABLED(I2C_POSITION_ENCODERS) @@ -928,11 +1068,21 @@ void setup() { #endif #if ENABLED(SWITCHING_NOZZLE) - move_nozzle_servo(0); // Initialize nozzle servo + // Initialize nozzle servo(s) + #if SWITCHING_NOZZLE_TWO_SERVOS + lower_nozzle(0); + raise_nozzle(1); + #else + move_nozzle_servo(0); + #endif + #endif + + #if ENABLED(MAGNETIC_PARKING_EXTRUDER) + mpe_settings_init(); #endif #if ENABLED(PARKING_EXTRUDER) - pe_magnet_init(); + pe_solenoid_init(); #endif #if ENABLED(POWER_LOSS_RECOVERY) @@ -950,6 +1100,14 @@ void setup() { #if ENABLED(SDSUPPORT) && DISABLED(ULTRA_LCD) card.beginautostart(); #endif + + #if HAS_TRINAMIC && DISABLED(PS_DEFAULT_OFF) + test_tmc_connection(true, true, true, true); + #endif + + #if ENABLED(PRUSA_MMU2) + mmu2.init(); + #endif } /** @@ -977,11 +1135,14 @@ void loop() { quickstop_stepper(); print_job_timer.stop(); thermalManager.disable_all_heaters(); - zero_fan_speeds(); + thermalManager.zero_fan_speeds(); wait_for_heatup = false; #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 1025d677c9aa..1252d7f574ac 100644 --- a/Marlin/src/Marlin.h +++ b/Marlin/src/Marlin.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -31,6 +31,11 @@ #include #include +#if HAS_DRIVER(L6470) + #include "libs/L6470/L6470_Marlin.h" + extern uint8_t axis_known_position; +#endif + void stop(); void idle( @@ -41,40 +46,177 @@ void idle( void manage_inactivity(const bool ignore_stepper_queue=false); -#if HAS_X2_ENABLE - #define enable_X() do{ X_ENABLE_WRITE( X_ENABLE_ON); X2_ENABLE_WRITE( X_ENABLE_ON); }while(0) - #define disable_X() do{ X_ENABLE_WRITE(!X_ENABLE_ON); X2_ENABLE_WRITE(!X_ENABLE_ON); CBI(axis_known_position, X_AXIS); }while(0) +// +// X, Y, Z Stepper enable / disable +// +#if AXIS_DRIVER_TYPE_X(L6470) + extern L6470 stepperX; + #define X_enable NOOP + #define X_disable stepperX.free() #elif HAS_X_ENABLE - #define enable_X() X_ENABLE_WRITE( X_ENABLE_ON) - #define disable_X() do{ X_ENABLE_WRITE(!X_ENABLE_ON); CBI(axis_known_position, X_AXIS); }while(0) + #define X_enable X_ENABLE_WRITE( X_ENABLE_ON) + #define X_disable X_ENABLE_WRITE(!X_ENABLE_ON) +#else + #define X_enable NOOP + #define X_disable NOOP +#endif + +#if AXIS_DRIVER_TYPE_X2(L6470) + extern L6470 stepperX2; + #define X2_enable NOOP + #define X2_disable stepperX2.free() +#elif HAS_X2_ENABLE + #define X2_enable X2_ENABLE_WRITE( X_ENABLE_ON) + #define X2_disable X2_ENABLE_WRITE(!X_ENABLE_ON) #else - #define enable_X() NOOP - #define disable_X() NOOP + #define X2_enable NOOP + #define X2_disable NOOP #endif -#if HAS_Y2_ENABLE - #define enable_Y() do{ Y_ENABLE_WRITE( Y_ENABLE_ON); Y2_ENABLE_WRITE(Y_ENABLE_ON); }while(0) - #define disable_Y() do{ Y_ENABLE_WRITE(!Y_ENABLE_ON); Y2_ENABLE_WRITE(!Y_ENABLE_ON); CBI(axis_known_position, Y_AXIS); }while(0) +#define enable_X() do{ X_enable; X2_enable; }while(0) +#define disable_X() do{ X_disable; X2_disable; CBI(axis_known_position, X_AXIS); }while(0) + +#if AXIS_DRIVER_TYPE_Y(L6470) + extern L6470 stepperY; + #define Y_enable NOOP + #define Y_disable stepperY.free() #elif HAS_Y_ENABLE - #define enable_Y() Y_ENABLE_WRITE( Y_ENABLE_ON) - #define disable_Y() do{ Y_ENABLE_WRITE(!Y_ENABLE_ON); CBI(axis_known_position, Y_AXIS); }while(0) + #define Y_enable Y_ENABLE_WRITE( Y_ENABLE_ON) + #define Y_disable Y_ENABLE_WRITE(!Y_ENABLE_ON) #else - #define enable_Y() NOOP - #define disable_Y() NOOP + #define Y_enable NOOP + #define Y_disable NOOP #endif -#if HAS_Z3_ENABLE - #define enable_Z() do{ Z_ENABLE_WRITE( Z_ENABLE_ON); Z2_ENABLE_WRITE(Z_ENABLE_ON); Z3_ENABLE_WRITE(Z_ENABLE_ON); }while(0) - #define disable_Z() do{ Z_ENABLE_WRITE(!Z_ENABLE_ON); Z2_ENABLE_WRITE(!Z_ENABLE_ON); Z3_ENABLE_WRITE(!Z_ENABLE_ON); CBI(axis_known_position, Z_AXIS); }while(0) -#elif HAS_Z2_ENABLE - #define enable_Z() do{ Z_ENABLE_WRITE( Z_ENABLE_ON); Z2_ENABLE_WRITE(Z_ENABLE_ON); }while(0) - #define disable_Z() do{ Z_ENABLE_WRITE(!Z_ENABLE_ON); Z2_ENABLE_WRITE(!Z_ENABLE_ON); CBI(axis_known_position, Z_AXIS); }while(0) +#if AXIS_DRIVER_TYPE_Y2(L6470) + extern L6470 stepperY2; + #define Y2_enable NOOP + #define Y2_disable stepperY2.free() +#elif HAS_Y2_ENABLE + #define Y2_enable Y2_ENABLE_WRITE( Y_ENABLE_ON) + #define Y2_disable Y2_ENABLE_WRITE(!Y_ENABLE_ON) +#else + #define Y2_enable NOOP + #define Y2_disable NOOP +#endif + +#define enable_Y() do{ Y_enable; Y2_enable; }while(0) +#define disable_Y() do{ Y_disable; Y2_disable; CBI(axis_known_position, Y_AXIS); }while(0) + +#if AXIS_DRIVER_TYPE_Z(L6470) + extern L6470 stepperZ; + #define Z_enable NOOP + #define Z_disable stepperZ.free() #elif HAS_Z_ENABLE - #define enable_Z() Z_ENABLE_WRITE( Z_ENABLE_ON) - #define disable_Z() do{ Z_ENABLE_WRITE(!Z_ENABLE_ON); CBI(axis_known_position, Z_AXIS); }while(0) + #define Z_enable Z_ENABLE_WRITE( Z_ENABLE_ON) + #define Z_disable Z_ENABLE_WRITE(!Z_ENABLE_ON) +#else + #define Z_enable NOOP + #define Z_disable NOOP +#endif + +#if AXIS_DRIVER_TYPE_Z2(L6470) + extern L6470 stepperZ2; + #define Z2_enable NOOP + #define Z2_disable stepperZ2.free() +#elif HAS_Z2_ENABLE + #define Z2_enable Z2_ENABLE_WRITE( Z_ENABLE_ON) + #define Z2_disable Z2_ENABLE_WRITE(!Z_ENABLE_ON) +#else + #define Z2_enable NOOP + #define Z2_disable NOOP +#endif + +#if AXIS_DRIVER_TYPE_Z3(L6470) + extern L6470 stepperZ3; + #define Z3_enable NOOP + #define Z3_disable stepperZ3.free() +#elif HAS_Z3_ENABLE + #define Z3_enable Z3_ENABLE_WRITE( Z_ENABLE_ON) + #define Z3_disable Z3_ENABLE_WRITE(!Z_ENABLE_ON) +#else + #define Z3_enable NOOP + #define Z3_disable NOOP +#endif + +#define enable_Z() do{ Z_enable; Z2_enable; Z3_enable; }while(0) +#define disable_Z() do{ Z_disable; Z2_disable; Z3_disable; CBI(axis_known_position, Z_AXIS); }while(0) + +// +// Extruder Stepper enable / disable +// + +// define the individual enables/disables +#if AXIS_DRIVER_TYPE_E0(L6470) + extern L6470 stepperE0; + #define E0_enable NOOP + #define E0_disable do{ stepperE0.free(); CBI(axis_known_position, E_AXIS); }while(0) +#elif HAS_E0_ENABLE + #define E0_enable E0_ENABLE_WRITE( E_ENABLE_ON) + #define E0_disable E0_ENABLE_WRITE(!E_ENABLE_ON) +#else + #define E0_enable NOOP + #define E0_disable NOOP +#endif + +#if AXIS_DRIVER_TYPE_E1(L6470) + extern L6470 stepperE1; + #define E1_enable NOOP + #define E1_disable do{ stepperE1.free(); CBI(axis_known_position, E_AXIS); }while(0) +#elif E_STEPPERS > 1 && HAS_E1_ENABLE + #define E1_enable E1_ENABLE_WRITE( E_ENABLE_ON) + #define E1_disable E1_ENABLE_WRITE(!E_ENABLE_ON) +#else + #define E1_enable NOOP + #define E1_disable NOOP +#endif + +#if AXIS_DRIVER_TYPE_E2(L6470) + extern L6470 stepperE2; + #define E2_enable NOOP + #define E2_disable do{ stepperE2.free(); CBI(axis_known_position, E_AXIS); }while(0) +#elif E_STEPPERS > 2 && HAS_E2_ENABLE + #define E2_enable E2_ENABLE_WRITE( E_ENABLE_ON) + #define E2_disable E2_ENABLE_WRITE(!E_ENABLE_ON) +#else + #define E2_enable NOOP + #define E2_disable NOOP +#endif + +#if AXIS_DRIVER_TYPE_E3(L6470) + extern L6470 stepperE3; + #define E3_enable NOOP + #define E3_disable do{ stepperE3.free(); CBI(axis_known_position, E_AXIS); }while(0) +#elif E_STEPPERS > 3 && HAS_E3_ENABLE + #define E3_enable E3_ENABLE_WRITE( E_ENABLE_ON) + #define E3_disable E3_ENABLE_WRITE(!E_ENABLE_ON) +#else + #define E3_enable NOOP + #define E3_disable NOOP +#endif + +#if AXIS_DRIVER_TYPE_E4(L6470) + extern L6470 stepperE4; + #define E4_enable NOOP + #define E4_disable do{ stepperE4.free(); CBI(axis_known_position, E_AXIS); }while(0) +#elif E_STEPPERS > 4 && HAS_E4_ENABLE + #define E4_enable E4_ENABLE_WRITE( E_ENABLE_ON) + #define E4_disable E4_ENABLE_WRITE(!E_ENABLE_ON) #else - #define enable_Z() NOOP - #define disable_Z() NOOP + #define E4_enable NOOP + #define E4_disable NOOP +#endif + +#if AXIS_DRIVER_TYPE_E5(L6470) + extern L6470 stepperE5; + #define E5_enable NOOP + #define E5_disable do{ stepperE5.free(); CBI(axis_known_position, E_AXIS); }while(0) +#elif E_STEPPERS > 5 && HAS_E5_ENABLE + #define E5_enable E5_ENABLE_WRITE( E_ENABLE_ON) + #define E5_disable E5_ENABLE_WRITE(!E_ENABLE_ON) +#else + #define E5_enable NOOP + #define E5_disable NOOP #endif #if ENABLED(MIXING_EXTRUDER) @@ -83,20 +225,20 @@ void manage_inactivity(const bool ignore_stepper_queue=false); * Mixing steppers synchronize their enable (and direction) together */ #if MIXING_STEPPERS > 5 - #define enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); E2_ENABLE_WRITE( E_ENABLE_ON); E3_ENABLE_WRITE( E_ENABLE_ON); E4_ENABLE_WRITE( E_ENABLE_ON); E5_ENABLE_WRITE( E_ENABLE_ON); } - #define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); E2_ENABLE_WRITE(!E_ENABLE_ON); E3_ENABLE_WRITE(!E_ENABLE_ON); E4_ENABLE_WRITE(!E_ENABLE_ON); E5_ENABLE_WRITE(!E_ENABLE_ON); } + #define enable_E0() { E0_enable; E1_enable; E2_enable; E3_enable; E4_enable; E5_enable; } + #define disable_E0() { E0_disable; E1_disable; E2_disable; E3_disable; E4_disable; E5_disable; } #elif MIXING_STEPPERS > 4 - #define enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); E2_ENABLE_WRITE( E_ENABLE_ON); E3_ENABLE_WRITE( E_ENABLE_ON); E4_ENABLE_WRITE( E_ENABLE_ON); } - #define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); E2_ENABLE_WRITE(!E_ENABLE_ON); E3_ENABLE_WRITE(!E_ENABLE_ON); E4_ENABLE_WRITE(!E_ENABLE_ON); } + #define enable_E0() { E0_enable; E1_enable; E2_enable; E3_enable; E4_enable; } + #define disable_E0() { E0_disable; E1_disable; E2_disable; E3_disable; E4_disable; } #elif MIXING_STEPPERS > 3 - #define enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); E2_ENABLE_WRITE( E_ENABLE_ON); E3_ENABLE_WRITE( E_ENABLE_ON); } - #define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); E2_ENABLE_WRITE(!E_ENABLE_ON); E3_ENABLE_WRITE(!E_ENABLE_ON); } + #define enable_E0() { E0_enable; E1_enable; E2_enable; E3_enable; } + #define disable_E0() { E0_disable; E1_disable; E2_disable; E3_disable; } #elif MIXING_STEPPERS > 2 - #define enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); E2_ENABLE_WRITE( E_ENABLE_ON); } - #define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); E2_ENABLE_WRITE(!E_ENABLE_ON); } + #define enable_E0() { E0_enable; E1_enable; E2_enable; } + #define disable_E0() { E0_disable; E1_disable; E2_disable; } #else - #define enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); } - #define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); } + #define enable_E0() { E0_enable; E1_enable; } + #define disable_E0() { E0_disable; E1_disable; } #endif #define enable_E1() NOOP #define disable_E1() NOOP @@ -112,48 +254,48 @@ void manage_inactivity(const bool ignore_stepper_queue=false); #else // !MIXING_EXTRUDER #if HAS_E0_ENABLE - #define enable_E0() E0_ENABLE_WRITE( E_ENABLE_ON) - #define disable_E0() E0_ENABLE_WRITE(!E_ENABLE_ON) + #define enable_E0() E0_enable + #define disable_E0() E0_disable #else #define enable_E0() NOOP #define disable_E0() NOOP #endif #if E_STEPPERS > 1 && HAS_E1_ENABLE - #define enable_E1() E1_ENABLE_WRITE( E_ENABLE_ON) - #define disable_E1() E1_ENABLE_WRITE(!E_ENABLE_ON) + #define enable_E1() E1_enable + #define disable_E1() E1_disable #else #define enable_E1() NOOP #define disable_E1() NOOP #endif #if E_STEPPERS > 2 && HAS_E2_ENABLE - #define enable_E2() E2_ENABLE_WRITE( E_ENABLE_ON) - #define disable_E2() E2_ENABLE_WRITE(!E_ENABLE_ON) + #define enable_E2() E2_enable + #define disable_E2() E2_disable #else #define enable_E2() NOOP #define disable_E2() NOOP #endif #if E_STEPPERS > 3 && HAS_E3_ENABLE - #define enable_E3() E3_ENABLE_WRITE( E_ENABLE_ON) - #define disable_E3() E3_ENABLE_WRITE(!E_ENABLE_ON) + #define enable_E3() E3_enable + #define disable_E3() E3_disable #else #define enable_E3() NOOP #define disable_E3() NOOP #endif #if E_STEPPERS > 4 && HAS_E4_ENABLE - #define enable_E4() E4_ENABLE_WRITE( E_ENABLE_ON) - #define disable_E4() E4_ENABLE_WRITE(!E_ENABLE_ON) + #define enable_E4() E4_enable + #define disable_E4() E4_disable #else #define enable_E4() NOOP #define disable_E4() NOOP #endif #if E_STEPPERS > 5 && HAS_E5_ENABLE - #define enable_E5() E5_ENABLE_WRITE( E_ENABLE_ON) - #define disable_E5() E5_ENABLE_WRITE(!E_ENABLE_ON) + #define enable_E5() E5_enable + #define disable_E5() E5_disable #else #define enable_E5() NOOP #define disable_E5() NOOP @@ -167,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 /** @@ -188,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) @@ -201,23 +343,6 @@ extern volatile bool wait_for_heatup; // Inactivity shutdown timer extern millis_t max_inactive_time, stepper_inactive_time; -#if FAN_COUNT > 0 - extern uint8_t fan_speed[FAN_COUNT]; - #if ENABLED(EXTRA_FAN_SPEED) - extern uint8_t old_fan_speed[FAN_COUNT], new_fan_speed[FAN_COUNT]; - #endif - #if ENABLED(PROBING_FANS_OFF) - extern bool fans_paused; - extern uint8_t paused_fan_speed[FAN_COUNT]; - #endif -#endif - -inline void zero_fan_speeds() { - #if FAN_COUNT > 0 - LOOP_L_N(i, FAN_COUNT) fan_speed[i] = 0; - #endif -} - #if ENABLED(USE_CONTROLLER_FAN) extern uint8_t controllerfan_speed; #endif @@ -241,3 +366,12 @@ void protected_pin_err(); #if HAS_SUICIDE inline void suicide() { OUT_WRITE(SUICIDE_PIN, LOW); } #endif + +#if HAS_FILAMENT_SENSOR + void event_filament_runout(); +#endif + +#if ENABLED(G29_RETRY_AND_RECOVER) + void event_probe_recover(); + void event_probe_failure(); +#endif diff --git a/Marlin/src/config/examples/ArmEd/Configuration_adv.h b/Marlin/src/config/examples/ArmEd/Configuration_adv.h deleted file mode 100644 index aeb1448f30ca..000000000000 --- a/Marlin/src/config/examples/ArmEd/Configuration_adv.h +++ /dev/null @@ -1,1877 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -#pragma once - -/** - * Configuration_adv.h - * - * Advanced settings. - * Only change these if you know exactly what you're doing. - * Some of these settings can damage your printer if improperly set! - * - * Basic settings can be found in Configuration.h - * - */ -#define CONFIGURATION_ADV_H_VERSION 020000 - -// @section temperature - -//=========================================================================== -//=============================Thermal Settings ============================ -//=========================================================================== - -#define HEATER_BED_INVERTING true -#define HEATER_0_INVERTING true -#define HEATER_1_INVERTING true - -// -// Hephestos 2 24V heated bed upgrade kit. -// https://store.bq.com/en/heated-bed-kit-hephestos2 -// -//#define HEPHESTOS2_HEATED_BED_KIT -#if ENABLED(HEPHESTOS2_HEATED_BED_KIT) - #undef TEMP_SENSOR_BED - #define TEMP_SENSOR_BED 70 - #define HEATER_BED_INVERTING true -#endif - -#if DISABLED(PIDTEMPBED) - #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control - #if ENABLED(BED_LIMIT_SWITCHING) - #define BED_HYSTERESIS 2 // Only disable heating if T>target+BED_HYSTERESIS and enable heating if T>target-BED_HYSTERESIS - #endif -#endif - -/** - * Thermal Protection provides additional protection to your printer from damage - * and fire. Marlin always includes safe min and max temperature ranges which - * protect against a broken or disconnected thermistor wire. - * - * The issue: If a thermistor falls out, it will report the much lower - * temperature of the air in the room, and the the firmware will keep - * the heater on. - * - * The solution: Once the temperature reaches the target, start observing. - * If the temperature stays too far below the target (hysteresis) for too - * long (period), the firmware will halt the machine as a safety precaution. - * - * If you get false positives for "Thermal Runaway", increase - * THERMAL_PROTECTION_HYSTERESIS and/or THERMAL_PROTECTION_PERIOD - */ -#if ENABLED(THERMAL_PROTECTION_HOTENDS) - #define THERMAL_PROTECTION_PERIOD 40 // Seconds - #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius - - /** - * Whenever an M104, M109, or M303 increases the target temperature, the - * firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature - * hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted and - * requires a hard reset. This test restarts with any M104/M109/M303, but only - * if the current temperature is far enough below the target for a reliable - * test. - * - * If you get false positives for "Heating failed", increase WATCH_TEMP_PERIOD - * and/or decrease WATCH_TEMP_INCREASE. WATCH_TEMP_INCREASE should not be set - * below 2. - */ - #define WATCH_TEMP_PERIOD 20 // Seconds - #define WATCH_TEMP_INCREASE 2 // Degrees Celsius -#endif - -/** - * Thermal Protection parameters for the bed are just as above for hotends. - */ -#if ENABLED(THERMAL_PROTECTION_BED) - #define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds - #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius - - /** - * As described above, except for the bed (M140/M190/M303). - */ - #define WATCH_BED_TEMP_PERIOD 60 // Seconds - #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius -#endif - -#if ENABLED(PIDTEMP) - // this adds an experimental additional term to the heating power, proportional to the extrusion speed. - // if Kc is chosen well, the additional required power due to increased melting should be compensated. - //#define PID_EXTRUSION_SCALING - #if ENABLED(PID_EXTRUSION_SCALING) - #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) - #define LPQ_MAX_LEN 50 - #endif -#endif - -/** - * Automatic Temperature: - * The hotend target temperature is calculated by all the buffered lines of gcode. - * The maximum buffered steps/sec of the extruder motor is called "se". - * Start autotemp mode with M109 S B F - * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by - * mintemp and maxtemp. Turn this off by executing M109 without F* - * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp. - * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode - */ -#define AUTOTEMP -#if ENABLED(AUTOTEMP) - #define AUTOTEMP_OLDWEIGHT 0.98 -#endif - -// Show extra position information in M114 -//#define M114_DETAIL - -// Show Temperature ADC value -// Enable for M105 to include ADC values read from temperature sensors. -//#define SHOW_TEMP_ADC_VALUES - -/** - * High Temperature Thermistor Support - * - * Thermistors able to support high temperature tend to have a hard time getting - * good readings at room and lower temperatures. This means HEATER_X_RAW_LO_TEMP - * will probably be caught when the heating element first turns on during the - * preheating process, which will trigger a min_temp_error as a safety measure - * and force stop everything. - * To circumvent this limitation, we allow for a preheat time (during which, - * min_temp_error won't be triggered) and add a min_temp buffer to handle - * aberrant readings. - * - * If you want to enable this feature for your hotend thermistor(s) - * uncomment and set values > 0 in the constants below - */ - -// The number of consecutive low temperature errors that can occur -// before a min_temp_error is triggered. (Shouldn't be more than 10.) -//#define MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED 0 - -// The number of milliseconds a hotend will preheat before starting to check -// the temperature. This value should NOT be set to the time it takes the -// hot end to reach the target temperature, but the time it takes to reach -// the minimum temperature your thermistor can read. The lower the better/safer. -// This shouldn't need to be more than 30 seconds (30000) -//#define MILLISECONDS_PREHEAT_TIME 0 - -// @section extruder - -// Extruder runout prevention. -// If the machine is idle and the temperature over MINTEMP -// then extrude some filament every couple of SECONDS. -//#define EXTRUDER_RUNOUT_PREVENT -#if ENABLED(EXTRUDER_RUNOUT_PREVENT) - #define EXTRUDER_RUNOUT_MINTEMP 190 - #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) - #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) -#endif - -// @section temperature - -// Calibration for AD595 / AD8495 sensor to adjust temperature measurements. -// The final temperature is calculated as (measuredTemp * GAIN) + OFFSET. -#define TEMP_SENSOR_AD595_OFFSET 0.0 -#define TEMP_SENSOR_AD595_GAIN 1.0 -#define TEMP_SENSOR_AD8495_OFFSET 0.0 -#define TEMP_SENSOR_AD8495_GAIN 1.0 - -/** - * Controller Fan - * To cool down the stepper drivers and MOSFETs. - * - * The fan will turn on automatically whenever any stepper is enabled - * and turn off after a set period after all steppers are turned off. - */ -//#define USE_CONTROLLER_FAN -#if ENABLED(USE_CONTROLLER_FAN) - //#define CONTROLLER_FAN_PIN -1 // Set a custom pin for the controller fan - #define CONTROLLERFAN_SECS 60 // Duration in seconds for the fan to run after all motors are disabled - #define CONTROLLERFAN_SPEED 255 // 255 == full speed -#endif - -// When first starting the main fan, run it at full speed for the -// given number of milliseconds. This gets the fan spinning reliably -// before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu) -//#define FAN_KICKSTART_TIME 100 - -/** - * PWM Fan Scaling - * - * Define the min/max speeds for PWM fans (as set with M106). - * - * With these options the M106 0-255 value range is scaled to a subset - * to ensure that the fan has enough power to spin, or to run lower - * current fans with higher current. (e.g., 5V/12V fans with 12V/24V) - * Value 0 always turns off the fan. - * - * Define one or both of these to override the default 0-255 range. - */ -//#define FAN_MIN_PWM 50 -//#define FAN_MAX_PWM 128 - -// @section extruder - -/** - * Extruder cooling fans - * - * Extruder auto fans automatically turn on when their extruders' - * temperatures go above EXTRUDER_AUTO_FAN_TEMPERATURE. - * - * Your board's pins file specifies the recommended pins. Override those here - * or set to -1 to disable completely. - * - * Multiple extruders can be assigned to the same pin in which case - * the fan will turn on when any selected extruder is above the threshold. - */ -#define E0_AUTO_FAN_PIN -1 -#define E1_AUTO_FAN_PIN -1 -#define E2_AUTO_FAN_PIN -1 -#define E3_AUTO_FAN_PIN -1 -#define E4_AUTO_FAN_PIN -1 -#define E5_AUTO_FAN_PIN -1 -#define CHAMBER_AUTO_FAN_PIN -1 -#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed - -/** - * Part-Cooling Fan Multiplexer - * - * This feature allows you to digitally multiplex the fan output. - * The multiplexer is automatically switched at tool-change. - * Set FANMUX[012]_PINs below for up to 2, 4, or 8 multiplexed fans. - */ -#define FANMUX0_PIN -1 -#define FANMUX1_PIN -1 -#define FANMUX2_PIN -1 - -/** - * M355 Case Light on-off / brightness - */ -//#define CASE_LIGHT_ENABLE -#if ENABLED(CASE_LIGHT_ENABLE) - //#define CASE_LIGHT_PIN 4 // Override the default pin if needed - #define INVERT_CASE_LIGHT false // Set true if Case Light is ON when pin is LOW - #define CASE_LIGHT_DEFAULT_ON true // Set default power-up state on - #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105 // Set default power-up brightness (0-255, requires PWM pin) - //#define MENU_ITEM_CASE_LIGHT // Add a Case Light option to the LCD main menu - //#define CASE_LIGHT_USE_NEOPIXEL // Use Neopixel LED as case light, requires NEOPIXEL_LED. - #if ENABLED(CASE_LIGHT_USE_NEOPIXEL) - #define CASE_LIGHT_NEOPIXEL_COLOR { 255, 255, 255, 255 } // { Red, Green, Blue, White } - #endif -#endif - -//=========================================================================== -//============================ Mechanical Settings ========================== -//=========================================================================== - -// @section homing - -// If you want endstops to stay on (by default) even when not homing -// enable this option. Override at any time with M120, M121. -//#define ENDSTOPS_ALWAYS_ON_DEFAULT - -// @section extras - -//#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. - -// Employ an external closed loop controller. Override pins here if needed. -//#define EXTERNAL_CLOSED_LOOP_CONTROLLER -#if ENABLED(EXTERNAL_CLOSED_LOOP_CONTROLLER) - //#define CLOSED_LOOP_ENABLE_PIN -1 - //#define CLOSED_LOOP_MOVE_COMPLETE_PIN -1 -#endif - -/** - * Dual Steppers / Dual Endstops - * - * This section will allow you to use extra E drivers to drive a second motor for X, Y, or Z axes. - * - * For example, set X_DUAL_STEPPER_DRIVERS setting to use a second motor. If the motors need to - * spin in opposite directions set INVERT_X2_VS_X_DIR. If the second motor needs its own endstop - * set X_DUAL_ENDSTOPS. This can adjust for "racking." Use X2_USE_ENDSTOP to set the endstop plug - * that should be used for the second endstop. Extra endstops will appear in the output of 'M119'. - * - * Use X_DUAL_ENDSTOP_ADJUSTMENT to adjust for mechanical imperfection. After homing both motors - * this offset is applied to the X2 motor. To find the offset home the X axis, and measure the error - * in X2. Dual endstop offsets can be set at runtime with 'M666 X Y Z'. - */ - -//#define X_DUAL_STEPPER_DRIVERS -#if ENABLED(X_DUAL_STEPPER_DRIVERS) - #define INVERT_X2_VS_X_DIR true // Set 'true' if X motors should rotate in opposite directions - //#define X_DUAL_ENDSTOPS - #if ENABLED(X_DUAL_ENDSTOPS) - #define X2_USE_ENDSTOP _XMAX_ - #define X_DUAL_ENDSTOPS_ADJUSTMENT 0 - #endif -#endif - -//#define Y_DUAL_STEPPER_DRIVERS -#if ENABLED(Y_DUAL_STEPPER_DRIVERS) - #define INVERT_Y2_VS_Y_DIR true // Set 'true' if Y motors should rotate in opposite directions - //#define Y_DUAL_ENDSTOPS - #if ENABLED(Y_DUAL_ENDSTOPS) - #define Y2_USE_ENDSTOP _YMAX_ - #define Y_DUAL_ENDSTOPS_ADJUSTMENT 0 - #endif -#endif - -//#define Z_DUAL_STEPPER_DRIVERS -#if ENABLED(Z_DUAL_STEPPER_DRIVERS) - //#define Z_DUAL_ENDSTOPS - #if ENABLED(Z_DUAL_ENDSTOPS) - #define Z2_USE_ENDSTOP _XMAX_ - #define Z_DUAL_ENDSTOPS_ADJUSTMENT 0 - #endif -#endif - -//#define Z_TRIPLE_STEPPER_DRIVERS -#if ENABLED(Z_TRIPLE_STEPPER_DRIVERS) - //#define Z_TRIPLE_ENDSTOPS - #if ENABLED(Z_TRIPLE_ENDSTOPS) - #define Z2_USE_ENDSTOP _XMAX_ - #define Z3_USE_ENDSTOP _YMAX_ - #define Z_TRIPLE_ENDSTOPS_ADJUSTMENT2 0 - #define Z_TRIPLE_ENDSTOPS_ADJUSTMENT3 0 - #endif -#endif - -/** - * Dual X Carriage - * - * This setup has two X carriages that can move independently, each with its own hotend. - * The carriages can be used to print an object with two colors or materials, or in - * "duplication mode" it can print two identical or X-mirrored objects simultaneously. - * The inactive carriage is parked automatically to prevent oozing. - * X1 is the left carriage, X2 the right. They park and home at opposite ends of the X axis. - * By default the X2 stepper is assigned to the first unused E plug on the board. - */ -//#define DUAL_X_CARRIAGE -#if ENABLED(DUAL_X_CARRIAGE) - #define X1_MIN_POS X_MIN_POS // set minimum to ensure first x-carriage doesn't hit the parked second X-carriage - #define X1_MAX_POS X_BED_SIZE // set maximum to ensure first x-carriage doesn't hit the parked second X-carriage - #define X2_MIN_POS 80 // set minimum to ensure second x-carriage doesn't hit the parked first X-carriage - #define X2_MAX_POS 353 // set maximum to the distance between toolheads when both heads are homed - #define X2_HOME_DIR 1 // the second X-carriage always homes to the maximum endstop position - #define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position - // However: In this mode the HOTEND_OFFSET_X value for the second extruder provides a software - // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops - // without modifying the firmware (through the "M218 T1 X???" command). - // Remember: you should set the second extruder x-offset to 0 in your slicer. - - // There are a few selectable movement modes for dual x-carriages using M605 S - // Mode 0 (DXC_FULL_CONTROL_MODE): Full control. The slicer has full control over both x-carriages and can achieve optimal travel results - // as long as it supports dual x-carriages. (M605 S0) - // Mode 1 (DXC_AUTO_PARK_MODE) : Auto-park mode. The firmware will automatically park and unpark the x-carriages on tool changes so - // that additional slicer support is not required. (M605 S1) - // Mode 2 (DXC_DUPLICATION_MODE) : Duplication mode. The firmware will transparently make the second x-carriage and extruder copy all - // actions of the first x-carriage. This allows the printer to print 2 arbitrary items at - // once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm]) - - // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - - // Default x offset in duplication mode (typically set to half print bed width) - #define DEFAULT_DUPLICATION_X_OFFSET 100 - -#endif // DUAL_X_CARRIAGE - -// Activate a solenoid on the active extruder with M380. Disable all with M381. -// Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid. -//#define EXT_SOLENOID - -// @section homing - -// Homing hits each endstop, retracts by these distances, then does a slower bump. -#define X_HOME_BUMP_MM 5 -#define Y_HOME_BUMP_MM 5 -#define Z_HOME_BUMP_MM 2 -#define HOMING_BUMP_DIVISOR { 2, 2, 4 } // Re-Bump Speed Divisor (Divides the Homing Feedrate) -//#define QUICK_HOME // If homing includes X and Y, do a diagonal move initially - -// When G28 is called, this option will make Y home before X -//#define HOME_Y_BEFORE_X - -// Enable this if X or Y can't home without homing the other axis first. -//#define CODEPENDENT_XY_HOMING - -// @section machine - -#define AXIS_RELATIVE_MODES {false, false, false, false} - -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE - -// By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step. -#define INVERT_X_STEP_PIN false -#define INVERT_Y_STEP_PIN false -#define INVERT_Z_STEP_PIN false -#define INVERT_E_STEP_PIN false - -// Default stepper release if idle. Set to 0 to deactivate. -// Steppers will shut down DEFAULT_STEPPER_DEACTIVE_TIME seconds after the last move when DISABLE_INACTIVE_? is true. -// Time can be set by M18 and M84. -#define DEFAULT_STEPPER_DEACTIVE_TIME 120 -#define DISABLE_INACTIVE_X true -#define DISABLE_INACTIVE_Y true -#define DISABLE_INACTIVE_Z true // set to false if the nozzle will fall down on your printed part when print has finished. -#define DISABLE_INACTIVE_E true - -#define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate -#define DEFAULT_MINTRAVELFEEDRATE 0.0 - -//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated - -// @section lcd - -#if ENABLED(ULTIPANEL) - #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60} // Feedrates for manual moves along X, Y, Z, E from panel - #define MANUAL_E_MOVES_RELATIVE // Show LCD extruder moves as relative rather than absolute positions - #define ULTIPANEL_FEEDMULTIPLY // Comment to disable setting feedrate multiplier via encoder -#endif - -// @section extras - -// minimum time in microseconds that a movement needs to take if the buffer is emptied. -#define DEFAULT_MINSEGMENTTIME 20000 - -// If defined the movements slow down when the look ahead buffer is only half full -#define SLOWDOWN - -// Frequency limit -// See nophead's blog for more info -// Not working O -//#define XY_FREQUENCY_LIMIT 15 - -// Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end -// of the buffer and all stops. This should not be much greater than zero and should only be changed -// if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) - -// -// Use Junction Deviation instead of traditional Jerk Limiting -// -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge -#endif - -/** - * Adaptive Step Smoothing increases the resolution of multi-axis moves, particularly at step frequencies - * below 1kHz (for AVR) or 10kHz (for ARM), where aliasing between axes in multi-axis moves causes audible - * vibration and surface artifacts. The algorithm adapts to provide the best possible step smoothing at the - * lowest stepping frequencies. - */ -//#define ADAPTIVE_STEP_SMOOTHING - -// Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. -#define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] - -/** - * @section stepper motor current - * - * Some boards have a means of setting the stepper motor current via firmware. - * - * The power on motor currents are set by: - * PWM_MOTOR_CURRENT - used by MINIRAMBO & ULTIMAIN_2 - * known compatible chips: A4982 - * DIGIPOT_MOTOR_CURRENT - used by BQ_ZUM_MEGA_3D, RAMBO & SCOOVO_X9H - * known compatible chips: AD5206 - * DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 - * known compatible chips: MCP4728 - * DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT, AZTEEG_X3_PRO, AZTEEG_X5_MINI_WIFI, MIGHTYBOARD_REVE - * known compatible chips: MCP4451, MCP4018 - * - * Motor currents can also be set by M907 - M910 and by the LCD. - * M907 - applies to all. - * M908 - BQ_ZUM_MEGA_3D, RAMBO, PRINTRBOARD_REVF, RIGIDBOARD_V2 & SCOOVO_X9H - * M909, M910 & LCD - only PRINTRBOARD_REVF & RIGIDBOARD_V2 - */ -//#define PWM_MOTOR_CURRENT { 1300, 1300, 1250 } // Values in milliamps -//#define DIGIPOT_MOTOR_CURRENT { 135,135,135,135,135 } // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A) -//#define DAC_MOTOR_CURRENT_DEFAULT { 70, 80, 90, 80 } // Default drive percent - X, Y, Z, E axis - -// Use an I2C based DIGIPOT (e.g., Azteeg X3 Pro) -//#define DIGIPOT_I2C -#if ENABLED(DIGIPOT_I2C) && !defined(DIGIPOT_I2C_ADDRESS_A) - /** - * Common slave addresses: - * - * A (A shifted) B (B shifted) IC - * Smoothie 0x2C (0x58) 0x2D (0x5A) MCP4451 - * AZTEEG_X3_PRO 0x2C (0x58) 0x2E (0x5C) MCP4451 - * AZTEEG_X5_MINI_WIFI 0x58 0x5C MCP4451 - * MIGHTYBOARD_REVE 0x2F (0x5E) MCP4018 - */ - #define DIGIPOT_I2C_ADDRESS_A 0x2C // unshifted slave address for first DIGIPOT - #define DIGIPOT_I2C_ADDRESS_B 0x2D // unshifted slave address for second DIGIPOT -#endif - -//#define DIGIPOT_MCP4018 // Requires library from https://github.com/stawel/SlowSoftI2CMaster -#define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4 AZTEEG_X3_PRO: 8 MKS SBASE: 5 -// Actual motor currents in Amps. The number of entries must match DIGIPOT_I2C_NUM_CHANNELS. -// These correspond to the physical drivers, so be mindful if the order is changed. -#define DIGIPOT_I2C_MOTOR_CURRENTS { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 } // AZTEEG_X3_PRO - -//=========================================================================== -//=============================Additional Features=========================== -//=========================================================================== - -// @section lcd - -// Change values more rapidly when the encoder is rotated faster -#define ENCODER_RATE_MULTIPLIER -#if ENABLED(ENCODER_RATE_MULTIPLIER) - #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed - #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed -#endif - -// Include a page of printer information in the LCD Main Menu -//#define LCD_INFO_MENU - -// Scroll a longer status message into view -//#define STATUS_MESSAGE_SCROLLING - -// On the Info Screen, display XY with one decimal place when possible -//#define LCD_DECIMAL_SMALL_XY - -// The timeout (in ms) to return to the status screen from sub-menus -//#define LCD_TIMEOUT_TO_STATUS 15000 - -// Add an 'M73' G-code to set the current percentage -//#define LCD_SET_PROGRESS_MANUALLY - -#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS - //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing - #if ENABLED(LCD_PROGRESS_BAR) - #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar - #define PROGRESS_BAR_MSG_TIME 3000 // (ms) Amount of time to show the status message - #define PROGRESS_MSG_EXPIRE 0 // (ms) Amount of time to retain the status message (0=forever) - //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it - //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar - #endif -#endif // HAS_PRINT_PROGRESS - -/** - * LED Control Menu - * Enable this feature to add LED Control to the LCD menu - */ -//#define LED_CONTROL_MENU -#if ENABLED(LED_CONTROL_MENU) - #define LED_COLOR_PRESETS // Enable the Preset Color menu option - #if ENABLED(LED_COLOR_PRESETS) - #define LED_USER_PRESET_RED 255 // User defined RED value - #define LED_USER_PRESET_GREEN 128 // User defined GREEN value - #define LED_USER_PRESET_BLUE 0 // User defined BLUE value - #define LED_USER_PRESET_WHITE 255 // User defined WHITE value - #define LED_USER_PRESET_BRIGHTNESS 255 // User defined intensity - //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup - #endif -#endif // LED_CONTROL_MENU - -#if ENABLED(SDSUPPORT) - - // Some RAMPS and other boards don't detect when an SD card is inserted. You can work - // around this by connecting a push button or single throw switch to the pin defined - // as SD_DETECT_PIN in your board's pins definitions. - // This setting should be disabled unless you are using a push button, pulling the pin to ground. - // Note: This is always disabled for ULTIPANEL (except ELB_FULL_GRAPHIC_CONTROLLER). - #define SD_DETECT_INVERTED - - #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. - - // Reverse SD sort to show "more recent" files first, according to the card's FAT. - // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. - #define SDCARD_RATHERRECENTFIRST - - // Add an option in the menu to run all auto#.g files - //#define MENU_ADDAUTOSTART - - /** - * Continue after Power-Loss (Creality3D) - * - * Store the current state to the SD Card at the start of each layer - * during SD printing. If the recovery file is found at boot time, present - * an option on the LCD screen to continue the print from the last-known - * point in the file. - */ - //#define POWER_LOSS_RECOVERY - #if ENABLED(POWER_LOSS_RECOVERY) - //#define POWER_LOSS_PIN 44 // Pin to detect power loss - //#define POWER_LOSS_STATE HIGH // State of pin indicating power loss - #endif - - /** - * Sort SD file listings in alphabetical order. - * - * With this option enabled, items on SD cards will be sorted - * by name for easier navigation. - * - * By default... - * - * - Use the slowest -but safest- method for sorting. - * - Folders are sorted to the top. - * - The sort key is statically allocated. - * - No added G-code (M34) support. - * - 40 item sorting limit. (Items after the first 40 are unsorted.) - * - * SD sorting uses static allocation (as set by SDSORT_LIMIT), allowing the - * compiler to calculate the worst-case usage and throw an error if the SRAM - * limit is exceeded. - * - * - SDSORT_USES_RAM provides faster sorting via a static directory buffer. - * - SDSORT_USES_STACK does the same, but uses a local stack-based buffer. - * - SDSORT_CACHE_NAMES will retain the sorted file listing in RAM. (Expensive!) - * - SDSORT_DYNAMIC_RAM only uses RAM when the SD menu is visible. (Use with caution!) - */ - //#define SDCARD_SORT_ALPHA - - // SD Card Sorting options - #if ENABLED(SDCARD_SORT_ALPHA) - #define SDSORT_LIMIT 40 // Maximum number of sorted items (10-256). Costs 27 bytes each. - #define FOLDER_SORTING -1 // -1=above 0=none 1=below - #define SDSORT_GCODE false // Allow turning sorting on/off with LCD and M34 g-code. - #define SDSORT_USES_RAM false // Pre-allocate a static array for faster pre-sorting. - #define SDSORT_USES_STACK false // Prefer the stack for pre-sorting to give back some SRAM. (Negated by next 2 options.) - #define SDSORT_CACHE_NAMES false // Keep sorted items in RAM longer for speedy performance. Most expensive option. - #define SDSORT_DYNAMIC_RAM false // Use dynamic allocation (within SD menus). Least expensive option. Set SDSORT_LIMIT before use! - #define SDSORT_CACHE_VFATS 2 // Maximum number of 13-byte VFAT entries to use for sorting. - // Note: Only affects SCROLL_LONG_FILENAMES with SDSORT_CACHE_NAMES but not SDSORT_DYNAMIC_RAM. - #endif - - // This allows hosts to request long names for files and folders with M33 - //#define LONG_FILENAME_HOST_SUPPORT - - // Enable this option to scroll long filenames in the SD card menu - //#define SCROLL_LONG_FILENAMES - - /** - * This option allows you to abort SD printing when any endstop is triggered. - * This feature must be enabled with "M540 S1" or from the LCD menu. - * To have any effect, endstops must be enabled during SD printing. - */ - //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED - - /** - * This option makes it easier to print the same SD Card file again. - * On print completion the LCD Menu will open with the file selected. - * You can just click to start the print, or navigate elsewhere. - */ - //#define SD_REPRINT_LAST_SELECTED_FILE - - /** - * Auto-report SdCard status with M27 S - */ - //#define AUTO_REPORT_SD_STATUS - - /** - * Support for USB thumb drives using an Arduino USB Host Shield or - * equivalent MAX3421E breakout board. The USB thumb drive will appear - * to Marlin as an SD card. - * - * The MAX3421E must be assigned the same pins as the SD card reader, with - * the following pin mapping: - * - * SCLK, MOSI, MISO --> SCLK, MOSI, MISO - * INT --> SD_DETECT_PIN - * SS --> SDSS - */ - //#define USB_FLASH_DRIVE_SUPPORT - #if ENABLED(USB_FLASH_DRIVE_SUPPORT) - #define USB_CS_PIN SDSS - #define USB_INTR_PIN SD_DETECT_PIN - #endif - - /** - * When using a bootloader that supports SD-Firmware-Flashing, - * add a menu item to activate SD-FW-Update on the next reboot. - * - * Requires ATMEGA2560 (Arduino Mega) - * - * Tested with this bootloader: - * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 - */ - //#define SD_FIRMWARE_UPDATE - #if ENABLED(SD_FIRMWARE_UPDATE) - #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF - #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 - #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF - #endif - - // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER - -#endif // SDSUPPORT - -/** - * Additional options for Graphical Displays - * - * Use the optimizations here to improve printing performance, - * which can be adversely affected by graphical display drawing, - * especially when doing several short moves, and when printing - * on DELTA and SCARA machines. - * - * Some of these options may result in the display lagging behind - * controller events, as there is a trade-off between reliable - * printing performance versus fast display updates. - */ -#if HAS_GRAPHICAL_LCD - // Show SD percentage next to the progress bar - //#define DOGM_SD_PERCENT - - // Enable to save many cycles by drawing a hollow frame on the Info Screen - #define XYZ_HOLLOW_FRAME - - // Enable to save many cycles by drawing a hollow frame on Menu Screens - #define MENU_HOLLOW_FRAME - - // A bigger font is available for edit items. Costs 3120 bytes of PROGMEM. - // Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese. - //#define USE_BIG_EDIT_FONT - - // A smaller font may be used on the Info Screen. Costs 2300 bytes of PROGMEM. - // Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese. - //#define USE_SMALL_INFOFONT - - // Enable this option and reduce the value to optimize screen updates. - // The normal delay is 10µs. Use the lowest value that still gives a reliable display. - //#define DOGM_SPI_DELAY_US 5 - - // Swap the CW/CCW indicators in the graphics overlay - //#define OVERLAY_GFX_REVERSE - - #if ENABLED(U8GLIB_ST7920) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ - //#define LIGHTWEIGHT_UI - #if ENABLED(LIGHTWEIGHT_UI) - #define STATUS_EXPIRE_SECONDS 20 - #endif - #endif - - /** - * 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_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_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - #endif - - //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif - - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor - #endif -#endif - -// @section extruder - -/** - * Linear Pressure Control v1.5 - * - * Assumption: advance [steps] = k * (delta velocity [steps/s]) - * K=0 means advance disabled. - * - * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! - * - * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. - * Larger K values will be needed for flexible filament and greater distances. - * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) - * print acceleration will be reduced during the affected moves to keep within the limit. - * - * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. - * Mention @Sebastianv650 on GitHub to alert the author of any issues. - */ -//#define LIN_ADVANCE -#if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed - //#define LA_DEBUG // If enabled, this will generate debug information output over USB. -#endif - -// @section leveling - -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_UBL) - // Override the mesh area if the automatic (max) area is too large - //#define MESH_MIN_X MESH_INSET - //#define MESH_MIN_Y MESH_INSET - //#define MESH_MAX_X X_BED_SIZE - (MESH_INSET) - //#define MESH_MAX_Y Y_BED_SIZE - (MESH_INSET) -#endif - -/** - * Repeatedly attempt G29 leveling until it succeeds. - * Stop after G29_MAX_RETRIES attempts. - */ -//#define G29_RETRY_AND_RECOVER -#if ENABLED(G29_RETRY_AND_RECOVER) - #define G29_MAX_RETRIES 3 - #define G29_HALT_ON_FAILURE - /** - * Specify the GCODE commands that will be executed when leveling succeeds, - * between attempts, and after the maximum number of retries have been tried. - */ - #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." - #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" - #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" -#endif - -// @section extras - -// -// G2/G3 Arc Support -// -#define ARC_SUPPORT // Disable this feature to save ~3226 bytes -#if ENABLED(ARC_SUPPORT) - #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment - #define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections - //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles - //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes -#endif - -// Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. -//#define BEZIER_CURVE_SUPPORT - -// G38.2 and G38.3 Probe Target -// Set MULTIPLE_PROBING if you want G38 to double touch -//#define G38_PROBE_TARGET -#if ENABLED(G38_PROBE_TARGET) - #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move) -#endif - -// Moves (or segments) with fewer steps than this will be joined with the next move -#define MIN_STEPS_PER_SEGMENT 6 - -/** - * Minimum delay after setting the stepper DIR (in ns) - * 0 : No delay (Expect at least 10µS since one Stepper ISR must transpire) - * 20 : Minimum for TMC2xxx drivers - * 200 : Minimum for A4988 drivers - * 400 : Minimum for A5984 drivers - * 500 : Minimum for LV8729 drivers (guess, no info in datasheet) - * 650 : Minimum for DRV8825 drivers - * 1500 : Minimum for TB6600 drivers (guess, no info in datasheet) - * 15000 : Minimum for TB6560 drivers (guess, no info in datasheet) - * - * Override the default value based on the driver type set in Configuration.h. - */ -//#define MINIMUM_STEPPER_DIR_DELAY 650 - -/** - * Minimum stepper driver pulse width (in µs) - * 0 : Smallest possible width the MCU can produce, compatible with TMC2xxx drivers - * 1 : Minimum for A4988, A5984, and LV8729 stepper drivers - * 2 : Minimum for DRV8825 stepper drivers - * 3 : Minimum for TB6600 stepper drivers - * 30 : Minimum for TB6560 stepper drivers - * - * Override the default value based on the driver type set in Configuration.h. - */ -//#define MINIMUM_STEPPER_PULSE 2 - -/** - * Maximum stepping rate (in Hz) the stepper driver allows - * If undefined, defaults to 1MHz / (2 * MINIMUM_STEPPER_PULSE) - * 500000 : Maximum for A4988 stepper driver - * 400000 : Maximum for TMC2xxx stepper drivers - * 250000 : Maximum for DRV8825 stepper driver - * 150000 : Maximum for TB6600 stepper driver - * 130000 : Maximum for LV8729 stepper driver - * 15000 : Maximum for TB6560 stepper driver - * - * Override the default value based on the driver type set in Configuration.h. - */ -//#define MAXIMUM_STEPPER_RATE 250000 - -// @section temperature - -// Control heater 0 and heater 1 in parallel. -//#define HEATERS_PARALLEL - -//=========================================================================== -//================================= Buffers ================================= -//=========================================================================== - -// @section hidden - -// The number of linear motions that can be in the plan at any give time. -// THE BLOCK_BUFFER_SIZE NEEDS TO BE A POWER OF 2 (e.g. 8, 16, 32) because shifts and ors are used to do the ring-buffering. -#if ENABLED(SDSUPPORT) - #define BLOCK_BUFFER_SIZE 16 // SD,LCD,Buttons take more memory, block buffer needs to be smaller -#else - #define BLOCK_BUFFER_SIZE 16 // maximize block buffer -#endif - -// @section serial - -// The ASCII buffer for serial input -#define MAX_CMD_SIZE 96 -#define BUFSIZE 4 - -// Transmission to Host Buffer Size -// To save 386 bytes of PROGMEM (and TX_BUFFER_SIZE+3 bytes of RAM) set to 0. -// To buffer a simple "ok" you need 4 bytes. -// For ADVANCED_OK (M105) you need 32 bytes. -// For debug-echo: 128 bytes for the optimal speed. -// Other output doesn't need to be that speedy. -// :[0, 2, 4, 8, 16, 32, 64, 128, 256] -#define TX_BUFFER_SIZE 0 - -// Host Receive Buffer Size -// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough. -// To use flow control, set this buffer size to at least 1024 bytes. -// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048] -//#define RX_BUFFER_SIZE 1024 - -#if RX_BUFFER_SIZE >= 1024 - // Enable to have the controller send XON/XOFF control characters to - // the host to signal the RX buffer is becoming full. - //#define SERIAL_XON_XOFF -#endif - -#if ENABLED(SDSUPPORT) - // Enable this option to collect and display the maximum - // RX queue usage after transferring a file to SD. - //#define SERIAL_STATS_MAX_RX_QUEUED - - // Enable this option to collect and display the number - // of dropped bytes after a file transfer to SD. - //#define SERIAL_STATS_DROPPED_RX -#endif - -// Enable an emergency-command parser to intercept certain commands as they -// enter the serial receive buffer, so they cannot be blocked. -// Currently handles M108, M112, M410 -// Does not work on boards using AT90USB (USBCON) processors! -//#define EMERGENCY_PARSER - -// Bad Serial-connections can miss a received command by sending an 'ok' -// Therefore some clients abort after 30 seconds in a timeout. -// Some other clients start sending commands while receiving a 'wait'. -// This "wait" is only sent when the buffer is empty. 1 second is a good value here. -//#define NO_TIMEOUTS 1000 // Milliseconds - -// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary. -//#define ADVANCED_OK - -// 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_SWAP_RETRACT_SPEED 3600 // (mm/m) - #define TOOLCHANGE_FIL_SWAP_PRIME_SPEED 3600 // (mm/m) - #endif - - /** - * Position to park head during tool change. - * Doesn't apply to SWITCHING_TOOLHEAD, DUAL_X_CARRIAGE, or PARKING_EXTRUDER - */ - //#define TOOLCHANGE_PARK - #if ENABLED(TOOLCHANGE_PARK) - #define TOOLCHANGE_PARK_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } - #define TOOLCHANGE_PARK_XY_FEEDRATE 6000 // (mm/m) - #endif -#endif - -/** - * Advanced Pause - * Experimental feature for filament change support and for parking the nozzle when paused. - * Adds the GCode M600 for initiating filament change. - * If PARK_HEAD_ON_PAUSE enabled, adds the GCode M125 to pause printing and park the nozzle. - * - * Requires an LCD display. - * Requires NOZZLE_PARK_FEATURE. - * This feature is required for the default FILAMENT_RUNOUT_SCRIPT. - */ -//#define ADVANCED_PAUSE_FEATURE -#if ENABLED(ADVANCED_PAUSE_FEATURE) - #define PAUSE_PARK_RETRACT_FEEDRATE 60 // (mm/s) Initial retract feedrate. - #define PAUSE_PARK_RETRACT_LENGTH 2 // (mm) Initial retract. - // This short retract is done immediately, before parking the nozzle. - #define FILAMENT_CHANGE_UNLOAD_FEEDRATE 10 // (mm/s) Unload filament feedrate. This can be pretty fast. - #define FILAMENT_CHANGE_UNLOAD_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate. - #define FILAMENT_CHANGE_UNLOAD_LENGTH 100 // (mm) The length of filament for a complete unload. - // For Bowden, the full length of the tube and nozzle. - // For direct drive, the full length of the nozzle. - // Set to 0 for manual unloading. - #define FILAMENT_CHANGE_SLOW_LOAD_FEEDRATE 6 // (mm/s) Slow move when starting load. - #define FILAMENT_CHANGE_SLOW_LOAD_LENGTH 0 // (mm) Slow length, to allow time to insert material. - // 0 to disable start loading and skip to fast load only - #define FILAMENT_CHANGE_FAST_LOAD_FEEDRATE 6 // (mm/s) Load filament feedrate. This can be pretty fast. - #define FILAMENT_CHANGE_FAST_LOAD_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate. - #define FILAMENT_CHANGE_FAST_LOAD_LENGTH 0 // (mm) Load length of filament, from extruder gear to nozzle. - // For Bowden, the full length of the tube and nozzle. - // For direct drive, the full length of the nozzle. - //#define ADVANCED_PAUSE_CONTINUOUS_PURGE // Purge continuously up to the purge length until interrupted. - #define ADVANCED_PAUSE_PURGE_FEEDRATE 3 // (mm/s) Extrude feedrate (after loading). Should be slower than load feedrate. - #define ADVANCED_PAUSE_PURGE_LENGTH 50 // (mm) Length to extrude after loading. - // Set to 0 for manual extrusion. - // Filament can be extruded repeatedly from the Filament Change menu - // until extrusion is consistent, and to purge old filament. - - // Filament Unload does a Retract, Delay, and Purge first: - #define FILAMENT_UNLOAD_RETRACT_LENGTH 13 // (mm) Unload initial retract length. - #define FILAMENT_UNLOAD_DELAY 5000 // (ms) Delay for the filament to cool after retract. - #define FILAMENT_UNLOAD_PURGE_LENGTH 8 // (mm) An unretract is done, then this length is purged. - - #define PAUSE_PARK_NOZZLE_TIMEOUT 45 // (seconds) Time limit before the nozzle is turned off for safety. - #define FILAMENT_CHANGE_ALERT_BEEPS 10 // Number of alert beeps to play when a response is needed. - #define PAUSE_PARK_NO_STEPPER_TIMEOUT // Enable for XYZ steppers to stay powered on during filament change. - - //#define PARK_HEAD_ON_PAUSE // Park the nozzle during pause and filament change. - //#define HOME_BEFORE_FILAMENT_CHANGE // Ensure homing has been completed prior to parking for filament change - - //#define FILAMENT_LOAD_UNLOAD_GCODES // Add M701/M702 Load/Unload G-codes, plus Load/Unload in the LCD Prepare menu. - - //#define FILAMENT_UNLOAD_ALL_EXTRUDERS // Allow M702 to unload all extruders above a minimum target temp (as set by M302) -#endif - -// @section tmc - -/** - * TMC26X Stepper Driver options - * - * The TMC26XStepper library is required for this stepper driver. - * https://github.com/trinamic/TMC26XStepper - */ -#if HAS_DRIVER(TMC26X) - - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps - - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 - - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 - - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 - - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 - - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 - - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 - - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 - - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 - - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 - - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 - - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 - - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 - -#endif // TMC26X - -// @section tmc_smart - -/** - * To use TMC2130 stepper drivers in SPI mode connect your SPI pins to - * the hardware SPI interface on your board and define the required CS pins - * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.). - * You may also use software SPI if you wish to use general purpose IO pins. - * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. - * The drivers can also be used with hardware serial. - * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper - */ -#if HAS_TRINAMIC - - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 - #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current - #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 - - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 - - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 - - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 - - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 - - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 - - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 - - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 - - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 - - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 - - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 - - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 - - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 - - /** - * Use software SPI for TMC2130. - * The default SW SPI pins are defined the respective pins files, - * but you can override or define them here. - */ - //#define TMC_USE_SW_SPI - //#define TMC_SW_MOSI -1 - //#define TMC_SW_MISO -1 - //#define TMC_SW_SCK -1 - - /** - * Use Trinamic's ultra quiet stepping mode. - * When disabled, Marlin will use spreadCycle stepping mode. - */ - #define STEALTHCHOP - - /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, - * like overtemperature and short to ground. TMC2208 requires hardware serial. - * In the case of overtemperature Marlin can decrease the driver current until error condition clears. - * Other detected conditions can be used to stop the current print. - * Relevant g-codes: - * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. - * M911 - Report stepper driver overtemperature pre-warn condition. - * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) - */ - //#define MONITOR_DRIVER_STATUS - - #if ENABLED(MONITOR_DRIVER_STATUS) - #define CURRENT_STEP_DOWN 50 // [mA] - #define REPORT_CURRENT_CHANGE - #define STOP_ON_ERROR - #endif - - /** - * The driver will switch to spreadCycle when stepper speed is over HYBRID_THRESHOLD. - * This mode allows for faster movements at the expense of higher noise levels. - * STEALTHCHOP needs to be enabled. - * M913 X/Y/Z/E to live tune the setting - */ - //#define HYBRID_THRESHOLD - - #define X_HYBRID_THRESHOLD 100 // [mm/s] - #define X2_HYBRID_THRESHOLD 100 - #define Y_HYBRID_THRESHOLD 100 - #define Y2_HYBRID_THRESHOLD 100 - #define Z_HYBRID_THRESHOLD 3 - #define Z2_HYBRID_THRESHOLD 3 - #define Z3_HYBRID_THRESHOLD 3 - #define E0_HYBRID_THRESHOLD 30 - #define E1_HYBRID_THRESHOLD 30 - #define E2_HYBRID_THRESHOLD 30 - #define E3_HYBRID_THRESHOLD 30 - #define E4_HYBRID_THRESHOLD 30 - #define E5_HYBRID_THRESHOLD 30 - - /** - * Use StallGuard2 to sense an obstacle and trigger an endstop. - * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. - * X, Y, and Z homing will always be done in spreadCycle mode. - * - * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. - * Higher values make the system LESS sensitive. - * Lower value make the system MORE sensitive. - * Too low values can lead to false positives, while too high values will collide the axis without triggering. - * It is advised to set X/Y/Z_HOME_BUMP_MM to 0. - * M914 X/Y/Z to live tune the setting - */ - //#define SENSORLESS_HOMING // TMC2130 only - - /** - * Use StallGuard2 to probe the bed with the nozzle. - * - * CAUTION: This could cause damage to machines that use a lead screw or threaded rod - * to move the Z axis. Take extreme care when attempting to enable this feature. - */ - //#define SENSORLESS_PROBING // TMC2130 only - - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) - #define X_STALL_SENSITIVITY 8 - #define Y_STALL_SENSITIVITY 8 - //#define Z_STALL_SENSITIVITY 8 - #endif - - /** - * Enable M122 debugging command for TMC stepper drivers. - * M122 S0/1 will enable continous reporting. - */ - //#define TMC_DEBUG - - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - - /** - * You can set your own advanced settings by filling in predefined functions. - * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper - * - * Example: - * #define TMC_ADV() { \ - * stepperX.diag0_temp_prewarn(1); \ - * stepperY.interpolate(0); \ - * } - */ - #define TMC_ADV() { } - -#endif // HAS_TRINAMIC - -// @section L6470 - -/** - * L6470 Stepper Driver options - * - * The Arduino-L6470 library is required for this stepper driver. - * https://github.com/ameyer/Arduino-L6470 - */ -#if HAS_DRIVER(L6470) - - #define X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall - - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 - - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 - - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 - - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 - - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 - - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 - - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 - - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 - - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 - - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 - - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 - - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 - -#endif // L6470 - -/** - * TWI/I2C BUS - * - * This feature is an EXPERIMENTAL feature so it shall not be used on production - * machines. Enabling this will allow you to send and receive I2C data from slave - * devices on the bus. - * - * ; Example #1 - * ; This macro send the string "Marlin" to the slave device with address 0x63 (99) - * ; It uses multiple M260 commands with one B arg - * M260 A99 ; Target slave address - * M260 B77 ; M - * M260 B97 ; a - * M260 B114 ; r - * M260 B108 ; l - * M260 B105 ; i - * M260 B110 ; n - * M260 S1 ; Send the current buffer - * - * ; Example #2 - * ; Request 6 bytes from slave device with address 0x63 (99) - * M261 A99 B5 - * - * ; Example #3 - * ; Example serial output of a M261 request - * echo:i2c-reply: from:99 bytes:5 data:hello - */ - -// @section i2cbus - -//#define EXPERIMENTAL_I2CBUS -#define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave - -// @section extras - -/** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ - */ -//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH -#endif - -/** - * Spindle & Laser control - * - * Add the M3, M4, and M5 commands to turn the spindle/laser on and off, and - * to set spindle speed, spindle direction, and laser power. - * - * SuperPid is a router/spindle speed controller used in the CNC milling community. - * Marlin can be used to turn the spindle on and off. It can also be used to set - * the spindle speed from 5,000 to 30,000 RPM. - * - * You'll need to select a pin for the ON/OFF function and optionally choose a 0-5V - * hardware PWM pin for the speed control and a pin for the rotation direction. - * - * See http://marlinfw.org/docs/configuration/laser_spindle.html for more config details. - */ -//#define SPINDLE_LASER_ENABLE -#if ENABLED(SPINDLE_LASER_ENABLE) - - #define SPINDLE_LASER_ENABLE_INVERT false // set to "true" if the on/off function is reversed - #define SPINDLE_LASER_PWM true // set to true if your controller supports setting the speed/power - #define SPINDLE_LASER_PWM_INVERT true // set to "true" if the speed/power goes up when you want it to go slower - #define SPINDLE_LASER_POWERUP_DELAY 5000 // delay in milliseconds to allow the spindle/laser to come up to speed/power - #define SPINDLE_LASER_POWERDOWN_DELAY 5000 // delay in milliseconds to allow the spindle to stop - #define SPINDLE_DIR_CHANGE true // set to true if your spindle controller supports changing spindle direction - #define SPINDLE_INVERT_DIR false - #define SPINDLE_STOP_ON_DIR_CHANGE true // set to true if Marlin should stop the spindle before changing rotation direction - - /** - * The M3 & M4 commands use the following equation to convert PWM duty cycle to speed/power - * - * SPEED/POWER = PWM duty cycle * SPEED_POWER_SLOPE + SPEED_POWER_INTERCEPT - * where PWM duty cycle varies from 0 to 255 - * - * set the following for your controller (ALL MUST BE SET) - */ - - #define SPEED_POWER_SLOPE 118.4 - #define SPEED_POWER_INTERCEPT 0 - #define SPEED_POWER_MIN 5000 - #define SPEED_POWER_MAX 30000 // SuperPID router controller 0 - 30,000 RPM - - //#define SPEED_POWER_SLOPE 0.3922 - //#define SPEED_POWER_INTERCEPT 0 - //#define SPEED_POWER_MIN 10 - //#define SPEED_POWER_MAX 100 // 0-100% -#endif - -/** - * Filament Width Sensor - * - * Measures the filament width in real-time and adjusts - * flow rate to compensate for any irregularities. - * - * Also allows the measured filament diameter to set the - * extrusion rate, so the slicer only has to specify the - * volume. - * - * Only a single extruder is supported at this time. - * - * 34 RAMPS_14 : Analog input 5 on the AUX2 connector - * 81 PRINTRBOARD : Analog input 2 on the Exp1 connector (version B,C,D,E) - * 301 RAMBO : Analog input 3 - * - * Note: May require analog pins to be defined for other boards. - */ -//#define FILAMENT_WIDTH_SENSOR - -#if ENABLED(FILAMENT_WIDTH_SENSOR) - #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] - #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - - #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it - #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. - - #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially - - // Display filament width on the LCD status line. Status messages will expire after 5 seconds. - //#define FILAMENT_LCD_DISPLAY -#endif - -/** - * CNC Coordinate Systems - * - * Enables G53 and G54-G59.3 commands to select coordinate systems - * and G92.1 to reset the workspace to native machine space. - */ -//#define CNC_COORDINATE_SYSTEMS - -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - -/** - * Auto-report temperatures with M155 S - */ -#define AUTO_REPORT_TEMPERATURES - -/** - * Include capabilities in M115 output - */ -#define EXTENDED_CAPABILITIES_REPORT - -/** - * Disable all Volumetric extrusion options - */ -//#define NO_VOLUMETRICS - -#if DISABLED(NO_VOLUMETRICS) - /** - * Volumetric extrusion default state - * Activate to make volumetric extrusion the default method, - * with DEFAULT_NOMINAL_FILAMENT_DIA as the default diameter. - * - * M200 D0 to disable, M200 Dn to set a new diameter. - */ - //#define VOLUMETRIC_DEFAULT_ON -#endif - -/** - * Enable this option for a leaner build of Marlin that removes all - * workspace offsets, simplifying coordinate transformations, leveling, etc. - * - * - M206 and M428 are disabled. - * - G92 will revert to its behavior from Marlin 1.0. - */ -//#define NO_WORKSPACE_OFFSETS - -/** - * Set the number of proportional font spaces required to fill up a typical character space. - * This can help to better align the output of commands like `G29 O` Mesh Output. - * - * For clients that use a fixed-width font (like OctoPrint), leave this set to 1.0. - * Otherwise, adjust according to your client and font. - */ -#define PROPORTIONAL_FONT_RATIO 1.0 - -/** - * Spend 28 bytes of SRAM to optimize the GCode parser - */ -#define FASTER_GCODE_PARSER - -/** - * CNC G-code options - * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. - * Note that G0 feedrates should be used with care for 3D printing (if used at all). - * High feedrates may cause ringing and harm print quality. - */ -//#define PAREN_COMMENTS // Support for parentheses-delimited comments -//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. - -// Enable and set a (default) feedrate for all G0 moves -//#define G0_FEEDRATE 3000 // (mm/m) -#ifdef G0_FEEDRATE - //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode -#endif - -/** - * G-code Macros - * - * Add G-codes M810-M819 to define and run G-code macros. - * Macros are not saved to EEPROM. - */ -//#define GCODE_MACROS -#if ENABLED(GCODE_MACROS) - #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used - #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro -#endif - -/** - * User-defined menu items that execute custom GCode - */ -//#define CUSTOM_USER_MENUS -#if ENABLED(CUSTOM_USER_MENUS) - //#define CUSTOM_USER_MENU_TITLE "Custom Commands" - #define USER_SCRIPT_DONE "M117 User Script Done" - #define USER_SCRIPT_AUDIBLE_FEEDBACK - //#define USER_SCRIPT_RETURN // Return to status screen after a script - - #define USER_DESC_1 "Home & UBL Info" - #define USER_GCODE_1 "G28\nG29 W" - - #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL - #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - - #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL - #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) - - #define USER_DESC_4 "Heat Bed/Home/Level" - #define USER_GCODE_4 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nG28\nG29" - - #define USER_DESC_5 "Home & Info" - #define USER_GCODE_5 "G28\nM503" -#endif - -/** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" - -//=========================================================================== -//====================== I2C Position Encoder Settings ====================== -//=========================================================================== - -/** - * I2C position encoders for closed loop control. - * Developed by Chris Barr at Aus3D. - * - * Wiki: http://wiki.aus3d.com.au/Magnetic_Encoder - * Github: https://github.com/Aus3D/MagneticEncoder - * - * Supplier: http://aus3d.com.au/magnetic-encoder-module - * Alternative Supplier: http://reliabuild3d.com/ - * - * Reilabuild encoders have been modified to improve reliability. - */ - -//#define I2C_POSITION_ENCODERS -#if ENABLED(I2C_POSITION_ENCODERS) - - #define I2CPE_ENCODER_CNT 1 // The number of encoders installed; max of 5 - // encoders supported currently. - - #define I2CPE_ENC_1_ADDR I2CPE_PRESET_ADDR_X // I2C address of the encoder. 30-200. - #define I2CPE_ENC_1_AXIS X_AXIS // Axis the encoder module is installed on. _AXIS. - #define I2CPE_ENC_1_TYPE I2CPE_ENC_TYPE_LINEAR // Type of encoder: I2CPE_ENC_TYPE_LINEAR -or- - // I2CPE_ENC_TYPE_ROTARY. - #define I2CPE_ENC_1_TICKS_UNIT 2048 // 1024 for magnetic strips with 2mm poles; 2048 for - // 1mm poles. For linear encoders this is ticks / mm, - // for rotary encoders this is ticks / revolution. - //#define I2CPE_ENC_1_TICKS_REV (16 * 200) // Only needed for rotary encoders; number of stepper - // steps per full revolution (motor steps/rev * microstepping) - //#define I2CPE_ENC_1_INVERT // Invert the direction of axis travel. - #define I2CPE_ENC_1_EC_METHOD I2CPE_ECM_MICROSTEP // Type of error error correction. - #define I2CPE_ENC_1_EC_THRESH 0.10 // Threshold size for error (in mm) above which the - // printer will attempt to correct the error; errors - // smaller than this are ignored to minimize effects of - // measurement noise / latency (filter). - - #define I2CPE_ENC_2_ADDR I2CPE_PRESET_ADDR_Y // Same as above, but for encoder 2. - #define I2CPE_ENC_2_AXIS Y_AXIS - #define I2CPE_ENC_2_TYPE I2CPE_ENC_TYPE_LINEAR - #define I2CPE_ENC_2_TICKS_UNIT 2048 - //#define I2CPE_ENC_2_TICKS_REV (16 * 200) - //#define I2CPE_ENC_2_INVERT - #define I2CPE_ENC_2_EC_METHOD I2CPE_ECM_MICROSTEP - #define I2CPE_ENC_2_EC_THRESH 0.10 - - #define I2CPE_ENC_3_ADDR I2CPE_PRESET_ADDR_Z // Encoder 3. Add additional configuration options - #define I2CPE_ENC_3_AXIS Z_AXIS // as above, or use defaults below. - - #define I2CPE_ENC_4_ADDR I2CPE_PRESET_ADDR_E // Encoder 4. - #define I2CPE_ENC_4_AXIS E_AXIS - - #define I2CPE_ENC_5_ADDR 34 // Encoder 5. - #define I2CPE_ENC_5_AXIS E_AXIS - - // Default settings for encoders which are enabled, but without settings configured above. - #define I2CPE_DEF_TYPE I2CPE_ENC_TYPE_LINEAR - #define I2CPE_DEF_ENC_TICKS_UNIT 2048 - #define I2CPE_DEF_TICKS_REV (16 * 200) - #define I2CPE_DEF_EC_METHOD I2CPE_ECM_NONE - #define I2CPE_DEF_EC_THRESH 0.1 - - //#define I2CPE_ERR_THRESH_ABORT 100.0 // Threshold size for error (in mm) error on any given - // axis after which the printer will abort. Comment out to - // disable abort behaviour. - - #define I2CPE_TIME_TRUSTED 10000 // After an encoder fault, there must be no further fault - // for this amount of time (in ms) before the encoder - // is trusted again. - - /** - * Position is checked every time a new command is executed from the buffer but during long moves, - * this setting determines the minimum update time between checks. A value of 100 works well with - * error rolling average when attempting to correct only for skips and not for vibration. - */ - #define I2CPE_MIN_UPD_TIME_MS 4 // (ms) Minimum time between encoder checks. - - // Use a rolling average to identify persistant errors that indicate skips, as opposed to vibration and noise. - #define I2CPE_ERR_ROLLING_AVERAGE - -#endif // I2C_POSITION_ENCODERS - -/** - * MAX7219 Debug Matrix - * - * Add support for a low-cost 8x8 LED Matrix based on the Max7219 chip as a realtime status display. - * Requires 3 signal wires. Some useful debug options are included to demonstrate its usage. - */ -//#define MAX7219_DEBUG -#if ENABLED(MAX7219_DEBUG) - #define MAX7219_CLK_PIN 64 - #define MAX7219_DIN_PIN 57 - #define MAX7219_LOAD_PIN 44 - - //#define MAX7219_GCODE // Add the M7219 G-code to control the LED matrix - #define MAX7219_INIT_TEST 2 // Do a test pattern at initialization (Set to 2 for spiral) - #define MAX7219_NUMBER_UNITS 1 // Number of Max7219 units in chain. - #define MAX7219_ROTATE 0 // Rotate the display clockwise (in multiples of +/- 90°) - // connector at: right=0 bottom=-90 top=90 left=180 - //#define MAX7219_REVERSE_ORDER // The individual LED matrix units may be in reversed order - - /** - * Sample debug features - * If you add more debug displays, be careful to avoid conflicts! - */ - #define MAX7219_DEBUG_PRINTER_ALIVE // Blink corner LED of 8x8 matrix to show that the firmware is functioning - #define MAX7219_DEBUG_PLANNER_HEAD 3 // Show the planner queue head position on this and the next LED matrix row - #define MAX7219_DEBUG_PLANNER_TAIL 5 // Show the planner queue tail position on this and the next LED matrix row - - #define MAX7219_DEBUG_PLANNER_QUEUE 0 // Show the current planner queue depth on this and the next LED matrix row - // If you experience stuttering, reboots, etc. this option can reveal how - // tweaks made to the configuration are affecting the printer in real-time. -#endif - -/** - * NanoDLP Sync support - * - * Add support for Synchronized Z moves when using with NanoDLP. G0/G1 axis moves will output "Z_move_comp" - * string to enable synchronization with DLP projector exposure. This change will allow to use - * [[WaitForDoneMessage]] instead of populating your gcode with M400 commands - */ -//#define NANODLP_Z_SYNC -#if ENABLED(NANODLP_Z_SYNC) - //#define NANODLP_ALL_AXIS // Enables "Z_move_comp" output on any axis move. - // Default behaviour is limited to Z axis only. -#endif - -/** - * WiFi Support (Espressif ESP32 WiFi) - */ -//#define WIFISUPPORT -#if ENABLED(WIFISUPPORT) - #define WIFI_SSID "Wifi SSID" - #define WIFI_PWD "Wifi Password" -#endif - -// Enable Marlin dev mode which adds some special commands -//#define MARLIN_DEV_MODE diff --git a/Marlin/src/config/examples/delta/Geeetech/Rostock 301/Configuration_adv.h b/Marlin/src/config/examples/delta/Geeetech/Rostock 301/Configuration_adv.h deleted file mode 100644 index a97abf4091b2..000000000000 --- a/Marlin/src/config/examples/delta/Geeetech/Rostock 301/Configuration_adv.h +++ /dev/null @@ -1,1878 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -#pragma once - -/** - * Configuration_adv.h - * - * Advanced settings. - * Only change these if you know exactly what you're doing. - * Some of these settings can damage your printer if improperly set! - * - * Basic settings can be found in Configuration.h - * - */ -#define CONFIGURATION_ADV_H_VERSION 020000 - -// @section temperature - -//=========================================================================== -//=============================Thermal Settings ============================ -//=========================================================================== - -// -// Hephestos 2 24V heated bed upgrade kit. -// https://store.bq.com/en/heated-bed-kit-hephestos2 -// -//#define HEPHESTOS2_HEATED_BED_KIT -#if ENABLED(HEPHESTOS2_HEATED_BED_KIT) - #undef TEMP_SENSOR_BED - #define TEMP_SENSOR_BED 70 - #define HEATER_BED_INVERTING true -#endif - -#if DISABLED(PIDTEMPBED) - #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control - #if ENABLED(BED_LIMIT_SWITCHING) - #define BED_HYSTERESIS 2 // Only disable heating if T>target+BED_HYSTERESIS and enable heating if T>target-BED_HYSTERESIS - #endif -#endif - -/** - * Thermal Protection provides additional protection to your printer from damage - * and fire. Marlin always includes safe min and max temperature ranges which - * protect against a broken or disconnected thermistor wire. - * - * The issue: If a thermistor falls out, it will report the much lower - * temperature of the air in the room, and the the firmware will keep - * the heater on. - * - * The solution: Once the temperature reaches the target, start observing. - * If the temperature stays too far below the target (hysteresis) for too - * long (period), the firmware will halt the machine as a safety precaution. - * - * If you get false positives for "Thermal Runaway", increase - * THERMAL_PROTECTION_HYSTERESIS and/or THERMAL_PROTECTION_PERIOD - */ -#if ENABLED(THERMAL_PROTECTION_HOTENDS) - #define THERMAL_PROTECTION_PERIOD 40 // Seconds - #define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius - - /** - * Whenever an M104, M109, or M303 increases the target temperature, the - * firmware will wait for the WATCH_TEMP_PERIOD to expire. If the temperature - * hasn't increased by WATCH_TEMP_INCREASE degrees, the machine is halted and - * requires a hard reset. This test restarts with any M104/M109/M303, but only - * if the current temperature is far enough below the target for a reliable - * test. - * - * If you get false positives for "Heating failed", increase WATCH_TEMP_PERIOD - * and/or decrease WATCH_TEMP_INCREASE. WATCH_TEMP_INCREASE should not be set - * below 2. - */ - #define WATCH_TEMP_PERIOD 20 // Seconds - #define WATCH_TEMP_INCREASE 2 // Degrees Celsius -#endif - -/** - * Thermal Protection parameters for the bed are just as above for hotends. - */ -#if ENABLED(THERMAL_PROTECTION_BED) - #define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds - #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius - - /** - * As described above, except for the bed (M140/M190/M303). - */ - #define WATCH_BED_TEMP_PERIOD 60 // Seconds - #define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius -#endif - -#if ENABLED(PIDTEMP) - // this adds an experimental additional term to the heating power, proportional to the extrusion speed. - // if Kc is chosen well, the additional required power due to increased melting should be compensated. - //#define PID_EXTRUSION_SCALING - #if ENABLED(PID_EXTRUSION_SCALING) - #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) - #define LPQ_MAX_LEN 50 - #endif -#endif - -/** - * Automatic Temperature: - * The hotend target temperature is calculated by all the buffered lines of gcode. - * The maximum buffered steps/sec of the extruder motor is called "se". - * Start autotemp mode with M109 S B F - * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by - * mintemp and maxtemp. Turn this off by executing M109 without F* - * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp. - * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode - */ -#define AUTOTEMP -#if ENABLED(AUTOTEMP) - #define AUTOTEMP_OLDWEIGHT 0.98 -#endif - -// Show extra position information in M114 -//#define M114_DETAIL - -// Show Temperature ADC value -// Enable for M105 to include ADC values read from temperature sensors. -//#define SHOW_TEMP_ADC_VALUES - -/** - * High Temperature Thermistor Support - * - * Thermistors able to support high temperature tend to have a hard time getting - * good readings at room and lower temperatures. This means HEATER_X_RAW_LO_TEMP - * will probably be caught when the heating element first turns on during the - * preheating process, which will trigger a min_temp_error as a safety measure - * and force stop everything. - * To circumvent this limitation, we allow for a preheat time (during which, - * min_temp_error won't be triggered) and add a min_temp buffer to handle - * aberrant readings. - * - * If you want to enable this feature for your hotend thermistor(s) - * uncomment and set values > 0 in the constants below - */ - -// The number of consecutive low temperature errors that can occur -// before a min_temp_error is triggered. (Shouldn't be more than 10.) -//#define MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED 0 - -// The number of milliseconds a hotend will preheat before starting to check -// the temperature. This value should NOT be set to the time it takes the -// hot end to reach the target temperature, but the time it takes to reach -// the minimum temperature your thermistor can read. The lower the better/safer. -// This shouldn't need to be more than 30 seconds (30000) -//#define MILLISECONDS_PREHEAT_TIME 0 - -// @section extruder - -// Extruder runout prevention. -// If the machine is idle and the temperature over MINTEMP -// then extrude some filament every couple of SECONDS. -//#define EXTRUDER_RUNOUT_PREVENT -#if ENABLED(EXTRUDER_RUNOUT_PREVENT) - #define EXTRUDER_RUNOUT_MINTEMP 190 - #define EXTRUDER_RUNOUT_SECONDS 30 - #define EXTRUDER_RUNOUT_SPEED 1500 // (mm/m) - #define EXTRUDER_RUNOUT_EXTRUDE 5 // (mm) -#endif - -// @section temperature - -// Calibration for AD595 / AD8495 sensor to adjust temperature measurements. -// The final temperature is calculated as (measuredTemp * GAIN) + OFFSET. -#define TEMP_SENSOR_AD595_OFFSET 0.0 -#define TEMP_SENSOR_AD595_GAIN 1.0 -#define TEMP_SENSOR_AD8495_OFFSET 0.0 -#define TEMP_SENSOR_AD8495_GAIN 1.0 - -/** - * Controller Fan - * To cool down the stepper drivers and MOSFETs. - * - * The fan will turn on automatically whenever any stepper is enabled - * and turn off after a set period after all steppers are turned off. - */ -//#define USE_CONTROLLER_FAN -#if ENABLED(USE_CONTROLLER_FAN) - //#define CONTROLLER_FAN_PIN -1 // Set a custom pin for the controller fan - #define CONTROLLERFAN_SECS 60 // Duration in seconds for the fan to run after all motors are disabled - #define CONTROLLERFAN_SPEED 255 // 255 == full speed -#endif - -// When first starting the main fan, run it at full speed for the -// given number of milliseconds. This gets the fan spinning reliably -// before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu) -//#define FAN_KICKSTART_TIME 100 - -/** - * PWM Fan Scaling - * - * Define the min/max speeds for PWM fans (as set with M106). - * - * With these options the M106 0-255 value range is scaled to a subset - * to ensure that the fan has enough power to spin, or to run lower - * current fans with higher current. (e.g., 5V/12V fans with 12V/24V) - * Value 0 always turns off the fan. - * - * Define one or both of these to override the default 0-255 range. - */ -//#define FAN_MIN_PWM 50 -//#define FAN_MAX_PWM 128 - -// @section extruder - -/** - * Extruder cooling fans - * - * Extruder auto fans automatically turn on when their extruders' - * temperatures go above EXTRUDER_AUTO_FAN_TEMPERATURE. - * - * Your board's pins file specifies the recommended pins. Override those here - * or set to -1 to disable completely. - * - * Multiple extruders can be assigned to the same pin in which case - * the fan will turn on when any selected extruder is above the threshold. - */ -#define E0_AUTO_FAN_PIN -1 -#define E1_AUTO_FAN_PIN -1 -#define E2_AUTO_FAN_PIN -1 -#define E3_AUTO_FAN_PIN -1 -#define E4_AUTO_FAN_PIN -1 -#define E5_AUTO_FAN_PIN -1 -#define CHAMBER_AUTO_FAN_PIN -1 -#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 -#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed - -/** - * Part-Cooling Fan Multiplexer - * - * This feature allows you to digitally multiplex the fan output. - * The multiplexer is automatically switched at tool-change. - * Set FANMUX[012]_PINs below for up to 2, 4, or 8 multiplexed fans. - */ -#define FANMUX0_PIN -1 -#define FANMUX1_PIN -1 -#define FANMUX2_PIN -1 - -/** - * M355 Case Light on-off / brightness - */ -//#define CASE_LIGHT_ENABLE -#if ENABLED(CASE_LIGHT_ENABLE) - //#define CASE_LIGHT_PIN 4 // Override the default pin if needed - #define INVERT_CASE_LIGHT false // Set true if Case Light is ON when pin is LOW - #define CASE_LIGHT_DEFAULT_ON true // Set default power-up state on - #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105 // Set default power-up brightness (0-255, requires PWM pin) - //#define MENU_ITEM_CASE_LIGHT // Add a Case Light option to the LCD main menu - //#define CASE_LIGHT_USE_NEOPIXEL // Use Neopixel LED as case light, requires NEOPIXEL_LED. - #if ENABLED(CASE_LIGHT_USE_NEOPIXEL) - #define CASE_LIGHT_NEOPIXEL_COLOR { 255, 255, 255, 255 } // { Red, Green, Blue, White } - #endif -#endif - -//=========================================================================== -//============================ Mechanical Settings ========================== -//=========================================================================== - -// @section homing - -// If you want endstops to stay on (by default) even when not homing -// enable this option. Override at any time with M120, M121. -//#define ENDSTOPS_ALWAYS_ON_DEFAULT - -// @section extras - -//#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. - -// Employ an external closed loop controller. Override pins here if needed. -//#define EXTERNAL_CLOSED_LOOP_CONTROLLER -#if ENABLED(EXTERNAL_CLOSED_LOOP_CONTROLLER) - //#define CLOSED_LOOP_ENABLE_PIN -1 - //#define CLOSED_LOOP_MOVE_COMPLETE_PIN -1 -#endif - -/** - * Dual Steppers / Dual Endstops - * - * This section will allow you to use extra E drivers to drive a second motor for X, Y, or Z axes. - * - * For example, set X_DUAL_STEPPER_DRIVERS setting to use a second motor. If the motors need to - * spin in opposite directions set INVERT_X2_VS_X_DIR. If the second motor needs its own endstop - * set X_DUAL_ENDSTOPS. This can adjust for "racking." Use X2_USE_ENDSTOP to set the endstop plug - * that should be used for the second endstop. Extra endstops will appear in the output of 'M119'. - * - * Use X_DUAL_ENDSTOP_ADJUSTMENT to adjust for mechanical imperfection. After homing both motors - * this offset is applied to the X2 motor. To find the offset home the X axis, and measure the error - * in X2. Dual endstop offsets can be set at runtime with 'M666 X Y Z'. - */ - -//#define X_DUAL_STEPPER_DRIVERS -#if ENABLED(X_DUAL_STEPPER_DRIVERS) - #define INVERT_X2_VS_X_DIR true // Set 'true' if X motors should rotate in opposite directions - //#define X_DUAL_ENDSTOPS - #if ENABLED(X_DUAL_ENDSTOPS) - #define X2_USE_ENDSTOP _XMAX_ - #define X_DUAL_ENDSTOPS_ADJUSTMENT 0 - #endif -#endif - -//#define Y_DUAL_STEPPER_DRIVERS -#if ENABLED(Y_DUAL_STEPPER_DRIVERS) - #define INVERT_Y2_VS_Y_DIR true // Set 'true' if Y motors should rotate in opposite directions - //#define Y_DUAL_ENDSTOPS - #if ENABLED(Y_DUAL_ENDSTOPS) - #define Y2_USE_ENDSTOP _YMAX_ - #define Y_DUAL_ENDSTOPS_ADJUSTMENT 0 - #endif -#endif - -//#define Z_DUAL_STEPPER_DRIVERS -#if ENABLED(Z_DUAL_STEPPER_DRIVERS) - //#define Z_DUAL_ENDSTOPS - #if ENABLED(Z_DUAL_ENDSTOPS) - #define Z2_USE_ENDSTOP _XMAX_ - #define Z_DUAL_ENDSTOPS_ADJUSTMENT 0 - #endif -#endif - -//#define Z_TRIPLE_STEPPER_DRIVERS -#if ENABLED(Z_TRIPLE_STEPPER_DRIVERS) - //#define Z_TRIPLE_ENDSTOPS - #if ENABLED(Z_TRIPLE_ENDSTOPS) - #define Z2_USE_ENDSTOP _XMAX_ - #define Z3_USE_ENDSTOP _YMAX_ - #define Z_TRIPLE_ENDSTOPS_ADJUSTMENT2 0 - #define Z_TRIPLE_ENDSTOPS_ADJUSTMENT3 0 - #endif -#endif - -/** - * Dual X Carriage - * - * This setup has two X carriages that can move independently, each with its own hotend. - * The carriages can be used to print an object with two colors or materials, or in - * "duplication mode" it can print two identical or X-mirrored objects simultaneously. - * The inactive carriage is parked automatically to prevent oozing. - * X1 is the left carriage, X2 the right. They park and home at opposite ends of the X axis. - * By default the X2 stepper is assigned to the first unused E plug on the board. - */ -//#define DUAL_X_CARRIAGE -#if ENABLED(DUAL_X_CARRIAGE) - #define X1_MIN_POS X_MIN_POS // set minimum to ensure first x-carriage doesn't hit the parked second X-carriage - #define X1_MAX_POS X_BED_SIZE // set maximum to ensure first x-carriage doesn't hit the parked second X-carriage - #define X2_MIN_POS 80 // set minimum to ensure second x-carriage doesn't hit the parked first X-carriage - #define X2_MAX_POS 353 // set maximum to the distance between toolheads when both heads are homed - #define X2_HOME_DIR 1 // the second X-carriage always homes to the maximum endstop position - #define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position - // However: In this mode the HOTEND_OFFSET_X value for the second extruder provides a software - // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops - // without modifying the firmware (through the "M218 T1 X???" command). - // Remember: you should set the second extruder x-offset to 0 in your slicer. - - // There are a few selectable movement modes for dual x-carriages using M605 S - // Mode 0 (DXC_FULL_CONTROL_MODE): Full control. The slicer has full control over both x-carriages and can achieve optimal travel results - // as long as it supports dual x-carriages. (M605 S0) - // Mode 1 (DXC_AUTO_PARK_MODE) : Auto-park mode. The firmware will automatically park and unpark the x-carriages on tool changes so - // that additional slicer support is not required. (M605 S1) - // Mode 2 (DXC_DUPLICATION_MODE) : Duplication mode. The firmware will transparently make the second x-carriage and extruder copy all - // actions of the first x-carriage. This allows the printer to print 2 arbitrary items at - // once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm]) - - // This is the default power-up mode which can be later using M605. - #define DEFAULT_DUAL_X_CARRIAGE_MODE DXC_FULL_CONTROL_MODE - - // Default x offset in duplication mode (typically set to half print bed width) - #define DEFAULT_DUPLICATION_X_OFFSET 100 - -#endif // DUAL_X_CARRIAGE - -// Activate a solenoid on the active extruder with M380. Disable all with M381. -// Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid. -//#define EXT_SOLENOID - -// @section homing - -// Homing hits each endstop, retracts by these distances, then does a slower bump. -#define X_HOME_BUMP_MM 5 -#define Y_HOME_BUMP_MM 5 -#define Z_HOME_BUMP_MM 5 // deltas need the same for all three axes -#define HOMING_BUMP_DIVISOR { 10, 10, 10 } // Re-Bump Speed Divisor (Divides the Homing Feedrate) -//#define QUICK_HOME // If homing includes X and Y, do a diagonal move initially - -// When G28 is called, this option will make Y home before X -//#define HOME_Y_BEFORE_X - -// Enable this if X or Y can't home without homing the other axis first. -//#define CODEPENDENT_XY_HOMING - -/** - * Z Steppers Auto-Alignment - * Add the G34 command to align multiple Z steppers using a bed probe. - */ -//#define Z_STEPPER_AUTO_ALIGN -#if ENABLED(Z_STEPPER_AUTO_ALIGN) - // Define probe X and Y positions for Z1, Z2 [, Z3] - #define Z_STEPPER_ALIGN_X { 10, 150, 290 } - #define Z_STEPPER_ALIGN_Y { 290, 10, 290 } - // Set number of iterations to align - #define Z_STEPPER_ALIGN_ITERATIONS 3 - // Enable to restore leveling setup after operation - #define RESTORE_LEVELING_AFTER_G34 - // Use the amplification factor to de-/increase correction step. - // In case the stepper (spindle) position is further out than the test point - // Use a value > 1. NOTE: This may cause instability - #define Z_STEPPER_ALIGN_AMP 1.0 - // Stop criterion. If the accuracy is better than this stop iterating early - #define Z_STEPPER_ALIGN_ACC 0.02 -#endif - -// @section machine - -#define AXIS_RELATIVE_MODES {false, false, false, false} - -// Allow duplication mode with a basic dual-nozzle extruder -//#define DUAL_NOZZLE_DUPLICATION_MODE - -// By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step. -#define INVERT_X_STEP_PIN false -#define INVERT_Y_STEP_PIN false -#define INVERT_Z_STEP_PIN false -#define INVERT_E_STEP_PIN false - -// Default stepper release if idle. Set to 0 to deactivate. -// Steppers will shut down DEFAULT_STEPPER_DEACTIVE_TIME seconds after the last move when DISABLE_INACTIVE_? is true. -// Time can be set by M18 and M84. -#define DEFAULT_STEPPER_DEACTIVE_TIME 60 -#define DISABLE_INACTIVE_X true -#define DISABLE_INACTIVE_Y true -#define DISABLE_INACTIVE_Z true // set to false if the nozzle will fall down on your printed part when print has finished. -#define DISABLE_INACTIVE_E true - -#define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate -#define DEFAULT_MINTRAVELFEEDRATE 0.0 - -//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated - -// @section lcd - -#if ENABLED(ULTIPANEL) - #define MANUAL_FEEDRATE_XYZ 50*60 - #define MANUAL_FEEDRATE { MANUAL_FEEDRATE_XYZ, MANUAL_FEEDRATE_XYZ, MANUAL_FEEDRATE_XYZ, 60 } // Feedrates for manual moves along X, Y, Z, E from panel - #define MANUAL_E_MOVES_RELATIVE // Show LCD extruder moves as relative rather than absolute positions - #define ULTIPANEL_FEEDMULTIPLY // Comment to disable setting feedrate multiplier via encoder -#endif - -// @section extras - -// minimum time in microseconds that a movement needs to take if the buffer is emptied. -#define DEFAULT_MINSEGMENTTIME 20000 - -// If defined the movements slow down when the look ahead buffer is only half full -// (don't use SLOWDOWN with DELTA because DELTA generates hundreds of segments per second) -//#define SLOWDOWN - -// Frequency limit -// See nophead's blog for more info -// Not working O -//#define XY_FREQUENCY_LIMIT 15 - -// Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end -// of the buffer and all stops. This should not be much greater than zero and should only be changed -// if unwanted behavior is observed on a user's machine when running at very slow speeds. -#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) - -// -// Use Junction Deviation instead of traditional Jerk Limiting -// -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge -#endif - -/** - * Adaptive Step Smoothing increases the resolution of multi-axis moves, particularly at step frequencies - * below 1kHz (for AVR) or 10kHz (for ARM), where aliasing between axes in multi-axis moves causes audible - * vibration and surface artifacts. The algorithm adapts to provide the best possible step smoothing at the - * lowest stepping frequencies. - */ -//#define ADAPTIVE_STEP_SMOOTHING - -/** - * Custom Microstepping - * Override as-needed for your setup. Up to 3 MS pins are supported. - */ -//#define MICROSTEP1 LOW,LOW,LOW -//#define MICROSTEP2 HIGH,LOW,LOW -//#define MICROSTEP4 LOW,HIGH,LOW -//#define MICROSTEP8 HIGH,HIGH,LOW -//#define MICROSTEP16 LOW,LOW,HIGH -//#define MICROSTEP32 HIGH,LOW,HIGH - -// Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. -#define MICROSTEP_MODES { 16, 16, 16, 16, 16, 16 } // [1,2,4,8,16] - -/** - * @section stepper motor current - * - * Some boards have a means of setting the stepper motor current via firmware. - * - * The power on motor currents are set by: - * PWM_MOTOR_CURRENT - used by MINIRAMBO & ULTIMAIN_2 - * known compatible chips: A4982 - * DIGIPOT_MOTOR_CURRENT - used by BQ_ZUM_MEGA_3D, RAMBO & SCOOVO_X9H - * known compatible chips: AD5206 - * DAC_MOTOR_CURRENT_DEFAULT - used by PRINTRBOARD_REVF & RIGIDBOARD_V2 - * known compatible chips: MCP4728 - * DIGIPOT_I2C_MOTOR_CURRENTS - used by 5DPRINT, AZTEEG_X3_PRO, AZTEEG_X5_MINI_WIFI, MIGHTYBOARD_REVE - * known compatible chips: MCP4451, MCP4018 - * - * Motor currents can also be set by M907 - M910 and by the LCD. - * M907 - applies to all. - * M908 - BQ_ZUM_MEGA_3D, RAMBO, PRINTRBOARD_REVF, RIGIDBOARD_V2 & SCOOVO_X9H - * M909, M910 & LCD - only PRINTRBOARD_REVF & RIGIDBOARD_V2 - */ -//#define PWM_MOTOR_CURRENT { 1300, 1300, 1250 } // Values in milliamps -//#define DIGIPOT_MOTOR_CURRENT { 135,135,135,135,135 } // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A) -//#define DAC_MOTOR_CURRENT_DEFAULT { 70, 80, 90, 80 } // Default drive percent - X, Y, Z, E axis - -// Use an I2C based DIGIPOT (e.g., Azteeg X3 Pro) -//#define DIGIPOT_I2C -#if ENABLED(DIGIPOT_I2C) && !defined(DIGIPOT_I2C_ADDRESS_A) - /** - * Common slave addresses: - * - * A (A shifted) B (B shifted) IC - * Smoothie 0x2C (0x58) 0x2D (0x5A) MCP4451 - * AZTEEG_X3_PRO 0x2C (0x58) 0x2E (0x5C) MCP4451 - * AZTEEG_X5_MINI_WIFI 0x58 0x5C MCP4451 - * MIGHTYBOARD_REVE 0x2F (0x5E) MCP4018 - */ - #define DIGIPOT_I2C_ADDRESS_A 0x2C // unshifted slave address for first DIGIPOT - #define DIGIPOT_I2C_ADDRESS_B 0x2D // unshifted slave address for second DIGIPOT -#endif - -//#define DIGIPOT_MCP4018 // Requires library from https://github.com/stawel/SlowSoftI2CMaster -#define DIGIPOT_I2C_NUM_CHANNELS 8 // 5DPRINT: 4 AZTEEG_X3_PRO: 8 MKS SBASE: 5 -// Actual motor currents in Amps. The number of entries must match DIGIPOT_I2C_NUM_CHANNELS. -// These correspond to the physical drivers, so be mindful if the order is changed. -#define DIGIPOT_I2C_MOTOR_CURRENTS { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 } // AZTEEG_X3_PRO - -//=========================================================================== -//=============================Additional Features=========================== -//=========================================================================== - -// @section lcd - -// Change values more rapidly when the encoder is rotated faster -#define ENCODER_RATE_MULTIPLIER -#if ENABLED(ENCODER_RATE_MULTIPLIER) - #define ENCODER_10X_STEPS_PER_SEC 30 // (steps/s) Encoder rate for 10x speed - #define ENCODER_100X_STEPS_PER_SEC 80 // (steps/s) Encoder rate for 100x speed -#endif - -// Include a page of printer information in the LCD Main Menu -//#define LCD_INFO_MENU - -// Scroll a longer status message into view -//#define STATUS_MESSAGE_SCROLLING - -// On the Info Screen, display XY with one decimal place when possible -//#define LCD_DECIMAL_SMALL_XY - -// The timeout (in ms) to return to the status screen from sub-menus -//#define LCD_TIMEOUT_TO_STATUS 15000 - -// Add an 'M73' G-code to set the current percentage -//#define LCD_SET_PROGRESS_MANUALLY - -#if HAS_CHARACTER_LCD && HAS_PRINT_PROGRESS - //#define LCD_PROGRESS_BAR // Show a progress bar on HD44780 LCDs for SD printing - #if ENABLED(LCD_PROGRESS_BAR) - #define PROGRESS_BAR_BAR_TIME 2000 // (ms) Amount of time to show the bar - #define PROGRESS_BAR_MSG_TIME 3000 // (ms) Amount of time to show the status message - #define PROGRESS_MSG_EXPIRE 0 // (ms) Amount of time to retain the status message (0=forever) - //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it - //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar - #endif -#endif // HAS_PRINT_PROGRESS - -/** - * LED Control Menu - * Enable this feature to add LED Control to the LCD menu - */ -//#define LED_CONTROL_MENU -#if ENABLED(LED_CONTROL_MENU) - #define LED_COLOR_PRESETS // Enable the Preset Color menu option - #if ENABLED(LED_COLOR_PRESETS) - #define LED_USER_PRESET_RED 255 // User defined RED value - #define LED_USER_PRESET_GREEN 128 // User defined GREEN value - #define LED_USER_PRESET_BLUE 0 // User defined BLUE value - #define LED_USER_PRESET_WHITE 255 // User defined WHITE value - #define LED_USER_PRESET_BRIGHTNESS 255 // User defined intensity - //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup - #endif -#endif // LED_CONTROL_MENU - -#if ENABLED(SDSUPPORT) - - // Some RAMPS and other boards don't detect when an SD card is inserted. You can work - // around this by connecting a push button or single throw switch to the pin defined - // as SD_DETECT_PIN in your board's pins definitions. - // This setting should be disabled unless you are using a push button, pulling the pin to ground. - // Note: This is always disabled for ULTIPANEL (except ELB_FULL_GRAPHIC_CONTROLLER). - #define SD_DETECT_INVERTED - - #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. - - // Reverse SD sort to show "more recent" files first, according to the card's FAT. - // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. - #define SDCARD_RATHERRECENTFIRST - - // Add an option in the menu to run all auto#.g files - //#define MENU_ADDAUTOSTART - - /** - * Continue after Power-Loss (Creality3D) - * - * Store the current state to the SD Card at the start of each layer - * during SD printing. If the recovery file is found at boot time, present - * an option on the LCD screen to continue the print from the last-known - * point in the file. - */ - //#define POWER_LOSS_RECOVERY - #if ENABLED(POWER_LOSS_RECOVERY) - //#define POWER_LOSS_PIN 44 // Pin to detect power loss - //#define POWER_LOSS_STATE HIGH // State of pin indicating power loss - #endif - - /** - * Sort SD file listings in alphabetical order. - * - * With this option enabled, items on SD cards will be sorted - * by name for easier navigation. - * - * By default... - * - * - Use the slowest -but safest- method for sorting. - * - Folders are sorted to the top. - * - The sort key is statically allocated. - * - No added G-code (M34) support. - * - 40 item sorting limit. (Items after the first 40 are unsorted.) - * - * SD sorting uses static allocation (as set by SDSORT_LIMIT), allowing the - * compiler to calculate the worst-case usage and throw an error if the SRAM - * limit is exceeded. - * - * - SDSORT_USES_RAM provides faster sorting via a static directory buffer. - * - SDSORT_USES_STACK does the same, but uses a local stack-based buffer. - * - SDSORT_CACHE_NAMES will retain the sorted file listing in RAM. (Expensive!) - * - SDSORT_DYNAMIC_RAM only uses RAM when the SD menu is visible. (Use with caution!) - */ - //#define SDCARD_SORT_ALPHA - - // SD Card Sorting options - #if ENABLED(SDCARD_SORT_ALPHA) - #define SDSORT_LIMIT 40 // Maximum number of sorted items (10-256). Costs 27 bytes each. - #define FOLDER_SORTING -1 // -1=above 0=none 1=below - #define SDSORT_GCODE false // Allow turning sorting on/off with LCD and M34 g-code. - #define SDSORT_USES_RAM false // Pre-allocate a static array for faster pre-sorting. - #define SDSORT_USES_STACK false // Prefer the stack for pre-sorting to give back some SRAM. (Negated by next 2 options.) - #define SDSORT_CACHE_NAMES false // Keep sorted items in RAM longer for speedy performance. Most expensive option. - #define SDSORT_DYNAMIC_RAM false // Use dynamic allocation (within SD menus). Least expensive option. Set SDSORT_LIMIT before use! - #define SDSORT_CACHE_VFATS 2 // Maximum number of 13-byte VFAT entries to use for sorting. - // Note: Only affects SCROLL_LONG_FILENAMES with SDSORT_CACHE_NAMES but not SDSORT_DYNAMIC_RAM. - #endif - - // This allows hosts to request long names for files and folders with M33 - //#define LONG_FILENAME_HOST_SUPPORT - - // Enable this option to scroll long filenames in the SD card menu - //#define SCROLL_LONG_FILENAMES - - /** - * This option allows you to abort SD printing when any endstop is triggered. - * This feature must be enabled with "M540 S1" or from the LCD menu. - * To have any effect, endstops must be enabled during SD printing. - */ - //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED - - /** - * This option makes it easier to print the same SD Card file again. - * On print completion the LCD Menu will open with the file selected. - * You can just click to start the print, or navigate elsewhere. - */ - //#define SD_REPRINT_LAST_SELECTED_FILE - - /** - * Auto-report SdCard status with M27 S - */ - //#define AUTO_REPORT_SD_STATUS - - /** - * Support for USB thumb drives using an Arduino USB Host Shield or - * equivalent MAX3421E breakout board. The USB thumb drive will appear - * to Marlin as an SD card. - * - * The MAX3421E must be assigned the same pins as the SD card reader, with - * the following pin mapping: - * - * SCLK, MOSI, MISO --> SCLK, MOSI, MISO - * INT --> SD_DETECT_PIN - * SS --> SDSS - */ - //#define USB_FLASH_DRIVE_SUPPORT - #if ENABLED(USB_FLASH_DRIVE_SUPPORT) - #define USB_CS_PIN SDSS - #define USB_INTR_PIN SD_DETECT_PIN - #endif - - /** - * When using a bootloader that supports SD-Firmware-Flashing, - * add a menu item to activate SD-FW-Update on the next reboot. - * - * Requires ATMEGA2560 (Arduino Mega) - * - * Tested with this bootloader: - * https://github.com/FleetProbe/MicroBridge-Arduino-ATMega2560 - */ - //#define SD_FIRMWARE_UPDATE - #if ENABLED(SD_FIRMWARE_UPDATE) - #define SD_FIRMWARE_UPDATE_EEPROM_ADDR 0x1FF - #define SD_FIRMWARE_UPDATE_ACTIVE_VALUE 0xF0 - #define SD_FIRMWARE_UPDATE_INACTIVE_VALUE 0xFF - #endif - - // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER - -#endif // SDSUPPORT - -/** - * Additional options for Graphical Displays - * - * Use the optimizations here to improve printing performance, - * which can be adversely affected by graphical display drawing, - * especially when doing several short moves, and when printing - * on DELTA and SCARA machines. - * - * Some of these options may result in the display lagging behind - * controller events, as there is a trade-off between reliable - * printing performance versus fast display updates. - */ -#if HAS_GRAPHICAL_LCD - // Show SD percentage next to the progress bar - //#define DOGM_SD_PERCENT - - // Enable to save many cycles by drawing a hollow frame on the Info Screen - #define XYZ_HOLLOW_FRAME - - // Enable to save many cycles by drawing a hollow frame on Menu Screens - #define MENU_HOLLOW_FRAME - - // A bigger font is available for edit items. Costs 3120 bytes of PROGMEM. - // Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese. - //#define USE_BIG_EDIT_FONT - - // A smaller font may be used on the Info Screen. Costs 2300 bytes of PROGMEM. - // Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese. - //#define USE_SMALL_INFOFONT - - // Enable this option and reduce the value to optimize screen updates. - // The normal delay is 10µs. Use the lowest value that still gives a reliable display. - //#define DOGM_SPI_DELAY_US 5 - - // Swap the CW/CCW indicators in the graphics overlay - //#define OVERLAY_GFX_REVERSE - - #if ENABLED(U8GLIB_ST7920) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ - //#define LIGHTWEIGHT_UI - #if ENABLED(LIGHTWEIGHT_UI) - #define STATUS_EXPIRE_SECONDS 20 - #endif - #endif - - /** - * 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_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_XY // Also enable X/Y Babystepping. Not supported on DELTA! - #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. - - //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. - #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) - #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. - // Note: Extra time may be added to mitigate controller latency. - #endif - - //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif - //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping - #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets - //#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor - #endif -#endif - -// @section extruder - -/** - * Linear Pressure Control v1.5 - * - * Assumption: advance [steps] = k * (delta velocity [steps/s]) - * K=0 means advance disabled. - * - * NOTE: K values for LIN_ADVANCE 1.5 differ from earlier versions! - * - * Set K around 0.22 for 3mm PLA Direct Drive with ~6.5cm between the drive gear and heatbreak. - * Larger K values will be needed for flexible filament and greater distances. - * If this algorithm produces a higher speed offset than the extruder can handle (compared to E jerk) - * print acceleration will be reduced during the affected moves to keep within the limit. - * - * See http://marlinfw.org/docs/features/lin_advance.html for full instructions. - * Mention @Sebastianv650 on GitHub to alert the author of any issues. - */ -//#define LIN_ADVANCE -#if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed - //#define LA_DEBUG // If enabled, this will generate debug information output over USB. -#endif - -// @section leveling - -#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_UBL) - // Override the mesh area if the automatic (max) area is too large - //#define MESH_MIN_X MESH_INSET - //#define MESH_MIN_Y MESH_INSET - //#define MESH_MAX_X X_BED_SIZE - (MESH_INSET) - //#define MESH_MAX_Y Y_BED_SIZE - (MESH_INSET) -#endif - -/** - * Repeatedly attempt G29 leveling until it succeeds. - * Stop after G29_MAX_RETRIES attempts. - */ -//#define G29_RETRY_AND_RECOVER -#if ENABLED(G29_RETRY_AND_RECOVER) - #define G29_MAX_RETRIES 3 - #define G29_HALT_ON_FAILURE - /** - * Specify the GCODE commands that will be executed when leveling succeeds, - * between attempts, and after the maximum number of retries have been tried. - */ - #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." - #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" - #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" -#endif - -// @section extras - -// -// G2/G3 Arc Support -// -#define ARC_SUPPORT // Disable this feature to save ~3226 bytes -#if ENABLED(ARC_SUPPORT) - #define MM_PER_ARC_SEGMENT 1 // Length of each arc segment - #define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections - //#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles - //#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes -#endif - -// Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes. -//#define BEZIER_CURVE_SUPPORT - -// G38.2 and G38.3 Probe Target -// Set MULTIPLE_PROBING if you want G38 to double touch -//#define G38_PROBE_TARGET -#if ENABLED(G38_PROBE_TARGET) - #define G38_MINIMUM_MOVE 0.0275 // minimum distance in mm that will produce a move (determined using the print statement in check_move) -#endif - -// Moves (or segments) with fewer steps than this will be joined with the next move -#define MIN_STEPS_PER_SEGMENT 6 - -/** - * Minimum delay after setting the stepper DIR (in ns) - * 0 : No delay (Expect at least 10µS since one Stepper ISR must transpire) - * 20 : Minimum for TMC2xxx drivers - * 200 : Minimum for A4988 drivers - * 400 : Minimum for A5984 drivers - * 500 : Minimum for LV8729 drivers (guess, no info in datasheet) - * 650 : Minimum for DRV8825 drivers - * 1500 : Minimum for TB6600 drivers (guess, no info in datasheet) - * 15000 : Minimum for TB6560 drivers (guess, no info in datasheet) - * - * Override the default value based on the driver type set in Configuration.h. - */ -//#define MINIMUM_STEPPER_DIR_DELAY 650 - -/** - * Minimum stepper driver pulse width (in µs) - * 0 : Smallest possible width the MCU can produce, compatible with TMC2xxx drivers - * 1 : Minimum for A4988, A5984, and LV8729 stepper drivers - * 2 : Minimum for DRV8825 stepper drivers - * 3 : Minimum for TB6600 stepper drivers - * 30 : Minimum for TB6560 stepper drivers - * - * Override the default value based on the driver type set in Configuration.h. - */ -//#define MINIMUM_STEPPER_PULSE 2 - -/** - * Maximum stepping rate (in Hz) the stepper driver allows - * If undefined, defaults to 1MHz / (2 * MINIMUM_STEPPER_PULSE) - * 500000 : Maximum for A4988 stepper driver - * 400000 : Maximum for TMC2xxx stepper drivers - * 250000 : Maximum for DRV8825 stepper driver - * 150000 : Maximum for TB6600 stepper driver - * 130000 : Maximum for LV8729 stepper driver - * 15000 : Maximum for TB6560 stepper driver - * - * Override the default value based on the driver type set in Configuration.h. - */ -//#define MAXIMUM_STEPPER_RATE 250000 - -// @section temperature - -// Control heater 0 and heater 1 in parallel. -//#define HEATERS_PARALLEL - -//=========================================================================== -//================================= Buffers ================================= -//=========================================================================== - -// @section hidden - -// The number of linear motions that can be in the plan at any give time. -// THE BLOCK_BUFFER_SIZE NEEDS TO BE A POWER OF 2 (e.g. 8, 16, 32) because shifts and ors are used to do the ring-buffering. -#if ENABLED(SDSUPPORT) - #define BLOCK_BUFFER_SIZE 16 // SD,LCD,Buttons take more memory, block buffer needs to be smaller -#else - #define BLOCK_BUFFER_SIZE 16 // maximize block buffer -#endif - -// @section serial - -// The ASCII buffer for serial input -#define MAX_CMD_SIZE 96 -#define BUFSIZE 4 - -// Transmission to Host Buffer Size -// To save 386 bytes of PROGMEM (and TX_BUFFER_SIZE+3 bytes of RAM) set to 0. -// To buffer a simple "ok" you need 4 bytes. -// For ADVANCED_OK (M105) you need 32 bytes. -// For debug-echo: 128 bytes for the optimal speed. -// Other output doesn't need to be that speedy. -// :[0, 2, 4, 8, 16, 32, 64, 128, 256] -#define TX_BUFFER_SIZE 0 - -// Host Receive Buffer Size -// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough. -// To use flow control, set this buffer size to at least 1024 bytes. -// :[0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048] -//#define RX_BUFFER_SIZE 1024 - -#if RX_BUFFER_SIZE >= 1024 - // Enable to have the controller send XON/XOFF control characters to - // the host to signal the RX buffer is becoming full. - //#define SERIAL_XON_XOFF -#endif - -#if ENABLED(SDSUPPORT) - // Enable this option to collect and display the maximum - // RX queue usage after transferring a file to SD. - //#define SERIAL_STATS_MAX_RX_QUEUED - - // Enable this option to collect and display the number - // of dropped bytes after a file transfer to SD. - //#define SERIAL_STATS_DROPPED_RX -#endif - -// Enable an emergency-command parser to intercept certain commands as they -// enter the serial receive buffer, so they cannot be blocked. -// Currently handles M108, M112, M410 -// Does not work on boards using AT90USB (USBCON) processors! -//#define EMERGENCY_PARSER - -// Bad Serial-connections can miss a received command by sending an 'ok' -// Therefore some clients abort after 30 seconds in a timeout. -// Some other clients start sending commands while receiving a 'wait'. -// This "wait" is only sent when the buffer is empty. 1 second is a good value here. -//#define NO_TIMEOUTS 1000 // Milliseconds - -// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary. -//#define ADVANCED_OK - -// 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 - -/** - * Advanced Pause - * Experimental feature for filament change support and for parking the nozzle when paused. - * Adds the GCode M600 for initiating filament change. - * If PARK_HEAD_ON_PAUSE enabled, adds the GCode M125 to pause printing and park the nozzle. - * - * Requires an LCD display. - * Requires NOZZLE_PARK_FEATURE. - * This feature is required for the default FILAMENT_RUNOUT_SCRIPT. - */ -//#define ADVANCED_PAUSE_FEATURE -#if ENABLED(ADVANCED_PAUSE_FEATURE) - #define PAUSE_PARK_RETRACT_FEEDRATE 60 // (mm/s) Initial retract feedrate. - #define PAUSE_PARK_RETRACT_LENGTH 2 // (mm) Initial retract. - // This short retract is done immediately, before parking the nozzle. - #define FILAMENT_CHANGE_UNLOAD_FEEDRATE 10 // (mm/s) Unload filament feedrate. This can be pretty fast. - #define FILAMENT_CHANGE_UNLOAD_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate. - #define FILAMENT_CHANGE_UNLOAD_LENGTH 100 // (mm) The length of filament for a complete unload. - // For Bowden, the full length of the tube and nozzle. - // For direct drive, the full length of the nozzle. - // Set to 0 for manual unloading. - #define FILAMENT_CHANGE_SLOW_LOAD_FEEDRATE 6 // (mm/s) Slow move when starting load. - #define FILAMENT_CHANGE_SLOW_LOAD_LENGTH 0 // (mm) Slow length, to allow time to insert material. - // 0 to disable start loading and skip to fast load only - #define FILAMENT_CHANGE_FAST_LOAD_FEEDRATE 6 // (mm/s) Load filament feedrate. This can be pretty fast. - #define FILAMENT_CHANGE_FAST_LOAD_ACCEL 25 // (mm/s^2) Lower acceleration may allow a faster feedrate. - #define FILAMENT_CHANGE_FAST_LOAD_LENGTH 0 // (mm) Load length of filament, from extruder gear to nozzle. - // For Bowden, the full length of the tube and nozzle. - // For direct drive, the full length of the nozzle. - //#define ADVANCED_PAUSE_CONTINUOUS_PURGE // Purge continuously up to the purge length until interrupted. - #define ADVANCED_PAUSE_PURGE_FEEDRATE 3 // (mm/s) Extrude feedrate (after loading). Should be slower than load feedrate. - #define ADVANCED_PAUSE_PURGE_LENGTH 50 // (mm) Length to extrude after loading. - // Set to 0 for manual extrusion. - // Filament can be extruded repeatedly from the Filament Change menu - // until extrusion is consistent, and to purge old filament. - - // Filament Unload does a Retract, Delay, and Purge first: - #define FILAMENT_UNLOAD_RETRACT_LENGTH 13 // (mm) Unload initial retract length. - #define FILAMENT_UNLOAD_DELAY 5000 // (ms) Delay for the filament to cool after retract. - #define FILAMENT_UNLOAD_PURGE_LENGTH 8 // (mm) An unretract is done, then this length is purged. - - #define PAUSE_PARK_NOZZLE_TIMEOUT 45 // (seconds) Time limit before the nozzle is turned off for safety. - #define FILAMENT_CHANGE_ALERT_BEEPS 10 // Number of alert beeps to play when a response is needed. - #define PAUSE_PARK_NO_STEPPER_TIMEOUT // Enable for XYZ steppers to stay powered on during filament change. - - //#define PARK_HEAD_ON_PAUSE // Park the nozzle during pause and filament change. - //#define HOME_BEFORE_FILAMENT_CHANGE // Ensure homing has been completed prior to parking for filament change - - //#define FILAMENT_LOAD_UNLOAD_GCODES // Add M701/M702 Load/Unload G-codes, plus Load/Unload in the LCD Prepare menu. - //#define FILAMENT_UNLOAD_ALL_EXTRUDERS // Allow M702 to unload all extruders above a minimum target temp (as set by M302) -#endif - -// @section tmc - -/** - * TMC26X Stepper Driver options - * - * The TMC26XStepper library is required for this stepper driver. - * https://github.com/trinamic/TMC26XStepper - */ -#if HAS_DRIVER(TMC26X) - - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps - - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 - - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 - - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 - - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 - - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 - - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 - - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 - - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 - - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 - - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 - - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 - - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 - -#endif // TMC26X - -// @section tmc_smart - -/** - * To use TMC2130 stepper drivers in SPI mode connect your SPI pins to - * the hardware SPI interface on your board and define the required CS pins - * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.). - * You may also use software SPI if you wish to use general purpose IO pins. - * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. - * The drivers can also be used with hardware serial. - * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper - */ -#if HAS_TRINAMIC - - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 - #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current - #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 - - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 - - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 - - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 - - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 - - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 - - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 - - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 - - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 - - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 - - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 - - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 - - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 - - /** - * Use software SPI for TMC2130. - * The default SW SPI pins are defined the respective pins files, - * but you can override or define them here. - */ - //#define TMC_USE_SW_SPI - //#define TMC_SW_MOSI -1 - //#define TMC_SW_MISO -1 - //#define TMC_SW_SCK -1 - - /** - * Use Trinamic's ultra quiet stepping mode. - * When disabled, Marlin will use spreadCycle stepping mode. - */ - #define STEALTHCHOP - - /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, - * like overtemperature and short to ground. TMC2208 requires hardware serial. - * In the case of overtemperature Marlin can decrease the driver current until error condition clears. - * Other detected conditions can be used to stop the current print. - * Relevant g-codes: - * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. - * M911 - Report stepper driver overtemperature pre-warn condition. - * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) - */ - //#define MONITOR_DRIVER_STATUS - - #if ENABLED(MONITOR_DRIVER_STATUS) - #define CURRENT_STEP_DOWN 50 // [mA] - #define REPORT_CURRENT_CHANGE - #define STOP_ON_ERROR - #endif - - /** - * The driver will switch to spreadCycle when stepper speed is over HYBRID_THRESHOLD. - * This mode allows for faster movements at the expense of higher noise levels. - * STEALTHCHOP needs to be enabled. - * M913 X/Y/Z/E to live tune the setting - */ - //#define HYBRID_THRESHOLD - - #define X_HYBRID_THRESHOLD 100 // [mm/s] - #define X2_HYBRID_THRESHOLD 100 - #define Y_HYBRID_THRESHOLD 100 - #define Y2_HYBRID_THRESHOLD 100 - #define Z_HYBRID_THRESHOLD 3 - #define Z2_HYBRID_THRESHOLD 3 - #define Z3_HYBRID_THRESHOLD 3 - #define E0_HYBRID_THRESHOLD 30 - #define E1_HYBRID_THRESHOLD 30 - #define E2_HYBRID_THRESHOLD 30 - #define E3_HYBRID_THRESHOLD 30 - #define E4_HYBRID_THRESHOLD 30 - #define E5_HYBRID_THRESHOLD 30 - - /** - * Use StallGuard2 to sense an obstacle and trigger an endstop. - * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. - * X, Y, and Z homing will always be done in spreadCycle mode. - * - * X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity. - * Higher values make the system LESS sensitive. - * Lower value make the system MORE sensitive. - * Too low values can lead to false positives, while too high values will collide the axis without triggering. - * It is advised to set X/Y/Z_HOME_BUMP_MM to 0. - * M914 X/Y/Z to live tune the setting - */ - //#define SENSORLESS_HOMING // TMC2130 only - - /** - * Use StallGuard2 to probe the bed with the nozzle. - * - * CAUTION: This could cause damage to machines that use a lead screw or threaded rod - * to move the Z axis. Take extreme care when attempting to enable this feature. - */ - //#define SENSORLESS_PROBING // TMC2130 only - - #if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING) - #define X_STALL_SENSITIVITY 8 - #define Y_STALL_SENSITIVITY 8 - //#define Z_STALL_SENSITIVITY 8 - #endif - - /** - * Enable M122 debugging command for TMC stepper drivers. - * M122 S0/1 will enable continous reporting. - */ - //#define TMC_DEBUG - - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - - /** - * You can set your own advanced settings by filling in predefined functions. - * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper - * - * Example: - * #define TMC_ADV() { \ - * stepperX.diag0_temp_prewarn(1); \ - * stepperY.interpolate(0); \ - * } - */ - #define TMC_ADV() { } - -#endif // HAS_TRINAMIC - -// @section L6470 - -/** - * L6470 Stepper Driver options - * - * The Arduino-L6470 library is required for this stepper driver. - * https://github.com/ameyer/Arduino-L6470 - */ -#if HAS_DRIVER(L6470) - - #define X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall - - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 - - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 - - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 - - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 - - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 - - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 - - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 - - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 - - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 - - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 - - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 - - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 - -#endif // L6470 - -/** - * TWI/I2C BUS - * - * This feature is an EXPERIMENTAL feature so it shall not be used on production - * machines. Enabling this will allow you to send and receive I2C data from slave - * devices on the bus. - * - * ; Example #1 - * ; This macro send the string "Marlin" to the slave device with address 0x63 (99) - * ; It uses multiple M260 commands with one B arg - * M260 A99 ; Target slave address - * M260 B77 ; M - * M260 B97 ; a - * M260 B114 ; r - * M260 B108 ; l - * M260 B105 ; i - * M260 B110 ; n - * M260 S1 ; Send the current buffer - * - * ; Example #2 - * ; Request 6 bytes from slave device with address 0x63 (99) - * M261 A99 B5 - * - * ; Example #3 - * ; Example serial output of a M261 request - * echo:i2c-reply: from:99 bytes:5 data:hello - */ - -// @section i2cbus - -//#define EXPERIMENTAL_I2CBUS -#define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave - -// @section extras - -/** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ - */ -//#define CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH -#endif - -/** - * Spindle & Laser control - * - * Add the M3, M4, and M5 commands to turn the spindle/laser on and off, and - * to set spindle speed, spindle direction, and laser power. - * - * SuperPid is a router/spindle speed controller used in the CNC milling community. - * Marlin can be used to turn the spindle on and off. It can also be used to set - * the spindle speed from 5,000 to 30,000 RPM. - * - * You'll need to select a pin for the ON/OFF function and optionally choose a 0-5V - * hardware PWM pin for the speed control and a pin for the rotation direction. - * - * See http://marlinfw.org/docs/configuration/laser_spindle.html for more config details. - */ -//#define SPINDLE_LASER_ENABLE -#if ENABLED(SPINDLE_LASER_ENABLE) - - #define SPINDLE_LASER_ENABLE_INVERT false // set to "true" if the on/off function is reversed - #define SPINDLE_LASER_PWM true // set to true if your controller supports setting the speed/power - #define SPINDLE_LASER_PWM_INVERT true // set to "true" if the speed/power goes up when you want it to go slower - #define SPINDLE_LASER_POWERUP_DELAY 5000 // delay in milliseconds to allow the spindle/laser to come up to speed/power - #define SPINDLE_LASER_POWERDOWN_DELAY 5000 // delay in milliseconds to allow the spindle to stop - #define SPINDLE_DIR_CHANGE true // set to true if your spindle controller supports changing spindle direction - #define SPINDLE_INVERT_DIR false - #define SPINDLE_STOP_ON_DIR_CHANGE true // set to true if Marlin should stop the spindle before changing rotation direction - - /** - * The M3 & M4 commands use the following equation to convert PWM duty cycle to speed/power - * - * SPEED/POWER = PWM duty cycle * SPEED_POWER_SLOPE + SPEED_POWER_INTERCEPT - * where PWM duty cycle varies from 0 to 255 - * - * set the following for your controller (ALL MUST BE SET) - */ - - #define SPEED_POWER_SLOPE 118.4 - #define SPEED_POWER_INTERCEPT 0 - #define SPEED_POWER_MIN 5000 - #define SPEED_POWER_MAX 30000 // SuperPID router controller 0 - 30,000 RPM - - //#define SPEED_POWER_SLOPE 0.3922 - //#define SPEED_POWER_INTERCEPT 0 - //#define SPEED_POWER_MIN 10 - //#define SPEED_POWER_MAX 100 // 0-100% -#endif - -/** - * Filament Width Sensor - * - * Measures the filament width in real-time and adjusts - * flow rate to compensate for any irregularities. - * - * Also allows the measured filament diameter to set the - * extrusion rate, so the slicer only has to specify the - * volume. - * - * Only a single extruder is supported at this time. - * - * 34 RAMPS_14 : Analog input 5 on the AUX2 connector - * 81 PRINTRBOARD : Analog input 2 on the Exp1 connector (version B,C,D,E) - * 301 RAMBO : Analog input 3 - * - * Note: May require analog pins to be defined for other boards. - */ -//#define FILAMENT_WIDTH_SENSOR - -#if ENABLED(FILAMENT_WIDTH_SENSOR) - #define FILAMENT_SENSOR_EXTRUDER_NUM 0 // Index of the extruder that has the filament sensor. :[0,1,2,3,4] - #define MEASUREMENT_DELAY_CM 14 // (cm) The distance from the filament sensor to the melting chamber - - #define FILWIDTH_ERROR_MARGIN 1.0 // (mm) If a measurement differs too much from nominal width ignore it - #define MAX_MEASUREMENT_DELAY 20 // (bytes) Buffer size for stored measurements (1 byte per cm). Must be larger than MEASUREMENT_DELAY_CM. - - #define DEFAULT_MEASURED_FILAMENT_DIA DEFAULT_NOMINAL_FILAMENT_DIA // Set measured to nominal initially - - // Display filament width on the LCD status line. Status messages will expire after 5 seconds. - //#define FILAMENT_LCD_DISPLAY -#endif - -/** - * CNC Coordinate Systems - * - * Enables G53 and G54-G59.3 commands to select coordinate systems - * and G92.1 to reset the workspace to native machine space. - */ -//#define CNC_COORDINATE_SYSTEMS - -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - -/** - * Auto-report temperatures with M155 S - */ -#define AUTO_REPORT_TEMPERATURES - -/** - * Include capabilities in M115 output - */ -#define EXTENDED_CAPABILITIES_REPORT - -/** - * Disable all Volumetric extrusion options - */ -//#define NO_VOLUMETRICS - -#if DISABLED(NO_VOLUMETRICS) - /** - * Volumetric extrusion default state - * Activate to make volumetric extrusion the default method, - * with DEFAULT_NOMINAL_FILAMENT_DIA as the default diameter. - * - * M200 D0 to disable, M200 Dn to set a new diameter. - */ - //#define VOLUMETRIC_DEFAULT_ON -#endif - -/** - * Enable this option for a leaner build of Marlin that removes all - * workspace offsets, simplifying coordinate transformations, leveling, etc. - * - * - M206 and M428 are disabled. - * - G92 will revert to its behavior from Marlin 1.0. - */ -//#define NO_WORKSPACE_OFFSETS - -/** - * Set the number of proportional font spaces required to fill up a typical character space. - * This can help to better align the output of commands like `G29 O` Mesh Output. - * - * For clients that use a fixed-width font (like OctoPrint), leave this set to 1.0. - * Otherwise, adjust according to your client and font. - */ -#define PROPORTIONAL_FONT_RATIO 1.0 - -/** - * Spend 28 bytes of SRAM to optimize the GCode parser - */ -#define FASTER_GCODE_PARSER - -/** - * CNC G-code options - * Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc. - * Note that G0 feedrates should be used with care for 3D printing (if used at all). - * High feedrates may cause ringing and harm print quality. - */ -//#define PAREN_COMMENTS // Support for parentheses-delimited comments -//#define GCODE_MOTION_MODES // Remember the motion mode (G0 G1 G2 G3 G5 G38.X) and apply for X Y Z E F, etc. - -// Enable and set a (default) feedrate for all G0 moves -//#define G0_FEEDRATE 3000 // (mm/m) -#ifdef G0_FEEDRATE - //#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode -#endif - -/** - * G-code Macros - * - * Add G-codes M810-M819 to define and run G-code macros. - * Macros are not saved to EEPROM. - */ -//#define GCODE_MACROS -#if ENABLED(GCODE_MACROS) - #define GCODE_MACROS_SLOTS 5 // Up to 10 may be used - #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro -#endif - -/** - * User-defined menu items that execute custom GCode - */ -//#define CUSTOM_USER_MENUS -#if ENABLED(CUSTOM_USER_MENUS) - //#define CUSTOM_USER_MENU_TITLE "Custom Commands" - #define USER_SCRIPT_DONE "M117 User Script Done" - #define USER_SCRIPT_AUDIBLE_FEEDBACK - //#define USER_SCRIPT_RETURN // Return to status screen after a script - - #define USER_DESC_1 "Home & UBL Info" - #define USER_GCODE_1 "G28\nG29 W" - - #define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL - #define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND) - - #define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL - #define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND) - - #define USER_DESC_4 "Heat Bed/Home/Level" - #define USER_GCODE_4 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nG28\nG29" - - #define USER_DESC_5 "Home & Info" - #define USER_GCODE_5 "G28\nM503" -#endif - -/** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" - -//=========================================================================== -//====================== I2C Position Encoder Settings ====================== -//=========================================================================== - -/** - * I2C position encoders for closed loop control. - * Developed by Chris Barr at Aus3D. - * - * Wiki: http://wiki.aus3d.com.au/Magnetic_Encoder - * Github: https://github.com/Aus3D/MagneticEncoder - * - * Supplier: http://aus3d.com.au/magnetic-encoder-module - * Alternative Supplier: http://reliabuild3d.com/ - * - * Reilabuild encoders have been modified to improve reliability. - */ - -//#define I2C_POSITION_ENCODERS -#if ENABLED(I2C_POSITION_ENCODERS) - - #define I2CPE_ENCODER_CNT 1 // The number of encoders installed; max of 5 - // encoders supported currently. - - #define I2CPE_ENC_1_ADDR I2CPE_PRESET_ADDR_X // I2C address of the encoder. 30-200. - #define I2CPE_ENC_1_AXIS X_AXIS // Axis the encoder module is installed on. _AXIS. - #define I2CPE_ENC_1_TYPE I2CPE_ENC_TYPE_LINEAR // Type of encoder: I2CPE_ENC_TYPE_LINEAR -or- - // I2CPE_ENC_TYPE_ROTARY. - #define I2CPE_ENC_1_TICKS_UNIT 2048 // 1024 for magnetic strips with 2mm poles; 2048 for - // 1mm poles. For linear encoders this is ticks / mm, - // for rotary encoders this is ticks / revolution. - //#define I2CPE_ENC_1_TICKS_REV (16 * 200) // Only needed for rotary encoders; number of stepper - // steps per full revolution (motor steps/rev * microstepping) - //#define I2CPE_ENC_1_INVERT // Invert the direction of axis travel. - #define I2CPE_ENC_1_EC_METHOD I2CPE_ECM_MICROSTEP // Type of error error correction. - #define I2CPE_ENC_1_EC_THRESH 0.10 // Threshold size for error (in mm) above which the - // printer will attempt to correct the error; errors - // smaller than this are ignored to minimize effects of - // measurement noise / latency (filter). - - #define I2CPE_ENC_2_ADDR I2CPE_PRESET_ADDR_Y // Same as above, but for encoder 2. - #define I2CPE_ENC_2_AXIS Y_AXIS - #define I2CPE_ENC_2_TYPE I2CPE_ENC_TYPE_LINEAR - #define I2CPE_ENC_2_TICKS_UNIT 2048 - //#define I2CPE_ENC_2_TICKS_REV (16 * 200) - //#define I2CPE_ENC_2_INVERT - #define I2CPE_ENC_2_EC_METHOD I2CPE_ECM_MICROSTEP - #define I2CPE_ENC_2_EC_THRESH 0.10 - - #define I2CPE_ENC_3_ADDR I2CPE_PRESET_ADDR_Z // Encoder 3. Add additional configuration options - #define I2CPE_ENC_3_AXIS Z_AXIS // as above, or use defaults below. - - #define I2CPE_ENC_4_ADDR I2CPE_PRESET_ADDR_E // Encoder 4. - #define I2CPE_ENC_4_AXIS E_AXIS - - #define I2CPE_ENC_5_ADDR 34 // Encoder 5. - #define I2CPE_ENC_5_AXIS E_AXIS - - // Default settings for encoders which are enabled, but without settings configured above. - #define I2CPE_DEF_TYPE I2CPE_ENC_TYPE_LINEAR - #define I2CPE_DEF_ENC_TICKS_UNIT 2048 - #define I2CPE_DEF_TICKS_REV (16 * 200) - #define I2CPE_DEF_EC_METHOD I2CPE_ECM_NONE - #define I2CPE_DEF_EC_THRESH 0.1 - - //#define I2CPE_ERR_THRESH_ABORT 100.0 // Threshold size for error (in mm) error on any given - // axis after which the printer will abort. Comment out to - // disable abort behaviour. - - #define I2CPE_TIME_TRUSTED 10000 // After an encoder fault, there must be no further fault - // for this amount of time (in ms) before the encoder - // is trusted again. - - /** - * Position is checked every time a new command is executed from the buffer but during long moves, - * this setting determines the minimum update time between checks. A value of 100 works well with - * error rolling average when attempting to correct only for skips and not for vibration. - */ - #define I2CPE_MIN_UPD_TIME_MS 4 // (ms) Minimum time between encoder checks. - - // Use a rolling average to identify persistant errors that indicate skips, as opposed to vibration and noise. - #define I2CPE_ERR_ROLLING_AVERAGE - -#endif // I2C_POSITION_ENCODERS - -/** - * MAX7219 Debug Matrix - * - * Add support for a low-cost 8x8 LED Matrix based on the Max7219 chip as a realtime status display. - * Requires 3 signal wires. Some useful debug options are included to demonstrate its usage. - */ -//#define MAX7219_DEBUG -#if ENABLED(MAX7219_DEBUG) - #define MAX7219_CLK_PIN 64 - #define MAX7219_DIN_PIN 57 - #define MAX7219_LOAD_PIN 44 - - //#define MAX7219_GCODE // Add the M7219 G-code to control the LED matrix - #define MAX7219_INIT_TEST 2 // Do a test pattern at initialization (Set to 2 for spiral) - #define MAX7219_NUMBER_UNITS 1 // Number of Max7219 units in chain. - #define MAX7219_ROTATE 0 // Rotate the display clockwise (in multiples of +/- 90°) - // connector at: right=0 bottom=-90 top=90 left=180 - //#define MAX7219_REVERSE_ORDER // The individual LED matrix units may be in reversed order - - /** - * Sample debug features - * If you add more debug displays, be careful to avoid conflicts! - */ - #define MAX7219_DEBUG_PRINTER_ALIVE // Blink corner LED of 8x8 matrix to show that the firmware is functioning - #define MAX7219_DEBUG_PLANNER_HEAD 3 // Show the planner queue head position on this and the next LED matrix row - #define MAX7219_DEBUG_PLANNER_TAIL 5 // Show the planner queue tail position on this and the next LED matrix row - - #define MAX7219_DEBUG_PLANNER_QUEUE 0 // Show the current planner queue depth on this and the next LED matrix row - // If you experience stuttering, reboots, etc. this option can reveal how - // tweaks made to the configuration are affecting the printer in real-time. -#endif - -/** - * NanoDLP Sync support - * - * Add support for Synchronized Z moves when using with NanoDLP. G0/G1 axis moves will output "Z_move_comp" - * string to enable synchronization with DLP projector exposure. This change will allow to use - * [[WaitForDoneMessage]] instead of populating your gcode with M400 commands - */ -//#define NANODLP_Z_SYNC -#if ENABLED(NANODLP_Z_SYNC) - //#define NANODLP_ALL_AXIS // Enables "Z_move_comp" output on any axis move. - // Default behaviour is limited to Z axis only. -#endif - -/** - * WiFi Support (Espressif ESP32 WiFi) - */ -//#define WIFISUPPORT -#if ENABLED(WIFISUPPORT) - #define WIFI_SSID "Wifi SSID" - #define WIFI_PWD "Wifi Password" -#endif - -// Enable Marlin dev mode which adds some special commands -//#define MARLIN_DEV_MODE diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index 575bf2653957..4a7fb642b9f5 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -57,6 +57,7 @@ #define BOARD_BAM_DICE 401 // 2PrintBeta BAM&DICE with STK drivers #define BOARD_BAM_DICE_DUE 402 // 2PrintBeta BAM&DICE Due with STK drivers #define BOARD_MKS_BASE 40 // MKS BASE v1.0 +#define BOARD_MKS_BASE_14 404 // MKS v1.4 A4982 stepper drivers #define BOARD_MKS_BASE_15 405 // MKS v1.5 with Allegro A4982 stepper drivers #define BOARD_MKS_BASE_HEROIC 41 // MKS BASE 1.0 with Heroic HR4982 stepper drivers #define BOARD_MKS_GEN_13 47 // MKS GEN v1.3 or 1.4 @@ -74,6 +75,7 @@ #define BOARD_ULTIMAIN_2 72 // Ultimainboard 2.x (Uses TEMP_SENSOR 20) #define BOARD_RUMBA 80 // Rumba #define BOARD_RUMBA_RAISE3D 333 // Raise3D N series Rumba derivative +#define BOARD_RL200 801 // Rapide Lite 200 (v1, low-cost RUMBA clone with drv) #define BOARD_FORMBOT_TREX2PLUS 95 // Formbot T-Rex 2 Plus #define BOARD_FORMBOT_TREX3 96 // Formbot T-Rex 3 #define BOARD_FORMBOT_RAPTOR 97 // Formbot Raptor @@ -85,6 +87,9 @@ #define BOARD_RAMPS_ENDER_4 243 // Creality: Ender-4, CR-8 #define BOARD_RAMPS_CREALITY 244 // Creality: CR10S, CR20, CR-X #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 @@ -99,6 +104,7 @@ #define BOARD_MEGATRONICS_2 701 // Megatronics v2.0 #define BOARD_MEGATRONICS_3 703 // Megatronics v3.0 #define BOARD_MEGATRONICS_31 704 // Megatronics v3.1 +#define BOARD_MEGATRONICS_32 705 // Megatronics v3.2 #define BOARD_RAMBO 301 // Rambo #define BOARD_MINIRAMBO 302 // Mini-Rambo #define BOARD_MINIRAMBO_10A 303 // Mini-Rambo 1.0a @@ -112,6 +118,7 @@ #define BOARD_GT2560_REV_A_PLUS 75 // Geeetech GT2560 Rev. A+ (with auto level probe) #define BOARD_GT2560_V3 76 // Geeetech GT2560 Rev B for A10(M/D) #define BOARD_GT2560_V3_MC2 73 // Geeetech GT2560 Rev B for Mecreator2 +#define BOARD_GT2560_V3_A20 86 // Geeetech GT2560 Rev B for A20(M/D) #define BOARD_EINSTART_S 666 // Einstart retrofit // @@ -182,7 +189,12 @@ #define BOARD_COHESION3D_REMIX 1755 // Cohesion3D ReMix #define BOARD_COHESION3D_MINI 1756 // Cohesion3D Mini #define BOARD_SMOOTHIEBOARD 1757 // Smoothieboard -#define BOARD_AZTEEG_X5_MINI_WIFI 1758 // Azteeg X5 Mini (Power outputs: Hotend0, Bed, Fan) +#define BOARD_AZTEEG_X5_MINI_WIFI 1758 // Azteeg X5 Mini Wifi (Power outputs: Hotend0, Bed, Fan) +#define BOARD_BIQU_SKR_V1_1 1759 // BIQU SKR_V1.1 (Power outputs: Hotend0,Hotend1, Fan, Bed) +#define BOARD_BIQU_B300_V1_0 1760 // BIQU B300_V1.0 (Power outputs: Hotend0, Fan, Bed, SPI Driver) +#define BOARD_BIGTREE_SKR_V1_3 1761 // BIGTREE SKR_V1.3 (Power outputs: Hotend0, Hotend1, Fan, Bed) +#define BOARD_AZTEEG_X5_MINI 1762 // Azteeg X5 Mini (Power outputs: Hotend0, Bed, Fan) +#define BOARD_MKS_SGEN 1763 // MKS-SGen (Power outputs: Hotend0, Hotend1, Bed, Fan) // // SAM3X8E ARM Cortex M3 @@ -215,6 +227,13 @@ #define BOARD_ARCHIM2 1592 // UltiMachine Archim2 (with TMC2130 drivers) #define BOARD_ALLIGATOR 1602 // Alligator Board R2 +// +// SAM3X8C ARM Cortex M3 +// + +#define BOARD_PRINTRBOARD_G2 1620 // PRINTRBOARD G2 +#define BOARD_ADSK 1610 // Arduino DUE Shield Kit (ADSK) + // // STM32 ARM Cortex-M3 // @@ -224,6 +243,7 @@ #define BOARD_STM3R_MINI 1803 // STM32 Libmaple based stm32f1 controller #define BOARD_GTM32_PRO_VB 1805 // STM32f103VET6 controller #define BOARD_MORPHEUS 1806 // STM32F103C8/STM32F103CB Libmaple based stm32f1 controller +#define BOARD_MKS_ROBIN 1808 // MKS Robin / STM32F103ZET6 // // STM32 ARM Cortex-M4F @@ -234,6 +254,10 @@ #define BOARD_BEAST 1802 // STM32FxxxVxT6 Libmaple based stm32f4 controller #define BOARD_STM32F4 1804 // STM32 STM32GENERIC based STM32F4 controller #define BOARD_ARMED 1807 // Arm'ed STM32F4 based controller +#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 // // ARM Cortex M7 @@ -247,4 +271,10 @@ // #define BOARD_ESP32 1900 +// +// Simulations +// + +#define BOARD_LINUX_RAMPS 2000 + #define MB(board) (defined(BOARD_##board) && MOTHERBOARD==BOARD_##board) diff --git a/Marlin/src/core/debug_out.h b/Marlin/src/core/debug_out.h new file mode 100644 index 000000000000..81e1e216b4c1 --- /dev/null +++ b/Marlin/src/core/debug_out.h @@ -0,0 +1,90 @@ +/** + * 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 . + * + */ + +// +// 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 ce2d913b8429..a686ea584f06 100644 --- a/Marlin/src/core/drivers.h +++ b/Marlin/src/core/drivers.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -23,29 +23,36 @@ #include "../inc/MarlinConfigPre.h" -#define A4988 0x001 -#define A5984 0x002 -#define DRV8825 0x003 -#define LV8729 0x004 -#define L6470 0x105 -#define TB6560 0x006 -#define TB6600 0x007 -#define TMC2100 0x008 -#define TMC2130 2130 -#define TMC2130_STANDALONE 0x009 -#define TMC2208 2208 -#define TMC2208_STANDALONE 0x00A -#define TMC26X 0x10B -#define TMC26X_STANDALONE 0x00B -#define TMC2660 2660 -#define TMC2660_STANDALONE 0x00C +#define _A4988 0x001 +#define _A5984 0x002 +#define _DRV8825 0x003 +#define _LV8729 0x004 +#define _L6470 0x105 +#define _TB6560 0x006 +#define _TB6600 0x007 +#define _TMC2100 0x008 +#define _TMC2130 2130 +#define _TMC2130_STANDALONE 0x009 +#define _TMC2160 2160 +#define _TMC2160_STANDALONE 2161 +#define _TMC2208 2208 +#define _TMC2208_STANDALONE 0x00A +#define _TMC26X 0x10B +#define _TMC26X_STANDALONE 0x00B +#define _TMC2660 2660 +#define _TMC2660_STANDALONE 0x00C +#define _TMC5130 5130 +#define _TMC5130_STANDALONE 5131 +#define _TMC5160 5160 +#define _TMC5160_STANDALONE 5161 -#define _AXIS_DRIVER_TYPE(A,T) (defined(A##_DRIVER_TYPE) && (A##_DRIVER_TYPE == T)) +#define _ACTUAL(V) _CAT(_, V) +#define _AXIS_DRIVER_TYPE(A,T) (defined(A##_DRIVER_TYPE) && _ACTUAL(A##_DRIVER_TYPE) == _CAT(_, T)) #define AXIS_DRIVER_TYPE_X(T) _AXIS_DRIVER_TYPE(X,T) #define AXIS_DRIVER_TYPE_Y(T) _AXIS_DRIVER_TYPE(Y,T) #define AXIS_DRIVER_TYPE_Z(T) _AXIS_DRIVER_TYPE(Z,T) -#define AXIS_DRIVER_TYPE_X2(T) ((ENABLED(X_DUAL_STEPPER_DRIVERS) || ENABLED(DUAL_X_CARRIAGE)) && _AXIS_DRIVER_TYPE(X2,T)) +#define AXIS_DRIVER_TYPE_X2(T) (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)) @@ -58,17 +65,45 @@ #define AXIS_DRIVER_TYPE(A,T) AXIS_DRIVER_TYPE_##A(T) -#define HAS_DRIVER(T) (AXIS_DRIVER_TYPE_X(T) || AXIS_DRIVER_TYPE_X2(T) || \ - AXIS_DRIVER_TYPE_Y(T) || AXIS_DRIVER_TYPE_Y2(T) || \ - AXIS_DRIVER_TYPE_Z(T) || AXIS_DRIVER_TYPE_Z2(T) || AXIS_DRIVER_TYPE_Z3(T) || \ - AXIS_DRIVER_TYPE_E0(T) || AXIS_DRIVER_TYPE_E1(T) || \ - AXIS_DRIVER_TYPE_E2(T) || AXIS_DRIVER_TYPE_E3(T) || \ - AXIS_DRIVER_TYPE_E4(T) || AXIS_DRIVER_TYPE_E5(T) ) +#define HAS_DRIVER(T) ( AXIS_DRIVER_TYPE_X(T) || AXIS_DRIVER_TYPE_X2(T) \ + || AXIS_DRIVER_TYPE_Y(T) || AXIS_DRIVER_TYPE_Y2(T) \ + || AXIS_DRIVER_TYPE_Z(T) || AXIS_DRIVER_TYPE_Z2(T) || AXIS_DRIVER_TYPE_Z3(T) \ + || AXIS_DRIVER_TYPE_E0(T) || AXIS_DRIVER_TYPE_E1(T) \ + || AXIS_DRIVER_TYPE_E2(T) || AXIS_DRIVER_TYPE_E3(T) \ + || AXIS_DRIVER_TYPE_E4(T) || AXIS_DRIVER_TYPE_E5(T) ) // Test for supported TMC drivers that require advanced configuration // Does not match standalone configurations -#define HAS_TRINAMIC (HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2660)) +#define HAS_TRINAMIC ( HAS_DRIVER(TMC2130) \ + || HAS_DRIVER(TMC2160) \ + || HAS_DRIVER(TMC2208) \ + || HAS_DRIVER(TMC2660) \ + || HAS_DRIVER(TMC5130) \ + || HAS_DRIVER(TMC5160) ) -#define AXIS_IS_TMC(A) ( AXIS_DRIVER_TYPE_##A(TMC2130) || \ - AXIS_DRIVER_TYPE_##A(TMC2208) || \ - AXIS_DRIVER_TYPE_##A(TMC2660) ) +#define AXIS_IS_TMC(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \ + || AXIS_DRIVER_TYPE(A,TMC2160) \ + || AXIS_DRIVER_TYPE(A,TMC2208) \ + || AXIS_DRIVER_TYPE(A,TMC2660) \ + || AXIS_DRIVER_TYPE(A,TMC5130) \ + || AXIS_DRIVER_TYPE(A,TMC5160) ) + +// Test for a driver that uses SPI - this allows checking whether a _CS_ pin +// is considered sensitive +#define AXIS_HAS_SPI(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \ + || AXIS_DRIVER_TYPE(A,TMC2160) \ + || AXIS_DRIVER_TYPE(A,TMC2660) \ + || AXIS_DRIVER_TYPE(A,TMC5130) \ + || AXIS_DRIVER_TYPE(A,TMC5160) ) + +#define AXIS_HAS_STALLGUARD(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \ + || AXIS_DRIVER_TYPE(A,TMC2160) \ + || AXIS_DRIVER_TYPE(A,TMC2660) \ + || AXIS_DRIVER_TYPE(A,TMC5130) \ + || AXIS_DRIVER_TYPE(A,TMC5160) ) + +#define AXIS_HAS_STEALTHCHOP(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \ + || AXIS_DRIVER_TYPE(A,TMC2160) \ + || AXIS_DRIVER_TYPE(A,TMC2208) \ + || AXIS_DRIVER_TYPE(A,TMC5130) \ + || AXIS_DRIVER_TYPE(A,TMC5160) ) diff --git a/Marlin/src/core/enum.h b/Marlin/src/core/enum.h index 7abfe0bb8813..f2e0fe063b4f 100644 --- a/Marlin/src/core/enum.h +++ b/Marlin/src/core/enum.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -39,10 +39,20 @@ enum AxisEnum : unsigned char { X_HEAD = 4, Y_HEAD = 5, Z_HEAD = 6, + E0_AXIS = 3, + E1_AXIS = 4, + E2_AXIS = 5, + E3_AXIS = 6, + E4_AXIS = 7, + E5_AXIS = 8, ALL_AXES = 0xFE, NO_AXIS = 0xFF }; +#if HAS_DRIVER(L6470) + enum L6470_driver_enum : unsigned char { X, Y, Z, X2, Y2, Z2, Z3, E0, E1, E2, E3, E4, E5 }; +#endif + #define LOOP_S_LE_N(VAR, S, N) for (uint8_t VAR=(S); VAR<=(N); VAR++) #define LOOP_S_L_N(VAR, S, N) for (uint8_t VAR=(S); VAR<(N); VAR++) #define LOOP_LE_N(VAR, N) LOOP_S_LE_N(VAR, 0, N) diff --git a/Marlin/src/core/language.h b/Marlin/src/core/language.h index fbd19bc0cc7b..0dfd54b3afee 100644 --- a/Marlin/src/core/language.h +++ b/Marlin/src/core/language.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -89,9 +89,9 @@ #define MACHINE_UUID DEFAULT_MACHINE_UUID #endif -#ifdef DEFAULT_WEBSITE_URL +#ifdef BOARD_WEBSITE_URL #undef WEBSITE_URL - #define WEBSITE_URL DEFAULT_WEBSITE_URL + #define WEBSITE_URL BOARD_WEBSITE_URL #endif #if HAS_GRAPHICAL_LCD @@ -197,7 +197,6 @@ #define MSG_SKEW_MIN "min_skew_factor: " #define MSG_SKEW_MAX "max_skew_factor: " #define MSG_ERR_MATERIAL_INDEX "M145 S out of range (0-1)" -#define MSG_ERR_M355_NONE "No case light" #define MSG_ERR_M421_PARAMETERS "M421 incorrect parameter usage" #define MSG_ERR_BAD_PLANE_MODE "G5 requires XY plane mode" #define MSG_ERR_MESH_XY "Mesh point cannot be resolved" @@ -286,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 1c57d88c861c..3805c216fe8e 100644 --- a/Marlin/src/core/macros.h +++ b/Marlin/src/core/macros.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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,17 +159,37 @@ #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 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 COPY(a,b) memcpy(a,b,MIN(sizeof(a),sizeof(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 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))); \ + }while(0) // Macros for initializing arrays #define ARRAY_6(v1, v2, v3, v4, v5, v6, ...) { v1, v2, v3, v4, v5, v6 } @@ -162,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 @@ -175,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 @@ -188,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) @@ -226,3 +261,9 @@ #define LROUND(x) lroundf(x) #define FMOD(x, y) fmodf(x, y) #define HYPOT(x,y) SQRT(HYPOT2(x,y)) + +#ifdef TARGET_LPC1768 + #define I2C_ADDRESS(A) ((A) << 1) +#else + #define I2C_ADDRESS(A) A +#endif diff --git a/Marlin/src/core/millis_t.h b/Marlin/src/core/millis_t.h index d38ab65d0a56..b2afeb83f017 100644 --- a/Marlin/src/core/millis_t.h +++ b/Marlin/src/core/millis_t.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/core/minmax.h b/Marlin/src/core/minmax.h index 0c334fbcda36..0f29443adc2e 100644 --- a/Marlin/src/core/minmax.h +++ b/Marlin/src/core/minmax.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 e43747b660b9..aae0d63698df 100644 --- a/Marlin/src/core/serial.cpp +++ b/Marlin/src/core/serial.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -22,6 +22,7 @@ #include "serial.h" #include "language.h" +#include "enum.h" uint8_t marlin_debug_flags = MARLIN_DEBUG_NONE; @@ -29,63 +30,53 @@ static const char errormagic[] PROGMEM = "Error:"; static const char echomagic[] PROGMEM = "echo:"; #if NUM_SERIAL > 1 - void serialprintPGM_P(const int8_t p, const char * str) { - while (char ch = pgm_read_byte(str++)) SERIAL_CHAR_P(p, ch); - } - - void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, const char *v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); } - void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, char v) { serialprintPGM_P(p, s_P); SERIAL_CHAR_P(p, v); } - void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, int v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); } - void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, long v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); } - void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, float v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); } - void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, double v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); } - void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, unsigned int v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); } - void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, unsigned long v) { serialprintPGM_P(p, s_P); SERIAL_ECHO_P(p, v); } - - void serial_spaces_P(const int8_t p, uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) SERIAL_CHAR_P(p, ' '); } - - void serial_echo_start_P(const int8_t p) { serialprintPGM_P(p, echomagic); } - void serial_error_start_P(const int8_t p) { serialprintPGM_P(p, errormagic); } - + int8_t serial_port_index = SERIAL_PORT; #endif void serialprintPGM(PGM_P str) { - while (char ch = pgm_read_byte(str++)) SERIAL_CHAR(ch); + while (const char c = pgm_read_byte(str++)) SERIAL_CHAR(c); } - void serial_echo_start() { serialprintPGM(echomagic); } void serial_error_start() { serialprintPGM(errormagic); } -void serial_echopair_PGM(PGM_P s_P, const char *v) { serialprintPGM(s_P); SERIAL_ECHO(v); } -void serial_echopair_PGM(PGM_P s_P, char v) { serialprintPGM(s_P); SERIAL_CHAR(v); } -void serial_echopair_PGM(PGM_P s_P, int v) { serialprintPGM(s_P); SERIAL_ECHO(v); } -void serial_echopair_PGM(PGM_P s_P, long v) { serialprintPGM(s_P); SERIAL_ECHO(v); } -void serial_echopair_PGM(PGM_P s_P, float v) { serialprintPGM(s_P); SERIAL_ECHO(v); } -void serial_echopair_PGM(PGM_P s_P, double v) { serialprintPGM(s_P); SERIAL_ECHO(v); } -void serial_echopair_PGM(PGM_P s_P, unsigned int v) { serialprintPGM(s_P); SERIAL_ECHO(v); } -void serial_echopair_PGM(PGM_P s_P, unsigned long v) { serialprintPGM(s_P); SERIAL_ECHO(v); } +void serial_echopair_PGM(PGM_P const s_P, const char *v) { serialprintPGM(s_P); SERIAL_ECHO(v); } +void serial_echopair_PGM(PGM_P const s_P, char v) { serialprintPGM(s_P); SERIAL_CHAR(v); } +void serial_echopair_PGM(PGM_P const s_P, int v) { serialprintPGM(s_P); SERIAL_ECHO(v); } +void serial_echopair_PGM(PGM_P const s_P, long v) { serialprintPGM(s_P); SERIAL_ECHO(v); } +void serial_echopair_PGM(PGM_P const s_P, float v) { serialprintPGM(s_P); SERIAL_ECHO(v); } +void serial_echopair_PGM(PGM_P const s_P, double v) { serialprintPGM(s_P); SERIAL_ECHO(v); } +void serial_echopair_PGM(PGM_P const s_P, unsigned int v) { serialprintPGM(s_P); SERIAL_ECHO(v); } +void serial_echopair_PGM(PGM_P const s_P, unsigned long v) { serialprintPGM(s_P); SERIAL_ECHO(v); } void serial_spaces(uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) SERIAL_CHAR(' '); } +void 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(); } - -#if ENABLED(DEBUG_LEVELING_FEATURE) - - #include "enum.h" - - void print_xyz(PGM_P prefix, PGM_P suffix, const float x, const float y, const float z) { - serialprintPGM(prefix); - SERIAL_CHAR('('); - SERIAL_ECHO(x); - SERIAL_ECHOPAIR(", ", y); - SERIAL_ECHOPAIR(", ", z); - SERIAL_CHAR(')'); - if (suffix) serialprintPGM(suffix); else 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; + for (uint8_t i = 16; i--;) { + if (i && !(i % 4)) SERIAL_CHAR(' '); + SERIAL_CHAR((val & mask) ? '1' : '0'); + mask >>= 1; } +} - void print_xyz(PGM_P prefix, PGM_P suffix, const float xyz[]) { - print_xyz(prefix, suffix, xyz[X_AXIS], xyz[Y_AXIS], xyz[Z_AXIS]); - } +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(); +} -#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 49b7e21b2ec2..f79856178c8e 100644 --- a/Marlin/src/core/serial.h +++ b/Marlin/src/core/serial.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -22,6 +22,7 @@ #pragma once #include "../inc/MarlinConfigPre.h" +#include "../core/minmax.h" #include HAL_PATH(../HAL, HAL.h) /** @@ -34,215 +35,154 @@ 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)) -#if TX_BUFFER_SIZE < 1 - #define SERIAL_FLUSHTX_P(p) - #define SERIAL_FLUSHTX() -#endif - +#define SERIAL_BOTH 0x7F #if NUM_SERIAL > 1 - #define SERIAL_CHAR_P(p,x) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.write(x) : MYSERIAL1.write(x)) : SERIAL_CHAR(x)) - #define SERIAL_PROTOCOL_P(p,x) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.print(x) : MYSERIAL1.print(x)) : SERIAL_PROTOCOL(x)) - #define SERIAL_PROTOCOL_F_P(p,x,y) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.print(x,y) : MYSERIAL1.print(x,y)) : SERIAL_PROTOCOL_F(x,y)) - #define SERIAL_PROTOCOLLN_P(p,x) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.println(x) : MYSERIAL1.println(x)) : SERIAL_PROTOCOLLN(x)) - #define SERIAL_PRINT_P(p,x,b) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.print(x,b) : MYSERIAL1.print(x,b)) : SERIAL_PRINT(x,b)) - #define SERIAL_PRINTLN_P(p,x,b) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.println(x,b) : MYSERIAL1.println(x,b)) : SERIAL_PRINTLN(x,b)) - #define SERIAL_PRINTF_P(p,args...) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.printf(args) : MYSERIAL1.printf(args)) : SERIAL_PRINTF(args)) - - #define SERIAL_CHAR(x) (MYSERIAL0.write(x), MYSERIAL1.write(x)) - #define SERIAL_PROTOCOL(x) (MYSERIAL0.print(x), MYSERIAL1.print(x)) - #define SERIAL_PROTOCOL_F(x,y) (MYSERIAL0.print(x,y), MYSERIAL1.print(x,y)) - #define SERIAL_PROTOCOLLN(x) (MYSERIAL0.println(x), MYSERIAL1.println(x)) - #define SERIAL_PRINT(x,b) (MYSERIAL0.print(x,b), MYSERIAL1.print(x,b)) - #define SERIAL_PRINTLN(x,b) (MYSERIAL0.println(x,b), MYSERIAL1.println(x,b)) - #define SERIAL_PRINTF(args...) (MYSERIAL0.printf(args), MYSERIAL1.printf(args)) - - #define SERIAL_FLUSH_P(p) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.flush() : MYSERIAL1.flush()) : SERIAL_FLUSH()) - #define SERIAL_FLUSH() (MYSERIAL0.flush(), MYSERIAL1.flush()) - #if TX_BUFFER_SIZE > 0 - #define SERIAL_FLUSHTX_P(p) (WITHIN(p, 0, NUM_SERIAL-1) ? (p == 0 ? MYSERIAL0.flushTX() : MYSERIAL1.flushTX()) : SERIAL_FLUSHTX()) - #define SERIAL_FLUSHTX() (MYSERIAL0.flushTX(), MYSERIAL1.flushTX()) - #endif - - #define SERIAL_EOL_P(p) SERIAL_CHAR_P(p,'\n') - - #define SERIAL_PROTOCOLCHAR_P(p,x) SERIAL_CHAR_P(p,x) - #define SERIAL_PROTOCOLPGM_P(p,x) (serialprintPGM_P(p,PSTR(x))) - #define SERIAL_PROTOCOLLNPGM_P(p,x) (serialprintPGM_P(p,PSTR(x "\n"))) - #define SERIAL_PROTOCOLPAIR_P(p, pre, value) (serial_echopair_PGM_P(p,PSTR(pre),(value))) - #define SERIAL_PROTOCOLLNPAIR_P(p, pre, value) do{ SERIAL_PROTOCOLPAIR_P(p, pre, value); SERIAL_EOL_P(p); }while(0) - - #define SERIAL_ECHO_START_P(p) serial_echo_start_P(p) - #define SERIAL_ECHO_P(p,x) SERIAL_PROTOCOL_P(p,x) - #define SERIAL_ECHOPGM_P(p,x) SERIAL_PROTOCOLPGM_P(p,x) - #define SERIAL_ECHOLN_P(p,x) SERIAL_PROTOCOLLN_P(p,x) - #define SERIAL_ECHOLNPGM_P(p,x) SERIAL_PROTOCOLLNPGM_P(p,x) - #define SERIAL_ECHOPAIR_P(p,pre,value) SERIAL_PROTOCOLPAIR_P(p, pre, value) - #define SERIAL_ECHOLNPAIR_P(p,pre, value) SERIAL_PROTOCOLLNPAIR_P(p, pre, value) - #define SERIAL_ECHO_F_P(p,x,y) SERIAL_PROTOCOL_F_P(p,x,y) - - #define SERIAL_ERROR_START_P(p) serial_error_start_P(p) - #define SERIAL_ERROR_P(p,x) SERIAL_PROTOCOL_P(p,x) - #define SERIAL_ERRORPGM_P(p,x) SERIAL_PROTOCOLPGM_P(p,x) - #define SERIAL_ERRORLN_P(p,x) SERIAL_PROTOCOLLN_P(p,x) - #define SERIAL_ERRORLNPGM_P(p,x) SERIAL_PROTOCOLLNPGM_P(p,x) - - // These macros compensate for float imprecision - #define SERIAL_PROTOCOLPAIR_F_P(p, pre, value) SERIAL_PROTOCOLPAIR_P(p, pre, FIXFLOAT(value)) - #define SERIAL_PROTOCOLLNPAIR_F_P(p, pre, value) SERIAL_PROTOCOLLNPAIR_P(p, pre, FIXFLOAT(value)) - #define SERIAL_ECHOPAIR_F_P(p,pre,value) SERIAL_ECHOPAIR_P(p, pre, FIXFLOAT(value)) - #define SERIAL_ECHOLNPAIR_F_P(p,pre, value) SERIAL_ECHOLNPAIR_P(p, pre, FIXFLOAT(value)) - - void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, const char *v); - void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, char v); - void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, int v); - void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, long v); - void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, float v); - void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, double v); - void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, unsigned int v); - void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, unsigned long v); - inline void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, uint8_t v) { serial_echopair_PGM_P(p, s_P, (int)v); } - inline void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, bool v) { serial_echopair_PGM_P(p, s_P, (int)v); } - inline void serial_echopair_PGM_P(const int8_t p, PGM_P s_P, void *v) { serial_echopair_PGM_P(p, s_P, (unsigned long)v); } - - void serial_spaces_P(const int8_t p, uint8_t count); - #define SERIAL_ECHO_SP_P(p,C) serial_spaces_P(p,C) - #define SERIAL_ERROR_SP_P(p,C) serial_spaces_P(p,C) - #define SERIAL_PROTOCOL_SP_P(p,C) serial_spaces_P(p,C) - - void serialprintPGM_P(const int8_t p, PGM_P str); - void serial_echo_start_P(const int8_t p); - void serial_error_start_P(const int8_t p); - -#else // NUM_SERIAL < 2 - - #define SERIAL_CHAR_P(p,x) SERIAL_CHAR(x) - #define SERIAL_PROTOCOL_P(p,x) SERIAL_PROTOCOL(x) - #define SERIAL_PROTOCOL_F_P(p,x,y) SERIAL_PROTOCOL_F(x,y) - #define SERIAL_PROTOCOLLN_P(p,x) SERIAL_PROTOCOLLN(x) - #define SERIAL_PRINT_P(p,x,b) SERIAL_PRINT(x,b) - #define SERIAL_PRINTLN_P(p,x,b) SERIAL_PRINTLN(x,b) - #define SERIAL_PRINTF_P(p,args...) SERIAL_PRINTF(args) - - #define SERIAL_CHAR(x) MYSERIAL0.write(x) - #define SERIAL_PROTOCOL(x) MYSERIAL0.print(x) - #define SERIAL_PROTOCOL_F(x,y) MYSERIAL0.print(x,y) - #define SERIAL_PROTOCOLLN(x) MYSERIAL0.println(x) - #define SERIAL_PRINT(x,b) MYSERIAL0.print(x,b) - #define SERIAL_PRINTLN(x,b) MYSERIAL0.println(x,b) - #define SERIAL_PRINTF(args...) MYSERIAL0.printf(args) - - #define SERIAL_FLUSH_P(p) SERIAL_FLUSH() - #define SERIAL_FLUSH() MYSERIAL0.flush() - #if TX_BUFFER_SIZE > 0 - #define SERIAL_FLUSHTX_P(p) SERIAL_FLUSHTX() - #define SERIAL_FLUSHTX() MYSERIAL0.flushTX() - #endif + 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_OUT(WHAT, ...) do{ \ + 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, ...) (void)MYSERIAL0.WHAT(__VA_ARGS__) +#endif - #define SERIAL_EOL_P(p) SERIAL_EOL() - - #define SERIAL_PROTOCOLCHAR_P(p,x) SERIAL_PROTOCOLCHAR(x) - #define SERIAL_PROTOCOLPGM_P(p,x) SERIAL_PROTOCOLPGM(x) - #define SERIAL_PROTOCOLLNPGM_P(p,x) SERIAL_PROTOCOLLNPGM(x) - #define SERIAL_PROTOCOLPAIR_P(p, pre, value) SERIAL_PROTOCOLPAIR(pre, value) - #define SERIAL_PROTOCOLLNPAIR_P(p, pre, value) SERIAL_PROTOCOLLNPAIR(pre, value) - - #define SERIAL_ECHO_START_P(p) SERIAL_ECHO_START() - #define SERIAL_ECHO_P(p,x) SERIAL_ECHO(x) - #define SERIAL_ECHOPGM_P(p,x) SERIAL_ECHOPGM(x) - #define SERIAL_ECHOLN_P(p,x) SERIAL_ECHOLN(x) - #define SERIAL_ECHOLNPGM_P(p,x) SERIAL_ECHOLNPGM(x) - #define SERIAL_ECHOPAIR_P(p,pre,value) SERIAL_ECHOPAIR(pre, value) - #define SERIAL_ECHOLNPAIR_P(p,pre, value) SERIAL_ECHOLNPAIR(pre, value) - #define SERIAL_ECHO_F_P(p,x,y) SERIAL_ECHO_F(x,y) - - #define SERIAL_ERROR_START_P(p) SERIAL_ERROR_START() - #define SERIAL_ERROR_P(p,x) SERIAL_ERROR(x) - #define SERIAL_ERRORPGM_P(p,x) SERIAL_ERRORPGM(x) - #define SERIAL_ERRORLN_P(p,x) SERIAL_ERRORLN(x) - #define SERIAL_ERRORLNPGM_P(p,x) SERIAL_ERRORLNPGM(x) - - // These macros compensate for float imprecision - #define SERIAL_PROTOCOLPAIR_F_P(p, pre, value) SERIAL_PROTOCOLPAIR_F(pre, value) - #define SERIAL_PROTOCOLLNPAIR_F_P(p, pre, value) SERIAL_PROTOCOLLNPAIR_F(pre, value) - #define SERIAL_ECHOPAIR_F_P(p,pre,value) SERIAL_ECHOPAIR_F(pre, value) - #define SERIAL_ECHOLNPAIR_F_P(p,pre, value) SERIAL_ECHOLNPAIR_F(pre, value) - - #define serial_echopair_PGM_P(p,s_P,v) serial_echopair_PGM(s_P, v) - - #define serial_spaces_P(p,c) serial_spaces(c) - #define SERIAL_ECHO_SP_P(p,C) SERIAL_ECHO_SP(C) - #define SERIAL_ERROR_SP_P(p,C) SERIAL_ERROR_SP(C) - #define SERIAL_PROTOCOL_SP_P(p,C) SERIAL_PROTOCOL_SP(C) - - #define serialprintPGM_P(p,s) serialprintPGM(s) - -#endif // NUM_SERIAL < 2 - -#define SERIAL_EOL() SERIAL_CHAR('\n') - -#define SERIAL_PROTOCOLCHAR(x) SERIAL_CHAR(x) -#define SERIAL_PROTOCOLPGM(x) (serialprintPGM(PSTR(x))) -#define SERIAL_PROTOCOLLNPGM(x) (serialprintPGM(PSTR(x "\n"))) -#define SERIAL_PROTOCOLPAIR(pre, value) (serial_echopair_PGM(PSTR(pre), value)) -#define SERIAL_PROTOCOLLNPAIR(pre, value) do { SERIAL_PROTOCOLPAIR(pre, value); SERIAL_EOL(); } while(0) - -#define SERIAL_ECHO_START() serial_echo_start() -#define SERIAL_ECHO(x) SERIAL_PROTOCOL(x) -#define SERIAL_ECHOPGM(x) SERIAL_PROTOCOLPGM(x) -#define SERIAL_ECHOLN(x) SERIAL_PROTOCOLLN(x) -#define SERIAL_ECHOLNPGM(x) SERIAL_PROTOCOLLNPGM(x) -#define SERIAL_ECHOPAIR(pre,value) SERIAL_PROTOCOLPAIR(pre, value) -#define SERIAL_ECHOLNPAIR(pre, value) SERIAL_PROTOCOLLNPAIR(pre, value) -#define SERIAL_ECHO_F(x,y) SERIAL_PROTOCOL_F(x, y) - -#define SERIAL_ERROR_START() serial_error_start() -#define SERIAL_ERROR(x) SERIAL_PROTOCOL(x) -#define SERIAL_ERRORPGM(x) SERIAL_PROTOCOLPGM(x) -#define SERIAL_ERRORLN(x) SERIAL_PROTOCOLLN(x) -#define SERIAL_ERRORLNPGM(x) SERIAL_PROTOCOLLNPGM(x) - -// These macros compensate for float imprecision -#define SERIAL_PROTOCOLPAIR_F(pre, value) SERIAL_PROTOCOLPAIR(pre, FIXFLOAT(value)) -#define SERIAL_PROTOCOLLNPAIR_F(pre, value) SERIAL_PROTOCOLLNPAIR(pre, FIXFLOAT(value)) -#define SERIAL_ECHOPAIR_F(pre,value) SERIAL_ECHOPAIR(pre, FIXFLOAT(value)) -#define SERIAL_ECHOLNPAIR_F(pre, value) SERIAL_ECHOLNPAIR(pre, FIXFLOAT(value)) - -void serial_echopair_PGM(PGM_P s_P, const char *v); -void serial_echopair_PGM(PGM_P s_P, char v); -void serial_echopair_PGM(PGM_P s_P, int v); -void serial_echopair_PGM(PGM_P s_P, long v); -void serial_echopair_PGM(PGM_P s_P, float v); -void serial_echopair_PGM(PGM_P s_P, double v); -void serial_echopair_PGM(PGM_P s_P, unsigned int v); -void serial_echopair_PGM(PGM_P s_P, unsigned long v); -inline void serial_echopair_PGM(PGM_P s_P, uint8_t v) { serial_echopair_PGM(s_P, (int)v); } -inline void serial_echopair_PGM(PGM_P s_P, bool v) { serial_echopair_PGM(s_P, (int)v); } -inline void serial_echopair_PGM(PGM_P s_P, void *v) { serial_echopair_PGM(s_P, (unsigned long)v); } +#define PORT_REDIRECT(p) _PORT_REDIRECT(1,p) +#define PORT_RESTORE() _PORT_RESTORE(1) + +#define SERIAL_CHAR(x) SERIAL_OUT(write, x) +#define SERIAL_ECHO(x) SERIAL_OUT(print, x) +#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(...) SERIAL_OUT(printf, __VA_ARGS__) +#define SERIAL_FLUSH() SERIAL_OUT(flush) + +#if TX_BUFFER_SIZE > 0 + #define SERIAL_FLUSHTX() SERIAL_OUT(flushTX) +#else + #define SERIAL_FLUSHTX() +#endif -void serial_spaces(uint8_t count); -#define SERIAL_ECHO_SP(C) serial_spaces(C) -#define SERIAL_ERROR_SP(C) serial_spaces(C) -#define SERIAL_PROTOCOL_SP(C) serial_spaces(C) +// 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(...) _SEP_N(NUM_ARGS(__VA_ARGS__),__VA_ARGS__) + +// 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_ECHOLNPAIR(...) _SELP_N(NUM_ARGS(__VA_ARGS__),__VA_ARGS__) + +#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.) // +void serial_echopair_PGM(PGM_P const s_P, const char *v); +void serial_echopair_PGM(PGM_P const s_P, char v); +void serial_echopair_PGM(PGM_P const s_P, int v); +void serial_echopair_PGM(PGM_P const s_P, long v); +void serial_echopair_PGM(PGM_P const s_P, float v); +void serial_echopair_PGM(PGM_P const s_P, double v); +void serial_echopair_PGM(PGM_P const s_P, unsigned int v); +void serial_echopair_PGM(PGM_P const s_P, unsigned long v); +inline void serial_echopair_PGM(PGM_P const s_P, uint8_t v) { serial_echopair_PGM(s_P, (int)v); } +inline void serial_echopair_PGM(PGM_P const s_P, bool v) { serial_echopair_PGM(s_P, (int)v); } +inline void serial_echopair_PGM(PGM_P const s_P, void *v) { serial_echopair_PGM(s_P, (unsigned long)v); } + 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); -#if ENABLED(DEBUG_LEVELING_FEATURE) - void print_xyz(PGM_P prefix, PGM_P suffix, const float x, const float y, const float z); - void print_xyz(PGM_P prefix, PGM_P suffix, const float xyz[]); - #define DEBUG_POS(SUFFIX,VAR) do { print_xyz(PSTR(" " STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n"), VAR); } while(0) -#endif +void print_bin(const uint16_t val); + +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 041c61b1eabd..cc7d0065e99e 100644 --- a/Marlin/src/core/utility.cpp +++ b/Marlin/src/core/utility.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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,24 +57,61 @@ 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 unsigned int to string 123 format - char* i8tostr3(const uint8_t i) { + // Convert a full-range unsigned 8bit int to a percentage + char* ui8tostr4pct(const uint8_t i) { + const uint8_t n = ui8_to_percent(i); + conv[3] = RJDIGIT(n, 100); + conv[4] = RJDIGIT(n, 10); + conv[5] = DIGIMOD(n, 1); + conv[6] = '%'; + return &conv[3]; + } + + // Convert unsigned 8bit int to string 123 format + char* ui8tostr3(const uint8_t i) { conv[4] = RJDIGIT(i, 100); conv[5] = RJDIGIT(i, 10); conv[6] = DIGIMOD(i, 1); return &conv[4]; } - // Convert signed int to rj string with 123 or -12 format - char* itostr3(int i) { - conv[4] = MINUSOR(i, RJDIGIT(i, 100)); - conv[5] = RJDIGIT(i, 10); - conv[6] = DIGIMOD(i, 1); + // Convert signed 8bit int to rj string with 123 or -12 format + char* i8tostr3(const int8_t x) { + int xx = x; + conv[4] = MINUSOR(xx, RJDIGIT(xx, 100)); + conv[5] = RJDIGIT(xx, 10); + conv[6] = DIGIMOD(xx, 1); + return &conv[4]; + } + + // Convert unsigned 16bit int to string 123 format + char* ui16tostr3(const uint16_t xx) { + conv[4] = RJDIGIT(xx, 100); + conv[5] = RJDIGIT(xx, 10); + conv[6] = DIGIMOD(xx, 1); + return &conv[4]; + } + + // Convert unsigned 16bit int to string 1234 format + char* ui16tostr4(const uint16_t xx) { + conv[3] = RJDIGIT(xx, 1000); + conv[4] = RJDIGIT(xx, 100); + conv[5] = RJDIGIT(xx, 10); + conv[6] = DIGIMOD(xx, 1); + return &conv[3]; + } + + // Convert signed 16bit int to rj string with 123 or -12 format + char* i16tostr3(const int16_t x) { + int xx = x; + conv[4] = MINUSOR(xx, RJDIGIT(xx, 100)); + conv[5] = RJDIGIT(xx, 10); + conv[6] = DIGIMOD(xx, 1); return &conv[4]; } - // Convert unsigned int to lj string with 123 format - char* itostr3left(const int i) { + // Convert unsigned 16bit int to lj string with 123 format + char* i16tostr3left(const int16_t i) { char *str = &conv[6]; *str = DIGIMOD(i, 1); if (i >= 10) { @@ -85,8 +122,8 @@ void safe_delay(millis_t ms) { return str; } - // Convert signed int to rj string with 1234, _123, -123, _-12, or __-1 format - char* itostr4sign(const int i) { + // Convert signed 16bit int to rj string with 1234, _123, -123, _-12, or __-1 format + char* i16tostr4sign(const int16_t i) { const bool neg = i < 0; const int ii = neg ? -i : i; if (i >= 1000) { @@ -141,7 +178,7 @@ void safe_delay(millis_t ms) { // Convert float to rj string with 1234, _123, -123, _-12, 12.3, _1.2, or -1.2 format char* ftostr4sign(const float &f) { const int i = (f * 100 + (f < 0 ? -5: 5)) / 10; - if (!WITHIN(i, -99, 999)) return itostr4sign((int)f); + if (!WITHIN(i, -99, 999)) return i16tostr4sign((int)f); const bool neg = i < 0; const int ii = neg ? -i : i; conv[3] = neg ? '-' : (ii >= 100 ? DIGIMOD(ii, 100) : ' '); @@ -177,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; @@ -214,15 +264,15 @@ void safe_delay(millis_t ms) { return conv; } - // Convert unsigned float to string with 1234.56 format omitting trailing zeros - char* ftostr62rj(const float &f) { - const long i = ((f < 0 ? -f : f) * 1000 + 5) / 10; - conv[0] = RJDIGIT(i, 100000); + // Convert unsigned float to string with 1234.5 format omitting trailing zeros + char* ftostr51rj(const float &f) { + const long i = ((f < 0 ? -f : f) * 100 + 5) / 10; + conv[0] = ' '; conv[1] = RJDIGIT(i, 10000); conv[2] = RJDIGIT(i, 1000); - conv[3] = DIGIMOD(i, 100); - conv[4] = '.'; - conv[5] = DIGIMOD(i, 10); + conv[3] = RJDIGIT(i, 100); + conv[4] = DIGIMOD(i, 10); + conv[5] = '.'; conv[6] = DIGIMOD(i, 1); return conv; } @@ -294,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) @@ -331,7 +384,7 @@ void safe_delay(millis_t ms) { SERIAL_ECHOLNPGM(" Nozzle)"); #endif - #if HAS_ABL + #if HAS_ABL_OR_UBL SERIAL_ECHOLNPGM("Auto Bed Leveling: " #if ENABLED(AUTO_BED_LEVELING_LINEAR) "LINEAR" diff --git a/Marlin/src/core/utility.h b/Marlin/src/core/utility.h index da3a065eaf84..c04524f672fc 100644 --- a/Marlin/src/core/utility.h +++ b/Marlin/src/core/utility.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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,19 +53,31 @@ 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* ui8tostr4pct(const uint8_t i); // Convert uint8_t to string with 123 format - char* i8tostr3(const uint8_t x); + char* ui8tostr3(const uint8_t x); + + // Convert int8_t to string with 123 format + char* i8tostr3(const int8_t x); + + // Convert uint16_t to string with 123 format + char* ui16tostr3(const uint16_t x); - // Convert signed int to rj string with 123 or -12 format - char* itostr3(const int x); + // Convert uint16_t to string with 1234 format + char* ui16tostr4(const uint16_t x); + + // Convert int16_t to string with 123 format + char* i16tostr3(const int16_t x); // Convert unsigned int to lj string with 123 format - char* itostr3left(const int xx); + char* i16tostr3left(const int16_t xx); // Convert signed int to rj string with _123, -123, _-12, or __-1 format - char* itostr4sign(const int x); + char* i16tostr4sign(const int16_t x); // Convert unsigned float to string with 1.23 format char* ftostr12ns(const float &x); @@ -79,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); @@ -91,22 +106,43 @@ inline void serial_delay(const millis_t ms) { // Convert signed float to string with +123.45 format char* ftostr52sign(const float &x); - // Convert unsigned float to string with 1234.56 format omitting trailing zeros - char* ftostr62rj(const float &x); + // Convert unsigned float to string with 1234.5 format omitting trailing zeros + char* ftostr51rj(const float &x); // Convert float to rj string with 123 or -12 format - FORCE_INLINE char* ftostr3(const float &x) { return itostr3(int(x + (x < 0 ? -0.5f : 0.5f))); } + FORCE_INLINE char* ftostr3(const float &x) { return i16tostr3(int16_t(x + (x < 0 ? -0.5f : 0.5f))); } #if ENABLED(LCD_DECIMAL_SMALL_XY) // Convert float to rj string with 1234, _123, 12.3, _1.2, -123, _-12, or -1.2 format char* ftostr4sign(const float &fx); #else // Convert float to rj string with 1234, _123, -123, __12, _-12, ___1, or __-1 format - FORCE_INLINE char* ftostr4sign(const float &x) { return itostr4sign(int(x + (x < 0 ? -0.5f : 0.5f))); } + FORCE_INLINE char* ftostr4sign(const float &x) { return i16tostr4sign(int16_t(x + (x < 0 ? -0.5f : 0.5f))); } #endif #endif // ULTRA_LCD #if ENABLED(DEBUG_LEVELING_FEATURE) void log_machine_info(); +#else + #define log_machine_info() NOOP #endif + +template +class restorer { + T& ref_; + T val_; +public: + restorer(T& perm) : ref_(perm), val_(perm) {} + restorer(T& perm, T temp_val) : ref_(perm), val_(perm) { perm = temp_val; } + ~restorer() { restore(); } + inline void restore() { ref_ = val_; } +}; + +#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 b5ab7234eb42..c1c20021eaf9 100644 --- a/Marlin/src/feature/I2CPositionEncoder.cpp +++ b/Marlin/src/feature/I2CPositionEncoder.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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,9 +66,7 @@ void I2CPositionEncoder::update() { /* if (trusted) { //commented out as part of the note below trusted = false; - SERIAL_ECHOPGM("Fault detected on "); - SERIAL_ECHO(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; @@ -93,9 +91,7 @@ void I2CPositionEncoder::update() { if (millis() - lastErrorTime > I2CPE_TIME_TRUSTED) { trusted = true; - SERIAL_ECHOPGM("Untrusted encoder module on "); - SERIAL_ECHO(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 @@ -106,17 +102,10 @@ void I2CPositionEncoder::update() { zeroOffset -= (positionInTicks - get_position()); #ifdef I2CPE_DEBUG - SERIAL_ECHOPGM("Current position is "); - SERIAL_ECHOLN(pos); - - SERIAL_ECHOPGM("Position in encoder ticks is "); - SERIAL_ECHOLN(positionInTicks); - - SERIAL_ECHOPGM("New zero-offset of "); - SERIAL_ECHOLN(zeroOffset); - - SERIAL_ECHOPGM("New position reads as "); - SERIAL_ECHO(get_position()); + SERIAL_ECHOLNPAIR("Current position is ", pos); + SERIAL_ECHOLNPAIR("Position in encoder ticks is ", positionInTicks); + SERIAL_ECHOLNPAIR("New zero-offset of ", zeroOffset); + SERIAL_ECHOPAIR("New position reads as ", get_position()); SERIAL_CHAR('('); SERIAL_ECHO(mm_from_count(get_position())); SERIAL_ECHOLNPGM(")"); @@ -159,14 +148,12 @@ void I2CPositionEncoder::update() { const int32_t error = get_axis_error_steps(false); #endif - //SERIAL_ECHOPGM("Axis error steps: "); - //SERIAL_ECHOLN(error); + //SERIAL_ECHOLNPAIR("Axis error steps: ", error); #ifdef I2CPE_ERR_THRESH_ABORT if (ABS(error) > I2CPE_ERR_THRESH_ABORT * planner.settings.axis_steps_per_mm[encoderAxis]) { //kill(PSTR("Significant Error")); - SERIAL_ECHOPGM("Axis error greater than set threshold, aborting!"); - SERIAL_ECHOLN(error); + SERIAL_ECHOLNPAIR("Axis error over threshold, aborting!", error); safe_delay(5000); } #endif @@ -183,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; } } @@ -196,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; } @@ -226,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 } } @@ -246,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!"); @@ -272,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; @@ -307,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."); } @@ -352,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; @@ -390,12 +366,12 @@ bool I2CPositionEncoder::test_axis() { void I2CPositionEncoder::calibrate_steps_mm(const uint8_t iter) { if (type != I2CPE_ENC_TYPE_LINEAR) { - SERIAL_ECHOLNPGM("Steps per mm calibration is only available using linear encoders."); + SERIAL_ECHOLNPGM("Steps/mm calibration requires linear encoder."); return; } if (!(encoderAxis == X_AXIS || encoderAxis == Y_AXIS || encoderAxis == Z_AXIS)) { - SERIAL_ECHOLNPGM("Automatic steps / mm calibration not supported for this axis."); + SERIAL_ECHOLNPGM("Steps/mm calibration not supported for this axis."); return; } @@ -414,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) { @@ -447,18 +423,16 @@ void I2CPositionEncoder::calibrate_steps_mm(const uint8_t iter) { travelledDistance = mm_from_count(ABS(stopCount - startCount)); - SERIAL_ECHOPAIR("Attempted to travel: ", travelDistance); - SERIAL_ECHOLNPGM("mm."); + SERIAL_ECHOLNPAIR("Attempted travel: ", travelDistance, "mm"); - SERIAL_ECHOPAIR("Actually travelled: ", 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]; new_steps_mm = (old_steps_mm * travelDistance) / travelledDistance; - SERIAL_ECHOLNPAIR("Old steps per mm: ", old_steps_mm); - SERIAL_ECHOLNPAIR("New steps per mm: ", new_steps_mm); + SERIAL_ECHOLNPAIR("Old steps/mm: ", old_steps_mm); + SERIAL_ECHOLNPAIR("New steps/mm: ", new_steps_mm); //Save new value planner.settings.axis_steps_per_mm[encoderAxis] = new_steps_mm; @@ -475,16 +449,16 @@ void I2CPositionEncoder::calibrate_steps_mm(const uint8_t iter) { if (iter > 1) { total /= (float)iter; - SERIAL_ECHOLNPAIR("Average steps per mm: ", total); + SERIAL_ECHOLNPAIR("Average steps/mm: ", total); } ec = oldec; - SERIAL_ECHOLNPGM("Calculated steps per mm has been set. Please save to EEPROM (M500) if you wish to keep these values."); + SERIAL_ECHOLNPGM("Calculated steps/mm set. Use M500 to save to EEPROM."); } void I2CPositionEncoder::reset() { - Wire.beginTransmission(i2cAddress); + Wire.beginTransmission(I2C_ADDRESS(i2cAddress)); Wire.write(I2CPE_RESET_COUNT); Wire.endTransmission(); @@ -714,26 +688,23 @@ void I2CPositionEncodersMgr::report_position(const int8_t idx, const bool units, void I2CPositionEncodersMgr::change_module_address(const uint8_t oldaddr, const uint8_t newaddr) { // First check 'new' address is not in use - Wire.beginTransmission(newaddr); + 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(oldaddr); + 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(oldaddr); + Wire.beginTransmission(I2C_ADDRESS(oldaddr)); Wire.write(I2CPE_SET_ADDR); Wire.write(newaddr); Wire.endTransmission(); @@ -744,7 +715,7 @@ void I2CPositionEncodersMgr::change_module_address(const uint8_t oldaddr, const safe_delay(I2CPE_REBOOT_TIME); // Look for the module at the new address. - Wire.beginTransmission(newaddr); + Wire.beginTransmission(I2C_ADDRESS(newaddr)); if (Wire.endTransmission()) { SERIAL_ECHOLNPGM("Address change failed! Check encoder module."); return; @@ -764,17 +735,15 @@ void I2CPositionEncodersMgr::change_module_address(const uint8_t oldaddr, const void I2CPositionEncodersMgr::report_module_firmware(const uint8_t address) { // First check there is a module - Wire.beginTransmission(address); + 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(address); + Wire.beginTransmission(I2C_ADDRESS(address)); Wire.write(I2CPE_SET_REPORT_MODE); Wire.write(I2CPE_REPORT_VERSION); Wire.endTransmission(); @@ -788,7 +757,7 @@ void I2CPositionEncodersMgr::report_module_firmware(const uint8_t address) { } // Set module back to normal (distance) mode - Wire.beginTransmission(address); + Wire.beginTransmission(I2C_ADDRESS(address)); Wire.write(I2CPE_SET_REPORT_MODE); Wire.write(I2CPE_REPORT_DISTANCE); Wire.endTransmission(); @@ -800,34 +769,32 @@ int8_t I2CPositionEncodersMgr::parse() { if (parser.seen('A')) { if (!parser.has_value()) { - SERIAL_PROTOCOLLNPGM("?A seen, but no address specified! [30-200]"); + SERIAL_ECHOLNPGM("?A seen, but no address specified! [30-200]"); return I2CPE_PARSE_ERR; }; I2CPE_addr = parser.value_byte(); if (!WITHIN(I2CPE_addr, 30, 200)) { // reserve the first 30 and last 55 - SERIAL_PROTOCOLLNPGM("?Address out of range. [30-200]"); + SERIAL_ECHOLNPGM("?Address out of range. [30-200]"); return I2CPE_PARSE_ERR; } I2CPE_idx = idx_from_addr(I2CPE_addr); if (I2CPE_idx >= I2CPE_ENCODER_CNT) { - SERIAL_PROTOCOLLNPGM("?No device with this address!"); + SERIAL_ECHOLNPGM("?No device with this address!"); return I2CPE_PARSE_ERR; } } else if (parser.seenval('I')) { if (!parser.has_value()) { - SERIAL_PROTOCOLLNPAIR("?I seen, but no index specified! [0-", I2CPE_ENCODER_CNT - 1); - SERIAL_PROTOCOLLNPGM("]"); + 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_PROTOCOLLNPAIR("?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; } @@ -984,18 +951,18 @@ void I2CPositionEncodersMgr::M864() { if (parser.seen('S')) { if (!parser.has_value()) { - SERIAL_PROTOCOLLNPGM("?S seen, but no address specified! [30-200]"); + SERIAL_ECHOLNPGM("?S seen, but no address specified! [30-200]"); return; }; newAddress = parser.value_byte(); if (!WITHIN(newAddress, 30, 200)) { - SERIAL_PROTOCOLLNPGM("?New address out of range. [30-200]"); + SERIAL_ECHOLNPGM("?New address out of range. [30-200]"); return; } } else if (!I2CPE_anyaxis) { - SERIAL_PROTOCOLLNPGM("?You must specify S or [XYZE]."); + SERIAL_ECHOLNPGM("?You must specify S or [XYZE]."); return; } else { @@ -1006,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 32895e62ce45..592aeb328d56 100644 --- a/Marlin/src/feature/I2CPositionEncoder.h +++ b/Marlin/src/feature/I2CPositionEncoder.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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_F(" axis set to ", 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_F(" axis is ", 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/Max7219_Debug_LEDs.cpp b/Marlin/src/feature/Max7219_Debug_LEDs.cpp index f9b8574453fa..6f620aed8e34 100644 --- a/Marlin/src/feature/Max7219_Debug_LEDs.cpp +++ b/Marlin/src/feature/Max7219_Debug_LEDs.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/feature/Max7219_Debug_LEDs.h b/Marlin/src/feature/Max7219_Debug_LEDs.h index 643a560944e0..627dc4232368 100644 --- a/Marlin/src/feature/Max7219_Debug_LEDs.h +++ b/Marlin/src/feature/Max7219_Debug_LEDs.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/feature/babystep.cpp b/Marlin/src/feature/babystep.cpp new file mode 100644 index 000000000000..0f0b64295db7 --- /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 int16_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 000000000000..d7ac71ba44b4 --- /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 int16_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/baricuda.cpp b/Marlin/src/feature/baricuda.cpp index c74e4b60bd10..ead666913502 100644 --- a/Marlin/src/feature/baricuda.cpp +++ b/Marlin/src/feature/baricuda.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/feature/baricuda.h b/Marlin/src/feature/baricuda.h index a7a70d8dc99b..a93bf1b16170 100644 --- a/Marlin/src/feature/baricuda.h +++ b/Marlin/src/feature/baricuda.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/feature/bedlevel/abl/abl.cpp b/Marlin/src/feature/bedlevel/abl/abl.cpp index f1e736c88b4b..ce2799cd3844 100644 --- a/Marlin/src/feature/bedlevel/abl/abl.cpp +++ b/Marlin/src/feature/bedlevel/abl/abl.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 26a5350645dc..8f2a900bebfd 100644 --- a/Marlin/src/feature/bedlevel/abl/abl.h +++ b/Marlin/src/feature/bedlevel/abl/abl.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 bc5bf2397d95..55267b44e045 100644 --- a/Marlin/src/feature/bedlevel/bedlevel.cpp +++ b/Marlin/src/feature/bedlevel/bedlevel.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 @@ -160,57 +161,57 @@ void reset_bed_level() { #ifndef SCAD_MESH_OUTPUT for (uint8_t x = 0; x < sx; x++) { serial_spaces(precision + (x < 10 ? 3 : 2)); - SERIAL_PROTOCOL(int(x)); + SERIAL_ECHO(int(x)); } SERIAL_EOL(); #endif #ifdef SCAD_MESH_OUTPUT - SERIAL_PROTOCOLLNPGM("measured_z = ["); // open 2D array + SERIAL_ECHOLNPGM("measured_z = ["); // open 2D array #endif for (uint8_t y = 0; y < sy; y++) { #ifdef SCAD_MESH_OUTPUT - SERIAL_PROTOCOLPGM(" ["); // open sub-array + SERIAL_ECHOPGM(" ["); // open sub-array #else - if (y < 10) SERIAL_PROTOCOLCHAR(' '); - SERIAL_PROTOCOL(int(y)); + if (y < 10) SERIAL_CHAR(' '); + SERIAL_ECHO(int(y)); #endif for (uint8_t x = 0; x < sx; x++) { - SERIAL_PROTOCOLCHAR(' '); + SERIAL_CHAR(' '); const float offset = fn(x, y); if (!isnan(offset)) { - if (offset >= 0) SERIAL_PROTOCOLCHAR('+'); - SERIAL_PROTOCOL_F(offset, int(precision)); + if (offset >= 0) SERIAL_CHAR('+'); + SERIAL_ECHO_F(offset, int(precision)); } else { #ifdef SCAD_MESH_OUTPUT for (uint8_t i = 3; i < precision + 3; i++) - SERIAL_PROTOCOLCHAR(' '); - SERIAL_PROTOCOLPGM("NAN"); + SERIAL_CHAR(' '); + SERIAL_ECHOPGM("NAN"); #else for (uint8_t i = 0; i < precision + 3; i++) - SERIAL_PROTOCOLCHAR(i ? '=' : ' '); + SERIAL_CHAR(i ? '=' : ' '); #endif } #ifdef SCAD_MESH_OUTPUT - if (x < sx - 1) SERIAL_PROTOCOLCHAR(','); + if (x < sx - 1) SERIAL_CHAR(','); #endif } #ifdef SCAD_MESH_OUTPUT - SERIAL_PROTOCOLCHAR(' '); - SERIAL_PROTOCOLCHAR(']'); // close sub-array - if (y < sy - 1) SERIAL_PROTOCOLCHAR(','); + SERIAL_CHAR(' '); + SERIAL_CHAR(']'); // close sub-array + if (y < sy - 1) SERIAL_CHAR(','); #endif SERIAL_EOL(); } #ifdef SCAD_MESH_OUTPUT - SERIAL_PROTOCOLPGM("];"); // close 2D array + SERIAL_ECHOPGM("];"); // close 2D array #endif SERIAL_EOL(); } #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 b57ed696faf4..e2e7e182f192 100644 --- a/Marlin/src/feature/bedlevel/bedlevel.h +++ b/Marlin/src/feature/bedlevel/bedlevel.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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) +#if EITHER(MESH_BED_LEVELING, PROBE_MANUALLY) + void _manual_goto_xy(const float &x, const float &y); +#endif - #include +#if HAS_MESH - typedef float (*element_2d_fn)(const uint8_t, const uint8_t); + typedef float (&bed_mesh_t)[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y]; - /** - * 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); + #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 -#endif + #define Z_VALUES(X,Y) Z_VALUES_ARR[X][Y] -#if ENABLED(MESH_BED_LEVELING) || ENABLED(PROBE_MANUALLY) - void _manual_goto_xy(const float &x, const float &y); -#endif + #if EITHER(AUTO_BED_LEVELING_BILINEAR, MESH_BED_LEVELING) -#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 + #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 bf60f87083dd..188ddb898d49 100644 --- a/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp +++ b/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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) @@ -119,9 +124,8 @@ #endif // IS_CARTESIAN && !SEGMENT_LEVELED_MOVES void mesh_bed_leveling::report_mesh() { - SERIAL_PROTOCOLPGM(STRINGIFY(GRID_MAX_POINTS_X) "x" STRINGIFY(GRID_MAX_POINTS_Y) " mesh. Z offset: "); - SERIAL_PROTOCOL_F(z_offset, 5); - SERIAL_PROTOCOLLNPGM("\nMeasured points:"); + SERIAL_ECHOPAIR_F(STRINGIFY(GRID_MAX_POINTS_X) "x" STRINGIFY(GRID_MAX_POINTS_Y) " mesh. Z offset: ", z_offset, 5); + SERIAL_ECHOLNPGM("\nMeasured points:"); print_2d_array(GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y, 5, [](const uint8_t ix, const uint8_t iy) { return z_values[ix][iy]; } ); diff --git a/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h b/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h index 8fbba8f7e82b..1869187afe90 100644 --- a/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h +++ b/Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 @@ class mesh_bed_leveling { }; 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 8178ee132088..9e637c7debd8 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -32,95 +32,36 @@ #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( - #if NUM_SERIAL > 1 - const int8_t port/*= -1*/ - #endif - ) { - SERIAL_PROTOCOLPGM_P(port, "Unified Bed Leveling"); + void unified_bed_leveling::echo_name() { + SERIAL_ECHOPGM("Unified Bed Leveling"); } - void unified_bed_leveling::report_current_mesh( - #if NUM_SERIAL > 1 - const int8_t port/*= -1*/ - #endif - ) { + void unified_bed_leveling::report_current_mesh() { if (!leveling_is_valid()) return; - SERIAL_ECHO_START_P(port); - SERIAL_ECHOLNPGM_P(port, " G29 I99"); + SERIAL_ECHO_MSG(" G29 I99"); 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])) { - SERIAL_ECHO_START_P(port); - SERIAL_ECHOPAIR_P(port, " M421 I", x); - SERIAL_ECHOPAIR_P(port, " J", y); - SERIAL_ECHOPGM_P(port, " Z"); - SERIAL_ECHO_F_P(port, z_values[x][y], 2); - SERIAL_EOL_P(port); + SERIAL_ECHO_START(); + 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 } } - void unified_bed_leveling::report_state( - #if NUM_SERIAL > 1 - const int8_t port/*= -1*/ - #endif - ) { - echo_name( - #if NUM_SERIAL > 1 - port - #endif - ); - SERIAL_PROTOCOLPGM_P(port, " System v" UBL_VERSION " "); - if (!planner.leveling_active) SERIAL_PROTOCOLPGM_P(port, "in"); - SERIAL_PROTOCOLLNPGM_P(port, "active."); + void unified_bed_leveling::report_state() { + echo_name(); + 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_ECHOPGM(" fpmm="); SERIAL_ECHO_F(fpmm, 6); - SERIAL_ECHOPGM(" current=( "); - SERIAL_ECHO_F(current_position[X_AXIS], 6); SERIAL_ECHOPGM(", "); - SERIAL_ECHO_F(current_position[Y_AXIS], 6); SERIAL_ECHOPGM(", "); - SERIAL_ECHO_F(current_position[Z_AXIS], 6); SERIAL_ECHOPGM(", "); - SERIAL_ECHO_F(current_position[E_AXIS], 6); SERIAL_ECHOPGM(" ) destination=( "); - debug_echo_axis(X_AXIS); SERIAL_ECHOPGM(", "); - debug_echo_axis(Y_AXIS); SERIAL_ECHOPGM(", "); - debug_echo_axis(Z_AXIS); SERIAL_ECHOPGM(", "); - debug_echo_axis(E_AXIS); SERIAL_ECHOPGM(" ) "); - 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]; @@ -148,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(); } @@ -160,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 } } } @@ -205,7 +154,7 @@ SERIAL_ECHOPGM("\nBed Topography Report"); if (human) { - SERIAL_ECHOPGM(":\n\n"); + SERIAL_ECHOLNPGM(":\n"); serial_echo_xy(4, MESH_MIN_X, MESH_MAX_Y); serial_echo_xy(twixt, MESH_MAX_X, MESH_MAX_Y); SERIAL_EOL(); @@ -216,8 +165,11 @@ serialprintPGM(csv ? PSTR("CSV:\n") : PSTR("LCD:\n")); } - const float current_xi = get_cell_index_x(current_position[X_AXIS] + (MESH_X_DIST) / 2.0), - current_yi = get_cell_index_y(current_position[Y_AXIS] + (MESH_Y_DIST) / 2.0); + // Add XY_PROBE_OFFSET_FROM_EXTRUDER because probe_pt() subtracts these when + // moving to the xy position to be measured. This ensures better agreement between + // the current Z position after G28 and the mesh values. + const float current_xi = find_closest_x_index(current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER), + current_yi = find_closest_y_index(current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER); if (!lcd) SERIAL_EOL(); for (int8_t j = GRID_MAX_POINTS_Y - 1; j >= 0; j--) { @@ -279,7 +231,7 @@ uint8_t error_flag = 0; if (settings.calc_num_meshes() < 1) { - SERIAL_PROTOCOLLNPGM("?Mesh too big for EEPROM."); + SERIAL_ECHOLNPGM("?Mesh too big for EEPROM."); error_flag++; } diff --git a/Marlin/src/feature/bedlevel/ubl/ubl.h b/Marlin/src/feature/bedlevel/ubl/ubl.h index cd13e081d9cc..a7c7f033b300 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl.h +++ b/Marlin/src/feature/bedlevel/ubl/ubl.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 }; @@ -94,21 +89,9 @@ class unified_bed_leveling { public: - static void echo_name( - #if NUM_SERIAL > 1 - const int8_t port = -1 - #endif - ); - static void report_current_mesh( - #if NUM_SERIAL > 1 - const int8_t port = -1 - #endif - ); - static void report_state( - #if NUM_SERIAL > 1 - const int8_t port = -1 - #endif - ); + static void echo_name(); + static void report_current_mesh(); + static void report_state(); static void save_ubl_active_state_and_disable(); static void restore_ubl_active_state_and_leave(); static void display_map(const int) _O0; @@ -211,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 ( @@ -245,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 ( @@ -305,23 +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_ECHOPGM(") = "); - SERIAL_ECHO_F(z0, 6); - } - #endif - - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(MESH_ADJUST)) { - SERIAL_ECHOPGM(" >>>---> "); - SERIAL_ECHO_F(z0, 6); - SERIAL_EOL(); - } - #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 @@ -329,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; } @@ -367,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 11aec934557e..ba9205b9c383 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 @@ -331,23 +336,26 @@ // meant to invalidate the ENTIRE mesh, which cannot be done with // find_closest_mesh_point loop which only returns REACHABLE points. set_all_mesh_points_to_value(NAN); - SERIAL_PROTOCOLLNPGM("Entire Mesh invalidated.\n"); + SERIAL_ECHOLNPGM("Entire Mesh invalidated.\n"); 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++; } } - SERIAL_PROTOCOLLNPGM("Locations invalidated.\n"); + SERIAL_ECHOLNPGM("Locations invalidated.\n"); } if (parser.seen('Q')) { const int test_pattern = parser.has_value() ? parser.value_int() : -99; if (!WITHIN(test_pattern, -1, 2)) { - SERIAL_PROTOCOLLNPGM("Invalid test_pattern value. (-1 to 2)\n"); + SERIAL_ECHOLNPGM("Invalid test_pattern value. (-1 to 2)\n"); return; } - SERIAL_PROTOCOLLNPGM("Loading test_pattern values.\n"); + SERIAL_ECHOLNPGM("Loading test_pattern values.\n"); switch (test_pattern) { #if ENABLED(UBL_DEVEL_DEBUGGING) @@ -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; } } @@ -405,7 +425,7 @@ if (parser.seen('P')) { if (WITHIN(g29_phase_value, 0, 1) && storage_slot == -1) { storage_slot = 0; - SERIAL_PROTOCOLLNPGM("Default storage slot 0 selected."); + SERIAL_ECHOLNPGM("Default storage slot 0 selected."); } switch (g29_phase_value) { @@ -414,7 +434,7 @@ // Zero Mesh Data // reset(); - SERIAL_PROTOCOLLNPGM("Mesh zeroed."); + SERIAL_ECHOLNPGM("Mesh zeroed."); break; #if HAS_BED_PROBE @@ -425,13 +445,13 @@ // if (!parser.seen('C')) { invalidate(); - SERIAL_PROTOCOLLNPGM("Mesh invalidated. Probing mesh."); + SERIAL_ECHOLNPGM("Mesh invalidated. Probing mesh."); } if (g29_verbose_level > 1) { - SERIAL_PROTOCOLPAIR("Probing Mesh Points Closest to (", g29_x_pos); - SERIAL_PROTOCOLCHAR(','); - SERIAL_PROTOCOL(g29_y_pos); - SERIAL_PROTOCOLLNPGM(").\n"); + SERIAL_ECHOPAIR("Probing around (", g29_x_pos); + SERIAL_CHAR(','); + SERIAL_ECHO(g29_y_pos); + SERIAL_ECHOLNPGM(").\n"); } probe_entire_mesh(g29_x_pos + X_PROBE_OFFSET_FROM_EXTRUDER, g29_y_pos + Y_PROBE_OFFSET_FROM_EXTRUDER, parser.seen('T'), parser.seen('E'), parser.seen('U')); @@ -446,7 +466,7 @@ // // Manually Probe Mesh in areas that can't be reached by the probe // - SERIAL_PROTOCOLLNPGM("Manually probing unreachable mesh locations."); + SERIAL_ECHOLNPGM("Manually probing unreachable mesh locations."); do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES); if (parser.seen('C') && !g29_x_flag && !g29_y_flag) { @@ -469,26 +489,26 @@ if (parser.seen('B')) { g29_card_thickness = parser.has_value() ? parser.value_float() : measure_business_card_thickness((float) Z_CLEARANCE_BETWEEN_PROBES); if (ABS(g29_card_thickness) > 1.5f) { - SERIAL_PROTOCOLLNPGM("?Error in Business Card measurement."); + SERIAL_ECHOLNPGM("?Error in Business Card measurement."); return; } } if (!position_is_reachable(g29_x_pos, g29_y_pos)) { - SERIAL_PROTOCOLLNPGM("XY outside printable radius."); + SERIAL_ECHOLNPGM("XY outside printable radius."); return; } const float height = parser.floatval('H', Z_CLEARANCE_BETWEEN_PROBES); manually_probe_remaining_mesh(g29_x_pos, g29_y_pos, height, g29_card_thickness, parser.seen('T')); - SERIAL_PROTOCOLLNPGM("G29 P2 finished."); + SERIAL_ECHOLNPGM("G29 P2 finished."); report_current_position(); #else - SERIAL_PROTOCOLLNPGM("?P2 is only available when an LCD is present."); + SERIAL_ECHOLNPGM("?P2 is only available when an LCD is present."); return; #endif @@ -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 } } } @@ -553,7 +576,7 @@ #if HAS_LCD_MENU fine_tune_mesh(g29_x_pos, g29_y_pos, parser.seen('T')); #else - SERIAL_PROTOCOLLNPGM("?P4 is only available when an LCD is present."); + SERIAL_ECHOLNPGM("?P4 is only available when an LCD is present."); return; #endif break; @@ -593,20 +616,19 @@ int16_t a = settings.calc_num_meshes(); if (!a) { - SERIAL_PROTOCOLLNPGM("?EEPROM storage not available."); + SERIAL_ECHOLNPGM("?EEPROM storage not available."); return; } if (!WITHIN(g29_storage_slot, 0, a - 1)) { - SERIAL_PROTOCOLLNPGM("?Invalid storage slot."); - SERIAL_PROTOCOLLNPAIR("?Use 0 to ", a - 1); + SERIAL_ECHOLNPAIR("?Invalid storage slot.\n?Use 0 to ", a - 1); return; } settings.load_mesh(g29_storage_slot); storage_slot = g29_storage_slot; - SERIAL_PROTOCOLLNPGM("Done."); + SERIAL_ECHOLNPGM("Done."); } // @@ -622,20 +644,19 @@ int16_t a = settings.calc_num_meshes(); if (!a) { - SERIAL_PROTOCOLLNPGM("?EEPROM storage not available."); + SERIAL_ECHOLNPGM("?EEPROM storage not available."); goto LEAVE; } if (!WITHIN(g29_storage_slot, 0, a - 1)) { - SERIAL_PROTOCOLLNPGM("?Invalid storage slot."); - SERIAL_PROTOCOLLNPAIR("?Use 0 to ", a - 1); + SERIAL_ECHOLNPAIR("?Invalid storage slot.\n?Use 0 to ", a - 1); goto LEAVE; } settings.store_mesh(g29_storage_slot); storage_slot = g29_storage_slot; - SERIAL_PROTOCOLLNPGM("Done."); + SERIAL_ECHOLNPGM("Done."); } if (parser.seen('T')) @@ -675,27 +696,31 @@ sum_of_diff_squared += sq(z_values[x][y] - mean); SERIAL_ECHOLNPAIR("# of samples: ", n); - SERIAL_ECHOPGM("Mean Mesh Height: "); - SERIAL_ECHO_F(mean, 6); - SERIAL_EOL(); + SERIAL_ECHOLNPAIR_F("Mean Mesh Height: ", mean, 6); const float sigma = SQRT(sum_of_diff_squared / (n + 1)); - SERIAL_ECHOPGM("Standard Deviation: "); - SERIAL_ECHO_F(sigma, 6); - SERIAL_EOL(); + SERIAL_ECHOLNPAIR_F("Standard Deviation: ", sigma, 6); 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 @@ -721,7 +746,7 @@ #if HAS_LCD_MENU if (ui.button_pressed()) { ui.quick_feedback(false); // Preserve button state for click-and-hold - SERIAL_PROTOCOLLNPGM("\nMesh only partially populated.\n"); + SERIAL_ECHOLNPGM("\nMesh only partially populated.\n"); STOW_PROBE(); ui.wait_for_release(); ui.quick_feedback(); @@ -738,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); @@ -803,7 +830,7 @@ return current_position[Z_AXIS]; } - static void echo_and_take_a_measurement() { SERIAL_PROTOCOLLNPGM(" and take a measurement."); } + static void echo_and_take_a_measurement() { SERIAL_ECHOLNPGM(" and take a measurement."); } float unified_bed_leveling::measure_business_card_thickness(float in_height) { ui.capture(); @@ -813,7 +840,7 @@ //, MIN(planner.settings.max_feedrate_mm_s[X_AXIS], planner.settings.max_feedrate_mm_s[Y_AXIS]) * 0.5f); planner.synchronize(); - SERIAL_PROTOCOLPGM("Place shim under nozzle"); + SERIAL_ECHOPGM("Place shim under nozzle"); LCD_MESSAGEPGM(MSG_UBL_BC_INSERT); ui.return_to_status(); echo_and_take_a_measurement(); @@ -822,7 +849,7 @@ do_blocking_move_to_z(current_position[Z_AXIS] + SIZE_OF_LITTLE_RAISE); planner.synchronize(); - SERIAL_PROTOCOLPGM("Remove shim"); + SERIAL_ECHOPGM("Remove shim"); LCD_MESSAGEPGM(MSG_UBL_BC_REMOVE); echo_and_take_a_measurement(); @@ -833,9 +860,8 @@ const float thickness = ABS(z1 - z2); if (g29_verbose_level > 1) { - SERIAL_PROTOCOLPGM("Business Card is "); - SERIAL_PROTOCOL_F(thickness, 4); - SERIAL_PROTOCOLLNPGM("mm thick."); + SERIAL_ECHOPAIR_F("Business Card is ", thickness, 4); + SERIAL_ECHOLNPGM("mm thick."); } ui.release(); @@ -846,7 +872,7 @@ } void abort_manual_probe_remaining_mesh() { - SERIAL_PROTOCOLLNPGM("\nMesh only partially populated."); + SERIAL_ECHOLNPGM("\nMesh only partially populated."); do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE); ui.release(); KEEPALIVE_STATE(IN_HANDLER); @@ -892,7 +918,7 @@ move_z_with_encoder(z_step); if (click_and_hold()) { - SERIAL_PROTOCOLLNPGM("\nMesh only partially populated."); + SERIAL_ECHOLNPGM("\nMesh only partially populated."); do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE); ui.release(); KEEPALIVE_STATE(IN_HANDLER); @@ -901,11 +927,12 @@ } z_values[location.x_index][location.y_index] = current_position[Z_AXIS] - thick; - if (g29_verbose_level > 2) { - SERIAL_PROTOCOLPGM("Mesh Point Measured at: "); - SERIAL_PROTOCOL_F(z_values[location.x_index][location.y_index], 6); - SERIAL_EOL(); - } + #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. } while (location.x_index >= 0 && location.y_index >= 0); @@ -934,7 +961,7 @@ #if ENABLED(UBL_MESH_EDIT_MOVES_Z) const float h_offset = parser.seenval('H') ? parser.value_linear_units() : 0; if (!WITHIN(h_offset, 0, 10)) { - SERIAL_PROTOCOLLNPGM("Offset out of bounds. (0 to 10mm)\n"); + SERIAL_ECHOLNPGM("Offset out of bounds. (0 to 10mm)\n"); return; } #endif @@ -942,7 +969,7 @@ mesh_index_pair location; if (!position_is_reachable(rx, ry)) { - SERIAL_PROTOCOLLNPGM("(X,Y) outside printable radius."); + SERIAL_ECHOLNPGM("(X,Y) outside printable radius."); return; } @@ -1004,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(); @@ -1050,14 +1080,14 @@ g29_repetition_cnt = parser.has_value() ? parser.value_int() : GRID_MAX_POINTS; NOMORE(g29_repetition_cnt, GRID_MAX_POINTS); if (g29_repetition_cnt < 1) { - SERIAL_PROTOCOLLNPGM("?(R)epetition count invalid (1+).\n"); + SERIAL_ECHOLNPGM("?(R)epetition count invalid (1+).\n"); return UBL_ERR; } } g29_verbose_level = parser.seen('V') ? parser.value_int() : 0; if (!WITHIN(g29_verbose_level, 0, 4)) { - SERIAL_PROTOCOLLNPGM("?(V)erbose level is implausible (0-4).\n"); + SERIAL_ECHOLNPGM("?(V)erbose level is implausible (0-4).\n"); err_flag = true; } @@ -1065,7 +1095,7 @@ const int pv = parser.value_int(); #if !HAS_BED_PROBE if (pv == 1) { - SERIAL_PROTOCOLLNPGM("G29 P1 requires a probe.\n"); + SERIAL_ECHOLNPGM("G29 P1 requires a probe.\n"); err_flag = true; } else @@ -1073,7 +1103,7 @@ { g29_phase_value = pv; if (!WITHIN(g29_phase_value, 0, 6)) { - SERIAL_PROTOCOLLNPGM("?(P)hase value invalid (0-6).\n"); + SERIAL_ECHOLNPGM("?(P)hase value invalid (0-6).\n"); err_flag = true; } } @@ -1083,17 +1113,17 @@ #if HAS_BED_PROBE g29_grid_size = parser.has_value() ? parser.value_int() : 0; if (g29_grid_size && !WITHIN(g29_grid_size, 2, 9)) { - SERIAL_PROTOCOLLNPGM("?Invalid grid size (J) specified (2-9).\n"); + SERIAL_ECHOLNPGM("?Invalid grid size (J) specified (2-9).\n"); err_flag = true; } #else - SERIAL_PROTOCOLLNPGM("G29 J action requires a probe.\n"); + SERIAL_ECHOLNPGM("G29 J action requires a probe.\n"); err_flag = true; #endif } if (g29_x_flag != g29_y_flag) { - SERIAL_PROTOCOLLNPGM("Both X & Y locations must be specified.\n"); + SERIAL_ECHOLNPGM("Both X & Y locations must be specified.\n"); err_flag = true; } @@ -1111,7 +1141,7 @@ */ if (parser.seen('A')) { if (parser.seen('D')) { - SERIAL_PROTOCOLLNPGM("?Can't activate and deactivate at the same time.\n"); + SERIAL_ECHOLNPGM("?Can't activate and deactivate at the same time.\n"); return UBL_ERR; } set_bed_leveling_enabled(true); @@ -1130,7 +1160,7 @@ if (parser.seenval('F')) { const float fh = parser.value_float(); if (!WITHIN(fh, 0, 100)) { - SERIAL_PROTOCOLLNPGM("?(F)ade height for Bed Level Correction not plausible.\n"); + SERIAL_ECHOLNPGM("?(F)ade height for Bed Level Correction not plausible.\n"); return UBL_ERR; } set_z_fade_height(fh); @@ -1139,7 +1169,7 @@ g29_map_type = parser.intval('T'); if (!WITHIN(g29_map_type, 0, 2)) { - SERIAL_PROTOCOLLNPGM("Invalid map type.\n"); + SERIAL_ECHOLNPGM("Invalid map type.\n"); return UBL_ERR; } return UBL_OK; @@ -1249,8 +1279,8 @@ out_mesh.distance = -99999.9f; // Get our reference position. Either the nozzle or probe location. - const float px = rx - (probe_as_reference == USE_PROBE_AS_REFERENCE ? X_PROBE_OFFSET_FROM_EXTRUDER : 0), - py = ry - (probe_as_reference == USE_PROBE_AS_REFERENCE ? Y_PROBE_OFFSET_FROM_EXTRUDER : 0); + const float px = rx + (probe_as_reference == USE_PROBE_AS_REFERENCE ? X_PROBE_OFFSET_FROM_EXTRUDER : 0), + py = ry + (probe_as_reference == USE_PROBE_AS_REFERENCE ? Y_PROBE_OFFSET_FROM_EXTRUDER : 0); float best_so_far = 99999.99f; @@ -1308,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; @@ -1415,7 +1450,7 @@ #endif if (abort_flag) { - SERIAL_ECHOPGM("?Error probing point. Aborting operation.\n"); + SERIAL_ECHOLNPGM("?Error probing point. Aborting operation."); return; } } @@ -1432,33 +1467,24 @@ abort_flag = isnan(measured_z); - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_CHAR('('); - SERIAL_PROTOCOL_F(rx, 7); - SERIAL_CHAR(','); - SERIAL_PROTOCOL_F(ry, 7); - SERIAL_ECHOPGM(") logical: "); - SERIAL_CHAR('('); - SERIAL_PROTOCOL_F(LOGICAL_X_POSITION(rx), 7); - SERIAL_CHAR(','); - SERIAL_PROTOCOL_F(LOGICAL_Y_POSITION(ry), 7); - SERIAL_ECHOPGM(") measured: "); - SERIAL_PROTOCOL_F(measured_z, 7); - SERIAL_ECHOPGM(" correction: "); - SERIAL_PROTOCOL_F(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_ECHOPGM(" final >>>---> "); - SERIAL_PROTOCOL_F(measured_z, 7); - SERIAL_EOL(); - } - #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); @@ -1483,12 +1509,11 @@ vector_3 normal = vector_3(lsf_results.A, lsf_results.B, 1).get_normal(); if (g29_verbose_level > 2) { - SERIAL_ECHOPGM("bed plane normal = ["); - SERIAL_PROTOCOL_F(normal.x, 7); - SERIAL_PROTOCOLCHAR(','); - SERIAL_PROTOCOL_F(normal.y, 7); - SERIAL_PROTOCOLCHAR(','); - SERIAL_PROTOCOL_F(normal.z, 7); + 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("]"); } @@ -1500,113 +1525,88 @@ y_tmp = mesh_index_to_ypos(j), z_tmp = z_values[i][j]; - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) { - SERIAL_ECHOPGM("before rotation = ["); - SERIAL_PROTOCOL_F(x_tmp, 7); - SERIAL_PROTOCOLCHAR(','); - SERIAL_PROTOCOL_F(y_tmp, 7); - SERIAL_PROTOCOLCHAR(','); - SERIAL_PROTOCOL_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_ECHOPGM("after rotation = ["); - SERIAL_PROTOCOL_F(x_tmp, 7); - SERIAL_PROTOCOLCHAR(','); - SERIAL_PROTOCOL_F(y_tmp, 7); - SERIAL_PROTOCOLCHAR(','); - SERIAL_PROTOCOL_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_ECHOPGM("LSF Results A="); - SERIAL_PROTOCOL_F(lsf_results.A, 7); - SERIAL_ECHOPGM(" B="); - SERIAL_PROTOCOL_F(lsf_results.B, 7); - SERIAL_ECHOPGM(" D="); - SERIAL_PROTOCOL_F(lsf_results.D, 7); - SERIAL_EOL(); - serial_delay(55); - - SERIAL_ECHOPGM("bed plane normal = ["); - SERIAL_PROTOCOL_F(normal.x, 7); - SERIAL_PROTOCOLCHAR(','); - SERIAL_PROTOCOL_F(normal.y, 7); - SERIAL_PROTOCOLCHAR(','); - SERIAL_PROTOCOL_F(normal.z, 7); - SERIAL_ECHOPGM("]\n"); - SERIAL_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_ECHOPGM("D from 1st point: "); - SERIAL_ECHO_F(d, 6); - SERIAL_ECHOPGM(" Z error: "); - SERIAL_ECHO_F(normal.z*z1-get_z_correction(PROBE_PT_1_X, PROBE_PT_1_Y), 6); - SERIAL_EOL(); - - t = normal.x * (PROBE_PT_2_X) + normal.y * (PROBE_PT_2_Y); - d = t + normal.z * z2; - SERIAL_EOL(); - SERIAL_ECHOPGM("D from 2nd point: "); - SERIAL_ECHO_F(d, 6); - SERIAL_ECHOPGM(" Z error: "); - SERIAL_ECHO_F(normal.z*z2-get_z_correction(PROBE_PT_2_X, PROBE_PT_2_Y), 6); - SERIAL_EOL(); - - t = normal.x * (PROBE_PT_3_X) + normal.y * (PROBE_PT_3_Y); - d = t + normal.z * z3; - SERIAL_ECHOPGM("D from 3rd point: "); - SERIAL_ECHO_F(d, 6); - SERIAL_ECHOPGM(" Z error: "); - SERIAL_ECHO_F(normal.z*z3-get_z_correction(PROBE_PT_3_X, PROBE_PT_3_Y), 6); - SERIAL_EOL(); - - t = normal.x * (Z_SAFE_HOMING_X_POINT) + normal.y * (Z_SAFE_HOMING_Y_POINT); - d = t + normal.z * 0; - SERIAL_ECHOPGM("D from home location with Z=0 : "); - SERIAL_ECHO_F(d, 6); - SERIAL_EOL(); - - 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_ECHOPGM("D from home location using mesh value for Z: "); - SERIAL_ECHO_F(d, 6); - - SERIAL_ECHOPAIR(" Z error: (", Z_SAFE_HOMING_X_POINT); - SERIAL_ECHOPAIR(",", Z_SAFE_HOMING_Y_POINT ); - SERIAL_ECHOPGM(") = "); - SERIAL_ECHO_F(get_z_correction(Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT), 6); - SERIAL_EOL(); - #endif - } // DEBUGGING(LEVELING) - #endif + 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); + + 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; + 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; + 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; + 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; + 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; + DEBUG_ECHOPAIR_F("D from home location using mesh value for Z: ", d, 6); + + 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) } @@ -1657,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 } } @@ -1675,26 +1678,20 @@ report_state(); if (storage_slot == -1) - SERIAL_PROTOCOLPGM("No Mesh Loaded."); - else { - SERIAL_PROTOCOLPAIR("Mesh ", storage_slot); - SERIAL_PROTOCOLPGM(" Loaded."); - } + SERIAL_ECHOPGM("No Mesh Loaded."); + else + SERIAL_ECHOPAIR("Mesh ", storage_slot, " Loaded."); SERIAL_EOL(); serial_delay(50); #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) - SERIAL_PROTOCOLPGM("planner.z_fade_height : "); - SERIAL_PROTOCOL_F(planner.z_fade_height, 4); - SERIAL_EOL(); + SERIAL_ECHOLNPAIR_F("planner.z_fade_height : ", planner.z_fade_height, 4); #endif adjust_mesh_to_mean(g29_c_flag, g29_constant); #if HAS_BED_PROBE - SERIAL_PROTOCOLPGM("zprobe_zoffset: "); - SERIAL_PROTOCOL_F(zprobe_zoffset, 7); - SERIAL_EOL(); + SERIAL_ECHOLNPAIR_F("zprobe_zoffset: ", zprobe_zoffset, 7); #endif SERIAL_ECHOLNPAIR("MESH_MIN_X " STRINGIFY(MESH_MIN_X) "=", MESH_MIN_X); serial_delay(50); @@ -1706,53 +1703,49 @@ SERIAL_ECHOLNPAIR("MESH_X_DIST ", MESH_X_DIST); SERIAL_ECHOLNPAIR("MESH_Y_DIST ", MESH_Y_DIST); serial_delay(50); - SERIAL_PROTOCOLPGM("X-Axis Mesh Points at: "); + SERIAL_ECHOPGM("X-Axis Mesh Points at: "); for (uint8_t i = 0; i < GRID_MAX_POINTS_X; i++) { - SERIAL_PROTOCOL_F(LOGICAL_X_POSITION(mesh_index_to_xpos(i)), 3); - SERIAL_PROTOCOLPGM(" "); + SERIAL_ECHO_F(LOGICAL_X_POSITION(mesh_index_to_xpos(i)), 3); + SERIAL_ECHOPGM(" "); serial_delay(25); } SERIAL_EOL(); - SERIAL_PROTOCOLPGM("Y-Axis Mesh Points at: "); + SERIAL_ECHOPGM("Y-Axis Mesh Points at: "); for (uint8_t i = 0; i < GRID_MAX_POINTS_Y; i++) { - SERIAL_PROTOCOL_F(LOGICAL_Y_POSITION(mesh_index_to_ypos(i)), 3); - SERIAL_PROTOCOLPGM(" "); + SERIAL_ECHO_F(LOGICAL_Y_POSITION(mesh_index_to_ypos(i)), 3); + SERIAL_ECHOPGM(" "); serial_delay(25); } SERIAL_EOL(); #if HAS_KILL - SERIAL_PROTOCOLPAIR("Kill pin on :", KILL_PIN); - SERIAL_PROTOCOLLNPAIR(" 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_PROTOCOLLNPAIR("ubl_state_at_invocation :", ubl_state_at_invocation); SERIAL_EOL(); - SERIAL_PROTOCOLLNPAIR("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_PROTOCOLPAIR("Meshes go from ", hex_address((void*)settings.meshes_start_index())); - SERIAL_PROTOCOLLNPAIR(" 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_PROTOCOLLNPAIR("sizeof(ubl) : ", (int)sizeof(ubl)); SERIAL_EOL(); - SERIAL_PROTOCOLLNPAIR("z_value[][] size: ", (int)sizeof(z_values)); SERIAL_EOL(); + SERIAL_ECHOLNPAIR("sizeof(ubl) : ", (int)sizeof(ubl)); SERIAL_EOL(); + SERIAL_ECHOLNPAIR("z_value[][] size: ", (int)sizeof(z_values)); SERIAL_EOL(); serial_delay(25); - SERIAL_PROTOCOLLNPAIR("EEPROM free for UBL: ", hex_address((void*)(settings.meshes_end_index() - settings.meshes_start_index()))); + SERIAL_ECHOLNPAIR("EEPROM free for UBL: ", hex_address((void*)(settings.meshes_end_index() - settings.meshes_start_index()))); serial_delay(50); - SERIAL_PROTOCOLPAIR("EEPROM can hold ", settings.calc_num_meshes()); - SERIAL_PROTOCOLLNPGM(" meshes.\n"); + SERIAL_ECHOLNPAIR("EEPROM can hold ", settings.calc_num_meshes(), " meshes.\n"); serial_delay(25); #endif // UBL_DEVEL_DEBUGGING if (!sanity_check()) { echo_name(); - SERIAL_PROTOCOLLNPGM(" sanity checks passed."); + SERIAL_ECHOLNPGM(" sanity checks passed."); } } @@ -1763,8 +1756,7 @@ void unified_bed_leveling::g29_eeprom_dump() { uint8_t cccc; - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM("EEPROM Dump:"); + SERIAL_ECHO_MSG("EEPROM Dump:"); persistentStore.access_start(); for (uint16_t i = 0; i < persistentStore.capacity(); i += 16) { if (!(i & 0x3)) idle(); @@ -1773,7 +1765,7 @@ for (uint16_t j = 0; j < 16; j++) { persistentStore.read_data(i + j, &cccc, sizeof(uint8_t)); print_hex_byte(cccc); - SERIAL_ECHO(' '); + SERIAL_CHAR(' '); } SERIAL_EOL(); } @@ -1786,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_PROTOCOLLNPGM("?EEPROM storage not available."); + SERIAL_ECHOLNPGM("?EEPROM storage not available."); return; } - if (!parser.has_value()) { - SERIAL_PROTOCOLLNPGM("?Storage slot # required."); - SERIAL_PROTOCOLLNPAIR("?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_PROTOCOLLNPGM("?Invalid storage slot."); - SERIAL_PROTOCOLLNPAIR("?Use 0 to ", a - 1); - return; - } - float tmp_z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y]; settings.load_mesh(g29_storage_slot, &tmp_z_values); - SERIAL_PROTOCOLPAIR("Subtracting mesh in slot ", g29_storage_slot); - SERIAL_PROTOCOLLNPGM(" from current mesh."); + 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 0519f736d9a1..d3cf1ac92473 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 000000000000..2e68835f3963 --- /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 000000000000..553caa60ad64 --- /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 e2cc23368a20..1256acb6d754 100644 --- a/Marlin/src/feature/caselight.cpp +++ b/Marlin/src/feature/caselight.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -69,8 +69,7 @@ void update_case_light() { #else // !CASE_LIGHT_USE_NEOPIXEL - SET_OUTPUT(CASE_LIGHT_PIN); - 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/caselight.h b/Marlin/src/feature/caselight.h index 4cd6c1377099..8ae4df4e2f83 100644 --- a/Marlin/src/feature/caselight.h +++ b/Marlin/src/feature/caselight.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/feature/closedloop.cpp b/Marlin/src/feature/closedloop.cpp index 2fe60fcf9c8a..d94181749db2 100644 --- a/Marlin/src/feature/closedloop.cpp +++ b/Marlin/src/feature/closedloop.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/feature/closedloop.h b/Marlin/src/feature/closedloop.h index 84cec36fe6c2..50c814df1c66 100644 --- a/Marlin/src/feature/closedloop.h +++ b/Marlin/src/feature/closedloop.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/feature/controllerfan.cpp b/Marlin/src/feature/controllerfan.cpp index 7ee667133293..81af95787342 100644 --- a/Marlin/src/feature/controllerfan.cpp +++ b/Marlin/src/feature/controllerfan.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 @@ -53,22 +53,24 @@ void controllerfan_update() { #if HAS_Z3_ENABLE || Z3_ENABLE_READ == Z_ENABLE_ON #endif - || E0_ENABLE_READ == E_ENABLE_ON - #if E_STEPPERS > 1 - || E1_ENABLE_READ == E_ENABLE_ON - #if E_STEPPERS > 2 - || E2_ENABLE_READ == E_ENABLE_ON - #if E_STEPPERS > 3 - || E3_ENABLE_READ == E_ENABLE_ON - #if E_STEPPERS > 4 - || E4_ENABLE_READ == E_ENABLE_ON - #if E_STEPPERS > 5 - || E5_ENABLE_READ == E_ENABLE_ON - #endif - #endif - #endif - #endif - #endif + #if E_STEPPERS + || E0_ENABLE_READ == E_ENABLE_ON + #if E_STEPPERS > 1 + || E1_ENABLE_READ == E_ENABLE_ON + #if E_STEPPERS > 2 + || E2_ENABLE_READ == E_ENABLE_ON + #if E_STEPPERS > 3 + || E3_ENABLE_READ == E_ENABLE_ON + #if E_STEPPERS > 4 + || E4_ENABLE_READ == E_ENABLE_ON + #if E_STEPPERS > 5 + || E5_ENABLE_READ == E_ENABLE_ON + #endif // E_STEPPERS > 5 + #endif // E_STEPPERS > 4 + #endif // E_STEPPERS > 3 + #endif // E_STEPPERS > 2 + #endif // E_STEPPERS > 1 + #endif // E_STEPPERS ) { lastMotorOn = ms; //... set time to NOW so the fan will turn on } diff --git a/Marlin/src/feature/controllerfan.h b/Marlin/src/feature/controllerfan.h index 7badc99d26c2..fb10f3fd3f74 100644 --- a/Marlin/src/feature/controllerfan.h +++ b/Marlin/src/feature/controllerfan.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/feature/dac/dac_dac084s085.h b/Marlin/src/feature/dac/dac_dac084s085.h index f1b69c292bcd..926fa003875a 100644 --- a/Marlin/src/feature/dac/dac_dac084s085.h +++ b/Marlin/src/feature/dac/dac_dac084s085.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/feature/dac/dac_mcp4728.cpp b/Marlin/src/feature/dac/dac_mcp4728.cpp index 01568fb5c6d1..689be54f9614 100644 --- a/Marlin/src/feature/dac/dac_mcp4728.cpp +++ b/Marlin/src/feature/dac/dac_mcp4728.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -69,7 +69,7 @@ uint8_t mcp4728_analogWrite(uint8_t channel, uint16_t value) { * This will also write current Vref, PowerDown, Gain settings to EEPROM */ uint8_t mcp4728_eepromWrite() { - Wire.beginTransmission(DAC_DEV_ADDRESS); + Wire.beginTransmission(I2C_ADDRESS(DAC_DEV_ADDRESS)); Wire.write(SEQWRITE); LOOP_XYZE(i) { Wire.write(DAC_STEPPER_VREF << 7 | DAC_STEPPER_GAIN << 4 | highByte(mcp4728_values[i])); @@ -82,7 +82,7 @@ uint8_t mcp4728_eepromWrite() { * Write Voltage reference setting to all input regiters */ uint8_t mcp4728_setVref_all(uint8_t value) { - Wire.beginTransmission(DAC_DEV_ADDRESS); + Wire.beginTransmission(I2C_ADDRESS(DAC_DEV_ADDRESS)); Wire.write(VREFWRITE | (value ? 0x0F : 0x00)); return Wire.endTransmission(); } @@ -90,7 +90,7 @@ uint8_t mcp4728_setVref_all(uint8_t value) { * Write Gain setting to all input regiters */ uint8_t mcp4728_setGain_all(uint8_t value) { - Wire.beginTransmission(DAC_DEV_ADDRESS); + Wire.beginTransmission(I2C_ADDRESS(DAC_DEV_ADDRESS)); Wire.write(GAINWRITE | (value ? 0x0F : 0x00)); return Wire.endTransmission(); } @@ -133,7 +133,7 @@ void mcp4728_setDrvPct(uint8_t pct[XYZE]) { * No EEPROM update */ uint8_t mcp4728_fastWrite() { - Wire.beginTransmission(DAC_DEV_ADDRESS); + Wire.beginTransmission(I2C_ADDRESS(DAC_DEV_ADDRESS)); LOOP_XYZE(i) { Wire.write(highByte(mcp4728_values[i])); Wire.write(lowByte(mcp4728_values[i])); @@ -145,7 +145,7 @@ uint8_t mcp4728_fastWrite() { * Common function for simple general commands */ uint8_t mcp4728_simpleCommand(byte simpleCommand) { - Wire.beginTransmission(GENERALCALL); + Wire.beginTransmission(I2C_ADDRESS(GENERALCALL)); Wire.write(simpleCommand); return Wire.endTransmission(); } diff --git a/Marlin/src/feature/dac/dac_mcp4728.h b/Marlin/src/feature/dac/dac_mcp4728.h index 2e0937fcf644..c1fd6151ecd2 100644 --- a/Marlin/src/feature/dac/dac_mcp4728.h +++ b/Marlin/src/feature/dac/dac_mcp4728.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/feature/dac/stepper_dac.cpp b/Marlin/src/feature/dac/stepper_dac.cpp index b5ea77a029f8..821fcab1abfb 100644 --- a/Marlin/src/feature/dac/stepper_dac.cpp +++ b/Marlin/src/feature/dac/stepper_dac.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -103,18 +103,14 @@ void dac_current_set_percents(const uint8_t pct[XYZE]) { void dac_print_values() { if (!dac_present) return; + SERIAL_ECHO_MSG("Stepper current values in % (Amps):"); SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM("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/dac/stepper_dac.h b/Marlin/src/feature/dac/stepper_dac.h index a2e2370482e6..c63b524a76da 100644 --- a/Marlin/src/feature/dac/stepper_dac.h +++ b/Marlin/src/feature/dac/stepper_dac.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/feature/digipot/digipot.h b/Marlin/src/feature/digipot/digipot.h index d4354c748fc9..8f94d07786bc 100644 --- a/Marlin/src/feature/digipot/digipot.h +++ b/Marlin/src/feature/digipot/digipot.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/feature/digipot/digipot_mcp4018.cpp b/Marlin/src/feature/digipot/digipot_mcp4018.cpp index e59c3d52696e..917a7df99ae0 100644 --- a/Marlin/src/feature/digipot/digipot_mcp4018.cpp +++ b/Marlin/src/feature/digipot/digipot_mcp4018.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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/digipot/digipot_mcp4451.cpp b/Marlin/src/feature/digipot/digipot_mcp4451.cpp index 4609a2c2172d..bc4330405549 100644 --- a/Marlin/src/feature/digipot/digipot_mcp4451.cpp +++ b/Marlin/src/feature/digipot/digipot_mcp4451.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -35,6 +35,9 @@ #if MB(5DPRINT) #define DIGIPOT_I2C_FACTOR 117.96 #define DIGIPOT_I2C_MAX_CURRENT 1.736 +#elif MB(AZTEEG_X5_MINI) || MB(AZTEEG_X5_MINI_WIFI) + #define DIGIPOT_I2C_FACTOR 113.5 + #define DIGIPOT_I2C_MAX_CURRENT 2.0 #else #define DIGIPOT_I2C_FACTOR 106.7 #define DIGIPOT_I2C_MAX_CURRENT 2.5 @@ -50,7 +53,7 @@ static void i2c_send(const byte addr, const byte a, const byte b) { digipot_mcp4451_send_byte(a); digipot_mcp4451_send_byte(b); #else - Wire.beginTransmission(addr); + Wire.beginTransmission(I2C_ADDRESS(addr)); Wire.write(a); Wire.write(b); Wire.endTransmission(); diff --git a/Marlin/src/feature/emergency_parser.cpp b/Marlin/src/feature/emergency_parser.cpp index 7908f342db1f..6840c82556dc 100644 --- a/Marlin/src/feature/emergency_parser.cpp +++ b/Marlin/src/feature/emergency_parser.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -34,6 +34,10 @@ bool EmergencyParser::killed_by_M112, // = false EmergencyParser::enabled; +#if ENABLED(HOST_PROMPT_SUPPORT) + uint8_t EmergencyParser::M876_reason; // = 0 +#endif + // Global instance EmergencyParser emergency_parser; diff --git a/Marlin/src/feature/emergency_parser.h b/Marlin/src/feature/emergency_parser.h index 3684a3b12602..3ce5dfc7cfcc 100644 --- a/Marlin/src/feature/emergency_parser.h +++ b/Marlin/src/feature/emergency_parser.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -27,15 +27,19 @@ #define FORCE_INLINE __attribute__((always_inline)) inline +#if ENABLED(HOST_PROMPT_SUPPORT) + #include "host_actions.h" +#endif + // External references -extern volatile bool wait_for_user, wait_for_heatup; +extern bool wait_for_user, wait_for_heatup; void quickstop_stepper(); class EmergencyParser { public: - // Currently looking for: M108, M112, M410 + // Currently looking for: M108, M112, M410, M876 enum State : char { EP_RESET, EP_N, @@ -48,11 +52,22 @@ class EmergencyParser { EP_M4, EP_M41, EP_M410, + #if ENABLED(HOST_PROMPT_SUPPORT) + EP_M8, + EP_M87, + EP_M876, + EP_M876S, + EP_M876SN, + #endif EP_IGNORE // to '\n' }; static bool killed_by_M112; + #if ENABLED(HOST_PROMPT_SUPPORT) + static uint8_t M876_reason; + #endif + EmergencyParser() { enable(); } FORCE_INLINE static void enable() { enabled = true; } @@ -86,6 +101,9 @@ class EmergencyParser { case ' ': break; case '1': state = EP_M1; break; case '4': state = EP_M4; break; + #if ENABLED(HOST_PROMPT_SUPPORT) + case '8': state = EP_M8; break; + #endif default: state = EP_IGNORE; } break; @@ -114,6 +132,37 @@ class EmergencyParser { state = (c == '0') ? EP_M410 : EP_IGNORE; break; + #if ENABLED(HOST_PROMPT_SUPPORT) + case EP_M8: + state = (c == '7') ? EP_M87 : EP_IGNORE; + break; + + case EP_M87: + state = (c == '6') ? EP_M876 : EP_IGNORE; + break; + + case EP_M876: + switch (c) { + case ' ': break; + case 'S': state = EP_M876S; break; + default: state = EP_IGNORE; break; + } + break; + + case EP_M876S: + switch (c) { + case ' ': break; + case '0': case '1': case '2': + case '3': case '4': case '5': + case '6': case '7': case '8': + case '9': + state = EP_M876SN; + M876_reason = (uint8_t)(c - '0'); + break; + } + break; + #endif + case EP_IGNORE: if (c == '\n') state = EP_RESET; break; @@ -121,17 +170,13 @@ class EmergencyParser { default: if (c == '\n') { if (enabled) switch (state) { - case EP_M108: - wait_for_user = wait_for_heatup = false; - break; - case EP_M112: - killed_by_M112 = true; - break; - case EP_M410: - quickstop_stepper(); - break; - default: - break; + case EP_M108: wait_for_user = wait_for_heatup = false; break; + case EP_M112: killed_by_M112 = true; break; + case EP_M410: quickstop_stepper(); break; + #if ENABLED(HOST_PROMPT_SUPPORT) + case EP_M876SN: host_response_handler(M876_reason); break; + #endif + default: break; } state = EP_RESET; } diff --git a/Marlin/src/feature/fanmux.cpp b/Marlin/src/feature/fanmux.cpp index ad22f15030e8..bba073ebbda7 100644 --- a/Marlin/src/feature/fanmux.cpp +++ b/Marlin/src/feature/fanmux.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/feature/fanmux.h b/Marlin/src/feature/fanmux.h index 2dfc4aabf813..82bf79be24ea 100644 --- a/Marlin/src/feature/fanmux.h +++ b/Marlin/src/feature/fanmux.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/feature/filwidth.cpp b/Marlin/src/feature/filwidth.cpp index 98743713c8ad..9c4731a2ce5d 100644 --- a/Marlin/src/feature/filwidth.cpp +++ b/Marlin/src/feature/filwidth.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/feature/filwidth.h b/Marlin/src/feature/filwidth.h index a130e8cf8c63..b66a7c76892a 100644 --- a/Marlin/src/feature/filwidth.h +++ b/Marlin/src/feature/filwidth.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/feature/fwretract.cpp b/Marlin/src/feature/fwretract.cpp index 3fc37e3aa372..f5f7cefc450a 100644 --- a/Marlin/src/feature/fwretract.cpp +++ b/Marlin/src/feature/fwretract.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -37,7 +37,7 @@ FWRetract fwretract; // Single instance - this calls the constructor #include "../module/stepper.h" #if ENABLED(RETRACT_SYNC_MIXING) - #include "../feature/mixing.h" + #include "mixing.h" #endif // private: @@ -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]); @@ -142,7 +142,7 @@ void FWRetract::retract(const bool retracting set_destination_from_current(); #if ENABLED(RETRACT_SYNC_MIXING) - uint8_t old_mixing_tool = mixer.get_current_v_tool(); + const uint8_t old_mixing_tool = mixer.get_current_vtool(); mixer.T(MIXER_AUTORETRACT_TOOL); #endif @@ -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 247ea220230a..6c088acb87a3 100644 --- a/Marlin/src/feature/fwretract.h +++ b/Marlin/src/feature/fwretract.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 new file mode 100644 index 000000000000..f15462195e41 --- /dev/null +++ b/Marlin/src/feature/host_actions.cpp @@ -0,0 +1,157 @@ +/** + * 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(HOST_ACTION_COMMANDS) + +#include "host_actions.h" + +//#define DEBUG_HOST_ACTIONS + +#if ENABLED(ADVANCED_PAUSE_FEATURE) + #include "pause.h" + #include "../gcode/queue.h" +#endif + +#if HAS_FILAMENT_SENSOR + #include "runout.h" +#endif + +extern bool wait_for_user; + +void host_action(const char * const pstr, const bool eol) { + SERIAL_ECHOPGM("//action:"); + serialprintPGM(pstr); + if (eol) SERIAL_EOL(); +} + +#ifdef ACTION_ON_KILL + void host_action_kill() { host_action(PSTR(ACTION_ON_KILL)); } +#endif +#ifdef ACTION_ON_PAUSE + void host_action_pause(const bool eol/*=true*/) { host_action(PSTR(ACTION_ON_PAUSE), eol); } +#endif +#ifdef ACTION_ON_PAUSED + void host_action_paused(const bool eol/*=true*/) { host_action(PSTR(ACTION_ON_PAUSED), eol); } +#endif +#ifdef ACTION_ON_RESUME + void host_action_resume() { host_action(PSTR(ACTION_ON_RESUME)); } +#endif +#ifdef ACTION_ON_RESUMED + void host_action_resumed() { host_action(PSTR(ACTION_ON_RESUMED)); } +#endif +#ifdef ACTION_ON_CANCEL + void host_action_cancel() { host_action(PSTR(ACTION_ON_CANCEL)); } +#endif + +#if ENABLED(HOST_PROMPT_SUPPORT) + + PromptReason host_prompt_reason = PROMPT_NOT_DEFINED; + + void host_action_prompt(const char * const ptype, const bool eol=true) { + host_action(PSTR("prompt_"), false); + serialprintPGM(ptype); + if (eol) SERIAL_EOL(); + } + + void host_action_prompt_plus(const char * const ptype, const char * const pstr, const bool eol=true) { + host_action_prompt(ptype, false); + SERIAL_CHAR(' '); + serialprintPGM(pstr); + if (eol) SERIAL_EOL(); + } + void host_action_prompt_begin(const char * const pstr, const bool eol/*=true*/) { host_action_prompt_plus(PSTR("begin"), pstr, eol); } + void host_action_prompt_button(const char * const pstr) { host_action_prompt_plus(PSTR("button"), pstr); } + void host_action_prompt_end() { host_action_prompt(PSTR("end")); } + void host_action_prompt_show() { host_action_prompt(PSTR("show")); } + void host_prompt_do(const PromptReason reason, const char * const pstr, const char * const pbtn/*=NULL*/) { + host_prompt_reason = reason; + host_action_prompt_end(); + host_action_prompt_begin(pstr); + if (pbtn) host_action_prompt_button(pbtn); + host_action_prompt_show(); + } + + inline void say_m876_response(const char * const pstr) { + SERIAL_ECHOPGM("M876 Responding PROMPT_"); + serialprintPGM(pstr); + SERIAL_EOL(); + } + + void host_response_handler(const uint8_t response) { + #ifdef DEBUG_HOST_ACTIONS + SERIAL_ECHOLNPAIR("M86 Handle Reason: ", host_prompt_reason); + SERIAL_ECHOLNPAIR("M86 Handle Response: ", response); + #endif + const char *msg = PSTR("UNKNOWN STATE"); + const PromptReason hpr = host_prompt_reason; + host_prompt_reason = PROMPT_NOT_DEFINED; + switch (hpr) { + case PROMPT_FILAMENT_RUNOUT: + msg = PSTR("FILAMENT_RUNOUT"); + if (response == 0) { + 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")); + if (false + #if HAS_FILAMENT_SENSOR + || runout.filament_ran_out + #endif + ) + host_action_prompt_button(PSTR("DisableRunout")); + else { + host_prompt_reason = PROMPT_FILAMENT_RUNOUT; + host_action_prompt_button(PSTR("Continue")); + } + host_action_prompt_show(); + } + else if (response == 1) { + #if HAS_FILAMENT_SENSOR + if (runout.filament_ran_out) { + runout.enabled = false; + runout.reset(); + } + #endif + pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT; + } + break; + case PROMPT_USER_CONTINUE: + msg = PSTR("FILAMENT_RUNOUT_CONTINUE"); + wait_for_user = false; + break; + case PROMPT_PAUSE_RESUME: + msg = PSTR("LCD_PAUSE_RESUME"); + enqueue_and_echo_commands_P(PSTR("M24")); + break; + case PROMPT_INFO: + msg = PSTR("GCODE_INFO"); + break; + default: break; + } + say_m876_response(msg); + } + +#endif // HOST_PROMPT_SUPPORT + +#endif // HOST_ACTION_COMMANDS diff --git a/Marlin/src/feature/host_actions.h b/Marlin/src/feature/host_actions.h new file mode 100644 index 000000000000..e6f77cb63cbe --- /dev/null +++ b/Marlin/src/feature/host_actions.h @@ -0,0 +1,70 @@ +/** + * 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/MarlinConfig.h" + +void host_action(const char * const pstr, const bool eol=true); + +#ifdef ACTION_ON_KILL + void host_action_kill(); +#endif +#ifdef ACTION_ON_PAUSE + void host_action_pause(const bool eol=true); +#endif +#ifdef ACTION_ON_PAUSED + void host_action_paused(const bool eol=true); +#endif +#ifdef ACTION_ON_RESUME + void host_action_resume(); +#endif +#ifdef ACTION_ON_RESUMED + void host_action_resumed(); +#endif +#ifdef ACTION_ON_CANCEL + void host_action_cancel(); +#endif + +#if ENABLED(HOST_PROMPT_SUPPORT) + + enum PromptReason : uint8_t { + PROMPT_NOT_DEFINED, + PROMPT_FILAMENT_RUNOUT, + PROMPT_USER_CONTINUE, + PROMPT_FILAMENT_RUNOUT_REHEAT, + PROMPT_PAUSE_RESUME, + PROMPT_INFO + }; + + extern PromptReason host_prompt_reason; + + void host_response_handler(const uint8_t response); + void host_action_prompt_begin(const char * const pstr, const bool eol=true); + void host_action_prompt_button(const char * const pstr); + void host_action_prompt_end(); + void host_action_prompt_show(); + void host_prompt_do(const PromptReason type, const char * const pstr, const char * const pbtn=NULL); + inline void host_prompt_open(const PromptReason reason, const char * const pstr, const char * const pbtn=NULL) { + if (host_prompt_reason == PROMPT_NOT_DEFINED) host_prompt_do(reason, pstr, pbtn); + } + +#endif diff --git a/Marlin/src/feature/leds/blinkm.cpp b/Marlin/src/feature/leds/blinkm.cpp index ff5bb71a9513..f994f9026cce 100644 --- a/Marlin/src/feature/leds/blinkm.cpp +++ b/Marlin/src/feature/leds/blinkm.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -34,7 +34,7 @@ void blinkm_set_led_color(const LEDColor &color) { Wire.begin(); - Wire.beginTransmission(0x09); + Wire.beginTransmission(I2C_ADDRESS(0x09)); Wire.write('o'); //to disable ongoing script, only needs to be used once Wire.write('n'); Wire.write(color.r); diff --git a/Marlin/src/feature/leds/blinkm.h b/Marlin/src/feature/leds/blinkm.h index 8709ebda3405..6b641d5bc7ab 100644 --- a/Marlin/src/feature/leds/blinkm.h +++ b/Marlin/src/feature/leds/blinkm.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/feature/leds/leds.cpp b/Marlin/src/feature/leds/leds.cpp index 0694491f0f81..d490b86e6baa 100644 --- a/Marlin/src/feature/leds/leds.cpp +++ b/Marlin/src/feature/leds/leds.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -38,6 +38,10 @@ #include "pca9632.h" #endif +#if ENABLED(PCA9533) + #include "SailfishRGB_LED.h" +#endif + #if ENABLED(LED_COLOR_PRESETS) const LEDColor LEDLights::defaultLEDColor = MakeLEDColor( LED_USER_PRESET_RED, @@ -48,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 @@ -56,6 +60,14 @@ LEDLights leds; void LEDLights::setup() { + #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) + 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) setup_neopixel(); #endif @@ -96,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 @@ -119,7 +127,11 @@ void LEDLights::set_color(const LEDColor &incol pca9632_set_led_color(incol); #endif - #if ENABLED(LED_CONTROL_MENU) || ENABLED(PRINTER_EVENT_LEDS) + #if ENABLED(PCA9533) + RGBsetColor(incol.r, incol.g, incol.b, true); + #endif + + #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 77654d44a3bf..eafede7dc9ff 100644 --- a/Marlin/src/feature/leds/leds.h +++ b/Marlin/src/feature/leds/leds.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 @@ -120,19 +120,28 @@ typedef struct LEDColor { #else #define MakeLEDColor(R,G,B,W,I) LEDColor(R, G, B, W) #endif - #define LEDColorWhite() LEDColor(0, 0, 0, 255) #else - #define MakeLEDColor(R,G,B,W,I) LEDColor(R, G, B) - #define LEDColorWhite() LEDColor(255, 255, 255) + #define MakeLEDColor(R,G,B,W,I) LEDColor(R, G, B) +#endif + +#define LEDColorOff() LEDColor( 0, 0, 0) +#define LEDColorRed() LEDColor(255, 0, 0) +#if ENABLED(LED_COLORS_REDUCE_GREEN) + #define LEDColorOrange() LEDColor(255, 25, 0) + #define LEDColorYellow() LEDColor(255, 75, 0) +#else + #define LEDColorOrange() LEDColor(255, 80, 0) + #define LEDColorYellow() LEDColor(255, 255, 0) +#endif +#define LEDColorGreen() LEDColor( 0, 255, 0) +#define LEDColorBlue() LEDColor( 0, 0, 255) +#define LEDColorIndigo() LEDColor( 0, 255, 255) +#define LEDColorViolet() LEDColor(255, 0, 255) +#if HAS_WHITE_LED + #define LEDColorWhite() LEDColor( 0, 0, 0, 255) +#else + #define LEDColorWhite() LEDColor(255, 255, 255) #endif -#define LEDColorOff() LEDColor( 0, 0, 0) -#define LEDColorRed() LEDColor(255, 0, 0) -#define LEDColorOrange() LEDColor(255, 80, 0) -#define LEDColorYellow() LEDColor(255, 255, 0) -#define LEDColorGreen() LEDColor( 0, 255, 0) -#define LEDColorBlue() LEDColor( 0, 0, 255) -#define LEDColorIndigo() LEDColor( 0, 255, 255) -#define LEDColorViolet() LEDColor(255, 0, 255) class LEDLights { public: @@ -183,10 +192,11 @@ class LEDLights { 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 + #if ENABLED(LED_CONTROL_MENU) static void toggle(); // swap "off" with color static inline void update() { set_color(color); } diff --git a/Marlin/src/feature/leds/neopixel.cpp b/Marlin/src/feature/leds/neopixel.cpp index 729b4b190a53..816398c6fb64 100644 --- a/Marlin/src/feature/leds/neopixel.cpp +++ b/Marlin/src/feature/leds/neopixel.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/feature/leds/neopixel.h b/Marlin/src/feature/leds/neopixel.h index f761877c9a9d..d1dbedf8ce3e 100644 --- a/Marlin/src/feature/leds/neopixel.h +++ b/Marlin/src/feature/leds/neopixel.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/feature/leds/pca9632.cpp b/Marlin/src/feature/leds/pca9632.cpp index 11298f4efec8..d32fcd01c96e 100644 --- a/Marlin/src/feature/leds/pca9632.cpp +++ b/Marlin/src/feature/leds/pca9632.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -74,14 +74,14 @@ byte PCA_init = 0; static void PCA9632_WriteRegister(const byte addr, const byte regadd, const byte value) { - Wire.beginTransmission(addr); + Wire.beginTransmission(I2C_ADDRESS(addr)); Wire.write(regadd); Wire.write(value); Wire.endTransmission(); } static void PCA9632_WriteAllRegisters(const byte addr, const byte regadd, const byte value1, const byte value2, const byte value3) { - Wire.beginTransmission(addr); + Wire.beginTransmission(I2C_ADDRESS(addr)); Wire.write(PCA9632_AUTO_IND | regadd); Wire.write(value1); Wire.write(value2); @@ -91,7 +91,7 @@ static void PCA9632_WriteAllRegisters(const byte addr, const byte regadd, const #if 0 static byte PCA9632_ReadRegister(const byte addr, const byte regadd) { - Wire.beginTransmission(addr); + Wire.beginTransmission(I2C_ADDRESS(addr)); Wire.write(regadd); const byte value = Wire.read(); Wire.endTransmission(); diff --git a/Marlin/src/feature/leds/pca9632.h b/Marlin/src/feature/leds/pca9632.h index f2d66877800d..0e9a66b1faa7 100644 --- a/Marlin/src/feature/leds/pca9632.h +++ b/Marlin/src/feature/leds/pca9632.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/feature/leds/printer_event_leds.cpp b/Marlin/src/feature/leds/printer_event_leds.cpp index 3d974e7b3ebc..2e54310030a9 100644 --- a/Marlin/src/feature/leds/printer_event_leds.cpp +++ b/Marlin/src/feature/leds/printer_event_leds.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/feature/leds/printer_event_leds.h b/Marlin/src/feature/leds/printer_event_leds.h index bae891dd7097..1e1410bf6cc6 100644 --- a/Marlin/src/feature/leds/printer_event_leds.h +++ b/Marlin/src/feature/leds/printer_event_leds.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/feature/leds/tempstat.cpp b/Marlin/src/feature/leds/tempstat.cpp index 8a5a4a0b7060..30ec67542e8c 100644 --- a/Marlin/src/feature/leds/tempstat.cpp +++ b/Marlin/src/feature/leds/tempstat.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -32,26 +32,24 @@ #include "../../module/temperature.h" void handle_status_leds(void) { - static uint8_t red_led = LOW; + static int8_t old_red = -1; // Invalid value to force LED initialization static millis_t next_status_led_update_ms = 0; if (ELAPSED(millis(), next_status_led_update_ms)) { next_status_led_update_ms += 500; // Update every 0.5s float max_temp = 0.0; #if HAS_HEATED_BED - max_temp = MAX(max_temp, thermalManager.degTargetBed(), thermalManager.degBed()); + max_temp = MAX(thermalManager.degTargetBed(), thermalManager.degBed()); #endif HOTEND_LOOP() max_temp = MAX(max_temp, thermalManager.degHotend(e), thermalManager.degTargetHotend(e)); - const uint8_t new_led = (max_temp > 55.0) ? HIGH : (max_temp < 54.0) ? LOW : red_led; - if (new_led != red_led) { - red_led = new_led; + const int8_t new_red = (max_temp > 55.0) ? HIGH : (max_temp < 54.0 || old_red < 0) ? LOW : old_red; + if (new_red != old_red) { + old_red = new_red; #if PIN_EXISTS(STAT_LED_RED) - WRITE(STAT_LED_RED_PIN, new_led); - #if PIN_EXISTS(STAT_LED_BLUE) - WRITE(STAT_LED_BLUE_PIN, !new_led); - #endif - #else - WRITE(STAT_LED_BLUE_PIN, new_led); + WRITE(STAT_LED_RED_PIN, new_red); + #endif + #if PIN_EXISTS(STAT_LED_BLUE) + WRITE(STAT_LED_BLUE_PIN, !new_red); #endif } } diff --git a/Marlin/src/feature/leds/tempstat.h b/Marlin/src/feature/leds/tempstat.h index ac50d93f2933..391bb48452e3 100644 --- a/Marlin/src/feature/leds/tempstat.h +++ b/Marlin/src/feature/leds/tempstat.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/feature/mixing.cpp b/Marlin/src/feature/mixing.cpp index 0713dca56f77..98b26e29ce61 100644 --- a/Marlin/src/feature/mixing.cpp +++ b/Marlin/src/feature/mixing.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -25,69 +25,77 @@ #if ENABLED(MIXING_EXTRUDER) //#define MIXER_NORMALIZER_DEBUG -#ifdef MIXER_NORMALIZER_DEBUG - #include "../core/serial.h" -#endif #include "mixing.h" Mixer mixer; +#ifdef MIXER_NORMALIZER_DEBUG + #include "../core/serial.h" +#endif + // Used up to Planner level -uint_fast8_t Mixer::selected_v_tool = 0; -float Mixer::M163_collector[MIXING_STEPPERS]; // mix proportion. 0.0 = off, otherwise <= COLOR_A_MASK. -mixer_color_t Mixer::color[NR_MIXING_VIRTUAL_TOOLS][MIXING_STEPPERS]; +uint_fast8_t Mixer::selected_vtool = 0; +float Mixer::collector[MIXING_STEPPERS]; // mix proportion. 0.0 = off, otherwise <= COLOR_A_MASK. +mixer_comp_t Mixer::color[NR_MIXING_VIRTUAL_TOOLS][MIXING_STEPPERS]; // Used in Stepper int_fast8_t Mixer::runner = 0; -mixer_color_t Mixer::s_color[MIXING_STEPPERS]; +mixer_comp_t Mixer::s_color[MIXING_STEPPERS]; mixer_accu_t Mixer::accu[MIXING_STEPPERS] = { 0 }; +#if DUAL_MIXING_EXTRUDER || ENABLED(GRADIENT_MIX) + mixer_perc_t Mixer::mix[MIXING_STEPPERS]; +#endif + void Mixer::normalize(const uint8_t tool_index) { float cmax = 0; #ifdef MIXER_NORMALIZER_DEBUG float csum = 0; #endif MIXER_STEPPER_LOOP(i) { - cmax = max(cmax, M163_collector[i]); + const float v = collector[i]; + NOLESS(cmax, v); #ifdef MIXER_NORMALIZER_DEBUG - csum += M163_collector[i]; + csum += v; #endif } #ifdef MIXER_NORMALIZER_DEBUG - SERIAL_ECHOPGM("Mixer: Relation before normalizing: [ "); + SERIAL_ECHOPGM("Mixer: Old relation : [ "); MIXER_STEPPER_LOOP(i) { - SERIAL_ECHO_F(M163_collector[i] / csum, 3); + SERIAL_ECHO_F(collector[i] / csum, 3); SERIAL_CHAR(' '); } - SERIAL_ECHOPGM("]\n"); + SERIAL_ECHOLNPGM("]"); #endif // Scale all values so their maximum is COLOR_A_MASK - const float inverse_max = RECIPROCAL(cmax); - MIXER_STEPPER_LOOP(i) - color[tool_index][i] = M163_collector[i] * COLOR_A_MASK * inverse_max; + const float scale = float(COLOR_A_MASK) / cmax; + MIXER_STEPPER_LOOP(i) color[tool_index][i] = collector[i] * scale; #ifdef MIXER_NORMALIZER_DEBUG csum = 0; - SERIAL_ECHOPGM("Mixer: Normalizing to : [ "); + SERIAL_ECHOPGM("Mixer: Normalize to : [ "); MIXER_STEPPER_LOOP(i) { SERIAL_ECHO(uint16_t(color[tool_index][i])); SERIAL_CHAR(' '); csum += color[tool_index][i]; } SERIAL_ECHOLNPGM("]"); - SERIAL_ECHOPGM("Mixer: Relation after normalizing: [ "); + SERIAL_ECHOPGM("Mixer: New relation : [ "); MIXER_STEPPER_LOOP(i) { SERIAL_ECHO_F(uint16_t(color[tool_index][i]) / csum, 3); SERIAL_CHAR(' '); } SERIAL_ECHOLNPGM("]"); #endif + + #if ENABLED(GRADIENT_MIX) + refresh_gradient(); + #endif } -// called at boot -void Mixer::init( void ) { +void Mixer::reset_vtools() { // Virtual Tools 0, 1, 2, 3 = Filament 1, 2, 3, 4, etc. // Every virtual tool gets a pure filament for (uint8_t t = 0; t < MIXING_VIRTUAL_TOOLS && t < MIXING_STEPPERS; t++) @@ -95,11 +103,17 @@ void Mixer::init( void ) { color[t][i] = (t == i) ? COLOR_A_MASK : 0; // Remaining virtual tools are 100% filament 1 - #if MIXING_STEPPERS < MIXING_VIRTUAL_TOOLS + #if MIXING_VIRTUAL_TOOLS > MIXING_STEPPERS for (uint8_t t = MIXING_STEPPERS; t < MIXING_VIRTUAL_TOOLS; t++) MIXER_STEPPER_LOOP(i) color[t][i] = (i == 0) ? COLOR_A_MASK : 0; #endif +} + +// called at boot +void Mixer::init() { + + reset_vtools(); #if ENABLED(RETRACT_SYNC_MIXING) // AUTORETRACT_TOOL gets the same amount of all filaments @@ -107,7 +121,72 @@ void Mixer::init( void ) { color[MIXER_AUTORETRACT_TOOL][i] = COLOR_A_MASK; #endif - ZERO(M163_collector); + ZERO(collector); + + #if DUAL_MIXING_EXTRUDER || ENABLED(GRADIENT_MIX) + update_mix_from_vtool(); + #endif + + #if ENABLED(GRADIENT_MIX) + update_gradient_for_planner_z(); + #endif } +void Mixer::refresh_collector(const float proportion/*=1.0*/, const uint8_t t/*=selected_vtool*/) { + float csum = 0, cmax = 0; + MIXER_STEPPER_LOOP(i) { + const float v = color[t][i]; + cmax = MAX(cmax, v); + csum += v; + } + //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), "][", int(i), "] = ", int(color[t][i]), " (", collector[i], ") "); + } + //SERIAL_EOL(); +} + +#if ENABLED(GRADIENT_MIX) + + #include "../module/motion.h" + #include "../module/planner.h" + + gradient_t Mixer::gradient = { + false, // enabled + {0}, // color (array) + 0, 0, // start_z, end_z + 0, 1, // start_vtool, end_vtool + {0}, {0} // start_mix[], end_mix[] + #if ENABLED(GRADIENT_VTOOL) + , -1 // vtool_index + #endif + }; + + float Mixer::prev_z; // = 0 + + void Mixer::update_gradient_for_z(const float z) { + if (z == prev_z) return; + prev_z = z; + + const float slice = gradient.end_z - gradient.start_z; + + float pct = (z - gradient.start_z) / slice; + NOLESS(pct, 0.0f); NOMORE(pct, 1.0f); + + MIXER_STEPPER_LOOP(i) { + const mixer_perc_t sm = gradient.start_mix[i]; + mix[i] = sm + (gradient.end_mix[i] - sm) * pct; + } + + copy_mix_to_color(gradient.color); + } + + void Mixer::update_gradient_for_planner_z() { + update_gradient_for_z(planner.get_axis_position_mm(Z_AXIS)); + } + +#endif // GRADIENT_MIX + #endif // MIXING_EXTRUDER diff --git a/Marlin/src/feature/mixing.h b/Marlin/src/feature/mixing.h index 0c282377f48f..bb069c97d7c2 100644 --- a/Marlin/src/feature/mixing.h +++ b/Marlin/src/feature/mixing.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -23,65 +23,216 @@ #include "../inc/MarlinConfig.h" -#ifdef __AVR__ +//#define MIXER_NORMALIZER_DEBUG + +#if !defined(__AVR__) // || DUAL_MIXING_EXTRUDER + // Use 16-bit (or fastest) data for the integer mix factors + typedef uint_fast16_t mixer_comp_t; + typedef uint_fast16_t mixer_accu_t; + #define COLOR_A_MASK 0x8000 + #define COLOR_MASK 0x7FFF +#else + // Use 8-bit data for the integer mix factors + // Exactness is sacrificed for speed #define MIXER_ACCU_SIGNED - typedef uint8_t mixer_color_t; + typedef uint8_t mixer_comp_t; typedef int8_t mixer_accu_t; #define COLOR_A_MASK 0x80 #define COLOR_MASK 0x7F -#else - typedef uint_fast16_t mixer_color_t; - typedef uint_fast16_t mixer_accu_t; - #define COLOR_A_MASK 0x8000 - #define COLOR_MASK 0x7FFF #endif +typedef int8_t mixer_perc_t; + #ifndef MIXING_VIRTUAL_TOOLS #define MIXING_VIRTUAL_TOOLS 1 #endif -#ifdef RETRACT_SYNC_MIXING - #define NR_MIXING_VIRTUAL_TOOLS (MIXING_VIRTUAL_TOOLS + 1) - #define MIXER_AUTORETRACT_TOOL MIXING_VIRTUAL_TOOLS - #if NR_MIXING_VIRTUAL_TOOLS > 254 - #error "MIXING_VIRTUAL_TOOLS must be <= 254!" +enum MixTool { + FIRST_USER_VIRTUAL_TOOL = 0, + LAST_USER_VIRTUAL_TOOL = MIXING_VIRTUAL_TOOLS - 1, + NR_USER_VIRTUAL_TOOLS, + #ifdef RETRACT_SYNC_MIXING + MIXER_AUTORETRACT_TOOL = NR_USER_VIRTUAL_TOOLS, + NR_MIXING_VIRTUAL_TOOLS + #else + NR_MIXING_VIRTUAL_TOOLS = NR_USER_VIRTUAL_TOOLS #endif +}; + +#ifdef RETRACT_SYNC_MIXING + static_assert(NR_MIXING_VIRTUAL_TOOLS <= 254, "MIXING_VIRTUAL_TOOLS must be <= 254!"); #else - #define NR_MIXING_VIRTUAL_TOOLS (MIXING_VIRTUAL_TOOLS) - #if NR_MIXING_VIRTUAL_TOOLS > 255 - #error "MIXING_VIRTUAL_TOOLS must be <= 255!" - #endif + static_assert(NR_MIXING_VIRTUAL_TOOLS <= 255, "MIXING_VIRTUAL_TOOLS must be <= 255!"); #endif #define MIXER_STEPPER_LOOP(VAR) \ for (uint_fast8_t VAR = 0; VAR < MIXING_STEPPERS; VAR++) -#define MIXER_BLOCK_DEFINITION mixer_color_t b_color[MIXING_STEPPERS] -#define MIXER_POPULATE_BLOCK() mixer.populate_block(block->b_color) -#define MIXER_STEPPER_SETUP() mixer.stepper_setup(current_block->b_color) +#define MIXER_BLOCK_FIELD mixer_comp_t b_color[MIXING_STEPPERS] +#define MIXER_POPULATE_BLOCK() mixer.populate_block(block->b_color) +#define MIXER_STEPPER_SETUP() mixer.stepper_setup(current_block->b_color) + +#if ENABLED(GRADIENT_MIX) + + typedef struct { + bool enabled; // This gradient is enabled + mixer_comp_t color[MIXING_STEPPERS]; // The current gradient color + float start_z, end_z; // Region for gradient + int8_t start_vtool, end_vtool; // Start and end virtual tools + mixer_perc_t start_mix[MIXING_STEPPERS], // Start and end mixes from those tools + end_mix[MIXING_STEPPERS]; + #if ENABLED(GRADIENT_VTOOL) + int8_t vtool_index; // Use this virtual tool number as index + #endif + } gradient_t; + +#endif +/** + * @brief Mixer class + * @details Contains data and behaviors for a Mixing Extruder + */ class Mixer { public: - static void init(void); // Populate colors at boot time + static float collector[MIXING_STEPPERS]; // M163 components, also editable from LCD + + static void init(); // Populate colors at boot time + + static void reset_vtools(); + static void refresh_collector(const float proportion=1.0, const uint8_t t=selected_vtool); // Used up to Planner level + FORCE_INLINE static void set_collector(const uint8_t c, const float f) { collector[c] = MAX(f, 0.0f); } + static void normalize(const uint8_t tool_index); - FORCE_INLINE static uint8_t get_current_v_tool(void) { return selected_v_tool; } - FORCE_INLINE static void T(const uint_fast8_t c) { selected_v_tool = c; } - FORCE_INLINE static void set_M163_collector(const uint8_t c, const float f) { M163_collector[c] = f; } + FORCE_INLINE static void normalize() { normalize(selected_vtool); } + + FORCE_INLINE static uint8_t get_current_vtool() { return selected_vtool; } + + FORCE_INLINE static void T(const uint_fast8_t c) { + selected_vtool = c; + #if ENABLED(GRADIENT_VTOOL) + refresh_gradient(); + #endif + #if DUAL_MIXING_EXTRUDER + update_mix_from_vtool(); + #endif + } // Used when dealing with blocks - FORCE_INLINE static void populate_block(mixer_color_t b_color[]) { - uint_fast8_t j = get_current_v_tool(); - MIXER_STEPPER_LOOP(i) b_color[i] = color[j][i]; + FORCE_INLINE static void populate_block(mixer_comp_t b_color[MIXING_STEPPERS]) { + #if ENABLED(GRADIENT_MIX) + if (gradient.enabled) { + MIXER_STEPPER_LOOP(i) b_color[i] = gradient.color[i]; + return; + } + #endif + MIXER_STEPPER_LOOP(i) b_color[i] = color[selected_vtool][i]; + } + + FORCE_INLINE static void stepper_setup(mixer_comp_t b_color[MIXING_STEPPERS]) { + MIXER_STEPPER_LOOP(i) s_color[i] = b_color[i]; } - FORCE_INLINE static void stepper_setup(mixer_color_t b_color[]) { MIXER_STEPPER_LOOP(i) s_color[i] = b_color[i]; } + + #if DUAL_MIXING_EXTRUDER || ENABLED(GRADIENT_MIX) + + static mixer_perc_t mix[MIXING_STEPPERS]; // Scratch array for the Mix in proportion to 100 + + static inline void copy_mix_to_color(mixer_comp_t (&tcolor)[MIXING_STEPPERS]) { + // Scale each component to the largest one in terms of COLOR_A_MASK + // So the largest component will be COLOR_A_MASK and the other will be in proportion to it + const float scale = (COLOR_A_MASK) * RECIPROCAL(float(MAX(mix[0], mix[1]))); + + // Scale all values so their maximum is COLOR_A_MASK + MIXER_STEPPER_LOOP(i) tcolor[i] = mix[i] * scale; + + #ifdef MIXER_NORMALIZER_DEBUG + SERIAL_ECHOLNPAIR("Mix [", int(mix[0]), ", ", int(mix[1]), "] to Color [", int(tcolor[0]), ", ", int(tcolor[1]), "]"); + #endif + } + + static inline void update_mix_from_vtool(const uint8_t j=selected_vtool) { + float ctot = 0; + MIXER_STEPPER_LOOP(i) ctot += color[j][i]; + //MIXER_STEPPER_LOOP(i) mix[i] = 100.0f * color[j][i] / ctot; + mix[0] = mixer_perc_t(100.0f * color[j][0] / ctot); + mix[1] = 100 - mix[0]; + #ifdef MIXER_NORMALIZER_DEBUG + SERIAL_ECHOLNPAIR("V-tool ", int(j), " [", int(color[j][0]), ", ", int(color[j][1]), "] to Mix [", int(mix[0]), ", ", int(mix[1]), "]"); + #endif + } + + #endif // DUAL_MIXING_EXTRUDER || GRADIENT_MIX + + #if DUAL_MIXING_EXTRUDER + + // Update the virtual tool from an edited mix + static inline void update_vtool_from_mix() { + copy_mix_to_color(color[selected_vtool]); + #if ENABLED(GRADIENT_MIX) + refresh_gradient(); + #endif + // MIXER_STEPPER_LOOP(i) collector[i] = mix[i]; + // normalize(); + } + + #endif // DUAL_MIXING_EXTRUDER + + #if ENABLED(GRADIENT_MIX) + + static gradient_t gradient; + static float prev_z; + + // Update the current mix from the gradient for a given Z + static void update_gradient_for_z(const float z); + static void update_gradient_for_planner_z(); + static inline void gradient_control(const float z) { + if (gradient.enabled) { + if (z >= gradient.end_z) + T(gradient.end_vtool); + else + update_gradient_for_z(z); + } + } + + static inline void update_mix_from_gradient() { + float ctot = 0; + MIXER_STEPPER_LOOP(i) ctot += gradient.color[i]; + mix[0] = (mixer_perc_t)CEIL(100.0f * gradient.color[0] / ctot); + mix[1] = 100 - mix[0]; + #ifdef MIXER_NORMALIZER_DEBUG + 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 = (gradient.vtool_index == -1 || selected_vtool == (uint8_t)gradient.vtool_index); + #else + constexpr bool is_grd = true; + #endif + gradient.enabled = is_grd && gradient.start_vtool != gradient.end_vtool && gradient.start_z < gradient.end_z; + if (gradient.enabled) { + mixer_perc_t mix_bak[MIXING_STEPPERS]; + COPY(mix_bak, mix); + update_mix_from_vtool(gradient.start_vtool); + COPY(gradient.start_mix, mix); + update_mix_from_vtool(gradient.end_vtool); + COPY(gradient.end_mix, mix); + update_gradient_for_planner_z(); + COPY(mix, mix_bak); + prev_z = -1; + } + } + + #endif // GRADIENT_MIX // Used in Stepper - FORCE_INLINE static uint8_t get_stepper(void) { return runner; } - FORCE_INLINE static uint8_t get_next_stepper(void) { - do { + FORCE_INLINE static uint8_t get_stepper() { return runner; } + FORCE_INLINE static uint8_t get_next_stepper() { + for (;;) { if (--runner < 0) runner = MIXING_STEPPERS - 1; accu[runner] += s_color[runner]; if ( @@ -94,20 +245,19 @@ class Mixer { accu[runner] &= COLOR_MASK; return runner; } - } while( true ); + } } private: // Used up to Planner level - static uint_fast8_t selected_v_tool; - static float M163_collector[MIXING_STEPPERS]; - static mixer_color_t color[NR_MIXING_VIRTUAL_TOOLS][MIXING_STEPPERS]; + static uint_fast8_t selected_vtool; + static mixer_comp_t color[NR_MIXING_VIRTUAL_TOOLS][MIXING_STEPPERS]; // Used in Stepper - static int_fast8_t runner; - static mixer_color_t s_color[MIXING_STEPPERS]; - static mixer_accu_t accu[MIXING_STEPPERS]; + static int_fast8_t runner; + static mixer_comp_t s_color[MIXING_STEPPERS]; + static mixer_accu_t accu[MIXING_STEPPERS]; }; extern Mixer mixer; diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index 0736bfebd8d8..75705e159300 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -38,17 +38,18 @@ #include "../module/temperature.h" #if ENABLED(FWRETRACT) - #include "../feature/fwretract.h" + #include "fwretract.h" #endif -#if ENABLED(FILAMENT_RUNOUT_SENSOR) - #include "../feature/runout.h" +#if HAS_FILAMENT_SENSOR + #include "runout.h" #endif -#if HAS_LCD_MENU - #include "../lcd/ultralcd.h" +#if ENABLED(HOST_ACTION_COMMANDS) + #include "host_actions.h" #endif +#include "../lcd/ultralcd.h" #include "../libs/buzzer.h" #include "../libs/nozzle.h" #include "pause.h" @@ -57,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]; @@ -67,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; @@ -92,18 +96,17 @@ 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)) { - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM(MSG_ERR_HOTEND_TOO_COLD); + SERIAL_ECHO_MSG(MSG_ERR_HOTEND_TOO_COLD); return false; } #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 @@ -111,9 +114,12 @@ static bool ensure_safe_temperature(const AdvancedPauseMode mode=ADVANCED_PAUSE_ return thermalManager.wait_for_hotend(active_extruder); } -void do_pause_e_move(const float &length, const float &fr) { +void do_pause_e_move(const float &length, const float &fr_mm_s) { + #if HAS_FILAMENT_SENSOR + runout.reset(); + #endif current_position[E_AXIS] += length / planner.e_factor[active_extruder]; - planner.buffer_line(current_position, fr, active_extruder); + planner.buffer_line(current_position, fr_mm_s, active_extruder); planner.synchronize(); } @@ -131,22 +137,25 @@ void do_pause_e_move(const float &length, const float &fr) { */ 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 + UNUSED(show_lcd); + #endif + 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_START(); - SERIAL_ECHOLNPGM(MSG_FILAMENT_CHANGE_INSERT); + SERIAL_ECHO_MSG(MSG_FILAMENT_CHANGE_INSERT); #if HAS_BUZZER filament_change_beep(max_beep_count, true); @@ -156,6 +165,20 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l KEEPALIVE_STATE(PAUSED_FOR_USER); wait_for_user = true; // LCD click or M108 will clear this + #if ENABLED(HOST_PROMPT_SUPPORT) + const char tool = '0' + #if NUM_RUNOUT_SENSORS > 1 + + active_extruder + #endif + ; + host_prompt_reason = PROMPT_USER_CONTINUE; + host_action_prompt_end(); + host_action_prompt_begin(PSTR("Load Filament T"), false); + SERIAL_CHAR(tool); + SERIAL_EOL(); + host_action_prompt_button(PSTR("Continue")); + host_action_prompt_show(); + #endif while (wait_for_user) { #if HAS_BUZZER filament_change_beep(max_beep_count); @@ -166,9 +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); - #else - UNUSED(show_lcd); + if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_LOAD, mode); #endif #if ENABLED(DUAL_X_CARRIAGE) @@ -204,10 +225,13 @@ 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; + #if ENABLED(HOST_PROMPT_SUPPORT) + host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Continuous Purge Running..."), PSTR("Continue")); + #endif for (float purge_count = purge_length; purge_count > 0 && wait_for_user; --purge_count) do_pause_e_move(1, ADVANCED_PAUSE_PURGE_FEEDRATE); wait_for_user = false; @@ -218,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 @@ -226,22 +250,38 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l } // Show "Purge More" / "Resume" menu and wait for reply + #if ENABLED(HOST_PROMPT_SUPPORT) + host_prompt_reason = PROMPT_FILAMENT_RUNOUT; + host_action_prompt_end(); // Close current prompt + host_action_prompt_begin(PSTR("Paused")); + host_action_prompt_button(PSTR("PurgeMore")); + if (false + #if HAS_FILAMENT_SENSOR + || runout.filament_ran_out + #endif + ) + host_action_prompt_button(PSTR("DisableRunout")); + else { + host_prompt_reason = PROMPT_FILAMENT_RUNOUT; + host_action_prompt_button(PSTR("Continue")); + } + host_action_prompt_show(); + #endif + #if HAS_LCD_MENU if (show_lcd) { KEEPALIVE_STATE(PAUSED_FOR_USER); wait_for_user = false; - lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_OPTION); - 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 // Keep looping if "Purge More" was selected - } while ( + } while (false #if HAS_LCD_MENU - show_lcd && advanced_pause_menu_response == ADVANCED_PAUSE_RESPONSE_EXTRUDE_MORE - #else - 0 + || (show_lcd && pause_menu_response == PAUSE_RESPONSE_EXTRUDE_MORE) #endif ); @@ -261,20 +301,22 @@ 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); + #endif + 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); - #else - UNUSED(show_lcd); + if (show_lcd) lcd_pause_show_message(PAUSE_MESSAGE_UNLOAD, mode); #endif // Retract filament @@ -299,7 +341,7 @@ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/, #endif // Disable extruders steppers for manual filament changing (only on boards that have separate ENABLE_PINS) - #if (E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN) || AXIS_DRIVER_TYPE(E0, TMC2660) || AXIS_DRIVER_TYPE(E1, TMC2660) || AXIS_DRIVER_TYPE(E2, TMC2660) || AXIS_DRIVER_TYPE(E3, TMC2660) || AXIS_DRIVER_TYPE(E4, TMC2660) || AXIS_DRIVER_TYPE(E5, TMC2660) + #if (E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN) || AXIS_DRIVER_TYPE_E0(TMC2660) || AXIS_DRIVER_TYPE_E1(TMC2660) || AXIS_DRIVER_TYPE_E2(TMC2660) || AXIS_DRIVER_TYPE_E3(TMC2660) || AXIS_DRIVER_TYPE_E4(TMC2660) || AXIS_DRIVER_TYPE_E5(TMC2660) disable_e_stepper(active_extruder); safe_delay(100); #endif @@ -326,25 +368,29 @@ uint8_t did_pause_print = 0; bool pause_print(const float &retract, const point_t &park_point, const float &unload_length/*=0*/, const bool show_lcd/*=false*/ DXC_ARGS) { - if (did_pause_print) return false; // already paused - - #ifdef ACTION_ON_PAUSE - SERIAL_ECHOLNPGM("//action:" ACTION_ON_PAUSE); + #if !HAS_LCD_MENU + UNUSED(show_lcd); #endif - #if HAS_LCD_MENU - if (show_lcd) lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INIT, ADVANCED_PAUSE_MODE_PAUSE_PRINT); - #else - UNUSED(show_lcd); + if (did_pause_print) return false; // already paused + + #if ENABLED(HOST_ACTION_COMMANDS) + #ifdef ACTION_ON_PAUSED + host_action_paused(); + #elif defined(ACTION_ON_PAUSE) + host_action_pause(); + #endif + #if ENABLED(HOST_PROMPT_SUPPORT) + host_prompt_open(PROMPT_INFO, PSTR("Pause")); + #endif #endif if (!DEBUGGING(DRYRUN) && unload_length && thermalManager.targetTooColdToExtrude(active_extruder)) { - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM(MSG_ERR_HOTEND_TOO_COLD); + SERIAL_ECHO_MSG(MSG_ERR_HOTEND_TOO_COLD); #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 @@ -421,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")); @@ -439,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; @@ -452,6 +497,9 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep // Wait for filament insert by user and press button KEEPALIVE_STATE(PAUSED_FOR_USER); wait_for_user = true; // LCD click or M108 will clear this + #if ENABLED(HOST_PROMPT_SUPPORT) + host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Nozzle Parked"), PSTR("Continue")); + #endif while (wait_for_user) { #if HAS_BUZZER filament_change_beep(max_beep_count); @@ -459,20 +507,27 @@ 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)); + + #if ENABLED(HOST_PROMPT_SUPPORT) + host_prompt_do(PROMPT_USER_CONTINUE, PSTR("HeaterTimeout"), PSTR("Reheat")); #endif - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM(_PMSG(MSG_FILAMENT_CHANGE_HEAT)); // Wait for LCD click or M108 while (wait_for_user) idle(true); + #if ENABLED(HOST_PROMPT_SUPPORT) + host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Reheating")); + #endif + // Re-enable the heaters if they timed out HOTEND_LOOP() thermalManager.reset_heater_idle_timer(e); @@ -485,9 +540,10 @@ 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 wait_for_user = true; nozzle_timed_out = false; @@ -526,27 +582,28 @@ 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_ECHOPGM("start of resume_print()\n"); - 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_ECHOPGM("\n\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; // 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 @@ -565,24 +622,30 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le // Move Z_AXIS to saved position do_blocking_move_to_z(resume_position[Z_AXIS], NOZZLE_PARK_Z_FEEDRATE); + #if ADVANCED_PAUSE_RESUME_PRIME != 0 + do_pause_e_move(ADVANCED_PAUSE_RESUME_PRIME, ADVANCED_PAUSE_PURGE_FEEDRATE); + #endif + // Now all extrusion positions are resumed and ready to be confirmed // Set extruder to saved position planner.set_e_position_mm((destination[E_AXIS] = current_position[E_AXIS] = resume_position[E_AXIS])); - #if ENABLED(FILAMENT_RUNOUT_SENSOR) - runout.reset(); - #endif - #if HAS_LCD_MENU - lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS); + lcd_pause_show_message(PAUSE_MESSAGE_STATUS); #endif - #ifdef ACTION_ON_RESUME - SERIAL_ECHOLNPGM("//action:" ACTION_ON_RESUME); + #ifdef ACTION_ON_RESUMED + host_action_resumed(); + #elif defined(ACTION_ON_RESUME) + host_action_resume(); #endif --did_pause_print; + #if ENABLED(HOST_PROMPT_SUPPORT) + host_prompt_open(PROMPT_INFO, PSTR("Resume")); + #endif + #if ENABLED(SDSUPPORT) if (did_pause_print) { card.startFileprint(); @@ -590,9 +653,10 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le } #endif - #if ENABLED(ULTRA_LCD) - ui.reset_status(); - #endif + // Resume the print job timer if it was running + if (print_job_timer.isPaused()) print_job_timer.start(); + + ui.reset_status(); } #endif // ADVANCED_PAUSE_FEATURE diff --git a/Marlin/src/feature/pause.h b/Marlin/src/feature/pause.h index 87cfe05f7ccd..8a0653b2bde1 100644 --- a/Marlin/src/feature/pause.h +++ b/Marlin/src/feature/pause.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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]; @@ -79,7 +81,7 @@ extern uint8_t did_pause_print; #define DXC_PASS #endif -void do_pause_e_move(const float &length, const float &fr); +void do_pause_e_move(const float &length, const float &fr_mm_s); bool pause_print(const float &retract, const point_t &park_point, const float &unload_length=0, const bool show_lcd=false DXC_PARAMS); @@ -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 +#endif // ADVANCED_PAUSE_FEATURE diff --git a/Marlin/src/feature/power.cpp b/Marlin/src/feature/power.cpp index 24f02041b275..eed52634f1b4 100644 --- a/Marlin/src/feature/power.cpp +++ b/Marlin/src/feature/power.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -39,21 +39,21 @@ millis_t Power::lastPowerOn; bool Power::is_power_needed() { #if ENABLED(AUTO_POWER_FANS) - for (uint8_t i = 0; i < FAN_COUNT; i++) if (fan_speed[i]) return true; + FANS_LOOP(i) if (thermalManager.fan_speed[i]) return true; #endif #if ENABLED(AUTO_POWER_E_FANS) 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 @@ -64,22 +64,24 @@ bool Power::is_power_needed() { #if HAS_Z2_ENABLE || Z2_ENABLE_READ == Z_ENABLE_ON #endif - || E0_ENABLE_READ == E_ENABLE_ON - #if E_STEPPERS > 1 - || E1_ENABLE_READ == E_ENABLE_ON - #if E_STEPPERS > 2 - || E2_ENABLE_READ == E_ENABLE_ON - #if E_STEPPERS > 3 - || E3_ENABLE_READ == E_ENABLE_ON - #if E_STEPPERS > 4 - || E4_ENABLE_READ == E_ENABLE_ON - #if E_STEPPERS > 5 - || E5_ENABLE_READ == E_ENABLE_ON - #endif - #endif - #endif - #endif - #endif + #if E_STEPPERS + || E0_ENABLE_READ == E_ENABLE_ON + #if E_STEPPERS > 1 + || E1_ENABLE_READ == E_ENABLE_ON + #if E_STEPPERS > 2 + || E2_ENABLE_READ == E_ENABLE_ON + #if E_STEPPERS > 3 + || E3_ENABLE_READ == E_ENABLE_ON + #if E_STEPPERS > 4 + || E4_ENABLE_READ == E_ENABLE_ON + #if E_STEPPERS > 5 + || E5_ENABLE_READ == E_ENABLE_ON + #endif // E_STEPPERS > 5 + #endif // E_STEPPERS > 4 + #endif // E_STEPPERS > 3 + #endif // E_STEPPERS > 2 + #endif // E_STEPPERS > 1 + #endif // E_STEPPERS ) return true; HOTEND_LOOP() if (thermalManager.degTargetHotend(e) > 0) return true; diff --git a/Marlin/src/feature/power.h b/Marlin/src/feature/power.h index 101ccb4a5298..5f61bb3b7bb6 100644 --- a/Marlin/src/feature/power.h +++ b/Marlin/src/feature/power.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/feature/power_loss_recovery.cpp b/Marlin/src/feature/power_loss_recovery.cpp index d81911c39f91..0b9dba43fdd5 100644 --- a/Marlin/src/feature/power_loss_recovery.cpp +++ b/Marlin/src/feature/power_loss_recovery.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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; /** @@ -84,8 +87,8 @@ void PrintJobRecovery::changed() { */ void PrintJobRecovery::check() { if (enabled) { - if (!card.flag.cardOK) card.initsd(); - if (card.flag.cardOK) { + if (!card.isDetected()) card.initsd(); + if (card.isDetected()) { load(); if (!valid()) return purge(); enqueue_and_echo_commands_P(PSTR("M1000 S")); @@ -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 ) { @@ -149,20 +151,26 @@ void PrintJobRecovery::save(const bool force/*=false*/, const bool save_queue/*= // Machine state COPY(info.current_position, current_position); + #if HAS_HOME_OFFSET + COPY(info.home_offset, home_offset); + #endif + #if HAS_POSITION_SHIFT + COPY(info.position_shift, position_shift); + #endif info.feedrate = uint16_t(feedrate_mm_s * 60.0f); #if HOTENDS > 1 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 - COPY(info.fan_speed, fan_speed); + COPY(info.fan_speed, thermalManager.fan_speed); #endif #if HAS_LEVELING @@ -176,11 +184,19 @@ void PrintJobRecovery::save(const bool force/*=false*/, const bool save_queue/*= ); #endif + #if ENABLED(GRADIENT_MIX) + memcpy(&info.gradient, &mixer.gradient, sizeof(info.gradient)); + #endif + #if ENABLED(FWRETRACT) COPY(info.retract, fwretract.current_retract); 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; @@ -207,18 +223,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."); } /** @@ -233,20 +245,30 @@ void PrintJobRecovery::resume() { gcode.process_subcommands_now_P(PSTR("M420 S0 Z0")); #endif - // Set Z to 0, raise Z by 2mm, and Home (XY only for Cartesian) with no raise - // (Only do simulated homing in Marlin Dev Mode.) - gcode.process_subcommands_now_P(PSTR("G92.0 Z0|G1 Z" STRINGIFY(RECOVERY_ZRAISE) "|G28 R0" - #if ENABLED(MARLIN_DEV_MODE) - " S" - #elif !IS_KINEMATIC - " X Y" + // Reset E, raise Z, home XY... + gcode.process_subcommands_now_P(PSTR("G92.9 E0" + #if Z_HOME_DIR > 0 + // If Z homing goes to max, reset E and home all + "\nG28R0" + #if ENABLED(MARLIN_DEV_MODE) + "S" + #endif + #else + // Set Z to 0, raise Z by RECOVERY_ZRAISE, and Home (XY only for Cartesian) + // with no raise. (Only do simulated homing in Marlin Dev Mode.) + "Z0\nG1Z" STRINGIFY(RECOVERY_ZRAISE) "\nG28R0" + #if ENABLED(MARLIN_DEV_MODE) + "S" + #elif !IS_KINEMATIC + "XY" + #endif #endif )); // Pretend that all axes are homed axis_homed = axis_known_position = xyz_bits; - char cmd[40], str_1[16], str_2[16]; + char cmd[50], str_1[16], str_2[16]; // Select the previously active tool (with no_move) #if EXTRUDERS > 1 @@ -277,7 +299,7 @@ void PrintJobRecovery::resume() { } // Restore print cooling fan speeds - for (uint8_t i = 0; i < FAN_COUNT; i++) { + FANS_LOOP(i) { uint8_t f = info.fan_speed[i]; if (f) { sprintf_P(cmd, PSTR("M106 P%i S%i"), i, f); @@ -305,16 +327,20 @@ void PrintJobRecovery::resume() { } #endif - // Restore Z (plus raise) and E positions with G92.0 - dtostrf(info.current_position[Z_AXIS] + RECOVERY_ZRAISE, 1, 3, str_1); - dtostrf(info.current_position[E_AXIS] - #if ENABLED(SAVE_EACH_CMD_MODE) - - 5 // Extra extrusion on restart - #endif - , 1, 3, str_2 - ); - sprintf_P(cmd, PSTR("G92.0 Z%s E%s"), str_1, str_2); - gcode.process_subcommands_now(cmd); + #if ENABLED(GRADIENT_MIX) + memcpy(&mixer.gradient, &info.gradient, sizeof(info.gradient)); + #endif + + // Extrude and retract to clean the nozzle + #if POWER_LOSS_PURGE_LEN + //sprintf_P(cmd, PSTR("G1 E%d F200"), POWER_LOSS_PURGE_LEN); + //gcode.process_subcommands_now(cmd); + gcode.process_subcommands_now_P(PSTR("G1 E" STRINGIFY(POWER_LOSS_PURGE_LEN) " F200")); + #endif + #if POWER_LOSS_RETRACT_LEN + sprintf_P(cmd, PSTR("G1 E%d F3000"), POWER_LOSS_PURGE_LEN - POWER_LOSS_RETRACT_LEN); + gcode.process_subcommands_now(cmd); + #endif // Move back to the saved XY dtostrf(info.current_position[X_AXIS], 1, 3, str_1); @@ -327,10 +353,38 @@ void PrintJobRecovery::resume() { sprintf_P(cmd, PSTR("G1 Z%s F200"), str_1); gcode.process_subcommands_now(cmd); + // Un-retract + #if POWER_LOSS_PURGE_LEN + //sprintf_P(cmd, PSTR("G1 E%d F3000"), POWER_LOSS_PURGE_LEN); + //gcode.process_subcommands_now(cmd); + gcode.process_subcommands_now_P(PSTR("G1 E" STRINGIFY(POWER_LOSS_PURGE_LEN) " F3000")); + #endif + // Restore the feedrate sprintf_P(cmd, PSTR("G1 F%d"), info.feedrate); gcode.process_subcommands_now(cmd); + // Restore E position with G92.9 + dtostrf(info.current_position[E_AXIS], 1, 3, str_1); + sprintf_P(cmd, PSTR("G92.9 E%s"), str_1); + gcode.process_subcommands_now(cmd); + + // Relative mode + relative_mode = info.relative_mode; + gcode.axis_relative_modes[E_AXIS] = info.relative_modes_e; + + #if HAS_HOME_OFFSET || HAS_POSITION_SHIFT + LOOP_XYZ(i) { + #if HAS_HOME_OFFSET + home_offset[i] = info.home_offset[i]; + #endif + #if HAS_POSITION_SHIFT + position_shift[i] = info.position_shift[i]; + #endif + update_workspace_offset((AxisEnum)i); + } + #endif + // 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) @@ -348,67 +402,84 @@ 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(); + + #if HAS_HOME_OFFSET + DEBUG_ECHOPGM("home_offset: "); + LOOP_XYZ(i) { + if (i) DEBUG_CHAR(','); + DEBUG_ECHO(info.home_offset[i]); + } + DEBUG_EOL(); + #endif + + #if HAS_POSITION_SHIFT + DEBUG_ECHOPGM("position_shift: "); + LOOP_XYZ(i) { + if (i) DEBUG_CHAR(','); + DEBUG_ECHO(info.position_shift[i]); + } + DEBUG_EOL(); + #endif + + 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 d2222c779c49..68554dc602d0 100644 --- a/Marlin/src/feature/power_loss_recovery.h +++ b/Marlin/src/feature/power_loss_recovery.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -28,9 +28,15 @@ #include "../sd/cardreader.h" #include "../inc/MarlinConfigPre.h" +#if ENABLED(MIXING_EXTRUDER) + #include "../feature/mixing.h" +#endif + #define SAVE_INFO_INTERVAL_MS 0 //#define SAVE_EACH_CMD_MODE //#define DEBUG_POWER_LOSS_RECOVERY +#define POWER_LOSS_PURGE_LEN 20 +#define POWER_LOSS_RETRACT_LEN 10 typedef struct { uint8_t valid_head; @@ -38,6 +44,13 @@ typedef struct { // Machine state float current_position[NUM_AXIS]; + #if HAS_HOME_OFFSET + float home_offset[XYZ]; + #endif + #if HAS_POSITION_SHIFT + float position_shift[XYZ]; + #endif + uint16_t feedrate; #if HOTENDS > 1 @@ -63,6 +76,18 @@ typedef struct { float retract[EXTRUDERS], retract_hop; #endif + // Mixing extruder and gradient + #if ENABLED(MIXING_EXTRUDER) + //uint_fast8_t selected_vtool; + //mixer_comp_t color[NR_MIXING_VIRTUAL_TOOLS][MIXING_STEPPERS]; + #if ENABLED(GRADIENT_MIX) + gradient_t gradient; + #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]; @@ -109,9 +134,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 new file mode 100644 index 000000000000..7d0e6fcfda29 --- /dev/null +++ b/Marlin/src/feature/prusa_MMU2/mmu2.cpp @@ -0,0 +1,842 @@ +/** + * 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(PRUSA_MMU2) + +#include "mmu2.h" +#include "../../lcd/menu/menu_mmu2.h" + +MMU2 mmu2; + +#include "../../gcode/gcode.h" +#include "../../lcd/ultralcd.h" +#include "../../libs/buzzer.h" +#include "../../libs/nozzle.h" +#include "../../module/temperature.h" +#include "../../module/planner.h" +#include "../../module/stepper_indirection.h" +#include "../../Marlin.h" + +#if ENABLED(HOST_PROMPT_SUPPORT) + #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) +#define MMU_P0_TIMEOUT 3000ul //timeout for P0 command: 3seconds + +#define MMU_CMD_NONE 0 +#define MMU_CMD_T0 0x10 +#define MMU_CMD_T1 0x11 +#define MMU_CMD_T2 0x12 +#define MMU_CMD_T3 0x13 +#define MMU_CMD_T4 0x14 +#define MMU_CMD_L0 0x20 +#define MMU_CMD_L1 0x21 +#define MMU_CMD_L2 0x22 +#define MMU_CMD_L3 0x23 +#define MMU_CMD_L4 0x24 +#define MMU_CMD_C0 0x30 +#define MMU_CMD_U0 0x40 +#define MMU_CMD_E0 0x50 +#define MMU_CMD_E1 0x51 +#define MMU_CMD_E2 0x52 +#define MMU_CMD_E3 0x53 +#define MMU_CMD_E4 0x54 +#define MMU_CMD_R0 0x60 +#define MMU_CMD_F0 0x70 +#define MMU_CMD_F1 0x71 +#define MMU_CMD_F2 0x72 +#define MMU_CMD_F3 0x73 +#define MMU_CMD_F4 0x74 + +#if ENABLED(MMU2_MODE_12V) + #define MMU_REQUIRED_FW_BUILDNR 132 +#else + #define MMU_REQUIRED_FW_BUILDNR 126 +#endif + +#define MMU2_NO_TOOL 99 +#define MMU_BAUD 115200 + +#define mmuSerial MMU2_SERIAL + +bool MMU2::enabled, MMU2::ready, MMU2::mmu_print_saved; +uint8_t MMU2::cmd, MMU2::cmd_arg, MMU2::last_cmd, MMU2::extruder; +int8_t MMU2::state = 0; +volatile int8_t MMU2::finda = 1; +volatile bool MMU2::finda_runout_valid; +int16_t MMU2::version = -1, MMU2::buildnr = -1; +millis_t MMU2::last_request, MMU2::next_P0_request; +char MMU2::rx_buffer[16], MMU2::tx_buffer[16]; + +#if HAS_LCD_MENU && ENABLED(MMU2_MENUS) + + struct E_Step { + float extrude; //!< extrude distance in mm + float feedRate; //!< feed rate in mm/s + }; + + static constexpr E_Step ramming_sequence[] PROGMEM = { MMU2_RAMMING_SEQUENCE }; + static constexpr E_Step load_to_nozzle_sequence[] PROGMEM = { MMU2_LOAD_TO_NOZZLE_SEQUENCE }; + +#endif // MMU2_MENUS + +MMU2::MMU2() { + rx_buffer[0] = '\0'; +} + +void MMU2::init() { + + set_runout_valid(false); + + #if PIN_EXISTS(MMU2_RST) + // TODO use macros for this + WRITE(MMU2_RST_PIN, HIGH); + SET_OUTPUT(MMU2_RST_PIN); + #endif + + mmuSerial.begin(MMU_BAUD); + extruder = MMU2_NO_TOOL; + + safe_delay(10); + reset(); + rx_buffer[0] = '\0'; + state = -1; +} + +void MMU2::reset() { + DEBUG_ECHOLNPGM("MMU <= reset"); + + #if PIN_EXISTS(MMU2_RST) + WRITE(MMU2_RST_PIN, LOW); + safe_delay(20); + WRITE(MMU2_RST_PIN, HIGH); + #else + tx_str_P(PSTR("X0\n")); // Send soft reset + #endif +} + +uint8_t MMU2::get_current_tool() { + return extruder == MMU2_NO_TOOL ? -1 : extruder; +} + +void MMU2::mmu_loop() { + + switch (state) { + + case 0: break; + + case -1: + if (rx_start()) { + DEBUG_ECHOLNPGM("MMU => 'start'"); + DEBUG_ECHOLNPGM("MMU <= 'S1'"); + + // send "read version" request + tx_str_P(PSTR("S1\n")); + + state = -2; + } + else if (millis() > 3000000) { + SERIAL_ECHOLNPGM("MMU not responding - DISABLED"); + state = 0; + } + break; + + case -2: + if (rx_ok()) { + sscanf(rx_buffer, "%uok\n", &version); + + DEBUG_ECHOLNPAIR("MMU => ", version, "\nMMU <= 'S2'"); + + tx_str_P(PSTR("S2\n")); // read build number + state = -3; + } + break; + + case -3: + if (rx_ok()) { + sscanf(rx_buffer, "%uok\n", &buildnr); + + DEBUG_ECHOLNPAIR("MMU => ", buildnr); + + check_version(); + + #if ENABLED(MMU2_MODE_12V) + DEBUG_ECHOLNPGM("MMU <= 'M1'"); + + tx_str_P(PSTR("M1\n")); // switch to stealth mode + state = -5; + + #else + DEBUG_ECHOLNPGM("MMU <= 'P0'"); + + tx_str_P(PSTR("P0\n")); // read finda + state = -4; + #endif + } + break; + + case -5: + // response to M1 + if (rx_ok()) { + DEBUG_ECHOLNPGM("MMU => ok"); + + check_version(); + + DEBUG_ECHOLNPGM("MMU <= 'P0'"); + + tx_str_P(PSTR("P0\n")); // read finda + state = -4; + } + break; + + case -4: + if (rx_ok()) { + sscanf(rx_buffer, "%hhuok\n", &finda); + + DEBUG_ECHOLNPAIR("MMU => ", finda, "\nMMU - ENABLED"); + + enabled = true; + state = 1; + } + break; + + case 1: + if (cmd) { + if (WITHIN(cmd, MMU_CMD_T0, MMU_CMD_T4)) { + // tool change + int filament = cmd - MMU_CMD_T0; + 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; + 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 + DEBUG_ECHOLNPGM("MMU <= 'C0'"); + tx_str_P(PSTR("C0\n")); + state = 3; // wait for response + } + else if (cmd == MMU_CMD_U0) { + // unload current + DEBUG_ECHOLNPGM("MMU <= 'U0'"); + + tx_str_P(PSTR("U0\n")); + state = 3; // wait for response + } + else if (WITHIN(cmd, MMU_CMD_E0, MMU_CMD_E4)) { + // eject filament + int filament = cmd - MMU_CMD_E0; + 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 + 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; + 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 + } + + last_cmd = cmd; + cmd = MMU_CMD_NONE; + } + else if (ELAPSED(millis(), next_P0_request)) { + // read FINDA + tx_str_P(PSTR("P0\n")); + state = 2; // wait for response + } + break; + + case 2: // response to command P0 + if (rx_ok()) { + sscanf(rx_buffer, "%hhuok\n", &finda); + + // This is super annoying. Only activate if necessary + // if (finda_runout_valid) DEBUG_ECHOLNPAIR_F("MMU <= 'P0'\nMMU => ", finda, 6); + + state = 1; + + if (cmd == 0) ready = true; + + if (!finda && finda_runout_valid) filament_runout(); + } + else if (ELAPSED(millis(), last_request + MMU_P0_TIMEOUT)) // Resend request after timeout (30s) + state = 1; + + break; + + case 3: // response to mmu commands + if (rx_ok()) { + DEBUG_ECHOLNPGM("MMU => 'ok'"); + ready = true; + state = 1; + last_cmd = MMU_CMD_NONE; + } + else if (ELAPSED(millis(), last_request + MMU_CMD_TIMEOUT)) { + // resend request after timeout + if (last_cmd) { + DEBUG_ECHOLNPGM("MMU retry"); + cmd = last_cmd; + last_cmd = MMU_CMD_NONE; + } + state = 1; + } + break; + } +} + + +/** + * Check if MMU was started + */ +bool MMU2::rx_start() { + // check for start message + if (rx_str_P(PSTR("start\n"))) { + next_P0_request = millis() + 300; + return true; + } + return false; +} + + +/** + * Check if the data received ends with the given string. + */ +bool MMU2::rx_str_P(const char* str) { + uint8_t i = strlen(rx_buffer); + + while (mmuSerial.available()) { + rx_buffer[i++] = mmuSerial.read(); + rx_buffer[i] = '\0'; + + if (i == sizeof(rx_buffer) - 1) { + DEBUG_ECHOLNPGM("rx buffer overrun"); + break; + } + } + + uint8_t len = strlen_P(str); + + if (i < len) return false; + + str += len; + + while (len--) { + char c0 = pgm_read_byte(str--), c1 = rx_buffer[i--]; + if (c0 == c1) continue; + if (c0 == '\r' && c1 == '\n') continue; // match cr as lf + if (c0 == '\n' && c1 == '\r') continue; // match lf as cr + return false; + } + return true; +} + + +/** + * Transfer data to MMU, no argument + */ +void MMU2::tx_str_P(const char* str) { + clear_rx_buffer(); + uint8_t len = strlen_P(str); + for (uint8_t i = 0; i < len; i++) mmuSerial.write(pgm_read_byte(str++)); + rx_buffer[0] = '\0'; + last_request = millis(); +} + + +/** + * Transfer data to MMU, single argument + */ +void MMU2::tx_printf_P(const char* format, int argument = -1) { + clear_rx_buffer(); + uint8_t len = sprintf_P(tx_buffer, format, argument); + for (uint8_t i = 0; i < len; i++) mmuSerial.write(tx_buffer[i]); + rx_buffer[0] = '\0'; + last_request = millis(); +} + + +/** + * Transfer data to MMU, two arguments + */ +void MMU2::tx_printf_P(const char* format, int argument1, int argument2) { + clear_rx_buffer(); + uint8_t len = sprintf_P(tx_buffer, format, argument1, argument2); + for (uint8_t i = 0; i < len; i++) mmuSerial.write(tx_buffer[i]); + rx_buffer[0] = '\0'; + last_request = millis(); +} + + +/** + * Empty the rx buffer + */ +void MMU2::clear_rx_buffer() { + while (mmuSerial.available()) mmuSerial.read(); + rx_buffer[0] = '\0'; +} + + +/** + * Check if we received 'ok' from MMU + */ +bool MMU2::rx_ok() { + if (rx_str_P(PSTR("ok\n"))) { + next_P0_request = millis() + 300; + return true; + } + return false; +} + + +/** + * Check if MMU has compatible firmware + */ +void MMU2::check_version() { + if (buildnr < MMU_REQUIRED_FW_BUILDNR) { + SERIAL_ERROR_START(); + SERIAL_ECHOPGM("MMU2 firmware version invalid. Required version >= "); + SERIAL_ECHOLN(MMU_REQUIRED_FW_BUILDNR); + kill(MSG_MMU2_WRONG_FIRMWARE); + } +} + + +/** + * Handle tool change + */ +void MMU2::tool_change(uint8_t index) { + + if (!enabled) return; + + set_runout_valid(false); + + if (index != extruder) { + + KEEPALIVE_STATE(IN_HANDLER); + disable_E0(); + ui.status_printf_P(0, PSTR(MSG_MMU2_LOADING_FILAMENT), int(index + 1)); + + command(MMU_CMD_T0 + index); + + manage_response(true, true); + KEEPALIVE_STATE(IN_HANDLER); + + command(MMU_CMD_C0); + extruder = index; //filament change is finished + active_extruder = 0; + + enable_E0(); + + SERIAL_ECHO_START(); + SERIAL_ECHOLNPAIR(MSG_ACTIVE_EXTRUDER, int(extruder)); + + ui.reset_status(); + KEEPALIVE_STATE(NOT_BUSY); + } + + set_runout_valid(true); +} + + +/** + * + * Handle special T?/Tx/Tc commands + * + * T? Gcode to extrude shouldn't have to follow, load to extruder wheels is done automatically + * Tx Same as T?, except nozzle doesn't have to be preheated. Tc must be placed after extruder nozzle is preheated to finish filament load. + * Tc Load to nozzle after filament was prepared by Tx and extruder nozzle is already heated. + * + */ +void MMU2::tool_change(const char* special) { + + if (!enabled) return; + + #if ENABLED(MMU2_MENUS) + + set_runout_valid(false); + KEEPALIVE_STATE(IN_HANDLER); + + switch (*special) { + case '?': { + uint8_t index = mmu2_choose_filament(); + while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100); + load_filament_to_nozzle(index); + } break; + + case 'x': { + planner.synchronize(); + uint8_t index = mmu2_choose_filament(); + disable_E0(); + command(MMU_CMD_T0 + index); + manage_response(true, true); + command(MMU_CMD_C0); + mmu_loop(); + + enable_E0(); + extruder = index; + active_extruder = 0; + } break; + + case 'c': { + while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100); + execute_extruder_sequence((const E_Step *)load_to_nozzle_sequence, COUNT(load_to_nozzle_sequence)); + } break; + } + + KEEPALIVE_STATE(NOT_BUSY); + + set_runout_valid(true); + + #endif +} + + +/** + * Set next command + */ +void MMU2::command(const uint8_t mmu_cmd) { + if (!enabled) return; + cmd = mmu_cmd; + ready = false; +} + + +/** + * Wait for response from MMU + */ +bool MMU2::get_response(void) { + while (cmd != MMU_CMD_NONE) idle(); + + while (!ready) { + idle(); + if (state != 3) break; + } + + const bool ret = ready; + ready = false; + + return ret; +} + + +/** + * Wait for response and deal with timeout if nexcessary + */ +void MMU2::manage_response(bool move_axes, bool turn_off_nozzle) { + + bool response = false; + mmu_print_saved = false; + point_t park_point = NOZZLE_PARK_POINT; + float resume_position[XYZE]; + int16_t resume_hotend_temp; + + while (!response) { + + response = get_response(); //wait for "ok" from mmu + + if (!response) { //no "ok" was received in reserved time frame, user will fix the issue on mmu unit + if (!mmu_print_saved) { //first occurence, we are saving current position, park print head in certain position and disable nozzle heater + + planner.synchronize(); + + mmu_print_saved = true; + + SERIAL_ECHOLNPGM("MMU not responding"); + + resume_hotend_temp = thermalManager.degTargetHotend(active_extruder); + COPY(resume_position, current_position); + + if (move_axes && all_axes_homed()) + Nozzle::park(2, park_point /*= NOZZLE_PARK_POINT*/); + + if (turn_off_nozzle) thermalManager.setTargetHotend(0, active_extruder); + + LCD_MESSAGEPGM(MSG_MMU2_NOT_RESPONDING); + BUZZ(100, 659); + BUZZ(200, 698); + BUZZ(100, 659); + BUZZ(300, 440); + BUZZ(100, 659); + + KEEPALIVE_STATE(PAUSED_FOR_USER); + } + } + else if (mmu_print_saved) { + SERIAL_ECHOLNPGM("MMU starts responding\n"); + KEEPALIVE_STATE(IN_HANDLER); + + if (turn_off_nozzle && resume_hotend_temp) { + thermalManager.setTargetHotend(resume_hotend_temp, active_extruder); + LCD_MESSAGEPGM(MSG_HEATING); + BUZZ(200, 40); + + while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(1000); + } + + if (move_axes && all_axes_homed()) { + LCD_MESSAGEPGM(MSG_MMU2_RESUMING); + BUZZ(200, 404); + BUZZ(200, 404); + + // Move XY to starting position, then Z + do_blocking_move_to_xy(resume_position[X_AXIS], resume_position[Y_AXIS], NOZZLE_PARK_XY_FEEDRATE); + + // Move Z_AXIS to saved position + do_blocking_move_to_z(resume_position[Z_AXIS], NOZZLE_PARK_Z_FEEDRATE); + } + else { + BUZZ(200, 404); + BUZZ(200, 404); + LCD_MESSAGEPGM(MSG_MMU2_RESUMING); + } + } + } +} + +void MMU2::set_filament_type(uint8_t index, uint8_t filamentType) { + if (!enabled) return; + + KEEPALIVE_STATE(IN_HANDLER); + + cmd_arg = filamentType; + command(MMU_CMD_F0 + index); + + manage_response(true, true); + + KEEPALIVE_STATE(NOT_BUSY); +} + +void MMU2::filament_runout() { + enqueue_and_echo_commands_P(PSTR(MMU2_FILAMENT_RUNOUT_SCRIPT)); + planner.synchronize(); +} + +#if HAS_LCD_MENU && ENABLED(MMU2_MENUS) + + // Load filament into MMU2 + void MMU2::load_filament(uint8_t index) { + if (!enabled) return; + command(MMU_CMD_L0 + index); + manage_response(false, false); + BUZZ(200, 404); + } + + /** + * + * Switch material and load to nozzle + * + */ + bool MMU2::load_filament_to_nozzle(uint8_t index) { + + if (!enabled) return false; + + if (thermalManager.tooColdToExtrude(active_extruder)) { + BUZZ(200, 404); + LCD_ALERTMESSAGEPGM(MSG_HOTEND_TOO_COLD); + return false; + } + else { + KEEPALIVE_STATE(IN_HANDLER); + + command(MMU_CMD_T0 + index); + manage_response(true, true); + command(MMU_CMD_C0); + mmu_loop(); + + extruder = index; + active_extruder = 0; + + load_to_nozzle(); + + BUZZ(200, 404); + + KEEPALIVE_STATE(NOT_BUSY); + return true; + } + } + + /** + * + * Load filament to nozzle of multimaterial printer + * + * This function is used only only after T? (user select filament) and M600 (change filament). + * It is not used after T0 .. T4 command (select filament), in such case, gcode is responsible for loading + * filament to nozzle. + */ + void MMU2::load_to_nozzle() { + if (!enabled) return; + execute_extruder_sequence((const E_Step *)load_to_nozzle_sequence, COUNT(load_to_nozzle_sequence)); + } + + bool MMU2::eject_filament(uint8_t index, bool recover) { + + if (!enabled) return false; + + if (thermalManager.tooColdToExtrude(active_extruder)) { + BUZZ(200, 404); + LCD_ALERTMESSAGEPGM(MSG_HOTEND_TOO_COLD); + return false; + } + + KEEPALIVE_STATE(IN_HANDLER); + LCD_MESSAGEPGM(MSG_MMU2_EJECTING_FILAMENT); + const bool saved_e_relative_mode = gcode.axis_relative_modes[E_AXIS]; + gcode.axis_relative_modes[E_AXIS] = true; + + enable_E0(); + current_position[E_AXIS] -= MMU2_FILAMENTCHANGE_EJECT_FEED; + planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 2500 / 60, active_extruder); + planner.synchronize(); + command(MMU_CMD_E0 + index); + manage_response(false, false); + + if (recover) { + LCD_MESSAGEPGM(MSG_MMU2_EJECT_RECOVER); + BUZZ(200, 404); + wait_for_user = true; + #if ENABLED(HOST_PROMPT_SUPPORT) + host_prompt_do(PROMPT_USER_CONTINUE, PSTR("MMU2 Eject Recover"), PSTR("Continue")); + #endif + while (wait_for_user) idle(); + BUZZ(200, 404); + BUZZ(200, 404); + + command(MMU_CMD_R0); + manage_response(false, false); + } + + ui.reset_status(); + + // no active tool + extruder = MMU2_NO_TOOL; + + set_runout_valid(false); + + BUZZ(200, 404); + + KEEPALIVE_STATE(NOT_BUSY); + + gcode.axis_relative_modes[E_AXIS] = saved_e_relative_mode; + + disable_E0(); + + return true; + } + + /** + * + * unload from hotend and retract to MMU + * + */ + bool MMU2::unload() { + + if (!enabled) return false; + + if (thermalManager.tooColdToExtrude(active_extruder)) { + BUZZ(200, 404); + LCD_ALERTMESSAGEPGM(MSG_HOTEND_TOO_COLD); + return false; + } + + KEEPALIVE_STATE(IN_HANDLER); + + filament_ramming(); + + command(MMU_CMD_U0); + manage_response(false, true); + + BUZZ(200, 404); + + // no active tool + extruder = MMU2_NO_TOOL; + + set_runout_valid(false); + + KEEPALIVE_STATE(NOT_BUSY); + + return true; + } + + /** + * Unload sequence to optimize shape of the tip of the unloaded filament + */ + void MMU2::filament_ramming() { + execute_extruder_sequence((const E_Step *)ramming_sequence, sizeof(ramming_sequence) / sizeof(E_Step)); + } + + void MMU2::execute_extruder_sequence(const E_Step * sequence, int steps) { + + planner.synchronize(); + enable_E0(); + + const bool saved_e_relative_mode = gcode.axis_relative_modes[E_AXIS]; + gcode.axis_relative_modes[E_AXIS] = true; + + const E_Step* step = sequence; + + for (uint8_t i = 0; i < steps; i++) { + const float es = pgm_read_float(&(step->extrude)), + fr = pgm_read_float(&(step->feedRate)); + + 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], + current_position[E_AXIS], MMM_TO_MMS(fr), active_extruder); + planner.synchronize(); + + step++; + } + + gcode.axis_relative_modes[E_AXIS] = saved_e_relative_mode; + + disable_E0(); + } + +#endif // HAS_LCD_MENU && MMU2_MENUS + +#endif // PRUSA_MMU2 diff --git a/Marlin/src/feature/prusa_MMU2/mmu2.h b/Marlin/src/feature/prusa_MMU2/mmu2.h new file mode 100644 index 000000000000..9c280479c194 --- /dev/null +++ b/Marlin/src/feature/prusa_MMU2/mmu2.h @@ -0,0 +1,94 @@ +/** + * 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/MarlinConfig.h" + +#if HAS_FILAMENT_SENSOR + #include "../runout.h" +#endif + +struct E_Step; + +class MMU2 { +public: + MMU2(); + + static void init(); + static void reset(); + static void mmu_loop(); + static void tool_change(uint8_t index); + static void tool_change(const char* special); + static uint8_t get_current_tool(); + static void set_filament_type(uint8_t index, uint8_t type); + + #if HAS_LCD_MENU && ENABLED(MMU2_MENUS) + static bool unload(); + static void load_filament(uint8_t); + static void load_all(); + static bool load_filament_to_nozzle(uint8_t index); + static bool eject_filament(uint8_t index, bool recover); + #endif + +private: + static bool rx_str_P(const char* str); + static void tx_str_P(const char* str); + static void tx_printf_P(const char* format, int argument); + static void tx_printf_P(const char* format, int argument1, int argument2); + static void clear_rx_buffer(); + + static bool rx_ok(); + static bool rx_start(); + static void check_version(); + + static void command(const uint8_t cmd); + static bool get_response(void); + static void manage_response(bool move_axes, bool turn_off_nozzle); + + #if HAS_LCD_MENU && ENABLED(MMU2_MENUS) + static void load_to_nozzle(); + static void filament_ramming(); + static void execute_extruder_sequence(const E_Step * sequence, int steps); + #endif + + static void filament_runout(); + + static bool enabled, ready, mmu_print_saved; + static uint8_t cmd, cmd_arg, last_cmd, extruder; + static int8_t state; + static volatile int8_t finda; + static volatile bool finda_runout_valid; + static int16_t version, buildnr; + static millis_t last_request, next_P0_request; + static char rx_buffer[16], tx_buffer[16]; + + static inline void set_runout_valid(const bool valid) { + finda_runout_valid = valid; + #if HAS_FILAMENT_SENSOR + if (valid) runout.reset(); + #endif + } + +}; + +extern MMU2 mmu2; diff --git a/Marlin/src/feature/prusa_MMU2/serial-protocol.md b/Marlin/src/feature/prusa_MMU2/serial-protocol.md new file mode 100644 index 000000000000..936830e1dc08 --- /dev/null +++ b/Marlin/src/feature/prusa_MMU2/serial-protocol.md @@ -0,0 +1,94 @@ +Startup sequence +================ + +When initialized, MMU sends + +- MMU => 'start\n' + +We follow with + +- MMU <= 'S1\n' +- MMU => 'ok*Firmware version*\n' +- MMU <= 'S2\n' +- MMU => 'ok*Build number*\n' + +#if (12V_mode) + +- MMU <= 'M1\n' +- MMU => 'ok\n' + +#endif + +- MMU <= 'P0\n' +- MMU => '*FINDA status*\n' + +Now we are sure MMU is available and ready. If there was a timeout or other communication problem somewhere, printer will be killed. + +- *Firmware version* is an integer value, but we don't care about it +- *Build number* is an integer value and has to be >=126, or =>132 if 12V mode is enabled +- *FINDA status* is 1 if the is filament loaded to the extruder, 0 otherwise + + +*Build number* is checked against the required value, if it does not match, printer is halted. + + + +Toolchange +========== + +- MMU <= 'T*Filament index*\n' + +MMU sends + +- MMU => 'ok\n' + +as soon as the filament is fed down to the extruder. We follow with + +- MMU <= 'C0\n' + +MMU will feed a few more millimeters of filament for the extruder gears to grab. +When done, the MMU sends + +- MMU => 'ok\n' + +We don't wait for a response here but immediately continue with the next gcode which should +be one or more extruder moves to feed the filament into the hotend. + + +FINDA status +============ + +- MMU <= 'P0\n' +- MMU => '*FINDA status*\n' + +*FINDA status* is 1 if the is filament loaded to the extruder, 0 otherwise. This could be used as filament runout sensor if probed regularly. + + + +Load filament +============= + +- MMU <= 'L*Filament index*\n' + +MMU will feed filament down to the extruder, when done + +- MMU => 'ok\n' + + +Unload filament +============= + +- MMU <= 'U0\n' + +MMU will retract current filament from the extruder, when done + +- MMU => 'ok\n' + + + +Eject filament +============== + +- MMU <= 'E*Filament index*\n' +- MMU => 'ok\n' + diff --git a/Marlin/src/feature/runout.cpp b/Marlin/src/feature/runout.cpp index 3dcb82673c44..9395dec5b41c 100644 --- a/Marlin/src/feature/runout.cpp +++ b/Marlin/src/feature/runout.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -26,14 +26,18 @@ #include "../inc/MarlinConfigPre.h" -#if ENABLED(FILAMENT_RUNOUT_SENSOR) +#if HAS_FILAMENT_SENSOR #include "runout.h" FilamentMonitor runout; bool FilamentMonitorBase::enabled = true, - FilamentMonitorBase::filament_ran_out; // = false + FilamentMonitorBase::filament_ran_out; // = false + +#if ENABLED(HOST_ACTION_COMMANDS) + bool FilamentMonitorBase::host_handling; // = false +#endif /** * Called by FilamentSensorSwitch::run when filament is detected. @@ -54,4 +58,4 @@ void FilamentSensorBase::filament_present(const uint8_t extruder) { int8_t RunoutResponseDebounced::runout_count; // = 0 #endif -#endif // FILAMENT_RUNOUT_SENSOR +#endif // HAS_FILAMENT_SENSOR diff --git a/Marlin/src/feature/runout.h b/Marlin/src/feature/runout.h index 77887c2a2489..3f1e5fa0187d 100644 --- a/Marlin/src/feature/runout.h +++ b/Marlin/src/feature/runout.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -36,14 +36,21 @@ #include "../lcd/extensible_ui/ui_api.h" #endif +#if ENABLED(ADVANCED_PAUSE_FEATURE) + #include "pause.h" +#endif + //#define FILAMENT_RUNOUT_SENSOR_DEBUG class FilamentMonitorBase { public: - static bool enabled; + static bool enabled, filament_ran_out; - protected: - static bool filament_ran_out; + #if ENABLED(HOST_ACTION_COMMANDS) + static bool host_handling; + #else + static constexpr bool host_handling = false; + #endif }; template @@ -82,7 +89,7 @@ class TFilamentMonitor : public FilamentMonitorBase { // Give the response a chance to update its counter. static inline void run() { - if (enabled && !filament_ran_out && (IS_SD_PRINTING() || print_job_timer.isRunning())) { + if (enabled && !filament_ran_out && (IS_SD_PRINTING() || print_job_timer.isRunning() || did_pause_print)) { #if FILAMENT_RUNOUT_DISTANCE_MM > 0 cli(); // Prevent RunoutResponseDelayed::block_completed from accumulating here #endif @@ -94,10 +101,7 @@ class TFilamentMonitor : public FilamentMonitorBase { #endif if (ran_out) { filament_ran_out = true; - #if ENABLED(EXTENSIBLE_UI) - ExtUI::onFilamentRunout(); - #endif - enqueue_and_echo_commands_P(PSTR(FILAMENT_RUNOUT_SCRIPT)); + event_filament_runout(); planner.synchronize(); } } @@ -192,7 +196,7 @@ class FilamentSensorBase { #ifdef FILAMENT_RUNOUT_SENSOR_DEBUG if (change) { - SERIAL_PROTOCOLPGM("Motion detected:"); + SERIAL_ECHOPGM("Motion detected:"); for (uint8_t e = 0; e < NUM_RUNOUT_SENSORS; e++) if (TEST(change, e)) { SERIAL_CHAR(' '); SERIAL_CHAR('0' + e); } SERIAL_EOL(); @@ -226,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 } @@ -253,7 +260,7 @@ class FilamentSensorBase { static bool was_out = false; if (out != was_out) { was_out = out; - SERIAL_PROTOCOL("Filament "); + SERIAL_ECHOPGM("Filament "); serialprintPGM(out ? PSTR("OUT\n") : PSTR("IN\n")); } #endif @@ -289,7 +296,7 @@ class FilamentSensorBase { t = millis() + 1000UL; LOOP_L_N(i, EXTRUDERS) { serialprintPGM(i ? PSTR(", ") : PSTR("Remaining mm: ")); - SERIAL_PROTOCOL(runout_mm_countdown[i]); + SERIAL_ECHO(runout_mm_countdown[i]); } SERIAL_EOL(); } @@ -305,7 +312,11 @@ class FilamentSensorBase { } static inline void block_completed(const block_t* const b) { - if (b->steps[X_AXIS] || b->steps[Y_AXIS] || b->steps[Z_AXIS]) { + if (b->steps[X_AXIS] || b->steps[Y_AXIS] || b->steps[Z_AXIS] + #if ENABLED(ADVANCED_PAUSE_FEATURE) + || did_pause_print // Allow pause purge move to re-trigger runout state + #endif + ) { // Only trigger on extrusion with XYZ movement to allow filament change and retract/recover. const uint8_t e = b->extruder; const int32_t steps = b->steps[E_AXIS]; diff --git a/Marlin/src/feature/snmm.cpp b/Marlin/src/feature/snmm.cpp index e8c04f219780..88fb2efa30df 100644 --- a/Marlin/src/feature/snmm.cpp +++ b/Marlin/src/feature/snmm.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/feature/snmm.h b/Marlin/src/feature/snmm.h index ad8782d16a6e..c1972723e985 100644 --- a/Marlin/src/feature/snmm.h +++ b/Marlin/src/feature/snmm.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/feature/solenoid.cpp b/Marlin/src/feature/solenoid.cpp index 33b442ccc5c3..36430c5514d9 100644 --- a/Marlin/src/feature/solenoid.cpp +++ b/Marlin/src/feature/solenoid.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -22,68 +22,77 @@ #include "../inc/MarlinConfig.h" -#if ENABLED(EXT_SOLENOID) || ENABLED(MANUAL_SOLENOID_CONTROL) +#if EITHER(EXT_SOLENOID, MANUAL_SOLENOID_CONTROL) #include "solenoid.h" #include "../module/motion.h" // for active_extruder -void enable_solenoid(const uint8_t num) { +#if ENABLED(MANUAL_SOLENOID_CONTROL) + #define HAS_SOLENOID(N) HAS_SOLENOID_##N +#else + #define HAS_SOLENOID(N) (HAS_SOLENOID_##N && EXTRUDERS > N) +#endif + +// Used primarily with MANUAL_SOLENOID_CONTROL +static void set_solenoid(const uint8_t num, const bool active) { + const uint8_t value = active ? HIGH : LOW; switch (num) { case 0: - OUT_WRITE(SOL0_PIN, HIGH); + OUT_WRITE(SOL0_PIN, value); break; - #if HAS_SOLENOID_1 && EXTRUDERS > 1 - case 1: - OUT_WRITE(SOL1_PIN, HIGH); - break; - #endif - #if HAS_SOLENOID_2 && EXTRUDERS > 2 - case 2: - OUT_WRITE(SOL2_PIN, HIGH); - break; - #endif - #if HAS_SOLENOID_3 && EXTRUDERS > 3 - case 3: - OUT_WRITE(SOL3_PIN, HIGH); - break; - #endif - #if HAS_SOLENOID_4 && EXTRUDERS > 4 - case 4: - OUT_WRITE(SOL4_PIN, HIGH); - break; - #endif - #if HAS_SOLENOID_5 && EXTRUDERS > 5 - case 5: - OUT_WRITE(SOL5_PIN, HIGH); - break; - #endif + #if HAS_SOLENOID(1) + case 1: + OUT_WRITE(SOL1_PIN, value); + break; + #endif + #if HAS_SOLENOID(2) + case 2: + OUT_WRITE(SOL2_PIN, value); + break; + #endif + #if HAS_SOLENOID(3) + case 3: + OUT_WRITE(SOL3_PIN, value); + break; + #endif + #if HAS_SOLENOID(4) + case 4: + OUT_WRITE(SOL4_PIN, value); + break; + #endif + #if HAS_SOLENOID(5) + case 5: + OUT_WRITE(SOL5_PIN, value); + break; + #endif default: - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM(MSG_INVALID_SOLENOID); + SERIAL_ECHO_MSG(MSG_INVALID_SOLENOID); break; } } +void enable_solenoid(const uint8_t num) { set_solenoid(num, true); } +void disable_solenoid(const uint8_t num) { set_solenoid(num, false); } void enable_solenoid_on_active_extruder() { enable_solenoid(active_extruder); } void disable_all_solenoids() { - OUT_WRITE(SOL0_PIN, LOW); - #if HAS_SOLENOID_1 && EXTRUDERS > 1 - OUT_WRITE(SOL1_PIN, LOW); + disable_solenoid(0); + #if HAS_SOLENOID(1) + disable_solenoid(1); #endif - #if HAS_SOLENOID_2 && EXTRUDERS > 2 - OUT_WRITE(SOL2_PIN, LOW); + #if HAS_SOLENOID(2) + disable_solenoid(2); #endif - #if HAS_SOLENOID_3 && EXTRUDERS > 3 - OUT_WRITE(SOL3_PIN, LOW); + #if HAS_SOLENOID(3) + disable_solenoid(3); #endif - #if HAS_SOLENOID_4 && EXTRUDERS > 4 - OUT_WRITE(SOL4_PIN, LOW); + #if HAS_SOLENOID(4) + disable_solenoid(4); #endif - #if HAS_SOLENOID_5 && EXTRUDERS > 5 - OUT_WRITE(SOL5_PIN, LOW); + #if HAS_SOLENOID(5) + disable_solenoid(5); #endif } -#endif // EXT_SOLENOID +#endif // EXT_SOLENOID || MANUAL_SOLENOID_CONTROL diff --git a/Marlin/src/feature/solenoid.h b/Marlin/src/feature/solenoid.h index 6652b19daa7c..4f867db30099 100644 --- a/Marlin/src/feature/solenoid.h +++ b/Marlin/src/feature/solenoid.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -24,3 +24,4 @@ void enable_solenoid_on_active_extruder(); void disable_all_solenoids(); void enable_solenoid(const uint8_t num); +void disable_solenoid(const uint8_t num); diff --git a/Marlin/src/feature/tmc_util.cpp b/Marlin/src/feature/tmc_util.cpp index 07128df4fcf1..ff477818fe7b 100644 --- a/Marlin/src/feature/tmc_util.cpp +++ b/Marlin/src/feature/tmc_util.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -34,7 +34,14 @@ #if ENABLED(TMC_DEBUG) #include "../module/planner.h" - static bool report_tmc_status; // = false; + #include "../libs/hex_print_routines.h" + #if ENABLED(MONITOR_DRIVER_STATUS) + static uint16_t report_tmc_status_interval; // = 0 + #endif +#endif + +#if HAS_LCD_MENU + #include "../module/stepper.h" #endif /** @@ -48,190 +55,321 @@ struct TMC_driver_data { uint32_t drv_status; - bool is_otpw; - bool is_ot; - bool is_error; + bool is_otpw:1, + is_ot:1, + is_s2g:1, + is_error:1 + #if ENABLED(TMC_DEBUG) + , is_stall:1 + , is_stealth:1 + , is_standstill:1 + #if HAS_STALLGUARD + , sg_result_reasonable:1 + #endif + #endif + ; + #if ENABLED(TMC_DEBUG) + #if HAS_TMCX1X0 || HAS_DRIVER(TMC2208) + uint8_t cs_actual; + #endif + #if HAS_STALLGUARD + uint16_t sg_result; + #endif + #endif }; - #if HAS_DRIVER(TMC2130) + + #if HAS_TMCX1X0 + #if ENABLED(TMC_DEBUG) static uint32_t get_pwm_scale(TMC2130Stepper &st) { return st.PWM_SCALE(); } - static uint8_t get_status_response(TMC2130Stepper &st) { return st.status_response & 0xF; } #endif + static TMC_driver_data get_driver_data(TMC2130Stepper &st) { - constexpr uint32_t OTPW_bm = 0x4000000UL; - constexpr uint8_t OTPW_bp = 26; - constexpr uint32_t OT_bm = 0x2000000UL; - constexpr uint8_t OT_bp = 25; - constexpr uint8_t DRIVER_ERROR_bm = 0x2UL; - constexpr uint8_t DRIVER_ERROR_bp = 1; + constexpr uint16_t SG_RESULT_bm = 0x3FF; // 0:9 + constexpr uint8_t STEALTH_bp = 14, CS_ACTUAL_sb = 16; + constexpr uint32_t CS_ACTUAL_bm = 0x1F0000; // 16:20 + constexpr uint8_t STALL_GUARD_bp = 24, OT_bp = 25, OTPW_bp = 26; + constexpr uint32_t S2G_bm = 0x18000000; + constexpr uint8_t STST_bp = 31; TMC_driver_data data; data.drv_status = st.DRV_STATUS(); - data.is_otpw = (data.drv_status & OTPW_bm) >> OTPW_bp; - data.is_ot = (data.drv_status & OT_bm) >> OT_bp; - data.is_error = (st.status_response & DRIVER_ERROR_bm) >> DRIVER_ERROR_bp; + #ifdef __AVR__ + // 8-bit optimization saves up to 70 bytes of PROGMEM per axis + uint8_t spart; + #if ENABLED(TMC_DEBUG) + data.sg_result = data.drv_status & SG_RESULT_bm; + spart = data.drv_status >> 8; + data.is_stealth = !!(spart & _BV(STEALTH_bp - 8)); + spart = data.drv_status >> 16; + data.cs_actual = spart & (CS_ACTUAL_bm >> 16); + #endif + spart = data.drv_status >> 24; + data.is_ot = !!(spart & _BV(OT_bp - 24)); + data.is_otpw = !!(spart & _BV(OTPW_bp - 24)); + data.is_s2g = !!(spart & (S2G_bm >> 24)); + #if ENABLED(TMC_DEBUG) + data.is_stall = !!(spart & _BV(STALL_GUARD_bp - 24)); + data.is_standstill = !!(spart & _BV(STST_bp - 24)); + data.sg_result_reasonable = !data.is_standstill; // sg_result has no reasonable meaning while standstill + #endif + UNUSED(CS_ACTUAL_sb); + #else // !__AVR__ + + data.is_ot = !!(data.drv_status & _BV(OT_bp)); + data.is_otpw = !!(data.drv_status & _BV(OTPW_bp)); + data.is_s2g = !!(data.drv_status & S2G_bm); + #if ENABLED(TMC_DEBUG) + data.sg_result = data.drv_status & SG_RESULT_bm; + data.is_stealth = !!(data.drv_status & _BV(STEALTH_bp)); + data.cs_actual = (data.drv_status & CS_ACTUAL_bm) >> CS_ACTUAL_sb; + data.is_stall = !!(data.drv_status & _BV(STALL_GUARD_bp)); + data.is_standstill = !!(data.drv_status & _BV(STST_bp)); + data.sg_result_reasonable = !data.is_standstill; // sg_result has no reasonable meaning while standstill + #endif + + #endif // !__AVR__ + return data; } - #endif + + #endif // HAS_TMCX1X0 + #if HAS_DRIVER(TMC2208) + #if ENABLED(TMC_DEBUG) static uint32_t get_pwm_scale(TMC2208Stepper &st) { return st.pwm_scale_sum(); } - static uint8_t get_status_response(TMC2208Stepper &st) { - uint32_t drv_status = st.DRV_STATUS(); - uint8_t gstat = st.GSTAT(); - uint8_t response = 0; - response |= (drv_status >> (31-3)) & 0b1000; - response |= gstat & 0b11; - return response; - } #endif + static TMC_driver_data get_driver_data(TMC2208Stepper &st) { - constexpr uint32_t OTPW_bm = 0b1ul; - constexpr uint8_t OTPW_bp = 0; - constexpr uint32_t OT_bm = 0b10ul; - constexpr uint8_t OT_bp = 1; + constexpr uint8_t OTPW_bp = 0, OT_bp = 1; + constexpr uint8_t S2G_bm = 0b11110; // 2..5 + constexpr uint8_t CS_ACTUAL_sb = 16; + constexpr uint32_t CS_ACTUAL_bm = 0x1F0000; // 16:20 + constexpr uint8_t STEALTH_bp = 30, STST_bp = 31; TMC_driver_data data; data.drv_status = st.DRV_STATUS(); - data.is_otpw = (data.drv_status & OTPW_bm) >> OTPW_bp; - data.is_ot = (data.drv_status & OT_bm) >> OT_bp; - data.is_error = st.drv_err(); + data.is_otpw = !!(data.drv_status & _BV(OTPW_bp)); + data.is_ot = !!(data.drv_status & _BV(OT_bp)); + data.is_s2g = !!(data.drv_status & S2G_bm); + #if ENABLED(TMC_DEBUG) + #ifdef __AVR__ + // 8-bit optimization saves up to 12 bytes of PROGMEM per axis + uint8_t spart = data.drv_status >> 16; + data.cs_actual = spart & (CS_ACTUAL_bm >> 16); + spart = data.drv_status >> 24; + data.is_stealth = !!(spart & _BV(STEALTH_bp - 24)); + data.is_standstill = !!(spart & _BV(STST_bp - 24)); + UNUSED(CS_ACTUAL_sb); + #else + data.cs_actual = (data.drv_status & CS_ACTUAL_bm) >> CS_ACTUAL_sb; + data.is_stealth = !!(data.drv_status & _BV(STEALTH_bp)); + data.is_standstill = !!(data.drv_status & _BV(STST_bp)); + #endif + #if HAS_STALLGUARD + data.sg_result_reasonable = false; + #endif + #endif return data; } - #endif + + #endif // TMC2208 + #if HAS_DRIVER(TMC2660) + #if ENABLED(TMC_DEBUG) static uint32_t get_pwm_scale(TMC2660Stepper) { return 0; } - static uint8_t get_status_response(TMC2660Stepper) { return 0; } #endif + static TMC_driver_data get_driver_data(TMC2660Stepper &st) { - constexpr uint32_t OTPW_bm = 0x4UL; - constexpr uint8_t OTPW_bp = 2; - constexpr uint32_t OT_bm = 0x2UL; - constexpr uint8_t OT_bp = 1; - constexpr uint8_t DRIVER_ERROR_bm = 0x6; + constexpr uint8_t STALL_GUARD_bp = 0; + constexpr uint8_t OT_bp = 1, OTPW_bp = 2; + constexpr uint8_t S2G_bm = 0b11000; + constexpr uint8_t STST_bp = 7, SG_RESULT_sp = 10; + constexpr uint32_t SG_RESULT_bm = 0xFFC00; // 10:19 TMC_driver_data data; data.drv_status = st.DRVSTATUS(); - data.is_otpw = (data.drv_status & OTPW_bm) >> OTPW_bp; - data.is_ot = (data.drv_status & OT_bm) >> OT_bp; - data.is_error = data.drv_status & DRIVER_ERROR_bm; + uint8_t spart = data.drv_status & 0xFF; + data.is_otpw = !!(spart & _BV(OTPW_bp)); + data.is_ot = !!(spart & _BV(OT_bp)); + data.is_s2g = !!(data.drv_status & S2G_bm); + #if ENABLED(TMC_DEBUG) + data.is_stall = !!(spart & _BV(STALL_GUARD_bp)); + data.is_standstill = !!(spart & _BV(STST_bp)); + data.sg_result = (data.drv_status & SG_RESULT_bm) >> SG_RESULT_sp; + data.sg_result_reasonable = true; + #endif return data; } + + #endif // TMC2660 + + #if ENABLED(STOP_ON_ERROR) + void report_driver_error(const TMC_driver_data &data) { + SERIAL_ECHOPGM(" driver error detected: 0x"); + SERIAL_PRINTLN(data.drv_status, HEX); + if (data.is_ot) SERIAL_ECHOLNPGM("overtemperature"); + if (data.is_s2g) SERIAL_ECHOLNPGM("coil short circuit"); + #if ENABLED(TMC_DEBUG) + tmc_report_all(true, true, true, true); + #endif + kill(PSTR("Driver error")); + } #endif template - void monitor_tmc_driver(TMC &st) { - TMC_driver_data data = get_driver_data(st); + void report_driver_otpw(TMC &st) { + char timestamp[14]; + duration_t elapsed = print_job_timer.duration(); + const bool has_days = (elapsed.value > 60*60*24L); + (void)elapsed.toDigital(timestamp, has_days); + SERIAL_EOL(); + SERIAL_ECHO(timestamp); + SERIAL_ECHOPGM(": "); + st.printLabel(); + SERIAL_ECHOPGM(" driver overtemperature warning! ("); + SERIAL_ECHO(st.getMilliamps()); + SERIAL_ECHOLNPGM("mA)"); + } - #if ENABLED(STOP_ON_ERROR) - if (data.is_error) { - SERIAL_EOL(); - st.printLabel(); - SERIAL_ECHOLNPGM(" driver error detected:"); - if (data.is_ot) SERIAL_ECHOLNPGM("overtemperature"); - if (st.s2ga()) SERIAL_ECHOLNPGM("short to ground (coil A)"); - if (st.s2gb()) SERIAL_ECHOLNPGM("short to ground (coil B)"); - #if ENABLED(TMC_DEBUG) - tmc_report_all(); - #endif - kill(PSTR("Driver error")); - } + template + void report_polled_driver_data(TMC &st, const TMC_driver_data &data) { + const uint32_t pwm_scale = get_pwm_scale(st); + st.printLabel(); + SERIAL_CHAR(':'); SERIAL_PRINT(pwm_scale, DEC); + #if ENABLED(TMC_DEBUG) + #if HAS_TMCX1X0 || HAS_DRIVER(TMC2208) + SERIAL_CHAR('/'); SERIAL_PRINT(data.cs_actual, DEC); + #endif + #if HAS_STALLGUARD + SERIAL_CHAR('/'); + if (data.sg_result_reasonable) + SERIAL_ECHO(data.sg_result); + else + SERIAL_CHAR('-'); + #endif #endif + SERIAL_CHAR('|'); + if (st.error_count) SERIAL_CHAR('E'); // Error + if (data.is_ot) SERIAL_CHAR('O'); // Over-temperature + if (data.is_otpw) SERIAL_CHAR('W'); // over-temperature pre-Warning + #if ENABLED(TMC_DEBUG) + if (data.is_stall) SERIAL_CHAR('G'); // stallGuard + if (data.is_stealth) SERIAL_CHAR('T'); // stealthChop + if (data.is_standstill) SERIAL_CHAR('I'); // standstIll + #endif + if (st.flag_otpw) SERIAL_CHAR('F'); // otpw Flag + SERIAL_CHAR('|'); + if (st.otpw_count > 0) SERIAL_PRINT(st.otpw_count, DEC); + SERIAL_CHAR('\t'); + } - // Report if a warning was triggered - if (data.is_otpw && st.otpw_count == 0) { - char timestamp[14]; - duration_t elapsed = print_job_timer.duration(); - const bool has_days = (elapsed.value > 60*60*24L); - (void)elapsed.toDigital(timestamp, has_days); - SERIAL_EOL(); - SERIAL_ECHO(timestamp); - SERIAL_ECHOPGM(": "); - st.printLabel(); - SERIAL_ECHOPGM(" driver overtemperature warning! ("); - SERIAL_ECHO(st.getMilliamps()); - SERIAL_ECHOLNPGM("mA)"); - } - #if CURRENT_STEP_DOWN > 0 - // Decrease current if is_otpw is true and driver is enabled and there's been more than 4 warnings - if (data.is_otpw && st.isEnabled() && st.otpw_count > 4) { - st.rms_current(MAX(int16_t(st.getMilliamps() - (CURRENT_STEP_DOWN)), 0)); - #if ENABLED(REPORT_CURRENT_CHANGE) + template + void monitor_tmc_driver(TMC &st, const bool need_update_error_counters, const bool need_debug_reporting) { + TMC_driver_data data = get_driver_data(st); + if (data.drv_status == 0xFFFFFFFF || data.drv_status == 0x0) return; + + if (need_update_error_counters) { + if (data.is_ot /* | data.s2ga | data.s2gb*/) st.error_count++; + else if (st.error_count > 0) st.error_count--; + + #if ENABLED(STOP_ON_ERROR) + if (st.error_count >= 10) { + SERIAL_EOL(); st.printLabel(); - SERIAL_ECHOLNPAIR(" current decreased to ", st.getMilliamps()); - #endif - } - #endif + report_driver_error(data); + } + #endif + + // Report if a warning was triggered + if (data.is_otpw && st.otpw_count == 0) + report_driver_otpw(st); - if (data.is_otpw) { - st.otpw_count++; - st.flag_otpw = true; + #if CURRENT_STEP_DOWN > 0 + // Decrease current if is_otpw is true and driver is enabled and there's been more than 4 warnings + if (data.is_otpw && st.otpw_count > 4) { + uint16_t I_rms = st.getMilliamps(); + if (st.isEnabled() && I_rms > 100) { + st.rms_current(I_rms - (CURRENT_STEP_DOWN)); + #if ENABLED(REPORT_CURRENT_CHANGE) + st.printLabel(); + SERIAL_ECHOLNPAIR(" current decreased to ", st.getMilliamps()); + #endif + } + } + #endif + + if (data.is_otpw) { + st.otpw_count++; + st.flag_otpw = true; + } + else if (st.otpw_count > 0) st.otpw_count = 0; } - else if (st.otpw_count > 0) st.otpw_count = 0; #if ENABLED(TMC_DEBUG) - if (report_tmc_status) { - const uint32_t pwm_scale = get_pwm_scale(st); - st.printLabel(); - SERIAL_ECHOPAIR(":", pwm_scale); - SERIAL_ECHOPGM(" |0b"); SERIAL_PRINT(get_status_response(st), BIN); - SERIAL_ECHOPGM("| "); - if (data.is_error) SERIAL_CHAR('E'); - else if (data.is_ot) SERIAL_CHAR('O'); - else if (data.is_otpw) SERIAL_CHAR('W'); - else if (st.otpw_count > 0) SERIAL_PRINT(st.otpw_count, DEC); - else if (st.flag_otpw) SERIAL_CHAR('F'); - SERIAL_CHAR('\t'); - } + if (need_debug_reporting) + report_polled_driver_data(st, data); #endif } - #define HAS_HW_COMMS(ST) AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2660) || (AXIS_DRIVER_TYPE(ST, TMC2208) && defined(ST##_HARDWARE_SERIAL)) + #define HAS_HW_COMMS(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) || (AXIS_DRIVER_TYPE(ST, TMC2208) && defined(ST##_HARDWARE_SERIAL)) void monitor_tmc_driver() { - static millis_t next_cOT = 0; - if (ELAPSED(millis(), next_cOT)) { - next_cOT = millis() + 500; + static millis_t next_poll = 0; + const millis_t ms = millis(); + bool need_update_error_counters = ELAPSED(ms, next_poll); + bool need_debug_reporting = false; + if (need_update_error_counters) + next_poll = ms + MONITOR_DRIVER_STATUS_INTERVAL_MS; + #if ENABLED(TMC_DEBUG) + static millis_t next_debug_reporting = 0; + if (report_tmc_status_interval && ELAPSED(ms, next_debug_reporting)) { + need_debug_reporting = true; + next_debug_reporting = ms + report_tmc_status_interval; + } + #endif + if (need_update_error_counters || need_debug_reporting) { #if HAS_HW_COMMS(X) - monitor_tmc_driver(stepperX); + monitor_tmc_driver(stepperX, need_update_error_counters, need_debug_reporting); #endif #if HAS_HW_COMMS(Y) - monitor_tmc_driver(stepperY); + monitor_tmc_driver(stepperY, need_update_error_counters, need_debug_reporting); #endif #if HAS_HW_COMMS(Z) - monitor_tmc_driver(stepperZ); + monitor_tmc_driver(stepperZ, need_update_error_counters, need_debug_reporting); #endif #if HAS_HW_COMMS(X2) - monitor_tmc_driver(stepperX2); + monitor_tmc_driver(stepperX2, need_update_error_counters, need_debug_reporting); #endif #if HAS_HW_COMMS(Y2) - monitor_tmc_driver(stepperY2); + monitor_tmc_driver(stepperY2, need_update_error_counters, need_debug_reporting); #endif #if HAS_HW_COMMS(Z2) - monitor_tmc_driver(stepperZ2); + monitor_tmc_driver(stepperZ2, need_update_error_counters, need_debug_reporting); #endif #if HAS_HW_COMMS(Z3) - monitor_tmc_driver(stepperZ3); + monitor_tmc_driver(stepperZ3, need_update_error_counters, need_debug_reporting); #endif #if HAS_HW_COMMS(E0) - monitor_tmc_driver(stepperE0); + monitor_tmc_driver(stepperE0, need_update_error_counters, need_debug_reporting); #endif #if HAS_HW_COMMS(E1) - monitor_tmc_driver(stepperE1); + monitor_tmc_driver(stepperE1, need_update_error_counters, need_debug_reporting); #endif #if HAS_HW_COMMS(E2) - monitor_tmc_driver(stepperE2); + monitor_tmc_driver(stepperE2, need_update_error_counters, need_debug_reporting); #endif #if HAS_HW_COMMS(E3) - monitor_tmc_driver(stepperE3); + monitor_tmc_driver(stepperE3, need_update_error_counters, need_debug_reporting); #endif #if HAS_HW_COMMS(E4) - monitor_tmc_driver(stepperE4); + monitor_tmc_driver(stepperE4, need_update_error_counters, need_debug_reporting); #endif #if HAS_HW_COMMS(E5) - monitor_tmc_driver(stepperE5); + monitor_tmc_driver(stepperE5, need_update_error_counters, need_debug_reporting); #endif #if ENABLED(TMC_DEBUG) - if (report_tmc_status) SERIAL_EOL(); + if (need_debug_reporting) SERIAL_EOL(); #endif } } @@ -241,12 +379,20 @@ #if ENABLED(TMC_DEBUG) /** - * M122 S[1,0] Enable periodic status reports + * M122 [S<0|1>] [Pnnn] Enable periodic status reports */ #if ENABLED(MONITOR_DRIVER_STATUS) - void tmc_set_report_status(const bool status) { - if ((report_tmc_status = status)) - SERIAL_ECHOLNPGM("axis:pwm_scale |status_response|"); + void tmc_set_report_interval(const uint16_t update_interval) { + if ((report_tmc_status_interval = update_interval)) + SERIAL_ECHOLNPGM("axis:pwm_scale" + #if HAS_STEALTHCHOP + "/current_scale" + #endif + #if HAS_STALLGUARD + "/mech_load" + #endif + "|flags|warncount" + ); } #endif @@ -258,6 +404,7 @@ TMC_MAX_CURRENT, TMC_IRUN, TMC_IHOLD, + TMC_GLOBAL_SCALER, TMC_CS_ACTUAL, TMC_PWM_SCALE, TMC_VSENSE, @@ -296,26 +443,38 @@ TMC_S2VSB, TMC_S2VSA }; - static void drv_status_print_hex(const uint32_t drv_status) { - for (int B = 24; B >= 8; B -= 8){ - SERIAL_PRINT((drv_status >> (B + 4)) & 0xF, HEX); - SERIAL_PRINT((drv_status >> B) & 0xF, HEX); - SERIAL_CHAR(':'); - } - SERIAL_PRINT((drv_status >> 4) & 0xF, HEX); - SERIAL_PRINT((drv_status) & 0xF, HEX); - SERIAL_EOL(); - } + enum TMC_get_registers_enum : char { + TMC_AXIS_CODES, + TMC_GET_GCONF, + TMC_GET_IHOLD_IRUN, + TMC_GET_GSTAT, + TMC_GET_IOIN, + TMC_GET_TPOWERDOWN, + TMC_GET_TSTEP, + TMC_GET_TPWMTHRS, + TMC_GET_TCOOLTHRS, + TMC_GET_THIGH, + TMC_GET_CHOPCONF, + TMC_GET_COOLCONF, + TMC_GET_PWMCONF, + TMC_GET_PWM_SCALE, + TMC_GET_DRV_STATUS, + TMC_GET_DRVCONF, + TMC_GET_DRVCTRL, + TMC_GET_DRVSTATUS, + TMC_GET_SGCSCONF, + TMC_GET_SMARTEN + }; template static void print_vsense(TMC &st) { serialprintPGM(st.vsense() ? PSTR("1=.18") : PSTR("0=.325")); } - #if HAS_DRIVER(TMC2130) + #if HAS_TMCX1X0 static void tmc_status(TMC2130Stepper &st, const TMC_debug_enum i) { switch (i) { case TMC_PWM_SCALE: SERIAL_PRINT(st.PWM_SCALE(), DEC); break; case TMC_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; } } @@ -330,11 +489,32 @@ } #endif + #if HAS_DRIVER(TMC2160) || HAS_DRIVER(TMC5160) + template void print_vsense(TMCMarlin &st) { UNUSED(st); } + template void print_vsense(TMCMarlin &st) { UNUSED(st); } + + static void tmc_status(TMC2160Stepper &st, const TMC_debug_enum i) { + 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: serialprint_truefalse(st.en_pwm_mode()); break; + case TMC_GLOBAL_SCALER: + { + uint16_t value = st.GLOBAL_SCALER(); + SERIAL_PRINT(value ? value : 256, DEC); + SERIAL_ECHOPGM("/256"); + } + break; + default: break; + } + } + #endif + #if HAS_DRIVER(TMC2208) 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; @@ -358,12 +538,12 @@ template static void tmc_status(TMC &st, const TMC_debug_enum i, const float spmm) { - SERIAL_ECHO('\t'); + 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_PROTOCOL(st.rms_current()); 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; case TMC_IRUN: SERIAL_PRINT(st.irun(), DEC); @@ -379,7 +559,12 @@ break; case TMC_VSENSE: print_vsense(st); break; case TMC_MICROSTEPS: SERIAL_ECHO(st.microsteps()); break; - case TMC_TSTEP: SERIAL_ECHO(st.TSTEP()); break; + case TMC_TSTEP: { + uint32_t tstep_value = st.TSTEP(); + if (tstep_value == 0xFFFFF) SERIAL_ECHOPGM("max"); + else SERIAL_ECHO(tstep_value); + } + break; case TMC_TPWMTHRS: { uint32_t tpwmthrs_val = st.TPWMTHRS(); SERIAL_ECHO(tpwmthrs_val); @@ -393,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; @@ -408,12 +593,12 @@ #if HAS_DRIVER(TMC2660) template void tmc_status(TMCMarlin &st, const TMC_debug_enum i, const float) { - SERIAL_ECHO('\t'); + 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_PROTOCOL(st.rms_current()); 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; case TMC_IRUN: SERIAL_PRINT(st.cs(), DEC); @@ -421,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; @@ -445,125 +630,146 @@ case TMC_S2GA: if (st.s2ga()) SERIAL_CHAR('X'); break; case TMC_DRV_OTPW: if (st.otpw()) SERIAL_CHAR('X'); break; case TMC_OT: if (st.ot()) SERIAL_CHAR('X'); break; - case TMC_DRV_STATUS_HEX: + case TMC_DRV_STATUS_HEX: { + const uint32_t drv_status = st.DRV_STATUS(); + SERIAL_CHAR('\t'); st.printLabel(); - SERIAL_ECHOPGM("\t0x"); - drv_status_print_hex(st.DRV_STATUS()); + SERIAL_CHAR('\t'); + print_hex_long(drv_status, ':'); + if (drv_status == 0xFFFFFFFF || drv_status == 0) SERIAL_ECHOPGM("\t Bad response!"); + SERIAL_EOL(); break; + } default: _tmc_parse_drv_status(st, i); break; } } - static void tmc_debug_loop(const TMC_debug_enum i) { - #if AXIS_IS_TMC(X) - tmc_status(stepperX, i, planner.settings.axis_steps_per_mm[X_AXIS]); - #endif - #if AXIS_IS_TMC(X2) - tmc_status(stepperX2, i, planner.settings.axis_steps_per_mm[X_AXIS]); - #endif + static void tmc_debug_loop(const TMC_debug_enum i, const bool print_x, const bool print_y, const bool print_z, const bool print_e) { + if (print_x) { + #if AXIS_IS_TMC(X) + tmc_status(stepperX, i, planner.settings.axis_steps_per_mm[X_AXIS]); + #endif + #if AXIS_IS_TMC(X2) + tmc_status(stepperX2, i, planner.settings.axis_steps_per_mm[X_AXIS]); + #endif + } - #if AXIS_IS_TMC(Y) - tmc_status(stepperY, i, planner.settings.axis_steps_per_mm[Y_AXIS]); - #endif - #if AXIS_IS_TMC(Y2) - tmc_status(stepperY2, i, planner.settings.axis_steps_per_mm[Y_AXIS]); - #endif + if (print_y) { + #if AXIS_IS_TMC(Y) + tmc_status(stepperY, i, planner.settings.axis_steps_per_mm[Y_AXIS]); + #endif + #if AXIS_IS_TMC(Y2) + tmc_status(stepperY2, i, planner.settings.axis_steps_per_mm[Y_AXIS]); + #endif + } - #if AXIS_IS_TMC(Z) - tmc_status(stepperZ, i, planner.settings.axis_steps_per_mm[Z_AXIS]); - #endif - #if AXIS_IS_TMC(Z2) - tmc_status(stepperZ2, i, planner.settings.axis_steps_per_mm[Z_AXIS]); - #endif - #if AXIS_IS_TMC(Z3) - tmc_status(stepperZ3, i, planner.settings.axis_steps_per_mm[Z_AXIS]); - #endif + if (print_z) { + #if AXIS_IS_TMC(Z) + tmc_status(stepperZ, i, planner.settings.axis_steps_per_mm[Z_AXIS]); + #endif + #if AXIS_IS_TMC(Z2) + tmc_status(stepperZ2, i, planner.settings.axis_steps_per_mm[Z_AXIS]); + #endif + #if AXIS_IS_TMC(Z3) + tmc_status(stepperZ3, i, planner.settings.axis_steps_per_mm[Z_AXIS]); + #endif + } - #if AXIS_IS_TMC(E0) - tmc_status(stepperE0, i, planner.settings.axis_steps_per_mm[E_AXIS]); - #endif - #if AXIS_IS_TMC(E1) - tmc_status(stepperE1, i, planner.settings.axis_steps_per_mm[E_AXIS - #if ENABLED(DISTINCT_E_FACTORS) - + 1 - #endif - ]); - #endif - #if AXIS_IS_TMC(E2) - tmc_status(stepperE2, i, planner.settings.axis_steps_per_mm[E_AXIS - #if ENABLED(DISTINCT_E_FACTORS) - + 2 - #endif - ]); - #endif - #if AXIS_IS_TMC(E3) - tmc_status(stepperE3, i, planner.settings.axis_steps_per_mm[E_AXIS - #if ENABLED(DISTINCT_E_FACTORS) - + 3 - #endif - ]); - #endif - #if AXIS_IS_TMC(E4) - tmc_status(stepperE4, i, planner.settings.axis_steps_per_mm[E_AXIS - #if ENABLED(DISTINCT_E_FACTORS) - + 4 - #endif - ]); - #endif - #if AXIS_IS_TMC(E5) - tmc_status(stepperE5, i, planner.settings.axis_steps_per_mm[E_AXIS - #if ENABLED(DISTINCT_E_FACTORS) - + 5 - #endif - ]); - #endif + if (print_e) { + #if AXIS_IS_TMC(E0) + tmc_status(stepperE0, i, planner.settings.axis_steps_per_mm[E_AXIS]); + #endif + #if AXIS_IS_TMC(E1) + tmc_status(stepperE1, i, planner.settings.axis_steps_per_mm[E_AXIS + #if ENABLED(DISTINCT_E_FACTORS) + + 1 + #endif + ]); + #endif + #if AXIS_IS_TMC(E2) + tmc_status(stepperE2, i, planner.settings.axis_steps_per_mm[E_AXIS + #if ENABLED(DISTINCT_E_FACTORS) + + 2 + #endif + ]); + #endif + #if AXIS_IS_TMC(E3) + tmc_status(stepperE3, i, planner.settings.axis_steps_per_mm[E_AXIS + #if ENABLED(DISTINCT_E_FACTORS) + + 3 + #endif + ]); + #endif + #if AXIS_IS_TMC(E4) + tmc_status(stepperE4, i, planner.settings.axis_steps_per_mm[E_AXIS + #if ENABLED(DISTINCT_E_FACTORS) + + 4 + #endif + ]); + #endif + #if AXIS_IS_TMC(E5) + tmc_status(stepperE5, i, planner.settings.axis_steps_per_mm[E_AXIS + #if ENABLED(DISTINCT_E_FACTORS) + + 5 + #endif + ]); + #endif + } SERIAL_EOL(); } - static void drv_status_loop(const TMC_drv_status_enum i) { - #if AXIS_IS_TMC(X) - tmc_parse_drv_status(stepperX, i); - #endif - #if AXIS_IS_TMC(X2) - tmc_parse_drv_status(stepperX2, i); - #endif + static void drv_status_loop(const TMC_drv_status_enum i, const bool print_x, const bool print_y, const bool print_z, const bool print_e) { + if (print_x) { + #if AXIS_IS_TMC(X) + tmc_parse_drv_status(stepperX, i); + #endif + #if AXIS_IS_TMC(X2) + tmc_parse_drv_status(stepperX2, i); + #endif + } - #if AXIS_IS_TMC(Y) - tmc_parse_drv_status(stepperY, i); - #endif - #if AXIS_IS_TMC(Y2) - tmc_parse_drv_status(stepperY2, i); - #endif + if (print_y) { + #if AXIS_IS_TMC(Y) + tmc_parse_drv_status(stepperY, i); + #endif + #if AXIS_IS_TMC(Y2) + tmc_parse_drv_status(stepperY2, i); + #endif + } - #if AXIS_IS_TMC(Z) - tmc_parse_drv_status(stepperZ, i); - #endif - #if AXIS_IS_TMC(Z2) - tmc_parse_drv_status(stepperZ2, i); - #endif - #if AXIS_IS_TMC(Z3) - tmc_parse_drv_status(stepperZ3, i); - #endif + if (print_z) { + #if AXIS_IS_TMC(Z) + tmc_parse_drv_status(stepperZ, i); + #endif + #if AXIS_IS_TMC(Z2) + tmc_parse_drv_status(stepperZ2, i); + #endif + #if AXIS_IS_TMC(Z3) + tmc_parse_drv_status(stepperZ3, i); + #endif + } - #if AXIS_IS_TMC(E0) - tmc_parse_drv_status(stepperE0, i); - #endif - #if AXIS_IS_TMC(E1) - tmc_parse_drv_status(stepperE1, i); - #endif - #if AXIS_IS_TMC(E2) - tmc_parse_drv_status(stepperE2, i); - #endif - #if AXIS_IS_TMC(E3) - tmc_parse_drv_status(stepperE3, i); - #endif - #if AXIS_IS_TMC(E4) - tmc_parse_drv_status(stepperE4, i); - #endif - #if AXIS_IS_TMC(E5) - tmc_parse_drv_status(stepperE5, i); - #endif + if (print_e) { + #if AXIS_IS_TMC(E0) + tmc_parse_drv_status(stepperE0, i); + #endif + #if AXIS_IS_TMC(E1) + tmc_parse_drv_status(stepperE1, i); + #endif + #if AXIS_IS_TMC(E2) + tmc_parse_drv_status(stepperE2, i); + #endif + #if AXIS_IS_TMC(E3) + tmc_parse_drv_status(stepperE3, i); + #endif + #if AXIS_IS_TMC(E4) + tmc_parse_drv_status(stepperE4, i); + #endif + #if AXIS_IS_TMC(E5) + tmc_parse_drv_status(stepperE5, i); + #endif + } SERIAL_EOL(); } @@ -572,9 +778,9 @@ * M122 report functions */ - void tmc_report_all() { - #define TMC_REPORT(LABEL, ITEM) do{ SERIAL_ECHOPGM(LABEL); tmc_debug_loop(ITEM); }while(0) - #define DRV_REPORT(LABEL, ITEM) do{ SERIAL_ECHOPGM(LABEL); drv_status_loop(ITEM); }while(0) + void tmc_report_all(bool print_x, const bool print_y, const bool print_z, const bool print_e) { + #define TMC_REPORT(LABEL, ITEM) do{ SERIAL_ECHOPGM(LABEL); tmc_debug_loop(ITEM, print_x, print_y, print_z, print_e); }while(0) + #define DRV_REPORT(LABEL, ITEM) do{ SERIAL_ECHOPGM(LABEL); drv_status_loop(ITEM, print_x, print_y, print_z, print_e); }while(0) TMC_REPORT("\t", TMC_CODES); TMC_REPORT("Enabled\t", TMC_ENABLED); TMC_REPORT("Set current", TMC_CURRENT); @@ -582,6 +788,9 @@ TMC_REPORT("MAX current", TMC_MAX_CURRENT); TMC_REPORT("Run current", TMC_IRUN); TMC_REPORT("Hold current", TMC_IHOLD); + #if HAS_DRIVER(TMC2160) || HAS_DRIVER(TMC5160) + TMC_REPORT("Global scaler", TMC_GLOBAL_SCALER); + #endif TMC_REPORT("CS actual\t", TMC_CS_ACTUAL); TMC_REPORT("PWM scale", TMC_PWM_SCALE); TMC_REPORT("vsense\t", TMC_VSENSE); @@ -602,7 +811,7 @@ TMC_REPORT("Stallguard thrs", TMC_SGT); DRV_REPORT("DRVSTATUS", TMC_DRV_CODES); - #if HAS_DRIVER(TMC2130) + #if HAS_TMCX1X0 DRV_REPORT("stallguard\t", TMC_STALLGUARD); DRV_REPORT("sg_result\t", TMC_SG_RESULT); DRV_REPORT("fsactive\t", TMC_FSACTIVE); @@ -626,20 +835,158 @@ SERIAL_EOL(); } + #define PRINT_TMC_REGISTER(REG_CASE) case TMC_GET_##REG_CASE: print_hex_long(st.REG_CASE(), ':'); break + + #if HAS_TMCX1X0 + static void tmc_get_ic_registers(TMC2130Stepper &st, const TMC_get_registers_enum i) { + switch (i) { + PRINT_TMC_REGISTER(TCOOLTHRS); + PRINT_TMC_REGISTER(THIGH); + PRINT_TMC_REGISTER(COOLCONF); + default: SERIAL_CHAR('\t'); break; + } + } + #endif + #if HAS_DRIVER(TMC2208) + static void tmc_get_ic_registers(TMC2208Stepper, const TMC_get_registers_enum) { SERIAL_CHAR('\t'); } + #endif + + #if HAS_TRINAMIC + template + static void tmc_get_registers(TMC &st, const TMC_get_registers_enum i) { + switch (i) { + case TMC_AXIS_CODES: SERIAL_CHAR('\t'); st.printLabel(); break; + PRINT_TMC_REGISTER(GCONF); + PRINT_TMC_REGISTER(IHOLD_IRUN); + PRINT_TMC_REGISTER(GSTAT); + PRINT_TMC_REGISTER(IOIN); + PRINT_TMC_REGISTER(TPOWERDOWN); + PRINT_TMC_REGISTER(TSTEP); + PRINT_TMC_REGISTER(TPWMTHRS); + PRINT_TMC_REGISTER(CHOPCONF); + PRINT_TMC_REGISTER(PWMCONF); + PRINT_TMC_REGISTER(PWM_SCALE); + PRINT_TMC_REGISTER(DRV_STATUS); + default: tmc_get_ic_registers(st, i); break; + } + SERIAL_CHAR('\t'); + } + #endif + #if HAS_DRIVER(TMC2660) + template + static void tmc_get_registers(TMCMarlin &st, const TMC_get_registers_enum i) { + switch (i) { + case TMC_AXIS_CODES: SERIAL_CHAR('\t'); st.printLabel(); break; + PRINT_TMC_REGISTER(DRVCONF); + PRINT_TMC_REGISTER(DRVCTRL); + PRINT_TMC_REGISTER(CHOPCONF); + PRINT_TMC_REGISTER(DRVSTATUS); + PRINT_TMC_REGISTER(SGCSCONF); + PRINT_TMC_REGISTER(SMARTEN); + default: SERIAL_CHAR('\t'); break; + } + SERIAL_CHAR('\t'); + } + #endif + + static void tmc_get_registers(TMC_get_registers_enum i, const bool print_x, const bool print_y, const bool print_z, const bool print_e) { + if (print_x) { + #if AXIS_IS_TMC(X) + tmc_get_registers(stepperX, i); + #endif + #if AXIS_IS_TMC(X2) + tmc_get_registers(stepperX2, i); + #endif + } + + if (print_y) { + #if AXIS_IS_TMC(Y) + tmc_get_registers(stepperY, i); + #endif + #if AXIS_IS_TMC(Y2) + tmc_get_registers(stepperY2, i); + #endif + } + + if (print_z) { + #if AXIS_IS_TMC(Z) + tmc_get_registers(stepperZ, i); + #endif + #if AXIS_IS_TMC(Z2) + tmc_get_registers(stepperZ2, i); + #endif + #if AXIS_IS_TMC(Z3) + tmc_get_registers(stepperZ3, i); + #endif + } + + if (print_e) { + #if AXIS_IS_TMC(E0) + tmc_get_registers(stepperE0, i); + #endif + #if AXIS_IS_TMC(E1) + tmc_get_registers(stepperE1, i); + #endif + #if AXIS_IS_TMC(E2) + tmc_get_registers(stepperE2, i); + #endif + #if AXIS_IS_TMC(E3) + tmc_get_registers(stepperE3, i); + #endif + #if AXIS_IS_TMC(E4) + tmc_get_registers(stepperE4, i); + #endif + #if AXIS_IS_TMC(E5) + tmc_get_registers(stepperE5, i); + #endif + } + + SERIAL_EOL(); + } + + void tmc_get_registers(bool print_x, bool print_y, bool print_z, bool print_e) { + #define _TMC_GET_REG(LABEL, ITEM) do{ SERIAL_ECHOPGM(LABEL); tmc_get_registers(ITEM, print_x, print_y, print_z, print_e); }while(0) + #define TMC_GET_REG(NAME, TABS) _TMC_GET_REG(STRINGIFY(NAME) TABS, TMC_GET_##NAME) + _TMC_GET_REG("\t", TMC_AXIS_CODES); + TMC_GET_REG(GCONF, "\t\t"); + TMC_GET_REG(IHOLD_IRUN, "\t"); + TMC_GET_REG(GSTAT, "\t\t"); + TMC_GET_REG(IOIN, "\t\t"); + TMC_GET_REG(TPOWERDOWN, "\t"); + TMC_GET_REG(TSTEP, "\t\t"); + TMC_GET_REG(TPWMTHRS, "\t"); + TMC_GET_REG(TCOOLTHRS, "\t"); + TMC_GET_REG(THIGH, "\t\t"); + TMC_GET_REG(CHOPCONF, "\t"); + TMC_GET_REG(COOLCONF, "\t"); + TMC_GET_REG(PWMCONF, "\t"); + TMC_GET_REG(PWM_SCALE, "\t"); + TMC_GET_REG(DRV_STATUS, "\t"); + } + #endif // TMC_DEBUG #if USE_SENSORLESS - void tmc_stallguard(TMC2130Stepper &st, const bool enable/*=true*/) { - st.TCOOLTHRS(enable ? 0xFFFFF : 0); - #if ENABLED(STEALTHCHOP) - st.en_pwm_mode(!enable); - #endif - st.diag1_stall(enable ? 1 : 0); + bool tmc_enable_stallguard(TMC2130Stepper &st) { + bool stealthchop_was_enabled = st.en_pwm_mode(); + + st.TCOOLTHRS(0xFFFFF); + st.en_pwm_mode(false); + st.diag1_stall(true); + + return stealthchop_was_enabled; } - void tmc_sensorless_homing(TMC2660Stepper &st, const bool enable) { + void tmc_disable_stallguard(TMC2130Stepper &st, const bool restore_stealth) { + st.TCOOLTHRS(0); + st.en_pwm_mode(restore_stealth); + st.diag1_stall(false); + } + bool tmc_enable_stallguard(TMC2660Stepper) { // TODO + return false; } + void tmc_disable_stallguard(TMC2660Stepper, const bool) {}; #endif // USE_SENSORLESS @@ -688,4 +1035,128 @@ } #endif // TMC_HAS_SPI +template +static bool test_connection(TMC &st) { + SERIAL_ECHOPGM("Testing "); + st.printLabel(); + SERIAL_ECHOPGM(" connection... "); + const uint8_t test_result = st.test_connection(); + + if (test_result > 0) SERIAL_ECHOPGM("Error: All "); + + const char *stat; + switch (test_result) { + default: + case 0: stat = PSTR("OK"); break; + case 1: stat = PSTR("HIGH"); break; + case 2: stat = PSTR("LOW"); break; + } + serialprintPGM(stat); + SERIAL_EOL(); + + return test_result; +} + +void test_tmc_connection(const bool test_x, const bool test_y, const bool test_z, const bool test_e) { + uint8_t axis_connection = 0; + + if (test_x) { + #if AXIS_IS_TMC(X) + axis_connection += test_connection(stepperX); + #endif + #if AXIS_IS_TMC(X2) + axis_connection += test_connection(stepperX2); + #endif + } + + if (test_y) { + #if AXIS_IS_TMC(Y) + axis_connection += test_connection(stepperY); + #endif + #if AXIS_IS_TMC(Y2) + axis_connection += test_connection(stepperY2); + #endif + } + + if (test_z) { + #if AXIS_IS_TMC(Z) + axis_connection += test_connection(stepperZ); + #endif + #if AXIS_IS_TMC(Z2) + axis_connection += test_connection(stepperZ2); + #endif + #if AXIS_IS_TMC(Z3) + axis_connection += test_connection(stepperZ3); + #endif + } + + if (test_e) { + #if AXIS_IS_TMC(E0) + axis_connection += test_connection(stepperE0); + #endif + #if AXIS_IS_TMC(E1) + axis_connection += test_connection(stepperE1); + #endif + #if AXIS_IS_TMC(E2) + axis_connection += test_connection(stepperE2); + #endif + #if AXIS_IS_TMC(E3) + axis_connection += test_connection(stepperE3); + #endif + #if AXIS_IS_TMC(E4) + axis_connection += test_connection(stepperE4); + #endif + #if AXIS_IS_TMC(E5) + axis_connection += test_connection(stepperE5); + #endif + } + + if (axis_connection) ui.set_status_P(PSTR("TMC CONNECTION ERROR")); +} + +#if HAS_LCD_MENU + + void init_tmc_section() { + #if AXIS_IS_TMC(X) + stepperX.init_lcd_variables(X_AXIS); + #endif + #if AXIS_IS_TMC(Y) + stepperY.init_lcd_variables(Y_AXIS); + #endif + #if AXIS_IS_TMC(Z) + stepperZ.init_lcd_variables(Z_AXIS); + #endif + #if AXIS_IS_TMC(X2) + stepperX2.init_lcd_variables(X_AXIS); + #endif + #if AXIS_IS_TMC(Y2) + stepperY2.init_lcd_variables(Y_AXIS); + #endif + #if AXIS_IS_TMC(Z2) + stepperZ2.init_lcd_variables(Z_AXIS); + #endif + #if AXIS_IS_TMC(Z3) + stepperZ3.init_lcd_variables(Z_AXIS); + #endif + #if AXIS_IS_TMC(E0) + stepperE0.init_lcd_variables(E_AXIS); + #endif + #if AXIS_IS_TMC(E1) + stepperE1.init_lcd_variables(E_AXIS_N(1)); + #endif + #if AXIS_IS_TMC(E2) + stepperE2.init_lcd_variables(E_AXIS_N(2)); + #endif + #if AXIS_IS_TMC(E3) + stepperE3.init_lcd_variables(E_AXIS_N(3)); + #endif + #if AXIS_IS_TMC(E4) + stepperE4.init_lcd_variables(E_AXIS_N(4)); + #endif + #if AXIS_IS_TMC(E5) + stepperE5.init_lcd_variables(E_AXIS_N(5)); + #endif + } +#endif + #endif // HAS_TRINAMIC diff --git a/Marlin/src/feature/tmc_util.h b/Marlin/src/feature/tmc_util.h index 015c82c49938..132efbb79e9e 100644 --- a/Marlin/src/feature/tmc_util.h +++ b/Marlin/src/feature/tmc_util.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -22,9 +22,13 @@ #pragma once #include "../inc/MarlinConfig.h" +#include "../lcd/ultralcd.h" #if HAS_TRINAMIC #include #endif +#if HAS_LCD_MENU + #include "../module/planner.h" +#endif #define TMC_X_LABEL 'X', '0' #define TMC_Y_LABEL 'Y', '0' @@ -42,28 +46,56 @@ #define TMC_E4_LABEL 'E', '4' #define TMC_E5_LABEL 'E', '5' +#define CHOPPER_DEFAULT_12V { 3, -1, 1 } +#define CHOPPER_DEFAULT_19V { 4, 1, 1 } +#define CHOPPER_DEFAULT_24V { 4, 2, 1 } +#define CHOPPER_DEFAULT_36V { 5, 2, 4 } +#define CHOPPER_PRUSAMK3_24V { 4, 1, 4 } +#define CHOPPER_MARLIN_119 { 5, 2, 3 } + +#if ENABLED(MONITOR_DRIVER_STATUS) && !defined(MONITOR_DRIVER_STATUS_INTERVAL_MS) + #define MONITOR_DRIVER_STATUS_INTERVAL_MS 500u +#endif + +constexpr uint16_t _tmc_thrs(const uint16_t msteps, const int32_t thrs, const uint32_t spmm) { + return 12650000UL * msteps / (256 * thrs * spmm); +} + template class TMCStorage { protected: // Only a child class has access to constructor => Don't create on its own! "Poor man's abstract class" TMCStorage() {} + public: uint16_t val_mA = 0; - public: #if ENABLED(MONITOR_DRIVER_STATUS) - uint8_t otpw_count = 0; + uint8_t otpw_count = 0, + error_count = 0; bool flag_otpw = false; - bool getOTPW() { return flag_otpw; } - void clear_otpw() { flag_otpw = 0; } + inline bool getOTPW() { return flag_otpw; } + inline void clear_otpw() { flag_otpw = 0; } #endif - uint16_t getMilliamps() { return val_mA; } + inline uint16_t getMilliamps() { return val_mA; } - void printLabel() { + inline void printLabel() { SERIAL_CHAR(AXIS_LETTER); if (DRIVER_ID > '0') SERIAL_CHAR(DRIVER_ID); } + + struct { + #if HAS_STEALTHCHOP + bool stealthChop_enabled = false; + #endif + #if ENABLED(HYBRID_THRESHOLD) + uint8_t hybrid_thrs = 0; + #endif + #if ENABLED(SENSORLESS_HOMING) + int8_t homing_thrs = 0; + #endif + } stored; }; template @@ -75,15 +107,41 @@ class TMCMarlin : public TMC, public TMCStorage { TMCMarlin(uint16_t CS, float RS, uint16_t pinMOSI, uint16_t pinMISO, uint16_t pinSCK) : TMC(CS, RS, pinMOSI, pinMISO, pinSCK) {} - uint16_t rms_current() { return TMC::rms_current(); } - void rms_current(uint16_t mA) { + inline uint16_t rms_current() { return TMC::rms_current(); } + inline void rms_current(uint16_t mA) { this->val_mA = mA; TMC::rms_current(mA); } - void rms_current(uint16_t mA, float mult) { + inline void rms_current(uint16_t mA, float mult) { this->val_mA = mA; TMC::rms_current(mA, mult); } + + #if HAS_STEALTHCHOP + inline void refresh_stepping_mode() { this->en_pwm_mode(this->stored.stealthChop_enabled); } + inline bool get_stealthChop_status() { return this->en_pwm_mode(); } + #endif + + #if HAS_LCD_MENU + + inline void init_lcd_variables(const AxisEnum spmm_id) { + #if ENABLED(HYBRID_THRESHOLD) + this->stored.hybrid_thrs = _tmc_thrs(this->microsteps(), this->TPWMTHRS(), planner.settings.axis_steps_per_mm[spmm_id]); + #endif + #if ENABLED(SENSORLESS_HOMING) + this->stored.homing_thrs = this->sgt(); + #endif + } + + inline void refresh_stepper_current() { rms_current(this->val_mA); } + + #if ENABLED(HYBRID_THRESHOLD) + inline void refresh_hybrid_thrs(float spmm) { this->TPWMTHRS(_tmc_thrs(this->microsteps(), this->stored.hybrid_thrs, spmm)); } + #endif + #if ENABLED(SENSORLESS_HOMING) + inline void refresh_homing_thrs() { this->sgt(this->stored.homing_thrs); } + #endif + #endif }; template class TMCMarlin : public TMC2208Stepper, public TMCStorage { @@ -95,19 +153,64 @@ class TMCMarlin : public TMC2208Stepper, TMC2208Stepper(RX, TX, RS, has_rx=true) {} uint16_t rms_current() { return TMC2208Stepper::rms_current(); } - void rms_current(uint16_t mA) { + inline void rms_current(uint16_t mA) { this->val_mA = mA; TMC2208Stepper::rms_current(mA); } - void rms_current(uint16_t mA, float mult) { + inline void rms_current(uint16_t mA, float mult) { this->val_mA = mA; TMC2208Stepper::rms_current(mA, mult); } + + #if HAS_STEALTHCHOP + inline void refresh_stepping_mode() { en_spreadCycle(!this->stored.stealthChop_enabled); } + inline bool get_stealthChop_status() { return !this->en_spreadCycle(); } + #endif + + #if HAS_LCD_MENU + + inline void init_lcd_variables(const AxisEnum spmm_id) { + #if ENABLED(HYBRID_THRESHOLD) + this->stored.hybrid_thrs = _tmc_thrs(this->microsteps(), this->TPWMTHRS(), planner.settings.axis_steps_per_mm[spmm_id]); + #endif + } + + inline void refresh_stepper_current() { rms_current(this->val_mA); } + + #if ENABLED(HYBRID_THRESHOLD) + inline void refresh_hybrid_thrs(float spmm) { this->TPWMTHRS(_tmc_thrs(this->microsteps(), this->stored.hybrid_thrs, spmm)); } + #endif + #endif }; +template +class TMCMarlin : public TMC2660Stepper, public TMCStorage { + public: + TMCMarlin(uint16_t cs_pin, float RS) : + TMC2660Stepper(cs_pin, RS) + {} + TMCMarlin(uint16_t CS, float RS, uint16_t pinMOSI, uint16_t pinMISO, uint16_t pinSCK) : + TMC2660Stepper(CS, RS, pinMOSI, pinMISO, pinSCK) + {} + inline uint16_t rms_current() { return TMC2660Stepper::rms_current(); } + inline void rms_current(uint16_t mA) { + this->val_mA = mA; + TMC2660Stepper::rms_current(mA); + } -constexpr uint32_t _tmc_thrs(const uint16_t msteps, const int32_t thrs, const uint32_t spmm) { - return 12650000UL * msteps / (256 * thrs * spmm); -} + #if HAS_LCD_MENU + inline void init_lcd_variables(const AxisEnum spmm_id) { + #if ENABLED(SENSORLESS_HOMING) + this->stored.homing_thrs = this->sgt(); + #endif + } + + inline void refresh_stepper_current() { rms_current(this->val_mA); } + + #if ENABLED(SENSORLESS_HOMING) + inline void refresh_homing_thrs() { this->sgt(this->stored.homing_thrs); } + #endif + #endif +}; template void tmc_get_current(TMC &st) { @@ -118,12 +221,13 @@ template void tmc_set_current(TMC &st, const int mA) { st.rms_current(mA); } + #if ENABLED(MONITOR_DRIVER_STATUS) template void tmc_report_otpw(TMC &st) { st.printLabel(); SERIAL_ECHOPGM(" temperature prewarn triggered: "); - serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false")); + serialprint_truefalse(st.getOTPW()); SERIAL_EOL(); } template @@ -154,12 +258,18 @@ void tmc_set_sgt(TMC &st, const int8_t sgt_val) { } void monitor_tmc_driver(); +void test_tmc_connection(const bool test_x, const bool test_y, const bool test_z, const bool test_e); #if ENABLED(TMC_DEBUG) #if ENABLED(MONITOR_DRIVER_STATUS) - void tmc_set_report_status(const bool status); + void tmc_set_report_interval(const uint16_t update_interval); #endif - void tmc_report_all(); + void tmc_report_all(const bool print_x, const bool print_y, const bool print_z, const bool print_e); + void tmc_get_registers(const bool print_x, const bool print_y, const bool print_z, const bool print_e); +#endif + +#if HAS_LCD_MENU + void init_tmc_section(); #endif /** @@ -170,8 +280,16 @@ void monitor_tmc_driver(); * Defined here because of limitations with templates and headers. */ #if USE_SENSORLESS - void tmc_stallguard(TMC2130Stepper &st, const bool enable=true); - void tmc_stallguard(TMC2660Stepper &st, const bool enable=true); + // Track enabled status of stealthChop and only re-enable where applicable + struct sensorless_t { + bool x, y, z, x2, y2, z2, z3; + }; + + bool tmc_enable_stallguard(TMC2130Stepper &st); + void tmc_disable_stallguard(TMC2130Stepper &st, const bool restore_stealth); + + bool tmc_enable_stallguard(TMC2660Stepper); + void tmc_disable_stallguard(TMC2660Stepper, const bool); #endif #if TMC_HAS_SPI diff --git a/Marlin/src/feature/twibus.cpp b/Marlin/src/feature/twibus.cpp index ef1fa742a04f..826b71416793 100644 --- a/Marlin/src/feature/twibus.cpp +++ b/Marlin/src/feature/twibus.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -44,8 +44,7 @@ void TWIBus::reset() { void TWIBus::address(const uint8_t adr) { if (!WITHIN(adr, 8, 127)) { - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM("Bad I2C address (8-127)"); + SERIAL_ECHO_MSG("Bad I2C address (8-127)"); } this->addr = adr; @@ -82,7 +81,7 @@ void TWIBus::send() { debug(PSTR("send"), this->addr); #endif - Wire.beginTransmission(this->addr); + Wire.beginTransmission(I2C_ADDRESS(this->addr)); Wire.write(this->buffer, this->buffer_s); Wire.endTransmission(); @@ -93,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/feature/twibus.h b/Marlin/src/feature/twibus.h index 449cf7f691e6..9dcc86b7bee7 100644 --- a/Marlin/src/feature/twibus.h +++ b/Marlin/src/feature/twibus.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/bedlevel/G26.cpp b/Marlin/src/gcode/bedlevel/G26.cpp index 65a777d41340..cdc2b7478eab 100644 --- a/Marlin/src/gcode/bedlevel/G26.cpp +++ b/Marlin/src/gcode/bedlevel/G26.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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,18 +542,20 @@ 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_PROTOCOLLNPGM("?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(); if (!WITHIN(g26_layer_height, 0.0, 2.0)) { - SERIAL_PROTOCOLLNPGM("?Specified layer height not plausible."); + SERIAL_ECHOLNPGM("?Specified layer height not plausible."); return; } } @@ -590,20 +564,20 @@ void GcodeSuite::G26() { if (parser.has_value()) { g26_retraction_multiplier = parser.value_float(); if (!WITHIN(g26_retraction_multiplier, 0.05, 15.0)) { - SERIAL_PROTOCOLLNPGM("?Specified Retraction Multiplier not plausible."); + SERIAL_ECHOLNPGM("?Specified Retraction Multiplier not plausible."); return; } } else { - SERIAL_PROTOCOLLNPGM("?Retraction Multiplier must be specified."); + SERIAL_ECHOLNPGM("?Retraction Multiplier must be specified."); return; } } if (parser.seenval('S')) { g26_nozzle = parser.value_float(); - if (!WITHIN(g26_nozzle, 0.1, 1.0)) { - SERIAL_PROTOCOLLNPGM("?Specified nozzle size not plausible."); + if (!WITHIN(g26_nozzle, 0.1, 2.0)) { + SERIAL_ECHOLNPGM("?Specified nozzle size not plausible."); return; } } @@ -613,7 +587,7 @@ void GcodeSuite::G26() { #if HAS_LCD_MENU g26_prime_flag = -1; #else - SERIAL_PROTOCOLLNPGM("?Prime length must be specified when not using an LCD."); + SERIAL_ECHOLNPGM("?Prime length must be specified when not using an LCD."); return; #endif } @@ -621,7 +595,7 @@ void GcodeSuite::G26() { g26_prime_flag++; g26_prime_length = parser.value_linear_units(); if (!WITHIN(g26_prime_length, 0.0, 25.0)) { - SERIAL_PROTOCOLLNPGM("?Specified prime length not plausible."); + SERIAL_ECHOLNPGM("?Specified prime length not plausible."); return; } } @@ -630,7 +604,7 @@ void GcodeSuite::G26() { if (parser.seenval('F')) { g26_filament_diameter = parser.value_linear_units(); if (!WITHIN(g26_filament_diameter, 1.0, 4.0)) { - SERIAL_PROTOCOLLNPGM("?Specified filament size not plausible."); + SERIAL_ECHOLNPGM("?Specified filament size not plausible."); return; } } @@ -642,8 +616,8 @@ void GcodeSuite::G26() { if (parser.seenval('H')) { g26_hotend_temp = parser.value_celsius(); - if (!WITHIN(g26_hotend_temp, 165, 280)) { - SERIAL_PROTOCOLLNPGM("?Specified nozzle temperature not plausible."); + if (!WITHIN(g26_hotend_temp, 165, (HEATER_0_MAXTEMP - 15))) { + SERIAL_ECHOLNPGM("?Specified nozzle temperature not plausible."); return; } } @@ -659,21 +633,21 @@ void GcodeSuite::G26() { g26_repeats = parser.intval('R', GRID_MAX_POINTS + 1); #else if (!parser.seen('R')) { - SERIAL_PROTOCOLLNPGM("?(R)epeat must be specified when not using an LCD."); + SERIAL_ECHOLNPGM("?(R)epeat must be specified when not using an LCD."); return; } else g26_repeats = parser.has_value() ? parser.value_int() : GRID_MAX_POINTS + 1; #endif if (g26_repeats < 1) { - SERIAL_PROTOCOLLNPGM("?(R)epeat value not plausible; must be at least 1."); + SERIAL_ECHOLNPGM("?(R)epeat value not plausible; must be at least 1."); return; } g26_x_pos = parser.seenval('X') ? RAW_X_POSITION(parser.value_linear_units()) : current_position[X_AXIS]; g26_y_pos = parser.seenval('Y') ? RAW_Y_POSITION(parser.value_linear_units()) : current_position[Y_AXIS]; if (!position_is_reachable(g26_x_pos, g26_y_pos)) { - SERIAL_PROTOCOLLNPGM("?Specified X,Y coordinate out of bounds."); + SERIAL_ECHOLNPGM("?Specified X,Y coordinate out of bounds."); 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/G42.cpp b/Marlin/src/gcode/bedlevel/G42.cpp index 727e4cf1da89..914d898fa64d 100644 --- a/Marlin/src/gcode/bedlevel/G42.cpp +++ b/Marlin/src/gcode/bedlevel/G42.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/bedlevel/M420.cpp b/Marlin/src/gcode/bedlevel/M420.cpp index 33f464efe2ca..f87c60fecb7b 100644 --- a/Marlin/src/gcode/bedlevel/M420.cpp +++ b/Marlin/src/gcode/bedlevel/M420.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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); @@ -95,13 +99,13 @@ void GcodeSuite::M420() { const int16_t a = settings.calc_num_meshes(); if (!a) { - SERIAL_PROTOCOLLNPGM("?EEPROM storage not available."); + SERIAL_ECHOLNPGM("?EEPROM storage not available."); return; } if (!WITHIN(storage_slot, 0, a - 1)) { - SERIAL_PROTOCOLLNPGM("?Invalid storage slot."); - SERIAL_PROTOCOLLNPAIR("?Use 0 to ", a - 1); + SERIAL_ECHOLNPGM("?Invalid storage slot."); + SERIAL_ECHOLNPAIR("?Use 0 to ", a - 1); return; } @@ -110,7 +114,7 @@ void GcodeSuite::M420() { #else - SERIAL_PROTOCOLLNPGM("?EEPROM storage not available."); + SERIAL_ECHOLNPGM("?EEPROM storage not available."); return; #endif @@ -126,61 +130,74 @@ void GcodeSuite::M420() { #endif // AUTO_BED_LEVELING_UBL + const bool seenV = parser.seen('V'); + #if HAS_MESH - // Subtract the given value or the mean from all mesh values - if (leveling_is_valid() && parser.seen('C')) { - const float cval = parser.value_float(); - #if ENABLED(AUTO_BED_LEVELING_UBL) + if (leveling_is_valid()) { - set_bed_leveling_enabled(false); - ubl.adjust_mesh_to_mean(true, cval); + // Subtract the given value or the mean from all mesh values + if (parser.seen('C')) { + const float cval = parser.value_float(); + #if ENABLED(AUTO_BED_LEVELING_UBL) - #else + set_bed_leveling_enabled(false); + ubl.adjust_mesh_to_mean(true, cval); - #if ENABLED(M420_C_USE_MEAN) + #else - // Get the sum and average of all mesh values - float mesh_sum = 0; - for (uint8_t x = GRID_MAX_POINTS_X; x--;) - for (uint8_t y = GRID_MAX_POINTS_Y; y--;) - mesh_sum += Z_VALUES(x, y); - const float zmean = mesh_sum / float(GRID_MAX_POINTS); + #if ENABLED(M420_C_USE_MEAN) - #else + // Get the sum and average of all mesh values + float mesh_sum = 0; + for (uint8_t x = GRID_MAX_POINTS_X; x--;) + for (uint8_t y = GRID_MAX_POINTS_Y; y--;) + mesh_sum += Z_VALUES(x, y); + const float zmean = mesh_sum / float(GRID_MAX_POINTS); - // Find the low and high mesh values - float lo_val = 100, hi_val = -100; - for (uint8_t x = GRID_MAX_POINTS_X; x--;) - for (uint8_t y = GRID_MAX_POINTS_Y; y--;) { - const float z = Z_VALUES(x, y); - NOMORE(lo_val, z); - NOLESS(hi_val, z); - } - // Take the mean of the lowest and highest - const float zmean = (lo_val + hi_val) / 2.0 + cval; + #else - #endif + // Find the low and high mesh values + float lo_val = 100, hi_val = -100; + for (uint8_t x = GRID_MAX_POINTS_X; x--;) + for (uint8_t y = GRID_MAX_POINTS_Y; y--;) { + const float z = Z_VALUES(x, y); + NOMORE(lo_val, z); + NOLESS(hi_val, z); + } + // Take the mean of the lowest and highest + const float zmean = (lo_val + hi_val) / 2.0 + cval; - // If not very close to 0, adjust the mesh - if (!NEAR_ZERO(zmean)) { - set_bed_leveling_enabled(false); - // Subtract the mean from all values - for (uint8_t x = GRID_MAX_POINTS_X; x--;) - for (uint8_t y = GRID_MAX_POINTS_Y; y--;) - Z_VALUES(x, y) -= zmean; - #if ENABLED(ABL_BILINEAR_SUBDIVISION) - bed_level_virt_interpolate(); #endif - } - #endif + // If not very close to 0, adjust the mesh + if (!NEAR_ZERO(zmean)) { + set_bed_leveling_enabled(false); + // Subtract the mean from all values + for (uint8_t x = GRID_MAX_POINTS_X; x--;) + for (uint8_t y = GRID_MAX_POINTS_Y; y--;) + Z_VALUES(x, y) -= zmean; + #if ENABLED(ABL_BILINEAR_SUBDIVISION) + bed_level_virt_interpolate(); + #endif + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onMeshUpdate(x, y, Z_VALUES(x, y)); + #endif + } + + #endif + } + + } + else if (to_enable || seenV) { + SERIAL_ECHO_MSG("Invalid mesh."); + goto EXIT_M420; } #endif // HAS_MESH // V to print the matrix or mesh - if (parser.seen('V')) { + if (seenV) { #if ABL_PLANAR planner.bed_level_matrix.debug(PSTR("Bed Level Correction Matrix:")); #else @@ -205,11 +222,13 @@ void GcodeSuite::M420() { // Enable leveling if specified, or if previously active set_bed_leveling_enabled(to_enable); + #if HAS_MESH + EXIT_M420: + #endif + // Error if leveling failed to enable or reenable - if (to_enable && !planner.leveling_active) { - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM(MSG_ERR_M420_FAILED); - } + if (to_enable && !planner.leveling_active) + SERIAL_ERROR_MSG(MSG_ERR_M420_FAILED); SERIAL_ECHO_START(); SERIAL_ECHOPGM("Bed Leveling "); diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index ecc21969230f..675cd2b88ec6 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -26,7 +26,7 @@ #include "../../../inc/MarlinConfig.h" -#if OLDSCHOOL_ABL +#if HAS_ABL_NOT_UBL #include "../../gcode.h" #include "../../../feature/bedlevel/bedlevel.h" @@ -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 @@ -293,15 +291,13 @@ G29_TYPE GcodeSuite::G29() { const bool seen_w = parser.seen('W'); if (seen_w) { if (!leveling_is_valid()) { - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM("No bilinear grid"); + SERIAL_ERROR_MSG("No bilinear grid"); G29_RETURN(false); } const float rz = parser.seenval('Z') ? RAW_Z_POSITION(parser.value_linear_units()) : current_position[Z_AXIS]; if (!WITHIN(rz, -10, 10)) { - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM("Bad Z value"); + SERIAL_ERROR_MSG("Bad Z value"); G29_RETURN(false); } @@ -323,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(); } @@ -343,7 +342,7 @@ G29_TYPE GcodeSuite::G29() { verbose_level = parser.intval('V'); if (!WITHIN(verbose_level, 0, 4)) { - SERIAL_PROTOCOLLNPGM("?(V)erbose level is implausible (0-4)."); + SERIAL_ECHOLNPGM("?(V)erbose level is implausible (0-4)."); G29_RETURN(false); } @@ -364,11 +363,11 @@ G29_TYPE GcodeSuite::G29() { if (parser.seenval('P')) abl_grid_points_x = abl_grid_points_y = parser.value_int(); if (!WITHIN(abl_grid_points_x, 2, GRID_MAX_POINTS_X)) { - SERIAL_PROTOCOLLNPGM("?Probe points (X) is implausible (2-" STRINGIFY(GRID_MAX_POINTS_X) ")."); + SERIAL_ECHOLNPGM("?Probe points (X) is implausible (2-" STRINGIFY(GRID_MAX_POINTS_X) ")."); G29_RETURN(false); } if (!WITHIN(abl_grid_points_y, 2, GRID_MAX_POINTS_Y)) { - SERIAL_PROTOCOLLNPGM("?Probe points (Y) is implausible (2-" STRINGIFY(GRID_MAX_POINTS_Y) ")."); + SERIAL_ECHOLNPGM("?Probe points (Y) is implausible (2-" STRINGIFY(GRID_MAX_POINTS_Y) ")."); G29_RETURN(false); } @@ -387,10 +386,10 @@ G29_TYPE GcodeSuite::G29() { if (parser.seen('H')) { const int16_t size = (int16_t)parser.value_linear_units(); - left_probe_bed_position = MAX((MIN_PROBE_X + MAX_PROBE_X - size) / 2, MIN_PROBE_X); - right_probe_bed_position = MIN(left_probe_bed_position + size, MAX_PROBE_X); - front_probe_bed_position = MAX((MIN_PROBE_Y + MAX_PROBE_Y - size) / 2, MIN_PROBE_Y); - back_probe_bed_position = MIN(front_probe_bed_position + size, MAX_PROBE_Y); + left_probe_bed_position = MAX(X_CENTER - size / 2, MIN_PROBE_X); + right_probe_bed_position = MIN(left_probe_bed_position + size, MAX_PROBE_X); + front_probe_bed_position = MAX(Y_CENTER - size / 2, MIN_PROBE_Y); + back_probe_bed_position = MIN(front_probe_bed_position + size, MAX_PROBE_Y); } else { left_probe_bed_position = parser.seenval('L') ? (int)RAW_X_POSITION(parser.value_linear_units()) : LEFT_PROBE_BED_POSITION; @@ -410,7 +409,7 @@ G29_TYPE GcodeSuite::G29() { || !position_is_reachable_by_probe(right_probe_bed_position, back_probe_bed_position) #endif ) { - SERIAL_PROTOCOLLNPGM("? (L,R,F,B) out of bounds."); + SERIAL_ECHOLNPGM("? (L,R,F,B) out of bounds."); G29_RETURN(false); } @@ -421,8 +420,8 @@ G29_TYPE GcodeSuite::G29() { #endif // ABL_GRID if (verbose_level > 0) { - SERIAL_PROTOCOLPGM("G29 Auto Bed Leveling"); - if (dryrun) SERIAL_PROTOCOLPGM(" (DRYRUN)"); + SERIAL_ECHOPGM("G29 Auto Bed Leveling"); + if (dryrun) SERIAL_ECHOPGM(" (DRYRUN)"); SERIAL_EOL(); } @@ -469,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,9 +488,9 @@ G29_TYPE GcodeSuite::G29() { // Abort current G29 procedure, go back to idle state if (seenA && g29_in_progress) { - SERIAL_PROTOCOLLNPGM("Manual G29 aborted"); + 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; @@ -504,13 +501,13 @@ G29_TYPE GcodeSuite::G29() { // Query G29 status if (verbose_level || seenQ) { - SERIAL_PROTOCOLPGM("Manual G29 "); + SERIAL_ECHOPGM("Manual G29 "); if (g29_in_progress) { - SERIAL_PROTOCOLPAIR("point ", MIN(abl_probe_index + 1, abl_points)); - SERIAL_PROTOCOLLNPAIR(" of ", abl_points); + SERIAL_ECHOPAIR("point ", MIN(abl_probe_index + 1, abl_points)); + SERIAL_ECHOLNPAIR(" of ", abl_points); } else - SERIAL_PROTOCOLLNPGM("idle"); + SERIAL_ECHOLNPGM("idle"); } if (no_action) G29_RETURN(false); @@ -518,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 @@ -550,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_PROTOCOLPAIR("Save X", xCount); - SERIAL_PROTOCOLPAIR(" Y", yCount); - SERIAL_PROTOCOLLNPAIR(" 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 } @@ -609,11 +603,11 @@ G29_TYPE GcodeSuite::G29() { // Leveling done! Fall through to G29 finishing code below - SERIAL_PROTOCOLLNPGM("Grid probing done."); + SERIAL_ECHOLNPGM("Grid probing done."); // Re-enable software endstops, if needed #if HAS_SOFTWARE_ENDSTOPS - soft_endstops_enabled = enable_soft_endstops; + soft_endstops_enabled = saved_soft_endstops_state; #endif } @@ -633,11 +627,11 @@ G29_TYPE GcodeSuite::G29() { } else { - SERIAL_PROTOCOLLNPGM("3-point probing done."); + SERIAL_ECHOLNPGM("3-point probing done."); // 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) { @@ -725,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 @@ -783,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; @@ -829,18 +824,12 @@ G29_TYPE GcodeSuite::G29() { mean /= abl_points; if (verbose_level) { - SERIAL_PROTOCOLPGM("Eqn coefficients: a: "); - SERIAL_PROTOCOL_F(plane_equation_coefficients[0], 8); - SERIAL_PROTOCOLPGM(" b: "); - SERIAL_PROTOCOL_F(plane_equation_coefficients[1], 8); - SERIAL_PROTOCOLPGM(" d: "); - SERIAL_PROTOCOL_F(plane_equation_coefficients[2], 8); + SERIAL_ECHOPAIR_F("Eqn coefficients: a: ", plane_equation_coefficients[0], 8); + SERIAL_ECHOPAIR_F(" b: ", plane_equation_coefficients[1], 8); + SERIAL_ECHOPAIR_F(" d: ", plane_equation_coefficients[2], 8); + if (verbose_level > 2) + SERIAL_ECHOPAIR_F("\nMean of sampled points: ", mean, 8); SERIAL_EOL(); - if (verbose_level > 2) { - SERIAL_PROTOCOLPGM("Mean of sampled points: "); - SERIAL_PROTOCOL_F(mean, 8); - SERIAL_EOL(); - } } // Create the matrix but don't correct the position yet @@ -852,7 +841,7 @@ G29_TYPE GcodeSuite::G29() { // Show the Topography map if enabled if (do_topography_map) { - SERIAL_PROTOCOLLNPGM("\nBed Height Topography:\n" + SERIAL_ECHOLNPGM("\nBed Height Topography:\n" " +--- BACK --+\n" " | |\n" " L | (+) | R\n" @@ -879,17 +868,17 @@ G29_TYPE GcodeSuite::G29() { NOMORE(min_diff, eqnBVector[ind] - z_tmp); if (diff >= 0.0) - SERIAL_PROTOCOLPGM(" +"); // Include + for column alignment + SERIAL_ECHOPGM(" +"); // Include + for column alignment else - SERIAL_PROTOCOLCHAR(' '); - SERIAL_PROTOCOL_F(diff, 5); + SERIAL_CHAR(' '); + SERIAL_ECHO_F(diff, 5); } // xx SERIAL_EOL(); } // yy SERIAL_EOL(); if (verbose_level > 3) { - SERIAL_PROTOCOLLNPGM("\nCorrected Bed Height vs. Bed Topology:"); + SERIAL_ECHOLNPGM("\nCorrected Bed Height vs. Bed Topology:"); for (int8_t yy = abl_grid_points_y - 1; yy >= 0; yy--) { for (uint8_t xx = 0; xx < abl_grid_points_x; xx++) { @@ -902,11 +891,11 @@ G29_TYPE GcodeSuite::G29() { float diff = eqnBVector[ind] - z_tmp - min_diff; if (diff >= 0.0) - SERIAL_PROTOCOLPGM(" +"); + SERIAL_ECHOPGM(" +"); // Include + for column alignment else - SERIAL_PROTOCOLCHAR(' '); - SERIAL_PROTOCOL_F(diff, 5); + SERIAL_CHAR(' '); + SERIAL_ECHO_F(diff, 5); } // xx SERIAL_EOL(); } // yy @@ -928,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); @@ -944,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 @@ -995,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); @@ -1013,4 +984,4 @@ G29_TYPE GcodeSuite::G29() { G29_RETURN(isnan(measured_z)); } -#endif // OLDSCHOOL_ABL +#endif // HAS_ABL_NOT_UBL diff --git a/Marlin/src/gcode/bedlevel/abl/M421.cpp b/Marlin/src/gcode/bedlevel/abl/M421.cpp index 8f3683af8c40..cba905b4fb42 100644 --- a/Marlin/src/gcode/bedlevel/abl/M421.cpp +++ b/Marlin/src/gcode/bedlevel/abl/M421.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -45,19 +45,18 @@ void GcodeSuite::M421() { hasZ = parser.seen('Z'), hasQ = !hasZ && parser.seen('Q'); - if (!hasI || !hasJ || !(hasZ || hasQ)) { - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM(MSG_ERR_M421_PARAMETERS); - } - else if (!WITHIN(ix, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(iy, 0, GRID_MAX_POINTS_Y - 1)) { - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM(MSG_ERR_MESH_XY); - } + if (!hasI || !hasJ || !(hasZ || hasQ)) + 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 { z_values[ix][iy] = parser.value_linear_units() + (hasQ ? z_values[ix][iy] : 0); #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 8643712d2c85..15fbf8212806 100644 --- a/Marlin/src/gcode/bedlevel/mbl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/mbl/G29.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -39,7 +39,7 @@ #include "../../../module/stepper.h" // Save 130 bytes with non-duplication of PSTR -inline void echo_not_entered(const char c) { SERIAL_CHAR(c); SERIAL_PROTOCOLLNPGM(" not entered."); } +inline void echo_not_entered(const char c) { SERIAL_CHAR(c); SERIAL_ECHOLNPGM(" not entered."); } /** * G29: Mesh-based Z probe, probes a grid and produces a @@ -59,12 +59,12 @@ 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); if (!WITHIN(state, 0, 5)) { - SERIAL_PROTOCOLLNPGM("S out of range (0-5)."); + SERIAL_ECHOLNPGM("S out of range (0-5)."); return; } @@ -72,13 +72,13 @@ void GcodeSuite::G29() { switch (state) { case MeshReport: - SERIAL_PROTOCOLPGM("Mesh Bed Leveling "); + SERIAL_ECHOPGM("Mesh Bed Leveling "); if (leveling_is_valid()) { serialprintln_onoff(planner.leveling_active); mbl.report_mesh(); } else - SERIAL_PROTOCOLLNPGM("has no data."); + SERIAL_ECHOLNPGM("has no data."); break; case MeshStart: @@ -92,14 +92,14 @@ void GcodeSuite::G29() { case MeshNext: if (mbl_probe_index < 0) { - SERIAL_PROTOCOLLNPGM("Start mesh probing with \"G29 S1\" first."); + SERIAL_ECHOLNPGM("Start mesh probing with \"G29 S1\" first."); return; } // For each G29 S2... 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. @@ -130,7 +130,7 @@ void GcodeSuite::G29() { // After recording the last point, activate home and activate mbl_probe_index = -1; - SERIAL_PROTOCOLLNPGM("Mesh probing done."); + SERIAL_ECHOLNPGM("Mesh probing done."); BUZZ(100, 659); BUZZ(100, 698); @@ -154,8 +154,8 @@ void GcodeSuite::G29() { if (parser.seenval('I')) { ix = parser.value_int(); if (!WITHIN(ix, 0, GRID_MAX_POINTS_X - 1)) { - SERIAL_PROTOCOLPAIR("I out of range (0-", int(GRID_MAX_POINTS_X - 1)); - SERIAL_PROTOCOLLNPGM(")"); + SERIAL_ECHOPAIR("I out of range (0-", int(GRID_MAX_POINTS_X - 1)); + SERIAL_ECHOLNPGM(")"); return; } } @@ -165,16 +165,20 @@ void GcodeSuite::G29() { if (parser.seenval('J')) { iy = parser.value_int(); if (!WITHIN(iy, 0, GRID_MAX_POINTS_Y - 1)) { - SERIAL_PROTOCOLPAIR("J out of range (0-", int(GRID_MAX_POINTS_Y - 1)); - SERIAL_PROTOCOLLNPGM(")"); + SERIAL_ECHOPAIR("J out of range (0-", int(GRID_MAX_POINTS_Y - 1)); + SERIAL_ECHOLNPGM(")"); return; } } 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; @@ -193,8 +197,8 @@ void GcodeSuite::G29() { } // switch(state) if (state == MeshNext) { - SERIAL_PROTOCOLPAIR("MBL G29 point ", MIN(mbl_probe_index, GRID_MAX_POINTS)); - SERIAL_PROTOCOLLNPAIR(" of ", int(GRID_MAX_POINTS)); + SERIAL_ECHOPAIR("MBL G29 point ", MIN(mbl_probe_index, GRID_MAX_POINTS)); + SERIAL_ECHOLNPAIR(" of ", int(GRID_MAX_POINTS)); } report_current_position(); diff --git a/Marlin/src/gcode/bedlevel/mbl/M421.cpp b/Marlin/src/gcode/bedlevel/mbl/M421.cpp index 3e0cd7f01631..06f175882a67 100644 --- a/Marlin/src/gcode/bedlevel/mbl/M421.cpp +++ b/Marlin/src/gcode/bedlevel/mbl/M421.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -48,14 +48,10 @@ void GcodeSuite::M421() { const int8_t iy = hasJ ? parser.value_int() : hasY ? mbl.probe_index_y(RAW_Y_POSITION(parser.value_linear_units())) : -1; const bool hasZ = parser.seen('Z'), hasQ = !hasZ && parser.seen('Q'); - if (int(hasI && hasJ) + int(hasX && hasY) != 1 || !(hasZ || hasQ)) { - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM(MSG_ERR_M421_PARAMETERS); - } - else if (ix < 0 || iy < 0) { - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM(MSG_ERR_MESH_XY); - } + if (int(hasI && hasJ) + int(hasX && hasY) != 1 || !(hasZ || hasQ)) + SERIAL_ERROR_MSG(MSG_ERR_M421_PARAMETERS); + else if (ix < 0 || iy < 0) + SERIAL_ERROR_MSG(MSG_ERR_MESH_XY); else mbl.set_z(ix, iy, parser.value_linear_units() + (hasQ ? mbl.z_values[ix][iy] : 0)); } diff --git a/Marlin/src/gcode/bedlevel/ubl/G29.cpp b/Marlin/src/gcode/bedlevel/ubl/G29.cpp index 1dbf2dfe4145..1019d7cd2417 100644 --- a/Marlin/src/gcode/bedlevel/ubl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/ubl/G29.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/bedlevel/ubl/M421.cpp b/Marlin/src/gcode/bedlevel/ubl/M421.cpp index e8597eee22cd..1bb34eafa257 100644 --- a/Marlin/src/gcode/bedlevel/ubl/M421.cpp +++ b/Marlin/src/gcode/bedlevel/ubl/M421.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 * @@ -56,16 +60,16 @@ void GcodeSuite::M421() { iy = location.y_index; } - if (int(hasC) + int(hasI && hasJ) != 1 || !(hasZ || hasQ || hasN)) { - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM(MSG_ERR_M421_PARAMETERS); - } - else if (!WITHIN(ix, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(iy, 0, GRID_MAX_POINTS_Y - 1)) { - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM(MSG_ERR_MESH_XY); - } - else + if (int(hasC) + int(hasI && hasJ) != 1 || !(hasZ || hasQ || hasN)) + 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 { 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 29a0e6552c7f..1a6922cfa443 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -43,8 +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() { @@ -67,8 +78,15 @@ fr_mm_s = MIN(homing_feedrate(X_AXIS), homing_feedrate(Y_AXIS)) * SQRT(sq(mlratio) + 1.0); #if ENABLED(SENSORLESS_HOMING) - sensorless_homing_per_axis(X_AXIS); - sensorless_homing_per_axis(Y_AXIS); + sensorless_t stealth_states { false, false, false, false, false, false, false }; + stealth_states.x = tmc_enable_stallguard(stepperX); + stealth_states.y = tmc_enable_stallguard(stepperY); + #if AXIS_HAS_STALLGUARD(X2) + stealth_states.x2 = tmc_enable_stallguard(stepperX2); + #endif + #if AXIS_HAS_STALLGUARD(Y2) + stealth_states.y2 = tmc_enable_stallguard(stepperY2); + #endif #endif do_blocking_move_to_xy(1.5 * mlx * x_axis_home_dir, 1.5 * mly * home_dir(Y_AXIS), fr_mm_s); @@ -78,8 +96,14 @@ current_position[X_AXIS] = current_position[Y_AXIS] = 0.0; #if ENABLED(SENSORLESS_HOMING) - sensorless_homing_per_axis(X_AXIS, false); - sensorless_homing_per_axis(Y_AXIS, false); + tmc_disable_stallguard(stepperX, stealth_states.x); + tmc_disable_stallguard(stepperY, stealth_states.y); + #if AXIS_HAS_STALLGUARD(X2) + tmc_disable_stallguard(stepperX2, stealth_states.x2); + #endif + #if AXIS_HAS_STALLGUARD(Y2) + tmc_disable_stallguard(stepperY2, stealth_states.y2); + #endif #endif } @@ -92,14 +116,11 @@ // Disallow Z homing if X or Y are unknown if (!TEST(axis_known_position, X_AXIS) || !TEST(axis_known_position, Y_AXIS)) { LCD_MESSAGEPGM(MSG_ERR_Z_HOMING); - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM(MSG_ERR_Z_HOMING); + SERIAL_ECHO_MSG(MSG_ERR_Z_HOMING); 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(); @@ -117,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) @@ -135,13 +154,10 @@ } else { LCD_MESSAGEPGM(MSG_ZPROBE_OUT); - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM(MSG_ZPROBE_OUT); + 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 @@ -166,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; @@ -185,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 @@ -200,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; } } @@ -232,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 @@ -243,14 +249,12 @@ 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 setup_for_endstop_or_probe_move(); - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> endstops.enable(true)"); - #endif + endstops.enable(true); // Enable endstops for next homing move #if ENABLED(DELTA) @@ -263,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 @@ -280,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 ) { @@ -345,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 @@ -361,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(); @@ -402,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 @@ -417,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 @@ -430,15 +441,21 @@ 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"); + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< G28"); + + #if HAS_DRIVER(L6470) + // Set L6470 absolute position registers to counts + for (uint8_t j = 1; j <= L6470::chain[0]; j++) { + const uint8_t cv = L6470::chain[j]; + L6470.set_param(cv, L6470_ABS_POS, stepper.position((AxisEnum)L6470.axis_xref[cv])); + } #endif } diff --git a/Marlin/src/gcode/calibrate/G33.cpp b/Marlin/src/gcode/calibrate/G33.cpp index 359f7dfe30d8..b3488766b6fc 100644 --- a/Marlin/src/gcode/calibrate/G33.cpp +++ b/Marlin/src/gcode/calibrate/G33.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -109,28 +109,28 @@ void ac_cleanup( } void print_signed_float(PGM_P const prefix, const float &f) { - SERIAL_PROTOCOLPGM(" "); + SERIAL_ECHOPGM(" "); serialprintPGM(prefix); - SERIAL_PROTOCOLCHAR(':'); + SERIAL_CHAR(':'); if (f >= 0) SERIAL_CHAR('+'); - SERIAL_PROTOCOL_F(f, 2); + SERIAL_ECHO_F(f, 2); } /** * - Print the delta settings */ static void print_calibration_settings(const bool end_stops, const bool tower_angles) { - SERIAL_PROTOCOLPAIR(".Height:", delta_height); + SERIAL_ECHOPAIR(".Height:", delta_height); if (end_stops) { print_signed_float(PSTR("Ex"), delta_endstop_adj[A_AXIS]); print_signed_float(PSTR("Ey"), delta_endstop_adj[B_AXIS]); print_signed_float(PSTR("Ez"), delta_endstop_adj[C_AXIS]); } if (end_stops && tower_angles) { - SERIAL_PROTOCOLPAIR(" Radius:", delta_radius); + SERIAL_ECHOPAIR(" Radius:", delta_radius); SERIAL_EOL(); SERIAL_CHAR('.'); - SERIAL_PROTOCOL_SP(13); + SERIAL_ECHO_SP(13); } if (tower_angles) { print_signed_float(PSTR("Tx"), delta_tower_angle_trim[A_AXIS]); @@ -138,14 +138,8 @@ static void print_calibration_settings(const bool end_stops, const bool tower_an print_signed_float(PSTR("Tz"), delta_tower_angle_trim[C_AXIS]); } if ((!end_stops && tower_angles) || (end_stops && !tower_angles)) { // XOR - SERIAL_PROTOCOLPAIR(" Radius:", delta_radius); + SERIAL_ECHOPAIR(" Radius:", delta_radius); } - #if HAS_BED_PROBE - if (!end_stops && !tower_angles) { - SERIAL_PROTOCOL_SP(30); - print_signed_float(PSTR("Offset"), zprobe_zoffset); - } - #endif SERIAL_EOL(); } @@ -153,7 +147,7 @@ static void print_calibration_settings(const bool end_stops, const bool tower_an * - Print the probe results */ static void print_calibration_results(const float z_pt[NPP + 1], const bool tower_points, const bool opposite_points) { - SERIAL_PROTOCOLPGM(". "); + SERIAL_ECHOPGM(". "); print_signed_float(PSTR("c"), z_pt[CEN]); if (tower_points) { print_signed_float(PSTR(" x"), z_pt[__A]); @@ -163,7 +157,7 @@ static void print_calibration_results(const float z_pt[NPP + 1], const bool towe if (tower_points && opposite_points) { SERIAL_EOL(); SERIAL_CHAR('.'); - SERIAL_PROTOCOL_SP(13); + SERIAL_ECHO_SP(13); } if (opposite_points) { print_signed_float(PSTR("yz"), z_pt[_BC]); @@ -194,30 +188,19 @@ static float std_dev_points(float z_pt[NPP + 1], const bool _0p_cal, const bool /** * - Probe a point */ -static float calibration_probe(const float &nx, const float &ny, const bool stow, const bool set_up) { +static float calibration_probe(const float &nx, const float &ny, const bool stow) { #if HAS_BED_PROBE - return probe_pt(nx, ny, set_up ? PROBE_PT_BIG_RAISE : stow ? PROBE_PT_STOW : PROBE_PT_RAISE, 0, false); + return probe_pt(nx, ny, stow ? PROBE_PT_STOW : PROBE_PT_RAISE, 0, false); #else UNUSED(stow); - UNUSED(set_up); return lcd_probe_pt(nx, ny); #endif } -#if HAS_BED_PROBE && HAS_LCD_MENU - static float probe_z_shift(const float center) { - STOW_PROBE(); - endstops.enable_z_probe(false); - float z_shift = lcd_probe_pt(0, 0) - center; - endstops.enable_z_probe(true); - return z_shift; - } -#endif - /** * - Probe a grid */ -static bool probe_calibration_points(float z_pt[NPP + 1], const int8_t probe_points, const bool towers_set, const bool stow_after_each, const bool set_up) { +static bool probe_calibration_points(float z_pt[NPP + 1], const int8_t probe_points, const bool towers_set, const bool stow_after_each) { const bool _0p_calibration = probe_points == 0, _1p_calibration = probe_points == 1 || probe_points == -1, _4p_calibration = probe_points == 2, @@ -240,7 +223,7 @@ static bool probe_calibration_points(float z_pt[NPP + 1], const int8_t probe_poi if (!_0p_calibration) { if (!_7p_no_intermediates && !_7p_4_intermediates && !_7p_11_intermediates) { // probe the center - z_pt[CEN] += calibration_probe(0, 0, stow_after_each, set_up); + z_pt[CEN] += calibration_probe(0, 0, stow_after_each); if (isnan(z_pt[CEN])) return false; } @@ -250,7 +233,7 @@ static bool probe_calibration_points(float z_pt[NPP + 1], const int8_t probe_poi I_LOOP_CAL_PT(rad, start, steps) { const float a = RADIANS(210 + (360 / NPP) * (rad - 1)), r = delta_calibration_radius * 0.1; - z_pt[CEN] += calibration_probe(cos(a) * r, sin(a) * r, stow_after_each, set_up); + z_pt[CEN] += calibration_probe(cos(a) * r, sin(a) * r, stow_after_each); if (isnan(z_pt[CEN])) return false; } z_pt[CEN] /= float(_7p_2_intermediates ? 7 : probe_points); @@ -274,7 +257,7 @@ static bool probe_calibration_points(float z_pt[NPP + 1], const int8_t probe_poi const float a = RADIANS(210 + (360 / NPP) * (rad - 1)), r = delta_calibration_radius * (1 - 0.1 * (zig_zag ? offset - circle : circle)), interpol = FMOD(rad, 1); - const float z_temp = calibration_probe(cos(a) * r, sin(a) * r, stow_after_each, set_up); + const float z_temp = calibration_probe(cos(a) * r, sin(a) * r, stow_after_each); if (isnan(z_temp)) return false; // split probe point to neighbouring calibration points z_pt[uint8_t(LROUND(rad - interpol + NPP - 1)) % NPP + 1] += z_temp * sq(cos(RADIANS(interpol * 90))); @@ -403,10 +386,7 @@ static float auto_tune_a() { * * Parameters: * - * S Setup mode; disables probe protection - * * Pn Number of probe points: - * P-1 Checks the z_offset with a center probe and paper test. * P0 Normalizes calibration. * P1 Calibrates height only with center probe. * P2 Probe center and towers. Calibrate height, endstops and delta radius. @@ -429,49 +409,34 @@ static float auto_tune_a() { */ void GcodeSuite::G33() { - const bool set_up = - #if HAS_BED_PROBE - parser.seen('S'); - #else - false; - #endif - - const int8_t probe_points = set_up ? 2 : parser.intval('P', DELTA_CALIBRATION_DEFAULT_POINTS); - if (!WITHIN(probe_points, -1, 10)) { - SERIAL_PROTOCOLLNPGM("?(P)oints is implausible (-1 - 10)."); + const int8_t probe_points = parser.intval('P', DELTA_CALIBRATION_DEFAULT_POINTS); + if (!WITHIN(probe_points, 0, 10)) { + SERIAL_ECHOLNPGM("?(P)oints is implausible (0-10)."); return; } const bool towers_set = !parser.seen('T'); - const float calibration_precision = set_up ? Z_CLEARANCE_BETWEEN_PROBES / 5.0 : parser.floatval('C', 0.0); + const float calibration_precision = parser.floatval('C', 0.0); if (calibration_precision < 0) { - SERIAL_PROTOCOLLNPGM("?(C)alibration precision is implausible (>=0)."); + SERIAL_ECHOLNPGM("?(C)alibration precision is implausible (>=0)."); return; } const int8_t force_iterations = parser.intval('F', 0); if (!WITHIN(force_iterations, 0, 30)) { - SERIAL_PROTOCOLLNPGM("?(F)orce iteration is implausible (0 - 30)."); + SERIAL_ECHOLNPGM("?(F)orce iteration is implausible (0-30)."); return; } const int8_t verbose_level = parser.byteval('V', 1); if (!WITHIN(verbose_level, 0, 3)) { - SERIAL_PROTOCOLLNPGM("?(V)erbose level is implausible (0 - 3)."); + SERIAL_ECHOLNPGM("?(V)erbose level is implausible (0-3)."); return; } const bool stow_after_each = parser.seen('E'); - if (set_up) { - delta_height = 999.99; - delta_radius = DELTA_PRINTABLE_RADIUS; - ZERO(delta_endstop_adj); - ZERO(delta_tower_angle_trim); - recalc_delta_settings(); - } - const bool _0p_calibration = probe_points == 0, _1p_calibration = probe_points == 1 || probe_points == -1, _4p_calibration = probe_points == 2, @@ -503,14 +468,14 @@ void GcodeSuite::G33() { delta_tower_angle_trim[C_AXIS] }; - SERIAL_PROTOCOLLNPGM("G33 Auto Calibrate"); + SERIAL_ECHOLNPGM("G33 Auto Calibrate"); if (!_1p_calibration && !_0p_calibration) { // test if the outer radius is reachable LOOP_CAL_RAD(axis) { const float a = RADIANS(210 + (360 / NPP) * (axis - 1)), r = delta_calibration_radius; if (!position_is_reachable(cos(a) * r, sin(a) * r)) { - SERIAL_PROTOCOLLNPGM("?(M665 B)ed radius is implausible."); + SERIAL_ECHOLNPGM("?(M665 B)ed radius is implausible."); return; } } @@ -519,8 +484,7 @@ void GcodeSuite::G33() { // Report settings PGM_P checkingac = PSTR("Checking... AC"); serialprintPGM(checkingac); - if (verbose_level == 0) SERIAL_PROTOCOLPGM(" (DRY-RUN)"); - if (set_up) SERIAL_PROTOCOLPGM(" (SET-UP)"); + if (verbose_level == 0) SERIAL_ECHOPGM(" (DRY-RUN)"); SERIAL_EOL(); ui.set_status_P(checkingac); @@ -539,8 +503,8 @@ void GcodeSuite::G33() { // Probe the points zero_std_dev_old = zero_std_dev; - if (!probe_calibration_points(z_at_pt, probe_points, towers_set, stow_after_each, set_up)) { - SERIAL_PROTOCOLLNPGM("Correct delta settings with M665 and M666"); + if (!probe_calibration_points(z_at_pt, probe_points, towers_set, stow_after_each)) { + SERIAL_ECHOLNPGM("Correct delta settings with M665 and M666"); return AC_CLEANUP(); } zero_std_dev = std_dev_points(z_at_pt, _0p_calibration, _1p_calibration, _4p_calibration, _4p_opposite_points); @@ -587,11 +551,6 @@ void GcodeSuite::G33() { delta_calibration_radius = cr_old; switch (probe_points) { - case -1: - #if HAS_BED_PROBE && HAS_LCD_MENU - zprobe_zoffset += probe_z_shift(z_at_pt[CEN]); - #endif - case 0: test_precision = 0.00; // forced end break; @@ -665,16 +624,15 @@ void GcodeSuite::G33() { if (verbose_level != 0) { // !dry run if ((zero_std_dev >= test_precision && iterations > force_iterations) || zero_std_dev <= calibration_precision) { // end iterations - SERIAL_PROTOCOLPGM("Calibration OK"); - SERIAL_PROTOCOL_SP(32); + SERIAL_ECHOPGM("Calibration OK"); + SERIAL_ECHO_SP(32); #if HAS_BED_PROBE if (zero_std_dev >= test_precision && !_1p_calibration && !_0p_calibration) - SERIAL_PROTOCOLPGM("rolling back."); + SERIAL_ECHOPGM("rolling back."); else #endif { - SERIAL_PROTOCOLPGM("std dev:"); - SERIAL_PROTOCOL_F(zero_std_dev_min, 3); + SERIAL_ECHOPAIR_F("std dev:", zero_std_dev_min, 3); } SERIAL_EOL(); char mess[21]; @@ -691,14 +649,12 @@ void GcodeSuite::G33() { else { // !end iterations char mess[15]; if (iterations < 31) - sprintf_P(mess, PSTR("Iteration : %02i"), (int)iterations); + sprintf_P(mess, PSTR("Iteration : %02i"), (unsigned int)iterations); else strcpy_P(mess, PSTR("No convergence")); - SERIAL_PROTOCOL(mess); - SERIAL_PROTOCOL_SP(32); - SERIAL_PROTOCOLPGM("std dev:"); - SERIAL_PROTOCOL_F(zero_std_dev, 3); - SERIAL_EOL(); + SERIAL_ECHO(mess); + SERIAL_ECHO_SP(32); + SERIAL_ECHOLNPAIR_F("std dev:", zero_std_dev, 3); ui.set_status(mess); if (verbose_level > 1) print_calibration_settings(_endstop_results, _angle_results); @@ -707,10 +663,8 @@ void GcodeSuite::G33() { else { // dry run PGM_P enddryrun = PSTR("End DRY-RUN"); serialprintPGM(enddryrun); - SERIAL_PROTOCOL_SP(35); - SERIAL_PROTOCOLPGM("std dev:"); - SERIAL_PROTOCOL_F(zero_std_dev, 3); - SERIAL_EOL(); + SERIAL_ECHO_SP(35); + SERIAL_ECHOLNPAIR_F("std dev:", zero_std_dev, 3); char mess[21]; strcpy_P(mess, enddryrun); diff --git a/Marlin/src/gcode/calibrate/G34_M422.cpp b/Marlin/src/gcode/calibrate/G34_M422.cpp index fbeb7b866981..9a26400a97ca 100644 --- a/Marlin/src/gcode/calibrate/G34_M422.cpp +++ b/Marlin/src/gcode/calibrate/G34_M422.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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; } @@ -88,7 +91,7 @@ void GcodeSuite::G34() { } const float z_auto_align_amplification = parser.floatval('A', Z_STEPPER_ALIGN_AMP); - if (!WITHIN(z_auto_align_amplification, 0.5f, 2.0f)) { + if (!WITHIN(ABS(z_auto_align_amplification), 0.5f, 2.0f)) { SERIAL_ECHOLNPGM("?(A)mplification out of bounds (0.5-2.0)."); 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"); } /** @@ -263,19 +246,19 @@ void GcodeSuite::G34() { void GcodeSuite::M422() { const int8_t zstepper = parser.intval('S') - 1; if (!WITHIN(zstepper, 0, Z_STEPPER_COUNT - 1)) { - SERIAL_PROTOCOLLNPGM("?(S) Z-Stepper index invalid."); + SERIAL_ECHOLNPGM("?(S) Z-Stepper index invalid."); return; } const float x_pos = parser.floatval('X', z_auto_align_xpos[zstepper]); if (!WITHIN(x_pos, X_MIN_POS, X_MAX_POS)) { - SERIAL_PROTOCOLLNPGM("?(X) out of bounds."); + SERIAL_ECHOLNPGM("?(X) out of bounds."); return; } const float y_pos = parser.floatval('Y', z_auto_align_ypos[zstepper]); if (!WITHIN(y_pos, Y_MIN_POS, Y_MAX_POS)) { - SERIAL_PROTOCOLLNPGM("?(Y) out of bounds."); + SERIAL_ECHOLNPGM("?(Y) out of bounds."); return; } diff --git a/Marlin/src/gcode/calibrate/G425.cpp b/Marlin/src/gcode/calibrate/G425.cpp new file mode 100644 index 000000000000..1174fc38f8c2 --- /dev/null +++ b/Marlin/src/gcode/calibrate/G425.cpp @@ -0,0 +1,656 @@ +/** + * 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 "../../Marlin.h" + +#if ENABLED(CALIBRATION_GCODE) + +#include "../gcode.h" +#include "../../lcd/ultralcd.h" +#include "../../module/motion.h" +#include "../../module/planner.h" +#include "../../module/tool_change.h" +#include "../../module/endstops.h" +#include "../../feature/bedlevel/bedlevel.h" + + +/** + * G425 backs away from the calibration object by various distances + * depending on the confidence level: + * + * UNKNOWN - No real notion on where the calibration object is on the bed + * UNCERTAIN - Measurement may be uncertain due to backlash + * CERTAIN - Measurement obtained with backlash compensation + */ + +#ifndef CALIBRATION_MEASUREMENT_UNKNOWN + #define CALIBRATION_MEASUREMENT_UNKNOWN 5.0 // mm +#endif +#ifndef CALIBRATION_MEASUREMENT_UNCERTAIN + #define CALIBRATION_MEASUREMENT_UNCERTAIN 1.0 // mm +#endif +#ifndef CALIBRATION_MEASUREMENT_CERTAIN + #define CALIBRATION_MEASUREMENT_CERTAIN 0.5 // mm +#endif + +#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_smoothing_mm; + extern uint8_t backlash_correction; +#endif + +enum side_t : uint8_t { TOP, RIGHT, FRONT, LEFT, BACK, NUM_SIDES }; + +struct measurements_t { + static constexpr float dimensions[XYZ] = CALIBRATION_OBJECT_DIMENSIONS; + static constexpr float true_center[XYZ] = CALIBRATION_OBJECT_CENTER; + + float obj_center[XYZ] = CALIBRATION_OBJECT_CENTER; + float obj_side[NUM_SIDES]; + + float backlash[NUM_SIDES]; + float pos_error[XYZ]; + + float nozzle_outer_dimension[2] = {CALIBRATION_NOZZLE_OUTER_DIAMETER, CALIBRATION_NOZZLE_OUTER_DIAMETER}; +}; + +#define TEMPORARY_BED_LEVELING_STATE(enable) TemporaryBedLevelingState tbls(enable) +#define TEMPORARY_SOFT_ENDSTOP_STATE(enable) REMEMBER(tes, soft_endstops_enabled, enable); + +#if ENABLED(BACKLASH_GCODE) + #define TEMPORARY_BACKLASH_CORRECTION(value) REMEMBER(tbst, backlash_correction, value) +#else + #define TEMPORARY_BACKLASH_CORRECTION(value) +#endif + +#if ENABLED(BACKLASH_GCODE) && defined(BACKLASH_SMOOTHING_MM) + #define TEMPORARY_BACKLASH_SMOOTHING(value) REMEMBER(tbsm, backlash_smoothing_mm, value) +#else + #define TEMPORARY_BACKLASH_SMOOTHING(value) +#endif + +/** + * A class to save and change the bed leveling state, + * then restore it when it goes out of scope. + */ +class TemporaryBedLevelingState { + bool saved; + + public: + TemporaryBedLevelingState(const bool enable) : saved(planner.leveling_active) { + set_bed_leveling_enabled(enable); + } + ~TemporaryBedLevelingState() { set_bed_leveling_enabled(saved); } +}; + +/** + * Move to a particular location. Up to three individual axes + * and their destinations can be specified, in any order. + */ +inline void move_to( + const AxisEnum a1 = NO_AXIS, const float p1 = 0, + const AxisEnum a2 = NO_AXIS, const float p2 = 0, + const AxisEnum a3 = NO_AXIS, const float p3 = 0 +) { + set_destination_from_current(); + + // Note: The order of p1, p2, p3 may not correspond to X, Y, Z + if (a1 != NO_AXIS) destination[a1] = p1; + if (a2 != NO_AXIS) destination[a2] = p2; + if (a3 != NO_AXIS) destination[a3] = p3; + + // Make sure coordinates are within bounds + destination[X_AXIS] = MAX(MIN(destination[X_AXIS], X_MAX_POS), X_MIN_POS); + destination[Y_AXIS] = MAX(MIN(destination[Y_AXIS], Y_MAX_POS), Y_MIN_POS); + destination[Z_AXIS] = MAX(MIN(destination[Z_AXIS], Z_MAX_POS), Z_MIN_POS); + + // Move to position + do_blocking_move_to(destination, MMM_TO_MMS(CALIBRATION_FEEDRATE_TRAVEL)); +} + +/** + * Move to the exact center above the calibration object + * + * m in - Measurement record + * uncertainty in - How far away from the object top to park + */ +inline void park_above_object(measurements_t &m, const float uncertainty) { + // Move to safe distance above calibration object + move_to(Z_AXIS, m.obj_center[Z_AXIS] + m.dimensions[Z_AXIS] / 2 + uncertainty); + + // Move to center of calibration object in XY + move_to(X_AXIS, m.obj_center[X_AXIS], Y_AXIS, m.obj_center[Y_AXIS]); +} + +#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 + +#if HAS_HOTEND_OFFSET + + inline void normalize_hotend_offsets() { + for (uint8_t e = 1; e < HOTENDS; e++) { + hotend_offset[X_AXIS][e] -= hotend_offset[X_AXIS][0]; + hotend_offset[Y_AXIS][e] -= hotend_offset[Y_AXIS][0]; + hotend_offset[Z_AXIS][e] -= hotend_offset[Z_AXIS][0]; + } + hotend_offset[X_AXIS][0] = 0; + hotend_offset[Y_AXIS][0] = 0; + hotend_offset[Z_AXIS][0] = 0; + } + +#endif + +inline bool read_calibration_pin() { + #if HAS_CALIBRATION_PIN + return (READ(CALIBRATION_PIN) != CALIBRATION_PIN_INVERTING); + #elif ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) + return (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING); + #else + return (READ(Z_MIN_PROBE_PIN) != Z_MIN_PROBE_ENDSTOP_INVERTING); + #endif +} + +/** + * Move along axis in the specified dir until the probe value becomes stop_state, + * then return the axis value. + * + * axis in - Axis along which the measurement will take place + * dir in - Direction along that axis (-1 or 1) + * stop_state in - Move until probe pin becomes this value + * fast in - Fast vs. precise measurement + */ +float measuring_movement(const AxisEnum axis, const int dir, const bool stop_state, const bool fast) { + const float step = fast ? 0.25 : CALIBRATION_MEASUREMENT_RESOLUTION; + const float mms = MMM_TO_MMS(fast ? CALIBRATION_FEEDRATE_FAST : CALIBRATION_FEEDRATE_SLOW); + const float limit = fast ? 50 : 5; + + set_destination_from_current(); + for (float travel = 0; travel < limit; travel += step) { + destination[axis] += dir * step; + do_blocking_move_to(destination, mms); + planner.synchronize(); + if (read_calibration_pin() == stop_state) + break; + } + return destination[axis]; +} + +/** + * Move along axis until the probe is triggered. Move toolhead to its starting + * point and return the measured value. + * + * axis in - Axis along which the measurement will take place + * dir in - Direction along that axis (-1 or 1) + * stop_state in - Move until probe pin becomes this value + * backlash_ptr in/out - When not NULL, measure and record axis backlash + * uncertainty in - If uncertainty is CALIBRATION_MEASUREMENT_UNKNOWN, do a fast probe. + */ +inline float measure(const AxisEnum axis, const int dir, const bool stop_state, float * const backlash_ptr, const float uncertainty) { + const bool fast = uncertainty == CALIBRATION_MEASUREMENT_UNKNOWN; + + // Save position + set_destination_from_current(); + const float start_pos = destination[axis]; + const float measured_pos = measuring_movement(axis, dir, stop_state, fast); + // Measure backlash + if (backlash_ptr && !fast) { + const float release_pos = measuring_movement(axis, -dir, !stop_state, fast); + *backlash_ptr = ABS(release_pos - measured_pos); + } + // Return to starting position + destination[axis] = start_pos; + do_blocking_move_to(destination, MMM_TO_MMS(CALIBRATION_FEEDRATE_TRAVEL)); + return measured_pos; +} + +/** + * Probe one side of the calibration object + * + * m in/out - Measurement record, m.obj_center and m.obj_side will be updated. + * uncertainty in - How far away from the calibration object to begin probing + * side in - Side of probe where probe will occur + * probe_top_at_edge in - When probing sides, probe top of calibration object nearest edge + * to find out height of edge + */ +inline void probe_side(measurements_t &m, const float uncertainty, const side_t side, const bool probe_top_at_edge=false) { + const float dimensions[] = CALIBRATION_OBJECT_DIMENSIONS; + AxisEnum axis; + float dir; + + park_above_object(m, uncertainty); + + switch (side) { + case TOP: { + const float measurement = measure(Z_AXIS, -1, true, &m.backlash[TOP], uncertainty); + m.obj_center[Z_AXIS] = measurement - dimensions[Z_AXIS] / 2; + m.obj_side[TOP] = measurement; + return; + } + case RIGHT: axis = X_AXIS; dir = -1; break; + case FRONT: axis = Y_AXIS; dir = 1; break; + case LEFT: axis = X_AXIS; dir = 1; break; + case BACK: axis = Y_AXIS; dir = -1; break; + default: + return; + } + + if (probe_top_at_edge) { + // Probe top nearest the side we are probing + move_to(axis, m.obj_center[axis] + (-dir) * (dimensions[axis] / 2 - m.nozzle_outer_dimension[axis])); + m.obj_side[TOP] = measure(Z_AXIS, -1, true, &m.backlash[TOP], uncertainty); + m.obj_center[Z_AXIS] = m.obj_side[TOP] - dimensions[Z_AXIS] / 2; + } + + // Move to safe distance to the side of the calibration object + move_to(axis, m.obj_center[axis] + (-dir) * (dimensions[axis] / 2 + m.nozzle_outer_dimension[axis] / 2 + uncertainty)); + + // Plunge below the side of the calibration object and measure + move_to(Z_AXIS, m.obj_side[TOP] - CALIBRATION_NOZZLE_TIP_HEIGHT * 0.7); + const float measurement = measure(axis, dir, true, &m.backlash[side], uncertainty); + m.obj_center[axis] = measurement + dir * (dimensions[axis] / 2 + m.nozzle_outer_dimension[axis] / 2); + m.obj_side[side] = measurement; +} + +/** + * Probe all sides of the calibration calibration object + * + * m in/out - Measurement record: center, backlash and error values be updated. + * uncertainty in - How far away from the calibration object to begin probing + */ +inline void probe_sides(measurements_t &m, const float uncertainty) { + #ifdef CALIBRATION_MEASURE_AT_TOP_EDGES + constexpr bool probe_top_at_edge = true; + #else + // Probing at the exact center only works if the center is flat. Probing on a washer + // or bolt will require probing the top near the side edges, away from the center. + constexpr bool probe_top_at_edge = false; + probe_side(m, uncertainty, TOP); + #endif + + #ifdef CALIBRATION_MEASURE_RIGHT + probe_side(m, uncertainty, RIGHT, probe_top_at_edge); + #endif + + #ifdef CALIBRATION_MEASURE_FRONT + probe_side(m, uncertainty, FRONT, probe_top_at_edge); + #endif + + #ifdef CALIBRATION_MEASURE_LEFT + probe_side(m, uncertainty, LEFT, probe_top_at_edge); + #endif + #ifdef CALIBRATION_MEASURE_BACK + probe_side(m, uncertainty, BACK, probe_top_at_edge); + #endif + + // Compute the measured center of the calibration object. + #if HAS_X_CENTER + m.obj_center[X_AXIS] = (m.obj_side[LEFT] + m.obj_side[RIGHT]) / 2; + #endif + #if HAS_Y_CENTER + m.obj_center[Y_AXIS] = (m.obj_side[FRONT] + m.obj_side[BACK]) / 2; + #endif + + // Compute the outside diameter of the nozzle at the height + // at which it makes contact with the calibration object + #if HAS_X_CENTER + m.nozzle_outer_dimension[X_AXIS] = m.obj_side[RIGHT] - m.obj_side[LEFT] - m.dimensions[X_AXIS]; + #endif + #if HAS_Y_CENTER + m.nozzle_outer_dimension[Y_AXIS] = m.obj_side[BACK] - m.obj_side[FRONT] - m.dimensions[Y_AXIS]; + #endif + + park_above_object(m, uncertainty); + + // The difference between the known and the measured location + // of the calibration object is the positional error + m.pos_error[X_AXIS] = + #if HAS_X_CENTER + m.true_center[X_AXIS] - m.obj_center[X_AXIS]; + #else + 0; + #endif + m.pos_error[Y_AXIS] = + #if HAS_Y_CENTER + m.true_center[Y_AXIS] - m.obj_center[Y_AXIS]; + #else + 0; + #endif + m.pos_error[Z_AXIS] = m.true_center[Z_AXIS] - m.obj_center[Z_AXIS]; +} + +#if ENABLED(CALIBRATION_REPORTING) + inline void report_measured_faces(const measurements_t &m) { + SERIAL_ECHOLNPGM("Sides:"); + SERIAL_ECHOLNPAIR(" Top: ", m.obj_side[TOP]); + #if ENABLED(CALIBRATION_MEASURE_LEFT) + SERIAL_ECHOLNPAIR(" Left: ", m.obj_side[LEFT]); + #endif + #if ENABLED(CALIBRATION_MEASURE_RIGHT) + SERIAL_ECHOLNPAIR(" Right: ", m.obj_side[RIGHT]); + #endif + #if ENABLED(CALIBRATION_MEASURE_FRONT) + SERIAL_ECHOLNPAIR(" Front: ", m.obj_side[FRONT]); + #endif + #if ENABLED(CALIBRATION_MEASURE_BACK) + SERIAL_ECHOLNPAIR(" Back: ", m.obj_side[BACK]); + #endif + SERIAL_EOL(); + } + + inline void report_measured_center(const measurements_t &m) { + SERIAL_ECHOLNPGM("Center:"); + #if HAS_X_CENTER + SERIAL_ECHOLNPAIR(" X", m.obj_center[X_AXIS]); + #endif + #if HAS_Y_CENTER + SERIAL_ECHOLNPAIR(" Y", m.obj_center[Y_AXIS]); + #endif + SERIAL_ECHOLNPAIR(" Z", m.obj_center[Z_AXIS]); + SERIAL_EOL(); + } + + inline void report_measured_backlash(const measurements_t &m) { + SERIAL_ECHOLNPGM("Backlash:"); + #if ENABLED(CALIBRATION_MEASURE_LEFT) + SERIAL_ECHOLNPAIR(" Left: ", m.backlash[LEFT]); + #endif + #if ENABLED(CALIBRATION_MEASURE_RIGHT) + SERIAL_ECHOLNPAIR(" Right: ", m.backlash[RIGHT]); + #endif + #if ENABLED(CALIBRATION_MEASURE_FRONT) + SERIAL_ECHOLNPAIR(" Front: ", m.backlash[FRONT]); + #endif + #if ENABLED(CALIBRATION_MEASURE_BACK) + SERIAL_ECHOLNPAIR(" Back: ", m.backlash[BACK]); + #endif + SERIAL_ECHOLNPAIR(" Top: ", m.backlash[TOP]); + SERIAL_EOL(); + } + + inline void report_measured_positional_error(const measurements_t &m) { + SERIAL_CHAR('T'); + SERIAL_ECHO(int(active_extruder)); + SERIAL_ECHOLNPGM(" Positional Error:"); + #if HAS_X_CENTER + SERIAL_ECHOLNPAIR(" X", m.pos_error[X_AXIS]); + #endif + #if HAS_Y_CENTER + SERIAL_ECHOLNPAIR(" Y", m.pos_error[Y_AXIS]); + #endif + SERIAL_ECHOLNPAIR(" Z", m.pos_error[Z_AXIS]); + SERIAL_EOL(); + } + + inline void report_measured_nozzle_dimensions(const measurements_t &m) { + SERIAL_ECHOLNPGM("Nozzle Tip Outer Dimensions:"); + #if HAS_X_CENTER + SERIAL_ECHOLNPAIR(" X", m.nozzle_outer_dimension[X_AXIS]); + #endif + #if HAS_Y_CENTER + SERIAL_ECHOLNPAIR(" Y", m.nozzle_outer_dimension[Y_AXIS]); + #endif + SERIAL_EOL(); + } + + #if HAS_HOTEND_OFFSET + // + // This function requires normalize_hotend_offsets() to be called + // + inline void report_hotend_offsets() { + for (uint8_t e = 1; e < HOTENDS; e++) { + SERIAL_ECHOPAIR("T", int(e)); + SERIAL_ECHOLNPGM(" Hotend Offset:"); + SERIAL_ECHOLNPAIR(" X: ", hotend_offset[X_AXIS][e]); + SERIAL_ECHOLNPAIR(" Y: ", hotend_offset[Y_AXIS][e]); + SERIAL_ECHOLNPAIR(" Z: ", hotend_offset[Z_AXIS][e]); + SERIAL_EOL(); + } + } + #endif +#endif // CALIBRATION_REPORTING + +/** + * Probe around the calibration object to measure backlash + * + * m in/out - Measurement record, updated with new readings + * uncertainty in - How far away from the object to begin probing + */ +inline void calibrate_backlash(measurements_t &m, const float uncertainty) { + // Backlash compensation should be off while measuring backlash + + { + // New scope for TEMPORARY_BACKLASH_CORRECTION + TEMPORARY_BACKLASH_CORRECTION(all_off); + TEMPORARY_BACKLASH_SMOOTHING(0.0f); + + probe_sides(m, uncertainty); + + #if ENABLED(BACKLASH_GCODE) + #if HAS_X_CENTER + backlash_distance_mm[X_AXIS] = (m.backlash[LEFT] + m.backlash[RIGHT]) / 2; + #elif ENABLED(CALIBRATION_MEASURE_LEFT) + backlash_distance_mm[X_AXIS] = m.backlash[LEFT]; + #elif ENABLED(CALIBRATION_MEASURE_RIGHT) + backlash_distance_mm[X_AXIS] = m.backlash[RIGHT]; + #endif + + #if HAS_Y_CENTER + backlash_distance_mm[Y_AXIS] = (m.backlash[FRONT] + m.backlash[BACK]) / 2; + #elif ENABLED(CALIBRATION_MEASURE_FRONT) + backlash_distance_mm[Y_AXIS] = m.backlash[FRONT]; + #elif ENABLED(CALIBRATION_MEASURE_BACK) + backlash_distance_mm[Y_AXIS] = m.backlash[BACK]; + #endif + + backlash_distance_mm[Z_AXIS] = m.backlash[TOP]; + #endif + } + + #if ENABLED(BACKLASH_GCODE) + // Turn on backlash compensation and move in all + // directions to take up any backlash + + { + // New scope for TEMPORARY_BACKLASH_CORRECTION + TEMPORARY_BACKLASH_CORRECTION(all_on); + TEMPORARY_BACKLASH_SMOOTHING(0.0f); + move_to( + X_AXIS, current_position[X_AXIS] + 3, + Y_AXIS, current_position[Y_AXIS] + 3, + Z_AXIS, current_position[Z_AXIS] + 3 + ); + move_to( + X_AXIS, current_position[X_AXIS] - 3, + Y_AXIS, current_position[Y_AXIS] - 3, + Z_AXIS, current_position[Z_AXIS] - 3 + ); + } + #endif +} + +inline void update_measurements(measurements_t &m, const AxisEnum axis) { + const float true_center[XYZ] = CALIBRATION_OBJECT_CENTER; + current_position[axis] += m.pos_error[axis]; + m.obj_center[axis] = true_center[axis]; + m.pos_error[axis] = 0; +} + +/** + * Probe around the calibration object. Adjust the position and toolhead offset + * using the deviation from the known position of the calibration object. + * + * m in/out - Measurement record, updated with new readings + * uncertainty in - How far away from the object to begin probing + * extruder in - What extruder to probe + * + * Prerequisites: + * - Call calibrate_backlash() beforehand for best accuracy + */ +inline void calibrate_toolhead(measurements_t &m, const float uncertainty, const uint8_t extruder) { + TEMPORARY_BACKLASH_CORRECTION(all_on); + TEMPORARY_BACKLASH_SMOOTHING(0.0f); + + #if HOTENDS > 1 + set_nozzle(m, extruder); + #endif + + probe_sides(m, uncertainty); + + // Adjust the hotend offset + #if HAS_HOTEND_OFFSET + #if HAS_X_CENTER + hotend_offset[X_AXIS][extruder] += m.pos_error[X_AXIS]; + #endif + #if HAS_Y_CENTER + 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 + + // Correct for positional error, so the object + // is at the known actual spot + planner.synchronize(); + #if HAS_X_CENTER + update_measurements(m, X_AXIS); + #endif + #if HAS_Y_CENTER + update_measurements(m, Y_AXIS); + #endif + update_measurements(m, Z_AXIS); + + sync_plan_position(); +} + +/** + * Probe around the calibration object for all toolheads, adjusting the coordinate + * system for the first nozzle and the nozzle offset for subsequent nozzles. + * + * m in/out - Measurement record, updated with new readings + * 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(all_on); + TEMPORARY_BACKLASH_SMOOTHING(0.0f); + + HOTEND_LOOP() calibrate_toolhead(m, uncertainty, e); + + #if HAS_HOTEND_OFFSET + normalize_hotend_offsets(); + #endif + + #if HOTENDS > 1 + set_nozzle(m, 0); + #endif +} + +/** + * Perform a full auto-calibration routine: + * + * 1) For each nozzle, touch top and sides of object to determine object position and + * nozzle offsets. Do a fast but rough search over a wider area. + * 2) With the first nozzle, touch top and sides of object to determine backlash values + * for all axis (if BACKLASH_GCODE is enabled) + * 3) For each nozzle, touch top and sides of object slowly to determine precise + * position of object. Adjust coordinate system and nozzle offsets so probed object + * location corresponds to known object location with a high degree of precision. + */ +inline void calibrate_all() { + measurements_t m; + + #if HAS_HOTEND_OFFSET + reset_hotend_offsets(); + #endif + + TEMPORARY_BACKLASH_CORRECTION(all_on); + TEMPORARY_BACKLASH_SMOOTHING(0.0f); + + // Do a fast and rough calibration of the toolheads + calibrate_all_toolheads(m, CALIBRATION_MEASUREMENT_UNKNOWN); + + #if ENABLED(BACKLASH_GCODE) + calibrate_backlash(m, CALIBRATION_MEASUREMENT_UNCERTAIN); + #endif + + // Cycle the toolheads so the servos settle into their "natural" positions + #if HOTENDS > 1 + HOTEND_LOOP() set_nozzle(m, e); + #endif + + // Do a slow and precise calibration of the toolheads + calibrate_all_toolheads(m, CALIBRATION_MEASUREMENT_UNCERTAIN); + + move_to(X_AXIS, 150); // Park nozzle away from calibration object +} + +/** + * G425: Perform calibration with calibration object. + * + * B - Perform calibration of backlash only. + * T - Perform calibration of toolhead only. + * V - Probe object and print position, error, backlash and hotend offset. + * U - Uncertainty, how far to start probe away from the object (mm) + * + * no args - Perform entire calibration sequence (backlash + position on all toolheads) + */ +void GcodeSuite::G425() { + TEMPORARY_SOFT_ENDSTOP_STATE(false); + TEMPORARY_BED_LEVELING_STATE(false); + + if (axis_unhomed_error()) return; + + measurements_t m; + + float uncertainty = parser.seenval('U') ? parser.value_float() : CALIBRATION_MEASUREMENT_UNCERTAIN; + + if (parser.seen('B')) + calibrate_backlash(m, uncertainty); + else if (parser.seen('T')) + calibrate_toolhead(m, uncertainty, parser.has_value() ? parser.value_int() : active_extruder); + #if ENABLED(CALIBRATION_REPORTING) + else if (parser.seen('V')) { + probe_sides(m, uncertainty); + SERIAL_EOL(); + report_measured_faces(m); + report_measured_center(m); + report_measured_backlash(m); + report_measured_nozzle_dimensions(m); + report_measured_positional_error(m); + #if HAS_HOTEND_OFFSET + normalize_hotend_offsets(); + report_hotend_offsets(); + #endif + } + #endif + else + calibrate_all(); +} + +#endif // CALIBRATION_GCODE diff --git a/Marlin/src/gcode/calibrate/M100.cpp b/Marlin/src/gcode/calibrate/M100.cpp index 075004b01d72..30c536810619 100644 --- a/Marlin/src/gcode/calibrate/M100.cpp +++ b/Marlin/src/gcode/calibrate/M100.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/calibrate/M12.cpp b/Marlin/src/gcode/calibrate/M12.cpp index a4b75e71bda5..fd3d8da20c17 100644 --- a/Marlin/src/gcode/calibrate/M12.cpp +++ b/Marlin/src/gcode/calibrate/M12.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/calibrate/M425.cpp b/Marlin/src/gcode/calibrate/M425.cpp new file mode 100644 index 000000000000..e51c9301cf0a --- /dev/null +++ b/Marlin/src/gcode/calibrate/M425.cpp @@ -0,0 +1,122 @@ +/** + * 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(BACKLASH_GCODE) + +#include "../../module/planner.h" + +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; +#endif + +#if ENABLED(MEASURE_BACKLASH_WHEN_PROBING) + float backlash_measured_mm[XYZ] = { 0 }; + uint8_t backlash_measured_num[XYZ] = { 0 }; +#endif + +#include "../gcode.h" + +/** + * M425: Enable and tune backlash correction. + * + * F Enable/disable/fade-out backlash correction (0.0 to 1.0) + * S Distance over which backlash correction is spread + * X Set the backlash distance on X (0 to disable) + * Y ... on Y + * Z ... on Z + * X If a backlash measurement was done on X, copy that value + * Y ... on Y + * Z ... on Z + * + * Type M425 without any arguments to show active values. + */ +void GcodeSuite::M425() { + bool noArgs = true; + + LOOP_XYZ(i) { + if (parser.seen(axis_codes[i])) { + planner.synchronize(); + const float measured_backlash = ( + #if ENABLED(MEASURE_BACKLASH_WHEN_PROBING) + backlash_measured_num[i] > 0 ? backlash_measured_mm[i] / backlash_measured_num[i] : 0 + #else + 0 + #endif + ); + backlash_distance_mm[i] = parser.has_value() ? parser.value_linear_units() : measured_backlash; + noArgs = false; + } + } + + if (parser.seen('F')) { + planner.synchronize(); + backlash_correction = MAX(0, MIN(1.0, parser.value_float())) * all_on; + noArgs = false; + } + + #ifdef BACKLASH_SMOOTHING_MM + if (parser.seen('S')) { + planner.synchronize(); + backlash_smoothing_mm = parser.value_linear_units(); + noArgs = false; + } + #endif + + if (noArgs) { + SERIAL_ECHOPGM("Backlash correction is "); + if (!backlash_correction) SERIAL_ECHOPGM("in"); + SERIAL_ECHOLNPGM("active:"); + 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(' '); + SERIAL_CHAR(axis_codes[a]); + SERIAL_ECHO(backlash_distance_mm[a]); + SERIAL_EOL(); + } + + #ifdef BACKLASH_SMOOTHING_MM + SERIAL_ECHOLNPAIR(" Smoothing (mm): S", backlash_smoothing_mm); + #endif + + #if ENABLED(MEASURE_BACKLASH_WHEN_PROBING) + SERIAL_ECHOPGM(" Average measured backlash (mm):"); + LOOP_XYZ(a) { + if (backlash_measured_num[a] > 0) { + SERIAL_CHAR(' '); + SERIAL_CHAR(axis_codes[a]); + SERIAL_ECHO(backlash_measured_mm[a] / backlash_measured_num[a]); + } + } + if (!backlash_measured_num[X_AXIS] && !backlash_measured_num[Y_AXIS] && !backlash_measured_num[Z_AXIS]) + SERIAL_ECHOPGM(" (Not yet measured)"); + SERIAL_EOL(); + #endif + } +} + +#endif // BACKLASH_GCODE diff --git a/Marlin/src/gcode/calibrate/M48.cpp b/Marlin/src/gcode/calibrate/M48.cpp index 098d626f5ec9..d17b2df3fd13 100644 --- a/Marlin/src/gcode/calibrate/M48.cpp +++ b/Marlin/src/gcode/calibrate/M48.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -55,16 +55,16 @@ void GcodeSuite::M48() { const int8_t verbose_level = parser.byteval('V', 1); if (!WITHIN(verbose_level, 0, 4)) { - SERIAL_PROTOCOLLNPGM("?(V)erbose level is implausible (0-4)."); + SERIAL_ECHOLNPGM("?(V)erbose level is implausible (0-4)."); return; } if (verbose_level > 0) - SERIAL_PROTOCOLLNPGM("M48 Z-Probe Repeatability Test"); + SERIAL_ECHOLNPGM("M48 Z-Probe Repeatability Test"); const int8_t n_samples = parser.byteval('P', 10); if (!WITHIN(n_samples, 4, 50)) { - SERIAL_PROTOCOLLNPGM("?Sample size not plausible (4-50)."); + SERIAL_ECHOLNPGM("?Sample size not plausible (4-50)."); return; } @@ -77,14 +77,14 @@ void GcodeSuite::M48() { Y_probe_location = parser.linearval('Y', Y_current + Y_PROBE_OFFSET_FROM_EXTRUDER); if (!position_is_reachable_by_probe(X_probe_location, Y_probe_location)) { - SERIAL_PROTOCOLLNPGM("? (X,Y) out of bounds."); + SERIAL_ECHOLNPGM("? (X,Y) out of bounds."); return; } bool seen_L = parser.seen('L'); uint8_t n_legs = seen_L ? parser.value_byte() : 0; if (n_legs > 15) { - SERIAL_PROTOCOLLNPGM("?Number of legs in movement not plausible (0-15)."); + SERIAL_ECHOLNPGM("?Number of legs in movement not plausible (0-15)."); return; } if (n_legs == 1) n_legs = 2; @@ -98,7 +98,7 @@ void GcodeSuite::M48() { * we don't want to use that as a starting point for each probe. */ if (verbose_level > 2) - SERIAL_PROTOCOLLNPGM("Positioning the probe..."); + SERIAL_ECHOLNPGM("Positioning the probe..."); // Disable bed level correction in M48 because we want the raw data when we probe @@ -178,7 +178,7 @@ void GcodeSuite::M48() { } #endif if (verbose_level > 3) { - SERIAL_PROTOCOLPGM("Going to:"); + SERIAL_ECHOPGM("Going to:"); SERIAL_ECHOPAIR(" X", X_current); SERIAL_ECHOPAIR(" Y", Y_current); SERIAL_ECHOLNPAIR(" Z", current_position[Z_AXIS]); @@ -215,22 +215,15 @@ void GcodeSuite::M48() { sigma = SQRT(sum / (n + 1)); if (verbose_level > 0) { if (verbose_level > 1) { - SERIAL_PROTOCOL(n + 1); - SERIAL_PROTOCOLPGM(" of "); - SERIAL_PROTOCOL((int)n_samples); - SERIAL_PROTOCOLPGM(": z: "); - SERIAL_PROTOCOL_F(sample_set[n], 3); + SERIAL_ECHO(n + 1); + SERIAL_ECHOPAIR(" of ", (int)n_samples); + SERIAL_ECHOPAIR_F(": z: ", sample_set[n], 3); if (verbose_level > 2) { - SERIAL_PROTOCOLPGM(" mean: "); - SERIAL_PROTOCOL_F(mean, 4); - SERIAL_PROTOCOLPGM(" sigma: "); - SERIAL_PROTOCOL_F(sigma, 6); - SERIAL_PROTOCOLPGM(" min: "); - SERIAL_PROTOCOL_F(min, 3); - SERIAL_PROTOCOLPGM(" max: "); - SERIAL_PROTOCOL_F(max, 3); - SERIAL_PROTOCOLPGM(" range: "); - SERIAL_PROTOCOL_F(max-min, 3); + SERIAL_ECHOPAIR_F(" mean: ", mean, 4); + SERIAL_ECHOPAIR_F(" sigma: ", sigma, 6); + SERIAL_ECHOPAIR_F(" min: ", min, 3); + SERIAL_ECHOPAIR_F(" max: ", max, 3); + SERIAL_ECHOPAIR_F(" range: ", max-min, 3); } SERIAL_EOL(); } @@ -242,23 +235,16 @@ void GcodeSuite::M48() { STOW_PROBE(); if (probing_good) { - SERIAL_PROTOCOLLNPGM("Finished!"); + SERIAL_ECHOLNPGM("Finished!"); if (verbose_level > 0) { - SERIAL_PROTOCOLPGM("Mean: "); - SERIAL_PROTOCOL_F(mean, 6); - SERIAL_PROTOCOLPGM(" Min: "); - SERIAL_PROTOCOL_F(min, 3); - SERIAL_PROTOCOLPGM(" Max: "); - SERIAL_PROTOCOL_F(max, 3); - SERIAL_PROTOCOLPGM(" Range: "); - SERIAL_PROTOCOL_F(max-min, 3); - SERIAL_EOL(); + SERIAL_ECHOPAIR_F("Mean: ", mean, 6); + SERIAL_ECHOPAIR_F(" Min: ", min, 3); + SERIAL_ECHOPAIR_F(" Max: ", max, 3); + SERIAL_ECHOLNPAIR_F(" Range: ", max-min, 3); } - SERIAL_PROTOCOLPGM("Standard Deviation: "); - SERIAL_PROTOCOL_F(sigma, 6); - SERIAL_EOL(); + SERIAL_ECHOLNPAIR_F("Standard Deviation: ", sigma, 6); SERIAL_EOL(); } diff --git a/Marlin/src/gcode/calibrate/M665.cpp b/Marlin/src/gcode/calibrate/M665.cpp index d0514ba598bb..64918cdb1b68 100644 --- a/Marlin/src/gcode/calibrate/M665.cpp +++ b/Marlin/src/gcode/calibrate/M665.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -84,8 +84,7 @@ if (sumAPX == 1) scara_home_offset[A_AXIS] = parser.value_float(); else { - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM("Only one of A, P, or X is allowed."); + SERIAL_ERROR_MSG("Only one of A, P, or X is allowed."); return; } } @@ -96,8 +95,7 @@ if (sumBTY == 1) scara_home_offset[B_AXIS] = parser.value_float(); else { - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM("Only one of B, T, or Y is allowed."); + SERIAL_ERROR_MSG("Only one of B, T, or Y is allowed."); return; } } diff --git a/Marlin/src/gcode/calibrate/M666.cpp b/Marlin/src/gcode/calibrate/M666.cpp index 31d07185c8b7..3af8fe7575aa 100644 --- a/Marlin/src/gcode/calibrate/M666.cpp +++ b/Marlin/src/gcode/calibrate/M666.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -22,7 +22,7 @@ #include "../../inc/MarlinConfig.h" -#if ENABLED(DELTA) || ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS +#if ENABLED(DELTA) || HAS_EXTRA_ENDSTOPS #include "../gcode.h" @@ -31,35 +31,25 @@ #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 ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS +#elif HAS_EXTRA_ENDSTOPS #include "../../module/endstops.h" @@ -107,6 +97,6 @@ } } -#endif // X_DUAL_ENDSTOPS || Y_DUAL_ENDSTOPS || Z_DUAL_ENDSTOPS +#endif // HAS_EXTRA_ENDSTOPS -#endif // DELTA || X_DUAL_ENDSTOPS || Y_DUAL_ENDSTOPS || Z_DUAL_ENDSTOPS +#endif // DELTA || HAS_EXTRA_ENDSTOPS diff --git a/Marlin/src/gcode/calibrate/M852.cpp b/Marlin/src/gcode/calibrate/M852.cpp index 71805a5b1ad6..8e010ba70a3c 100644 --- a/Marlin/src/gcode/calibrate/M852.cpp +++ b/Marlin/src/gcode/calibrate/M852.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -93,9 +93,7 @@ void GcodeSuite::M852() { if (!ijk) { SERIAL_ECHO_START(); - SERIAL_ECHOPGM(MSG_SKEW_FACTOR " XY: "); - SERIAL_ECHO_F(planner.skew_factor.xy, 6); - SERIAL_EOL(); + SERIAL_ECHOLNPAIR_F(MSG_SKEW_FACTOR " XY: ", planner.skew_factor.xy, 6); #if ENABLED(SKEW_CORRECTION_FOR_Z) SERIAL_ECHOPAIR(" XZ: ", planner.skew_factor.xz); SERIAL_ECHOLNPAIR(" YZ: ", planner.skew_factor.yz); diff --git a/Marlin/src/gcode/config/M200-M205.cpp b/Marlin/src/gcode/config/M200-M205.cpp index f806fd19d133..511ab6cdc61e 100644 --- a/Marlin/src/gcode/config/M200-M205.cpp +++ b/Marlin/src/gcode/config/M200-M205.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -147,10 +147,8 @@ void GcodeSuite::M205() { planner.recalculate_max_e_jerk(); #endif } - else { - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM("?J out of range (0.01 to 0.3)"); - } + else + SERIAL_ERROR_MSG("?J out of range (0.01 to 0.3)"); } #endif #if HAS_CLASSIC_JERK diff --git a/Marlin/src/gcode/config/M217.cpp b/Marlin/src/gcode/config/M217.cpp index f23b9550f938..89ae9b6eeb3c 100644 --- a/Marlin/src/gcode/config/M217.cpp +++ b/Marlin/src/gcode/config/M217.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -27,25 +27,17 @@ #include "../gcode.h" #include "../../module/tool_change.h" -#if NUM_SERIAL > 1 - #include "../../gcode/queue.h" -#endif - void M217_report(const bool eeprom=false) { - #if NUM_SERIAL > 1 - const int16_t port = command_queue_port[cmd_queue_index_r]; - #endif - #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) - serialprintPGM_P(port, eeprom ? PSTR(" M217") : PSTR("Singlenozzle:")); - SERIAL_ECHOPAIR_P(port, " S", LINEAR_UNIT(toolchange_settings.swap_length)); - SERIAL_ECHOPAIR_P(port, " P", LINEAR_UNIT(toolchange_settings.prime_speed)); - SERIAL_ECHOPAIR_P(port, " R", LINEAR_UNIT(toolchange_settings.retract_speed)); + serialprintPGM(eeprom ? PSTR(" M217") : PSTR("Toolchange:")); + SERIAL_ECHOPAIR(" S", LINEAR_UNIT(toolchange_settings.swap_length)); + SERIAL_ECHOPAIR(" P", LINEAR_UNIT(toolchange_settings.prime_speed)); + SERIAL_ECHOPAIR(" R", LINEAR_UNIT(toolchange_settings.retract_speed)); #if ENABLED(TOOLCHANGE_PARK) - SERIAL_ECHOPAIR_P(port, " X", LINEAR_UNIT(toolchange_settings.change_point.x)); - SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(toolchange_settings.change_point.y)); + SERIAL_ECHOPAIR(" X", LINEAR_UNIT(toolchange_settings.change_point.x)); + SERIAL_ECHOPAIR(" Y", LINEAR_UNIT(toolchange_settings.change_point.y)); #endif #else @@ -54,7 +46,7 @@ void M217_report(const bool eeprom=false) { #endif - SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(toolchange_settings.z_raise)); + SERIAL_ECHOPAIR(" Z", LINEAR_UNIT(toolchange_settings.z_raise)); SERIAL_EOL(); } diff --git a/Marlin/src/gcode/config/M218.cpp b/Marlin/src/gcode/config/M218.cpp index df17bd56474f..97000d6e05b8 100644 --- a/Marlin/src/gcode/config/M218.cpp +++ b/Marlin/src/gcode/config/M218.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/config/M220.cpp b/Marlin/src/gcode/config/M220.cpp index 82fa9c0ba30f..b7870c418885 100644 --- a/Marlin/src/gcode/config/M220.cpp +++ b/Marlin/src/gcode/config/M220.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/config/M221.cpp b/Marlin/src/gcode/config/M221.cpp index 71294278625e..70cb1874accd 100644 --- a/Marlin/src/gcode/config/M221.cpp +++ b/Marlin/src/gcode/config/M221.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/config/M281.cpp b/Marlin/src/gcode/config/M281.cpp index 08e6f5633428..4953fe7acbbb 100644 --- a/Marlin/src/gcode/config/M281.cpp +++ b/Marlin/src/gcode/config/M281.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -21,7 +21,7 @@ */ #include "../../inc/MarlinConfig.h" -#if HAS_SERVOS && ENABLED(EDITABLE_SERVO_ANGLES) +#if ENABLED(EDITABLE_SERVO_ANGLES) #include "../gcode.h" #include "../../module/servo.h" @@ -53,4 +53,4 @@ void GcodeSuite::M281() { } } -#endif // HAS_SERVOS && EDITABLE_SERVO_ANGLES +#endif // EDITABLE_SERVO_ANGLES diff --git a/Marlin/src/gcode/config/M301.cpp b/Marlin/src/gcode/config/M301.cpp index f61896ac7306..531aa88db3fe 100644 --- a/Marlin/src/gcode/config/M301.cpp +++ b/Marlin/src/gcode/config/M301.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -70,10 +70,8 @@ void GcodeSuite::M301() { #endif SERIAL_EOL(); } - else { - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM(MSG_INVALID_EXTRUDER); - } + else + SERIAL_ERROR_MSG(MSG_INVALID_EXTRUDER); } #endif // PIDTEMP diff --git a/Marlin/src/gcode/config/M302.cpp b/Marlin/src/gcode/config/M302.cpp index 5097c5493a3f..3db4921adef3 100644 --- a/Marlin/src/gcode/config/M302.cpp +++ b/Marlin/src/gcode/config/M302.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -54,7 +54,8 @@ void GcodeSuite::M302() { else if (!seen_S) { // Report current state SERIAL_ECHO_START(); - SERIAL_ECHOPAIR("Cold extrudes are ", (thermalManager.allow_cold_extrude ? "en" : "dis")); + SERIAL_ECHOPGM("Cold extrudes are "); + serialprintPGM(thermalManager.allow_cold_extrude ? PSTR("en") : PSTR("dis")); SERIAL_ECHOPAIR("abled (min temp ", thermalManager.extrude_min_temp); SERIAL_ECHOLNPGM("C)"); } diff --git a/Marlin/src/gcode/config/M304.cpp b/Marlin/src/gcode/config/M304.cpp index a4251482ae01..d3305a2ebc5d 100644 --- a/Marlin/src/gcode/config/M304.cpp +++ b/Marlin/src/gcode/config/M304.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 2115a1d26e73..e1445eaf6da7 100644 --- a/Marlin/src/gcode/config/M43.cpp +++ b/Marlin/src/gcode/config/M43.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -34,6 +34,10 @@ #include "../../module/servo.h" #endif +#if ENABLED(HOST_PROMPT_SUPPORT) + #include "../../feature/host_actions.h" +#endif + inline void toggle_pins() { const bool ignore_protection = parser.boolval('I'); const int repeat = parser.intval('R', 1), @@ -43,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) { @@ -73,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(); } @@ -89,22 +93,20 @@ inline void toggle_pins() { inline void servo_probe_test() { #if !(NUM_SERVOS > 0 && HAS_SERVO_0) - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM("SERVO not setup"); + SERIAL_ERROR_MSG("SERVO not setup"); #elif !HAS_Z_SERVO_PROBE - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM("Z_PROBE_SERVO_NR not setup"); + SERIAL_ERROR_MSG("Z_PROBE_SERVO_NR not setup"); #else // HAS_Z_SERVO_PROBE const uint8_t probe_index = parser.byteval('P', Z_PROBE_SERVO_NR); - SERIAL_PROTOCOLLNPGM("Servo probe test"); - SERIAL_PROTOCOLLNPAIR(". using index: ", probe_index); - SERIAL_PROTOCOLLNPAIR(". deploy angle: ", servo_angles[probe_index][0]); - SERIAL_PROTOCOLLNPAIR(". stow angle: ", servo_angles[probe_index][1]); + SERIAL_ECHOLNPGM("Servo probe test"); + SERIAL_ECHOLNPAIR(". using index: ", probe_index); + SERIAL_ECHOLNPAIR(". deploy angle: ", servo_angles[probe_index][0]); + SERIAL_ECHOLNPAIR(". stow angle: ", servo_angles[probe_index][1]); bool probe_inverting; @@ -112,36 +114,36 @@ inline void servo_probe_test() { #define PROBE_TEST_PIN Z_MIN_PIN - SERIAL_PROTOCOLLNPAIR(". probe uses Z_MIN pin: ", PROBE_TEST_PIN); - SERIAL_PROTOCOLLNPGM(". uses Z_MIN_ENDSTOP_INVERTING (ignores Z_MIN_PROBE_ENDSTOP_INVERTING)"); - SERIAL_PROTOCOLPGM(". Z_MIN_ENDSTOP_INVERTING: "); + SERIAL_ECHOLNPAIR(". probe uses Z_MIN pin: ", PROBE_TEST_PIN); + SERIAL_ECHOLNPGM(". uses Z_MIN_ENDSTOP_INVERTING (ignores Z_MIN_PROBE_ENDSTOP_INVERTING)"); + SERIAL_ECHOPGM(". Z_MIN_ENDSTOP_INVERTING: "); #if Z_MIN_ENDSTOP_INVERTING - SERIAL_PROTOCOLLNPGM("true"); + SERIAL_ECHOLNPGM("true"); #else - SERIAL_PROTOCOLLNPGM("false"); + SERIAL_ECHOLNPGM("false"); #endif probe_inverting = Z_MIN_ENDSTOP_INVERTING; - #elif ENABLED(Z_MIN_PROBE_ENDSTOP) + #elif USES_Z_MIN_PROBE_ENDSTOP #define PROBE_TEST_PIN Z_MIN_PROBE_PIN - SERIAL_PROTOCOLLNPAIR(". probe uses Z_MIN_PROBE_PIN: ", PROBE_TEST_PIN); - SERIAL_PROTOCOLLNPGM(". uses Z_MIN_PROBE_ENDSTOP_INVERTING (ignores Z_MIN_ENDSTOP_INVERTING)"); - SERIAL_PROTOCOLPGM(". Z_MIN_PROBE_ENDSTOP_INVERTING: "); + SERIAL_ECHOLNPAIR(". probe uses Z_MIN_PROBE_PIN: ", PROBE_TEST_PIN); + SERIAL_ECHOLNPGM(". uses Z_MIN_PROBE_ENDSTOP_INVERTING (ignores Z_MIN_ENDSTOP_INVERTING)"); + SERIAL_ECHOPGM(". Z_MIN_PROBE_ENDSTOP_INVERTING: "); #if Z_MIN_PROBE_ENDSTOP_INVERTING - SERIAL_PROTOCOLLNPGM("true"); + SERIAL_ECHOLNPGM("true"); #else - SERIAL_PROTOCOLLNPGM("false"); + SERIAL_ECHOLNPGM("false"); #endif probe_inverting = Z_MIN_PROBE_ENDSTOP_INVERTING; #endif - SERIAL_PROTOCOLLNPGM(". deploy & stow 4 times"); + SERIAL_ECHOLNPGM(". deploy & stow 4 times"); SET_INPUT_PULLUP(PROBE_TEST_PIN); uint8_t i = 0; bool deploy_state, stow_state; @@ -153,26 +155,26 @@ inline void servo_probe_test() { safe_delay(500); stow_state = READ(PROBE_TEST_PIN); } while (++i < 4); - if (probe_inverting != deploy_state) SERIAL_PROTOCOLLNPGM("WARNING - INVERTING setting probably backwards"); + if (probe_inverting != deploy_state) SERIAL_ECHOLNPGM("WARNING - INVERTING setting probably backwards"); if (deploy_state != stow_state) { - SERIAL_PROTOCOLLNPGM("BLTouch clone detected"); + SERIAL_ECHOLNPGM("BLTouch clone detected"); if (deploy_state) { - SERIAL_PROTOCOLLNPGM(". DEPLOYED state: HIGH (logic 1)"); - SERIAL_PROTOCOLLNPGM(". STOWED (triggered) state: LOW (logic 0)"); + SERIAL_ECHOLNPGM(". DEPLOYED state: HIGH (logic 1)"); + SERIAL_ECHOLNPGM(". STOWED (triggered) state: LOW (logic 0)"); } else { - SERIAL_PROTOCOLLNPGM(". DEPLOYED state: LOW (logic 0)"); - SERIAL_PROTOCOLLNPGM(". STOWED (triggered) state: HIGH (logic 1)"); + SERIAL_ECHOLNPGM(". DEPLOYED state: LOW (logic 0)"); + SERIAL_ECHOLNPGM(". STOWED (triggered) state: HIGH (logic 1)"); } #if ENABLED(BLTOUCH) - SERIAL_PROTOCOLLNPGM("ERROR: BLTOUCH enabled - set this device up as a Z Servo Probe with inverting as true."); + SERIAL_ECHOLNPGM("ERROR: BLTOUCH enabled - set this device up as a Z Servo Probe with inverting as true."); #endif } else { // measure active signal length MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][0]); // Deploy safe_delay(500); - SERIAL_PROTOCOLLNPGM("please trigger probe"); + SERIAL_ECHOLNPGM("please trigger probe"); uint16_t probe_counter = 0; // Allow 30 seconds max for operator to trigger probe @@ -188,11 +190,11 @@ inline void servo_probe_test() { safe_delay(2); if (probe_counter == 50) - SERIAL_PROTOCOLLNPGM("Z Servo Probe detected"); // >= 100mS active time + SERIAL_ECHOLNPGM("Z Servo Probe detected"); // >= 100mS active time else if (probe_counter >= 2) - SERIAL_PROTOCOLLNPAIR("BLTouch compatible probe detected - pulse width (+/- 4mS): ", probe_counter * 2); // allow 4 - 100mS pulse + SERIAL_ECHOLNPAIR("BLTouch compatible probe detected - pulse width (+/- 4mS): ", probe_counter * 2); // allow 4 - 100mS pulse else - SERIAL_PROTOCOLLNPGM("noise detected - please re-run test"); // less than 2mS pulse + SERIAL_ECHOLNPGM("noise detected - please re-run test"); // less than 2mS pulse MOVE_SERVO(probe_index, servo_angles[Z_PROBE_SERVO_NR][1]); // Stow @@ -200,7 +202,7 @@ inline void servo_probe_test() { } // for loop waiting for trigger - if (probe_counter == 0) SERIAL_PROTOCOLLNPGM("trigger not detected"); + if (probe_counter == 0) SERIAL_ECHOLNPGM("trigger not detected"); } // measure active signal length @@ -245,9 +247,9 @@ void GcodeSuite::M43() { // Enable or disable endstop monitoring if (parser.seen('E')) { endstops.monitor_flag = parser.value_bool(); - SERIAL_PROTOCOLPGM("endstop monitor "); + SERIAL_ECHOPGM("endstop monitor "); serialprintPGM(endstops.monitor_flag ? PSTR("en") : PSTR("dis")); - SERIAL_PROTOCOLLNPGM("abled"); + SERIAL_ECHOLNPGM("abled"); return; } @@ -266,7 +268,7 @@ void GcodeSuite::M43() { // Watch until click, M108, or reset if (parser.boolval('W')) { - SERIAL_PROTOCOLLNPGM("Watching pins"); + SERIAL_ECHOLNPGM("Watching pins"); #ifdef ARDUINO_ARCH_SAM NOLESS(first_pin, 2); // don't hijack the UART pins @@ -275,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); /* @@ -283,11 +285,14 @@ 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 wait_for_user = true; + #if ENABLED(HOST_PROMPT_SUPPORT) + host_prompt_do(PROMPT_USER_CONTINUE, PSTR("M43 Wait Called"), PSTR("Continue")); + #endif KEEPALIVE_STATE(PAUSED_FOR_USER); #endif @@ -295,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/config/M540.cpp b/Marlin/src/gcode/config/M540.cpp index d55425803092..5fa3020ac7fd 100644 --- a/Marlin/src/gcode/config/M540.cpp +++ b/Marlin/src/gcode/config/M540.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/config/M92.cpp b/Marlin/src/gcode/config/M92.cpp index cb438d41428e..6fe3b46c0ceb 100644 --- a/Marlin/src/gcode/config/M92.cpp +++ b/Marlin/src/gcode/config/M92.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -23,19 +23,53 @@ #include "../gcode.h" #include "../../module/planner.h" +void report_M92(const bool echo=true, const int8_t e=-1) { + if (echo) SERIAL_ECHO_START(); else SERIAL_CHAR(' '); + SERIAL_ECHOPAIR(" M92 X", LINEAR_UNIT(planner.settings.axis_steps_per_mm[X_AXIS])); + SERIAL_ECHOPAIR(" Y", LINEAR_UNIT(planner.settings.axis_steps_per_mm[Y_AXIS])); + SERIAL_ECHOPAIR(" Z", LINEAR_UNIT(planner.settings.axis_steps_per_mm[Z_AXIS])); + #if DISABLED(DISTINCT_E_FACTORS) + SERIAL_ECHOPAIR(" E", VOLUMETRIC_UNIT(planner.settings.axis_steps_per_mm[E_AXIS])); + #endif + SERIAL_EOL(); + + #if ENABLED(DISTINCT_E_FACTORS) + for (uint8_t i = 0; i < E_STEPPERS; i++) { + if (e >= 0 && i != e) continue; + if (echo) SERIAL_ECHO_START(); else SERIAL_CHAR(' '); + SERIAL_ECHOPAIR(" M92 T", (int)i); + SERIAL_ECHOLNPAIR(" E", VOLUMETRIC_UNIT(planner.settings.axis_steps_per_mm[E_AXIS_N(i)])); + } + #endif +} + /** * M92: Set axis steps-per-unit for one or more axes, X, Y, Z, and E. * (Follows the same syntax as G92) * * With multiple extruders use T to specify which one. + * + * If no argument is given print the current values. + * + * With MAGIC_NUMBERS_GCODE: + * Use 'H' and/or 'L' to get ideal layer-height information. + * 'H' specifies micro-steps to use. We guess if it's not supplied. + * 'L' specifies a desired layer height. Nearest good heights are shown. */ void GcodeSuite::M92() { const int8_t target_extruder = get_target_extruder_from_command(); if (target_extruder < 0) return; + // No arguments? Show M92 report. + if (!parser.seen("XYZE" + #if ENABLED(MAGIC_NUMBERS_GCODE) + "HL" + #endif + )) return report_M92(true, target_extruder); + LOOP_XYZE(i) { - if (parser.seen(axis_codes[i])) { + if (parser.seenval(axis_codes[i])) { if (i == E_AXIS) { const float value = parser.value_per_axis_units((AxisEnum)(E_AXIS_N(target_extruder))); if (value < 20) { @@ -54,4 +88,27 @@ void GcodeSuite::M92() { } } planner.refresh_positioning(); + + #if ENABLED(MAGIC_NUMBERS_GCODE) + #ifndef Z_MICROSTEPS + #define Z_MICROSTEPS 16 + #endif + const float wanted = parser.floatval('L'); + if (parser.seen('H') || wanted) { + const uint16_t argH = parser.ushortval('H'), + micro_steps = argH ? argH : Z_MICROSTEPS; + const float z_full_step_mm = micro_steps * planner.steps_to_mm[Z_AXIS]; + SERIAL_ECHO_START(); + SERIAL_ECHOPAIR("{ micro_steps:", micro_steps); + SERIAL_ECHOPAIR(", z_full_step_mm:", z_full_step_mm); + if (wanted) { + const float best = uint16_t(wanted / z_full_step_mm) * z_full_step_mm; + SERIAL_ECHOPGM(", best:["); + SERIAL_ECHO(best); + if (best != wanted) { SERIAL_CHAR(','); SERIAL_ECHO(best + z_full_step_mm); } + SERIAL_CHAR(']'); + } + SERIAL_ECHOLNPGM(" }"); + } + #endif } diff --git a/Marlin/src/gcode/control/M108_M112_M410.cpp b/Marlin/src/gcode/control/M108_M112_M410.cpp index 6e376bcc2412..5f1384c162ce 100644 --- a/Marlin/src/gcode/control/M108_M112_M410.cpp +++ b/Marlin/src/gcode/control/M108_M112_M410.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/control/M111.cpp b/Marlin/src/gcode/control/M111.cpp index 141035678939..f4bb6e1f628e 100644 --- a/Marlin/src/gcode/control/M111.cpp +++ b/Marlin/src/gcode/control/M111.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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/M120_M121.cpp b/Marlin/src/gcode/control/M120_M121.cpp index 3425fc947735..97d6b02b10c7 100644 --- a/Marlin/src/gcode/control/M120_M121.cpp +++ b/Marlin/src/gcode/control/M120_M121.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/control/M17_M18_M84.cpp b/Marlin/src/gcode/control/M17_M18_M84.cpp index 33a6eae5ff2c..1aea9955085e 100644 --- a/Marlin/src/gcode/control/M17_M18_M84.cpp +++ b/Marlin/src/gcode/control/M17_M18_M84.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -21,11 +21,11 @@ */ #include "../gcode.h" -#include "../../Marlin.h" // for stepper_inactive_time +#include "../../Marlin.h" // for stepper_inactive_time, disable_e_steppers #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 @@ -55,7 +55,7 @@ void GcodeSuite::M18_M84() { if (parser.seen('Y')) disable_Y(); if (parser.seen('Z')) disable_Z(); // Only disable on boards that have separate ENABLE_PINS or another method for disabling the driver - #if (E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN) || AXIS_DRIVER_TYPE(E0, TMC2660) || AXIS_DRIVER_TYPE(E1, TMC2660) || AXIS_DRIVER_TYPE(E2, TMC2660) || AXIS_DRIVER_TYPE(E3, TMC2660) || AXIS_DRIVER_TYPE(E4, TMC2660) || AXIS_DRIVER_TYPE(E5, TMC2660) + #if (E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN) || AXIS_DRIVER_TYPE_E0(TMC2660) || AXIS_DRIVER_TYPE_E1(TMC2660) || AXIS_DRIVER_TYPE_E2(TMC2660) || AXIS_DRIVER_TYPE_E3(TMC2660) || AXIS_DRIVER_TYPE_E4(TMC2660) || AXIS_DRIVER_TYPE_E5(TMC2660) if (parser.seen('E')) disable_e_steppers(); #endif } diff --git a/Marlin/src/gcode/control/M211.cpp b/Marlin/src/gcode/control/M211.cpp index 83db00a3bd27..3eb0ecf074e6 100644 --- a/Marlin/src/gcode/control/M211.cpp +++ b/Marlin/src/gcode/control/M211.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 59071aadf332..55f7dd8c508d 100644 --- a/Marlin/src/gcode/control/M226.cpp +++ b/Marlin/src/gcode/control/M226.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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/M280.cpp b/Marlin/src/gcode/control/M280.cpp index 1cfb6c89fdff..e7ee35413f6c 100644 --- a/Marlin/src/gcode/control/M280.cpp +++ b/Marlin/src/gcode/control/M280.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/control/M3-M5.cpp b/Marlin/src/gcode/control/M3-M5.cpp index 213d17450a07..132f7bb39916 100644 --- a/Marlin/src/gcode/control/M3-M5.cpp +++ b/Marlin/src/gcode/control/M3-M5.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -27,6 +27,8 @@ #include "../gcode.h" #include "../../module/stepper.h" +uint8_t spindle_laser_power; // = 0 + /** * M3: Spindle Clockwise * M4: Spindle Counter-clockwise @@ -51,7 +53,7 @@ * NOTE: A minimum PWM frequency of 50 Hz is needed. All prescaler * factors for timers 2, 3, 4, and 5 are acceptable. * - * SPINDLE_LASER_ENABLE_PIN needs an external pullup or it may power on + * SPINDLE_LASER_ENA_PIN needs an external pullup or it may power on * the spindle/laser during power-up or when connecting to the host * (usually goes through a reset which sets all I/O pins to tri-state) * @@ -59,10 +61,10 @@ */ // Wait for spindle to come up to speed -inline void delay_for_power_up() { gcode.dwell(SPINDLE_LASER_POWERUP_DELAY); } +inline void delay_for_power_up() { safe_delay(SPINDLE_LASER_POWERUP_DELAY); } // Wait for spindle to stop turning -inline void delay_for_power_down() { gcode.dwell(SPINDLE_LASER_POWERDOWN_DELAY); } +inline void delay_for_power_down() { safe_delay(SPINDLE_LASER_POWERDOWN_DELAY); } /** * ocr_val_mode() is used for debugging and to get the points needed to compute the RPM vs ocr_val line @@ -70,26 +72,74 @@ inline void delay_for_power_down() { gcode.dwell(SPINDLE_LASER_POWERDOWN_DELAY); * it accepts inputs of 0-255 */ -inline void ocr_val_mode() { - uint8_t spindle_laser_power = parser.value_byte(); - WRITE(SPINDLE_LASER_ENABLE_PIN, SPINDLE_LASER_ENABLE_INVERT); // turn spindle on (active low) - if (SPINDLE_LASER_PWM_INVERT) spindle_laser_power = 255 - spindle_laser_power; - analogWrite(SPINDLE_LASER_PWM_PIN, spindle_laser_power); +inline void set_spindle_laser_ocr(const uint8_t ocr) { + WRITE(SPINDLE_LASER_ENA_PIN, SPINDLE_LASER_ENABLE_INVERT); // turn spindle on (active low) + #if ENABLED(SPINDLE_LASER_PWM) + analogWrite(SPINDLE_LASER_PWM_PIN, (SPINDLE_LASER_PWM_INVERT) ? 255 - ocr : ocr); + #endif } -void GcodeSuite::M3_M4(bool is_M3) { +#if ENABLED(SPINDLE_LASER_PWM) - planner.synchronize(); // wait until previous movement commands (G0/G0/G2/G3) have completed before playing with the spindle - #if SPINDLE_DIR_CHANGE - const bool rotation_dir = (is_M3 != SPINDLE_INVERT_DIR); - if (SPINDLE_STOP_ON_DIR_CHANGE \ - && READ(SPINDLE_LASER_ENABLE_PIN) == SPINDLE_LASER_ENABLE_INVERT \ - && READ(SPINDLE_DIR_PIN) != rotation_dir - ) { - WRITE(SPINDLE_LASER_ENABLE_PIN, !SPINDLE_LASER_ENABLE_INVERT); // turn spindle off + void update_spindle_laser_power() { + if (spindle_laser_power == 0) { + WRITE(SPINDLE_LASER_ENA_PIN, !SPINDLE_LASER_ENABLE_INVERT); // turn spindle off (active low) + analogWrite(SPINDLE_LASER_PWM_PIN, SPINDLE_LASER_PWM_INVERT ? 255 : 0); // only write low byte delay_for_power_down(); } - WRITE(SPINDLE_DIR_PIN, rotation_dir); + else { // Convert RPM to PWM duty cycle + constexpr float inv_slope = 1.0f / (SPEED_POWER_SLOPE), + min_ocr = (SPEED_POWER_MIN - (SPEED_POWER_INTERCEPT)) * inv_slope, // Minimum allowed + max_ocr = (SPEED_POWER_MAX - (SPEED_POWER_INTERCEPT)) * inv_slope; // Maximum allowed + int16_t ocr_val; + if (spindle_laser_power <= SPEED_POWER_MIN) ocr_val = min_ocr; // Use minimum if set below + else if (spindle_laser_power >= SPEED_POWER_MAX) ocr_val = max_ocr; // Use maximum if set above + else ocr_val = (spindle_laser_power - (SPEED_POWER_INTERCEPT)) * inv_slope; // Use calculated OCR value + set_spindle_laser_ocr(ocr_val & 0xFF); // ...limited to Atmel PWM max + delay_for_power_up(); + } + } + +#endif // SPINDLE_LASER_PWM + +bool spindle_laser_enabled() { + return !!spindle_laser_power; // READ(SPINDLE_LASER_ENA_PIN) == SPINDLE_LASER_ENABLE_INVERT; +} + +void set_spindle_laser_enabled(const bool enable) { + // Enabled by PWM setting elsewhere + spindle_laser_power = enable ? 255 : 0; + #if ENABLED(SPINDLE_LASER_PWM) + update_spindle_laser_power(); + #else + if (enable) { + WRITE(SPINDLE_LASER_ENA_PIN, SPINDLE_LASER_ENABLE_INVERT); + delay_for_power_up(); + } + else { + WRITE(SPINDLE_LASER_ENA_PIN, !SPINDLE_LASER_ENABLE_INVERT); + delay_for_power_down(); + } + #endif +} + +#if SPINDLE_DIR_CHANGE + + void set_spindle_direction(const bool reverse_dir) { + const bool dir_state = (reverse_dir == SPINDLE_INVERT_DIR); // Forward (M3) HIGH when not inverted + if (SPINDLE_STOP_ON_DIR_CHANGE && spindle_laser_enabled() && READ(SPINDLE_DIR_PIN) != dir_state) + set_spindle_laser_enabled(false); + WRITE(SPINDLE_DIR_PIN, dir_state); + } + +#endif + +void GcodeSuite::M3_M4(const bool is_M4) { + + planner.synchronize(); // wait until previous movement commands (G0/G0/G2/G3) have completed before playing with the spindle + + #if SPINDLE_DIR_CHANGE + set_spindle_direction(is_M4); #endif /** @@ -98,30 +148,16 @@ void GcodeSuite::M3_M4(bool is_M3) { * Then needed to AND the uint16_t result with 0x00FF to make sure we only wrote the byte of interest. */ #if ENABLED(SPINDLE_LASER_PWM) - if (parser.seen('O')) ocr_val_mode(); + if (parser.seen('O')) { + spindle_laser_power = parser.value_byte(); + set_spindle_laser_ocr(spindle_laser_power); + } else { - const float spindle_laser_power = parser.floatval('S'); - if (spindle_laser_power == 0) { - WRITE(SPINDLE_LASER_ENABLE_PIN, !SPINDLE_LASER_ENABLE_INVERT); // turn spindle off (active low) - analogWrite(SPINDLE_LASER_PWM_PIN, SPINDLE_LASER_PWM_INVERT ? 255 : 0); // only write low byte - delay_for_power_down(); - } - else { - int16_t ocr_val = (spindle_laser_power - (SPEED_POWER_INTERCEPT)) * (1.0f / (SPEED_POWER_SLOPE)); // convert RPM to PWM duty cycle - NOMORE(ocr_val, 255); // limit to max the Atmel PWM will support - if (spindle_laser_power <= SPEED_POWER_MIN) - ocr_val = (SPEED_POWER_MIN - (SPEED_POWER_INTERCEPT)) * (1.0f / (SPEED_POWER_SLOPE)); // minimum setting - if (spindle_laser_power >= SPEED_POWER_MAX) - ocr_val = (SPEED_POWER_MAX - (SPEED_POWER_INTERCEPT)) * (1.0f / (SPEED_POWER_SLOPE)); // limit to max RPM - if (SPINDLE_LASER_PWM_INVERT) ocr_val = 255 - ocr_val; - WRITE(SPINDLE_LASER_ENABLE_PIN, SPINDLE_LASER_ENABLE_INVERT); // turn spindle on (active low) - analogWrite(SPINDLE_LASER_PWM_PIN, ocr_val & 0xFF); // only write low byte - delay_for_power_up(); - } + spindle_laser_power = parser.intval('S', 255); + update_spindle_laser_power(); } #else - WRITE(SPINDLE_LASER_ENABLE_PIN, SPINDLE_LASER_ENABLE_INVERT); // turn spindle on (active low) if spindle speed option not enabled - delay_for_power_up(); + set_spindle_laser_enabled(true); #endif } @@ -130,11 +166,7 @@ void GcodeSuite::M3_M4(bool is_M3) { */ void GcodeSuite::M5() { planner.synchronize(); - WRITE(SPINDLE_LASER_ENABLE_PIN, !SPINDLE_LASER_ENABLE_INVERT); - #if ENABLED(SPINDLE_LASER_PWM) - analogWrite(SPINDLE_LASER_PWM_PIN, SPINDLE_LASER_PWM_INVERT ? 255 : 0); - #endif - delay_for_power_down(); + set_spindle_laser_enabled(false); } #endif // SPINDLE_LASER_ENABLE diff --git a/Marlin/src/gcode/control/M350_M351.cpp b/Marlin/src/gcode/control/M350_M351.cpp index a83823f31563..53aaa58d6bfd 100644 --- a/Marlin/src/gcode/control/M350_M351.cpp +++ b/Marlin/src/gcode/control/M350_M351.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/control/M380_M381.cpp b/Marlin/src/gcode/control/M380_M381.cpp index 7f4a3afc5275..c23d7e57269d 100644 --- a/Marlin/src/gcode/control/M380_M381.cpp +++ b/Marlin/src/gcode/control/M380_M381.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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" @@ -35,15 +35,22 @@ */ void GcodeSuite::M380() { #if ENABLED(MANUAL_SOLENOID_CONTROL) - enable_solenoid(parser.seenval('S') ? parser.value_int() : active_extruder); + enable_solenoid(parser.intval('S', active_extruder)); #else enable_solenoid_on_active_extruder(); #endif } /** - * M381: Disable all solenoids + * M381: Disable all solenoids if EXT_SOLENOID + * Disable selected/active solenoid if MANUAL_SOLENOID_CONTROL */ -void GcodeSuite::M381() { disable_all_solenoids(); } +void GcodeSuite::M381() { + #if ENABLED(MANUAL_SOLENOID_CONTROL) + disable_solenoid(parser.intval('S', active_extruder)); + #else + disable_all_solenoids(); + #endif +} #endif // EXT_SOLENOID || MANUAL_SOLENOID_CONTROL diff --git a/Marlin/src/gcode/control/M400.cpp b/Marlin/src/gcode/control/M400.cpp index f55f626d098e..920462f8a913 100644 --- a/Marlin/src/gcode/control/M400.cpp +++ b/Marlin/src/gcode/control/M400.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/control/M42.cpp b/Marlin/src/gcode/control/M42.cpp index 2a7323a8617d..bafc40762e2d 100644 --- a/Marlin/src/gcode/control/M42.cpp +++ b/Marlin/src/gcode/control/M42.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -24,6 +24,10 @@ #include "../../Marlin.h" // for pin_is_protected #include "../../inc/MarlinConfig.h" +#if FAN_COUNT > 0 + #include "../../module/temperature.h" +#endif + /** * M42: Change pin status via GCode * @@ -46,19 +50,19 @@ 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 switch (pin) { #if HAS_FAN0 - case FAN_PIN: fan_speed[0] = pin_status; break; + case FAN_PIN: thermalManager.fan_speed[0] = pin_status; break; #endif #if HAS_FAN1 - case FAN1_PIN: fan_speed[1] = pin_status; break; + case FAN1_PIN: thermalManager.fan_speed[1] = pin_status; break; #endif #if HAS_FAN2 - case FAN2_PIN: fan_speed[2] = pin_status; break; + case FAN2_PIN: thermalManager.fan_speed[2] = pin_status; break; #endif } #endif diff --git a/Marlin/src/gcode/control/M605.cpp b/Marlin/src/gcode/control/M605.cpp index bcd0cf7b769a..f1f64f0ce369 100644 --- a/Marlin/src/gcode/control/M605.cpp +++ b/Marlin/src/gcode/control/M605.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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_ECHOPGM("Printer must be in DXC_DUPLICATION_MODE prior to \n"); - SERIAL_ECHOPGM("specifying DXC_SCALED_DUPLICATION_MODE.\n"); + SERIAL_ECHOLNPGM("Printer must be in DXC_DUPLICATION_MODE prior to "); + 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(); - - 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(); + 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(); + + 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/M80_M81.cpp b/Marlin/src/gcode/control/M80_M81.cpp index 3dbf15a794c0..d2d90b65181a 100644 --- a/Marlin/src/gcode/control/M80_M81.cpp +++ b/Marlin/src/gcode/control/M80_M81.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -42,13 +42,7 @@ #endif // Could be moved to a feature, but this is all the data - bool powersupply_on = ( - #if ENABLED(PS_DEFAULT_OFF) - false - #else - true - #endif - ); + bool powersupply_on; #if HAS_TRINAMIC #include "../../feature/tmc_util.h" @@ -100,10 +94,10 @@ void GcodeSuite::M81() { planner.finish_and_disable(); #if FAN_COUNT > 0 - zero_fan_speeds(); + thermalManager.zero_fan_speeds(); #if ENABLED(PROBING_FANS_OFF) - fans_paused = false; - ZERO(paused_fan_speed); + thermalManager.fans_paused = false; + ZERO(thermalManager.paused_fan_speed); #endif #endif diff --git a/Marlin/src/gcode/control/M85.cpp b/Marlin/src/gcode/control/M85.cpp index 2d8ab08b99de..4bead2e9c8cf 100644 --- a/Marlin/src/gcode/control/M85.cpp +++ b/Marlin/src/gcode/control/M85.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/control/M997.cpp b/Marlin/src/gcode/control/M997.cpp new file mode 100644 index 000000000000..06284a5db2fa --- /dev/null +++ b/Marlin/src/gcode/control/M997.cpp @@ -0,0 +1,34 @@ +/** + * 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 "../gcode.h" + +#if ENABLED(PLATFORM_M997_SUPPORT) + +/** + * M997: Perform in-application firmware update + */ +void GcodeSuite::M997() { + flashFirmware(parser.intval('S')); +} + +#endif diff --git a/Marlin/src/gcode/control/M999.cpp b/Marlin/src/gcode/control/M999.cpp index 18a7287aed72..8ddbf859e7d3 100644 --- a/Marlin/src/gcode/control/M999.cpp +++ b/Marlin/src/gcode/control/M999.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/control/T.cpp b/Marlin/src/gcode/control/T.cpp index ba6db224407f..fb8f09eeeb84 100644 --- a/Marlin/src/gcode/control/T.cpp +++ b/Marlin/src/gcode/control/T.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -27,20 +27,36 @@ #include "../../module/motion.h" #endif +#if ENABLED(PRUSA_MMU2) + #include "../../feature/prusa_MMU2/mmu2.h" +#endif + +#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) +#include "../../core/debug_out.h" + /** - * T0-T3: Switch tool, usually switching extruders + * T0-T: Switch tool, usually switching extruders * * F[units/min] Set the movement feedrate * S1 Don't move the tool in XY after change + * + * For PRUSA_MMU2: + * T[n] Gcode to extrude at least 38.10 mm at feedrate 19.02 mm/s must follow immediately to load to extruder wheels. + * T? Gcode to extrude shouldn't have to follow. Load to extruder wheels is done automatically. + * Tx Same as T?, but nozzle doesn't have to be preheated. Tc requires a preheated nozzle to finish filament load. + * Tc Load to nozzle after filament was prepared by Tc and nozzle is already heated. */ 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); + if (DEBUGGING(LEVELING)) { + DEBUG_ECHOLNPAIR(">>> T(", tool_index, ")"); + DEBUG_POS("BEFORE", current_position); + } + + #if ENABLED(PRUSA_MMU2) + if (parser.string_arg) { + mmu2.tool_change(parser.string_arg); // Special commands T?/Tx/Tc + return; } #endif @@ -58,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 caa139b17d54..12e323bd7bb0 100644 --- a/Marlin/src/gcode/eeprom/M500-M504.cpp +++ b/Marlin/src/gcode/eeprom/M500-M504.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -29,21 +29,11 @@ #include "../../lcd/extensible_ui/ui_api.h" #endif -#if NUM_SERIAL > 1 - #include "../../gcode/queue.h" -#endif - -#if ADD_PORT_ARG - #define CHAT_PORT command_queue_port[cmd_queue_index_r] -#else - #define CHAT_PORT -#endif - /** * M500: Store settings in EEPROM */ void GcodeSuite::M500() { - (void)settings.save(CHAT_PORT); + (void)settings.save(); #if ENABLED(EXTENSIBLE_UI) ExtUI::onStoreSettings(); #endif @@ -53,11 +43,7 @@ void GcodeSuite::M500() { * M501: Read settings from EEPROM */ void GcodeSuite::M501() { - (void)settings.load( - #if ENABLED(EEPROM_SETTINGS) - CHAT_PORT - #endif - ); + (void)settings.load(); #if ENABLED(EXTENSIBLE_UI) ExtUI::onLoadSettings(); #endif @@ -67,7 +53,7 @@ void GcodeSuite::M501() { * M502: Revert to default settings */ void GcodeSuite::M502() { - (void)settings.reset(CHAT_PORT); + (void)settings.reset(); #if ENABLED(EXTENSIBLE_UI) ExtUI::onFactoryReset(); #endif @@ -79,12 +65,7 @@ void GcodeSuite::M502() { * M503: print settings currently in memory */ void GcodeSuite::M503() { - (void)settings.report( - parser.seen('S') && !parser.value_bool() - #if NUM_SERIAL > 1 - , command_queue_port[cmd_queue_index_r] - #endif - ); + (void)settings.report(parser.boolval('S', true)); } #endif // !DISABLE_M503 @@ -94,9 +75,7 @@ void GcodeSuite::M502() { * M504: Validate EEPROM Contents */ void GcodeSuite::M504() { - if (settings.validate(CHAT_PORT)) { - SERIAL_ECHO_START_P(command_queue_port[cmd_queue_index_r]); - SERIAL_ECHOLNPGM_P(command_queue_port[cmd_queue_index_r], "EEPROM OK"); - } + if (settings.validate()) + SERIAL_ECHO_MSG("EEPROM OK"); } #endif diff --git a/Marlin/src/gcode/feature/L6470/M122.cpp b/Marlin/src/gcode/feature/L6470/M122.cpp new file mode 100644 index 000000000000..8f806cbd947b --- /dev/null +++ b/Marlin/src/gcode/feature/L6470/M122.cpp @@ -0,0 +1,115 @@ +/** + * 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 HAS_DRIVER(L6470) + +#include "../../gcode.h" +#include "../../../libs/L6470/L6470_Marlin.h" +#include "../../../module/stepper_indirection.h" + +inline void echo_yes_no(const bool yes) { serialprintPGM(yes ? PSTR(" YES") : PSTR(" NO ")); } + +void L6470_status_decode(const uint16_t status, const uint8_t axis) { + if (L6470.spi_abort) return; // don't do anything if set_directions() has occurred + L6470.say_axis(axis); + #if ENABLED(L6470_CHITCHAT) + char temp_buf[20]; + sprintf_P(temp_buf, PSTR(" status: %4x "), status); + SERIAL_ECHO(temp_buf); + print_bin(status); + #endif + SERIAL_ECHOPGM("\n...OUTPUT: "); + serialprintPGM(status & STATUS_HIZ ? PSTR("OFF") : PSTR("ON ")); + SERIAL_ECHOPGM(" BUSY: "); echo_yes_no(!(status & STATUS_BUSY)); + SERIAL_ECHOPGM(" DIR: "); + serialprintPGM((((status & STATUS_DIR) >> 4) ^ L6470.index_to_dir[axis]) ? PSTR("FORWARD") : PSTR("REVERSE")); + SERIAL_ECHOPGM(" Last Command: "); + if (status & STATUS_WRONG_CMD) SERIAL_ECHOPGM("IN"); + SERIAL_ECHOPGM("VALID "); + serialprintPGM(status & STATUS_NOTPERF_CMD ? PSTR("Not PERFORMED") : PSTR("COMPLETED ")); + SERIAL_ECHOPAIR("\n...THERMAL: ", !(status & STATUS_TH_SD) ? "SHUTDOWN" : !(status & STATUS_TH_WRN) ? "WARNING " : "OK "); + SERIAL_ECHOPGM(" OVERCURRENT:"); echo_yes_no(!(status & STATUS_OCD)); + SERIAL_ECHOPGM(" STALL:"); echo_yes_no(!(status & STATUS_STEP_LOSS_A) || !(status & STATUS_STEP_LOSS_B)); + SERIAL_ECHOPGM(" STEP-CLOCK MODE:"); echo_yes_no(status & STATUS_SCK_MOD); + SERIAL_EOL(); +} + +/** + * M122: Debug L6470 drivers + */ +void GcodeSuite::M122() { + + L6470.spi_active = true; // let set_directions() know we're in the middle of a series of SPI transfers + + #define L6470_SAY_STATUS(Q) L6470_status_decode(stepper##Q.getStatus(), Q) + + //if (parser.seen('S')) + // tmc_set_report_interval(parser.value_bool()); + //else + + #if AXIS_DRIVER_TYPE_X(L6470) + L6470_SAY_STATUS(X); + #endif + #if AXIS_DRIVER_TYPE_X2(L6470) + L6470_SAY_STATUS(X2); + #endif + #if AXIS_DRIVER_TYPE_Y(L6470) + L6470_SAY_STATUS(Y); + #endif + #if AXIS_DRIVER_TYPE_Y2(L6470) + L6470_SAY_STATUS(Y2); + #endif + #if AXIS_DRIVER_TYPE_Z(L6470) + L6470_SAY_STATUS(Z); + #endif + #if AXIS_DRIVER_TYPE_Z2(L6470) + L6470_SAY_STATUS(Z2); + #endif + #if AXIS_DRIVER_TYPE_Z3(L6470) + L6470_SAY_STATUS(Z3); + #endif + #if AXIS_DRIVER_TYPE_E0(L6470) + L6470_SAY_STATUS(E0); + #endif + #if AXIS_DRIVER_TYPE_E1(L6470) + L6470_SAY_STATUS(E1); + #endif + #if AXIS_DRIVER_TYPE_E2(L6470) + L6470_SAY_STATUS(E2); + #endif + #if AXIS_DRIVER_TYPE_E3(L6470) + L6470_SAY_STATUS(E3); + #endif + #if AXIS_DRIVER_TYPE_E4(L6470) + L6470_SAY_STATUS(E4); + #endif + #if AXIS_DRIVER_TYPE_E5(L6470) + L6470_SAY_STATUS(E5); + #endif + + L6470.spi_active = false; // done with all SPI transfers - clear handshake flags + L6470.spi_abort = false; +} + +#endif // HAS_DRIVER(L6470) diff --git a/Marlin/src/gcode/feature/L6470/M906.cpp b/Marlin/src/gcode/feature/L6470/M906.cpp new file mode 100644 index 000000000000..51bcfaee9ef6 --- /dev/null +++ b/Marlin/src/gcode/feature/L6470/M906.cpp @@ -0,0 +1,262 @@ +/** + * 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 HAS_DRIVER(L6470) + +#include "../../gcode.h" +#include "../../../libs/L6470/L6470_Marlin.h" +#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 + * PWMs to the steppers + * + * J - select which driver(s) to monitor on multi-driver axis + * 0 - (default) monitor all drivers on the axis or E0 + * 1 - monitor only X, Y, Z or E1 + * 2 - monitor only X2, Y2, Z2 or E2 + * 3 - monitor only Z3 or E3 + * 4 - monitor only E4 + * 5 - monitor only E5 + * Xxxx, Yxxx, Zxxx, Exxx - axis to be monitored with displacement + * xxx (1-255) is distance moved on either side of current position + * + * I - over current threshold + * optional - will report current value from driver if not specified + * + * K - value for KVAL_HOLD (0 - 255) (optional) + * optional - will report current value from driver if not specified + * + */ + +/** + * Sets KVAL_HOLD wich affects the current being driven through the stepper. + * + * L6470 is used in the STEP-CLOCK mode. KVAL_HOLD is the only KVAL_xxx + * that affects the effective voltage seen by the stepper. + * + */ + +/** + * MACRO to fetch information on the items associated with current limiting + * and maximum voltage output. + * + * L6470 can be setup to shutdown if either current threshold is exceeded. + * + * L6470 output current can not be set directly. It is set indirectly by + * setting the maximum effective output voltage. + * + * Effective output voltage is set by PWM duty cycle. + * + * Maximum effective output voltage is affected by MANY variables. The main ones are: + * KVAL_HOLD + * KVAL_RUN + * KVAL_ACC + * KVAL_DEC + * Vs compensation (if enabled) + */ + +void L6470_report_current(L6470 &motor, const uint8_t axis) { + if (L6470.spi_abort) return; // don't do anything if set_directions() has occurred + const uint16_t status = motor.getStatus() ; + const uint8_t overcurrent_threshold = (uint8_t)motor.GetParam(L6470_OCD_TH), + stall_threshold = (uint8_t)motor.GetParam(L6470_STALL_TH), + motor_status = (status & (STATUS_MOT_STATUS)) >> 13, + adc_out = motor.GetParam(L6470_ADC_OUT), + adc_out_limited = constrain(adc_out, 8, 24); + const float comp_coef = 1600.0f / adc_out_limited; + const int microsteps = _BV(motor.GetParam(L6470_STEP_MODE) & 0x07); + char temp_buf[80]; + L6470.say_axis(axis); + #if ENABLED(L6470_CHITCHAT) + sprintf_P(temp_buf, PSTR(" status: %4x "), status); + 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); + SERIAL_ECHO(temp_buf); + sprintf_P(temp_buf, PSTR(" Stall Threshold: %2d (%7.2f mA)"), stall_threshold, (stall_threshold + 1) * 31.25); + SERIAL_ECHO(temp_buf); + SERIAL_ECHOPGM(" Motor Status: "); + const char * const stat_str; + switch (motor_status) { + default: + case 0: stat_str = PSTR("stopped"); break; + case 1: stat_str = PSTR("accelerating"); break; + case 2: stat_str = PSTR("decelerating"); break; + case 3: stat_str = PSTR("at constant speed"); break; + } + serialprintPGM(stat_str); + SERIAL_EOL(); + SERIAL_ECHOPAIR("...microsteps: ", microsteps); + SERIAL_ECHOPAIR(" ADC_OUT: ", adc_out); + SERIAL_ECHOPGM(" Vs_compensation: "); + serialprintPGM((motor.GetParam(L6470_CONFIG) & CONFIG_EN_VSCOMP) ? PSTR("ENABLED ") : PSTR("DISABLED")); + sprintf_P(temp_buf, PSTR(" Compensation coefficient: ~%4.2f\n"), comp_coef * 0.01f); + SERIAL_ECHO(temp_buf); + SERIAL_ECHOPAIR("...KVAL_HOLD: ", motor.GetParam(L6470_KVAL_HOLD)); + SERIAL_ECHOPAIR(" KVAL_RUN : ", motor.GetParam(L6470_KVAL_RUN)); + SERIAL_ECHOPAIR(" KVAL_ACC: ", motor.GetParam(L6470_KVAL_ACC)); + SERIAL_ECHOPAIR(" KVAL_DEC: ", motor.GetParam(L6470_KVAL_DEC)); + SERIAL_ECHOPGM(" V motor max = "); + switch (motor_status) { + case 0: sprintf_P(temp_buf, PSTR(" %4.1f%% (KVAL_HOLD)\n"), float(motor.GetParam(L6470_KVAL_HOLD)) * 100 / 256); break; + case 1: sprintf_P(temp_buf, PSTR(" %4.1f%% (KVAL_RUN) \n"), float(motor.GetParam(L6470_KVAL_RUN)) * 100 / 256); break; + case 2: sprintf_P(temp_buf, PSTR(" %4.1f%% (KVAL_ACC) \n"), float(motor.GetParam(L6470_KVAL_ACC)) * 100 / 256); break; + case 3: sprintf_P(temp_buf, PSTR(" %4.1f%% (KVAL_DEC) \n"), float(motor.GetParam(L6470_KVAL_DEC)) * 100 / 256); break; + } + SERIAL_ECHO(temp_buf); +} + +void GcodeSuite::M906() { + #define L6470_SET_KVAL_HOLD(Q) stepper##Q.SetParam(L6470_KVAL_HOLD, value) + + DEBUG_ECHOLNPGM("M906"); + + bool report_current = true; + + #if HAS_DRIVER(L6470) + const uint8_t index = parser.byteval('I'); + #endif + + LOOP_XYZE(i) if (uint8_t value = parser.byteval(axis_codes[i])) { + + report_current = false; + + if (planner.has_blocks_queued() || planner.cleaning_buffer_counter) { + SERIAL_ECHOLNPGM("ERROR - can't set KVAL_HOLD while steppers are moving"); + return; + } + + switch (i) { + case X_AXIS: + #if AXIS_DRIVER_TYPE_X(L6470) + if (index == 0) L6470_SET_KVAL_HOLD(X); + #endif + #if AXIS_DRIVER_TYPE_X2(L6470) + if (index == 1) L6470_SET_KVAL_HOLD(X2); + #endif + break; + case Y_AXIS: + #if AXIS_DRIVER_TYPE_Y(L6470) + if (index == 0) L6470_SET_KVAL_HOLD(Y); + #endif + #if AXIS_DRIVER_TYPE_Y2(L6470) + if (index == 1) L6470_SET_KVAL_HOLD(Y2); + #endif + break; + case Z_AXIS: + #if AXIS_DRIVER_TYPE_Z(L6470) + if (index == 0) L6470_SET_KVAL_HOLD(Z); + #endif + #if AXIS_DRIVER_TYPE_Z2(L6470) + if (index == 1) L6470_SET_KVAL_HOLD(Z2); + #endif + #if AXIS_DRIVER_TYPE_Z3(L6470) + if (index == 2) L6470_SET_KVAL_HOLD(Z3); + #endif + break; + case E_AXIS: { + const int8_t target_extruder = get_target_extruder_from_command(); + if (target_extruder < 0) return; + switch (target_extruder) { + #if AXIS_DRIVER_TYPE_E0(L6470) + case 0: L6470_SET_KVAL_HOLD(E0); break; + #endif + #if AXIS_DRIVER_TYPE_E1(L6470) + case 1: L6470_SET_KVAL_HOLD(E1); break; + #endif + #if AXIS_DRIVER_TYPE_E2(L6470) + case 2: L6470_SET_KVAL_HOLD(E2); break; + #endif + #if AXIS_DRIVER_TYPE_E3(L6470) + case 3: L6470_SET_KVAL_HOLD(E3); break; + #endif + #if AXIS_DRIVER_TYPE_E4(L6470) + case 4: L6470_SET_KVAL_HOLD(E4); break; + #endif + #if AXIS_DRIVER_TYPE_E5(L6470) + case 5: L6470_SET_KVAL_HOLD(E5); break; + #endif + } + } break; + } + } + + if (report_current) { + #define L6470_REPORT_CURRENT(Q) L6470_report_current(stepper##Q, Q) + + L6470.spi_active = true; // let set_directions() know we're in the middle of a series of SPI transfers + + #if AXIS_DRIVER_TYPE_X(L6470) + L6470_REPORT_CURRENT(X); + #endif + #if AXIS_DRIVER_TYPE_X2(L6470) + L6470_REPORT_CURRENT(X2); + #endif + #if AXIS_DRIVER_TYPE_Y(L6470) + L6470_REPORT_CURRENT(Y); + #endif + #if AXIS_DRIVER_TYPE_Y2(L6470) + L6470_REPORT_CURRENT(Y2); + #endif + #if AXIS_DRIVER_TYPE_Z(L6470) + L6470_REPORT_CURRENT(Z); + #endif + #if AXIS_DRIVER_TYPE_Z2(L6470) + L6470_REPORT_CURRENT(Z2); + #endif + #if AXIS_DRIVER_TYPE_Z3(L6470) + L6470_REPORT_CURRENT(Z3); + #endif + #if AXIS_DRIVER_TYPE_E0(L6470) + L6470_REPORT_CURRENT(E0); + #endif + #if AXIS_DRIVER_TYPE_E1(L6470) + L6470_REPORT_CURRENT(E1); + #endif + #if AXIS_DRIVER_TYPE_E2(L6470) + L6470_REPORT_CURRENT(E2); + #endif + #if AXIS_DRIVER_TYPE_E3(L6470) + L6470_REPORT_CURRENT(E3); + #endif + #if AXIS_DRIVER_TYPE_E4(L6470) + L6470_REPORT_CURRENT(E4); + #endif + #if AXIS_DRIVER_TYPE_E5(L6470) + L6470_REPORT_CURRENT(E5); + #endif + + L6470.spi_active = false; // done with all SPI transfers - clear handshake flags + L6470.spi_abort = false; + } +} + +#endif // HAS_DRIVER(L6470) diff --git a/Marlin/src/gcode/feature/L6470/M916-918.cpp b/Marlin/src/gcode/feature/L6470/M916-918.cpp new file mode 100644 index 000000000000..590ae8c54141 --- /dev/null +++ b/Marlin/src/gcode/feature/L6470/M916-918.cpp @@ -0,0 +1,548 @@ +/** + * 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 HAS_DRIVER(L6470) + +#include "../../gcode.h" +#include "../../../module/stepper_indirection.h" +#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 + * + * + * J - select which driver(s) to monitor on multi-driver axis + * 0 - (default) monitor all drivers on the axis or E0 + * 1 - monitor only X, Y, Z, E1 + * 2 - monitor only X2, Y2, Z2, E2 + * 3 - monitor only Z3, E3 + * + * Xxxx, Yxxx, Zxxx, Exxx - axis to be monitored with displacement + * xxx (1-255) is distance moved on either side of current position + * + * F - feedrate + * optional - will use default max feedrate from configuration.h if not specified + * + * K - starting value for KVAL_HOLD (0 - 255) + * optional - will use & report current value from driver if not specified + * + */ + +/** + * This routine is also useful for determining the approximate KVAL_HOLD + * where the stepper stops losing steps. The sound will get noticeably quieter + * as it stops losing steps. + */ + +void GcodeSuite::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 + uint8_t axis_index[3]; + uint16_t axis_status[3]; + uint8_t driver_count = 1; + float position_max; + float position_min; + float final_feedrate; + uint8_t kval_hold; + uint8_t ocd_th_val = 0; + uint8_t stall_th_val = 0; + uint16_t over_current_threshold; + constexpr bool over_current_flag = false; // M916 doesn't play with the overcurrent thresholds + + uint8_t j; // general purpose counter + + 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 + + DEBUG_ECHOLNPAIR("feedrate = ", final_feedrate); + + planner.synchronize(); // wait for all current movement commands to complete + + for (j = 0; j < driver_count; j++) + L6470.get_status(axis_index[j]); // clear out any pre-existing error flags + + char temp_axis_string[] = " "; + temp_axis_string[0] = axis_mon[0][0]; // need to have a string for use within sprintf format section + char gcode_string[80]; + uint16_t status_composite = 0; + + DEBUG_ECHOLNPGM(".\n."); + + do { + + 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); + + // turn the motor(s) both directions + 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); + + sprintf_P(gcode_string, PSTR("G0 %s%4.3f F%4.3f"), temp_axis_string, position_max, final_feedrate); + gcode.process_subcommands_now_P(gcode_string); + + // get the status after the motors have stopped + planner.synchronize(); + + status_composite = 0; // clear out the old bits + + for (j = 0; j < driver_count; j++) { + axis_status[j] = (~L6470.get_status(axis_index[j])) & L6470_ERROR_MASK; // bits of interest are all active low + status_composite |= axis_status[j] ; + } + + if (status_composite && (status_composite & STATUS_UVLO)) { + DEBUG_ECHOLNPGM("Test aborted (Undervoltage lockout active)"); + for (j = 0; j < driver_count; j++) { + DEBUG_ECHOPGM("..."); + L6470.error_status_decode(axis_status[j], axis_index[j]); + } + return; + } + + // increment KVAL_HOLD if not yet at thermal warning/shutdown + if (!(status_composite & (STATUS_TH_WRN | STATUS_TH_SD))) + kval_hold++; + + } while (!(status_composite & (STATUS_TH_WRN | STATUS_TH_SD)) && kval_hold); // exit when kval_hold == 0 (rolls over) + + DEBUG_ECHOPGM(".\n.\nThermal warning/shutdown "); + if ((status_composite & (STATUS_TH_WRN | STATUS_TH_SD))) { + DEBUG_ECHOLNPGM("has occurred"); + for (j = 0; j < driver_count; j++) { + DEBUG_ECHOPGM("..."); + L6470.error_status_decode(axis_status[j], axis_index[j]); + } + } + else + DEBUG_ECHOLNPGM("(Unable to get)"); + + DEBUG_ECHOLNPGM("."); +} + +/** + * + * M917: Find minimum current thresholds + * + * Decrease OCD current until overcurrent error + * Increase OCD until overcurrent error goes away + * Decrease stall threshold until stall + * Increase stall until stall error goes away + * + * J - select which driver(s) to monitor on multi-driver axis + * 0 - (default) monitor all drivers on the axis or E0 + * 1 - monitor only X, Y, Z, E1 + * 2 - monitor only X2, Y2, Z2, E2 + * Xxxx, Yxxx, Zxxx, Exxx - axis to be monitored with displacement + * xxx (1-255) is distance moved on either side of current position + * + * F - feedrate + * optional - will use default max feedrate from Configuration.h if not specified + * + * I - starting over-current threshold + * optional - will report current value from driver if not specified + * if there are multiple drivers on the axis then all will be set the same + * + * K - value for KVAL_HOLD (0 - 255) + * optional - will report current value from driver if not specified + * + */ +void GcodeSuite::M917() { + + DEBUG_ECHOLNPGM("M917"); + + char axis_mon[3][3] = { " ", " ", " " }; // list of axes to be monitored + uint8_t axis_index[3]; + uint16_t axis_status[3]; + uint8_t driver_count = 1; + float position_max; + float position_min; + float final_feedrate; + uint8_t kval_hold; + uint8_t ocd_th_val = 0; + uint8_t stall_th_val = 0; + uint16_t over_current_threshold; + constexpr bool over_current_flag = true; + + uint8_t j; // general purpose counter + + 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 + + DEBUG_ECHOLNPAIR("feedrate = ", final_feedrate); + + planner.synchronize(); // wait for all current movement commands to complete + for (j = 0; j < driver_count; j++) + L6470.get_status(axis_index[j]); // clear out any pre-existing error flags + char temp_axis_string[] = " "; + temp_axis_string[0] = axis_mon[0][0]; // need to have a string for use within sprintf format section + char gcode_string[80]; + uint16_t status_composite = 0; + uint8_t test_phase = 0; + // 0 - decreasing OCD - exit when OCD warning occurs (ignore STALL) + // 1 - increasing OCD - exit when OCD warning stops (ignore STALL) - + // 2 - OCD finalized - decreasing STALL - exit when STALL warning happens + // 3 - OCD finalized - increasing STALL - exit when STALL warning stop + // 4 - all testing completed + 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 { + + 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); + + sprintf_P(gcode_string, PSTR("G0 %s%4.3f F%4.3f"), temp_axis_string, position_max, final_feedrate); + gcode.process_subcommands_now_P(gcode_string); + + planner.synchronize(); + + status_composite = 0; // clear out the old bits + + for (j = 0; j < driver_count; j++) { + axis_status[j] = (~L6470.get_status(axis_index[j])) & L6470_ERROR_MASK; // bits of interest are all active low + status_composite |= axis_status[j]; + } + + if (status_composite && (status_composite & STATUS_UVLO)) { + DEBUG_ECHOLNPGM("Test aborted (Undervoltage lockout active)"); + for (j = 0; j < driver_count; j++) { + DEBUG_ECHOPGM("..."); + L6470.error_status_decode(axis_status[j], axis_index[j]); + } + return; + } + + if (status_composite & (STATUS_TH_WRN | STATUS_TH_SD)) { + DEBUG_ECHOLNPGM("thermal problem - waiting for chip(s) to cool down "); + uint16_t status_composite_temp = 0; + uint8_t k = 0; + do { + k++; + if (!(k % 4)) { + kval_hold *= 0.95; + L6470_EOL(); + 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); + } + DEBUG_ECHOLNPGM("."); + gcode.reset_stepper_timeout(); // reset_stepper_timeout to keep steppers powered + watchdog_reset(); // beat the dog + safe_delay(5000); + status_composite_temp = 0; + for (j = 0; j < driver_count; j++) { + axis_status[j] = (~L6470.get_status(axis_index[j])) & L6470_ERROR_MASK; // bits of interest are all active low + status_composite_temp |= axis_status[j]; + } + } + while (status_composite_temp & (STATUS_TH_WRN | STATUS_TH_SD)); + L6470_EOL(); + } + if (status_composite & (STATUS_STEP_LOSS_A | STATUS_STEP_LOSS_B | STATUS_OCD)) { + switch (test_phase) { + + case 0: { + if (status_composite & STATUS_OCD) { + // phase 0 with OCD warning - time to go to next phase + if (ocd_th_val >=15) { + ocd_th_val = 15; // limit to max + test_phase = 2; // at highest value so skip phase 1 + 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 + 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 + DEBUG_ECHOLNPGM("LOGIC E0C - dec OCD"); + } + else { + test_phase = 2; // at lowest value without warning so skip phase 1 + DEBUG_ECHOLNPGM("LOGIC E0D - OCD at latest - go to 2"); + } + } + } break; + + case 1: { + if (status_composite & STATUS_OCD) { + // phase 1 with OCD warning - increment if can + if (ocd_th_val >= 15) { + ocd_th_val = 15; // limit to max + test_phase = 2; // at highest value so go to next phase + DEBUG_ECHOLNPGM("LOGIC E1A - OCD at max - go to 2"); + } + else { + ocd_th_val++; // try a higher value + DEBUG_ECHOLNPGM("LOGIC E1B - inc OCD"); + } + } + else { // phase 1 without OCD warning - normal exit to phase 2 + test_phase = 2; + DEBUG_ECHOLNPGM("LOGIC E1C - no OCD warning - go to 1"); + } + } break; + + case 2: { + if (status_composite & (STATUS_STEP_LOSS_A | STATUS_STEP_LOSS_B)) { + // phase 2 with stall warning - time to go to next phase + if (stall_th_val >= 127) { + stall_th_val = 127; // limit to max + 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 + 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 + DEBUG_ECHOLNPGM("LOGIC E2C - no STALL, dec STALL"); + } + else { + DEBUG_ECHOLNPGM("finished - STALL at lowest value but still do NOT have stall warning"); + test_phase = 4; + DEBUG_ECHOLNPGM("LOGIC E2D - no STALL, at lowest so quit"); + } + } + } break; + + case 3: { + if (status_composite & (STATUS_STEP_LOSS_A | STATUS_STEP_LOSS_B)) { + // phase 3 with stall warning - increment if can + if (stall_th_val >= 127) { + stall_th_val = 127; // limit to max + DEBUG_ECHOLNPGM("finished - STALL at maximum value but still have stall warning"); + test_phase = 4; + DEBUG_ECHOLNPGM("LOGIC E3A - STALL, at max so quit"); + } + else { + stall_th_val++; // still looking for passing value + DEBUG_ECHOLNPGM("LOGIC E3B - STALL, inc stall"); + } + } + else { //phase 3 without stall warning but have OCD warning + DEBUG_ECHOLNPGM("Hardware problem - OCD warning without STALL warning"); + test_phase = 4; + DEBUG_ECHOLNPGM("LOGIC E3C - not STALLED, hardware problem (quit)"); + } + } break; + + } + + } + else { + switch (test_phase) { + case 0: { // phase 0 without OCD warning - keep on decrementing if can + if (ocd_th_val) { + ocd_th_val--; // try lower value + DEBUG_ECHOLNPGM("LOGIC N0A - DEC OCD"); + } + else { + test_phase = 2; // at lowest value without warning so skip phase 1 + DEBUG_ECHOLNPGM("LOGIC N0B - OCD at lowest (go to phase 2)"); + } + } break; + + 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) + DEBUG_ECHOLNPGM("LOGIC N2B - dec STALL"); + } + else { + DEBUG_ECHOLNPGM("finished - STALL at lowest value but still no stall warning"); + test_phase = 4; + DEBUG_ECHOLNPGM("LOGIC N2C - STALL at lowest (quit)"); + } + } break; + + case 3: { test_phase = 4; + DEBUG_ECHOLNPGM("LOGIC N3 - finished!"); + } break; // phase 3 without any warnings - desired exit + } // + } // end of status checks + + if (test_phase != 4) { + 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) 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) { + DEBUG_ECHOLNPGM("Completed with errors"); + for (j = 0; j < driver_count; j++) { + DEBUG_ECHOPGM("..."); + L6470.error_status_decode(axis_status[j], axis_index[j]); + } + } + else + DEBUG_ECHOLNPGM("Completed with no errors"); + +} // M917 + +/** + * + * M918: increase speed until error or max feedrate achieved (as shown in configuration.h)) + * + * J - select which driver(s) to monitor on multi-driver axis + * 0 - (default) monitor all drivers on the axis or E0 + * 1 - monitor only X, Y, Z, E1 + * 2 - monitor only X2, Y2, Z2, E2 + * Xxxx, Yxxx, Zxxx, Exxx - axis to be monitored with displacement + * xxx (1-255) is distance moved on either side of current position + * + * I - over current threshold + * optional - will report current value from driver if not specified + * + * K - value for KVAL_HOLD (0 - 255) (optional) + * optional - will report current value from driver if not specified + * + */ +void GcodeSuite::M918() { + + DEBUG_ECHOLNPGM("M918"); + + char axis_mon[3][3] = { " ", " ", " " }; // List of axes to monitor + uint8_t axis_index[3]; + uint16_t axis_status[3]; + uint8_t driver_count = 1; + float position_max, position_min; + float final_feedrate; + uint8_t kval_hold; + uint8_t ocd_th_val = 0; + uint8_t stall_th_val = 0; + uint16_t over_current_threshold; + constexpr bool over_current_flag = true; + + uint8_t j; // general purpose counter + + 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 + + uint8_t m_steps = parser.byteval('M'); + LIMIT(m_steps, 0, 128); + DEBUG_ECHOLNPAIR("M = ", m_steps); + + int8_t m_bits = -1; + if (m_steps > 85) m_bits = 7; // 128 (no synch output) + else if (m_steps > 42) m_bits = 6; // 64 (no synch output) + else if (m_steps > 22) m_bits = 5; // 32 (no synch output) + else if (m_steps > 12) m_bits = 4; // 16 (no synch output) + else if (m_steps > 5) m_bits = 3; // 8 (no synch output) + else if (m_steps > 2) m_bits = 2; // 4 (no synch output) + else if (m_steps == 2) m_bits = 1; // 2 (no synch output) + else if (m_steps == 1) m_bits = 0; // 1 (no synch output) + else if (m_steps == 0) m_bits = 7; // 128 (no synch output) + + if (m_bits >= 0) { + const int micros = _BV(m_bits); + 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 + + 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; + + planner.synchronize(); // wait for all current movement commands to complete + + for (j = 0; j < driver_count; j++) + L6470.get_status(axis_index[j]); // clear all error flags + + char temp_axis_string[2]; + temp_axis_string[0] = axis_mon[0][0]; // need to have a string for use within sprintf format section + temp_axis_string[1] = '\n'; + + char gcode_string[80]; + uint16_t status_composite = 0; + DEBUG_ECHOLNPGM(".\n.\n."); // make the feedrate prints easier to see + + do { + current_feedrate += feedrate_inc; + 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); + + sprintf_P(gcode_string, PSTR("G0 %s%4.3f F%4.3f"), temp_axis_string, position_max, current_feedrate); + gcode.process_subcommands_now_P(gcode_string); + + planner.synchronize(); + + for (j = 0; j < driver_count; j++) { + axis_status[j] = (~L6470.get_status(axis_index[j])) & 0x0800; // bits of interest are all active low + status_composite |= axis_status[j]; + } + 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) { + DEBUG_ECHOLNPGM("errors"); + for (j = 0; j < driver_count; j++) { + DEBUG_ECHOPGM("..."); + L6470.error_status_decode(axis_status[j], axis_index[j]); + } + } + else + DEBUG_ECHOLNPGM("no errors"); + +} // M918 + +#endif // HAS_DRIVER(L6470) diff --git a/Marlin/src/gcode/feature/advance/M900.cpp b/Marlin/src/gcode/feature/advance/M900.cpp index 8b1c60d9c72a..ceb95dd54cc4 100644 --- a/Marlin/src/gcode/feature/advance/M900.cpp +++ b/Marlin/src/gcode/feature/advance/M900.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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_PROTOCOLLNPGM("?T value out of range."); + 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; + #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; + } } - else - SERIAL_PROTOCOLLNPGM("?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 (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; + } } - SERIAL_EOL(); - #endif - } + 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/baricuda/M126-M129.cpp b/Marlin/src/gcode/feature/baricuda/M126-M129.cpp index aaad59f465a3..7064a09dadde 100644 --- a/Marlin/src/gcode/feature/baricuda/M126-M129.cpp +++ b/Marlin/src/gcode/feature/baricuda/M126-M129.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/feature/camera/M240.cpp b/Marlin/src/gcode/feature/camera/M240.cpp index 1a1fb5cf6537..ca4dc0012501 100644 --- a/Marlin/src/gcode/feature/camera/M240.cpp +++ b/Marlin/src/gcode/feature/camera/M240.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -22,44 +22,151 @@ #include "../../../inc/MarlinConfig.h" -#if PIN_EXISTS(CHDK) || HAS_PHOTOGRAPH +#if ENABLED(PHOTO_GCODE) #include "../../gcode.h" +#include "../../../module/motion.h" // for active_extruder and current_position -bool chdk_active; // = false -millis_t chdk_timeout; +#if PIN_EXISTS(CHDK) + millis_t chdk_timeout; // = 0 +#endif + +#ifdef PHOTO_RETRACT_MM + + #define _PHOTO_RETRACT_MM (PHOTO_RETRACT_MM + 0) + + #include "../../../module/planner.h" + #include "../../../module/temperature.h" + + #if ENABLED(ADVANCED_PAUSE_FEATURE) + #include "../../../feature/pause.h" + #endif + + #ifdef PHOTO_RETRACT_MM + inline void e_move_m240(const float length, const float fr_mm_s) { + if (length && thermalManager.hotEnoughToExtrude(active_extruder)) { + #if ENABLED(ADVANCED_PAUSE_FEATURE) + do_pause_e_move(length, fr_mm_s); + #else + current_position[E_AXIS] += length / planner.e_factor[active_extruder]; + planner.buffer_line(current_position, fr_mm_s, active_extruder); + #endif + } + } + #endif + +#endif + +#if PIN_EXISTS(PHOTOGRAPH) + constexpr uint8_t NUM_PULSES = 16; + constexpr float PULSE_LENGTH = 0.01524; + inline void set_photo_pin(const uint8_t state) { WRITE(PHOTOGRAPH_PIN, state); _delay_ms(PULSE_LENGTH); } + inline void tweak_photo_pin() { set_photo_pin(HIGH); set_photo_pin(LOW); } + inline void spin_photo_pin() { for (uint8_t i = NUM_PULSES; i--;) tweak_photo_pin(); } +#endif /** - * M240: Trigger a camera by emulating a Canon RC-1 - * See http://www.doc-diy.net/photo/rc-1_hacked/ + * M240: Trigger a camera by... + * + * - CHDK : Emulate a Canon RC-1 with a configurable ON duration. + * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * - PHOTOGRAPH_PIN : Pulse a digital pin 16 times. + * See http://www.doc-diy.net/photo/rc-1_hacked/ + * - PHOTO_SWITCH_POSITION : Bump a physical switch with the X-carriage using a + * configured position, delay, and retract length. + * + * PHOTO_POSITION parameters: + * A - X offset to the return position + * B - Y offset to the return position + * F - Override the XY movement feedrate + * R - Retract/recover length (current units) + * S - Retract/recover feedrate (mm/m) + * X - Move to X before triggering the shutter + * Y - Move to Y before triggering the shutter + * Z - Raise Z by a distance before triggering the shutter + * + * PHOTO_SWITCH_POSITION parameters: + * D - Duration (ms) to hold down switch (Requires PHOTO_SWITCH_MS) + * P - Delay (ms) after triggering the shutter (Requires PHOTO_SWITCH_MS) + * I - Switch trigger position override X + * J - Switch trigger position override Y */ void GcodeSuite::M240() { + #ifdef PHOTO_POSITION + + if (axis_unhomed_error()) return; + + const float old_pos[XYZ] = { + current_position[X_AXIS] + parser.linearval('A'), + current_position[Y_AXIS] + parser.linearval('B'), + current_position[Z_AXIS] + }; + + #ifdef PHOTO_RETRACT_MM + constexpr float rfr = (MMS_TO_MMM( + #if ENABLED(ADVANCED_PAUSE_FEATURE) + PAUSE_PARK_RETRACT_FEEDRATE + #elif ENABLED(FWRETRACT) + RETRACT_FEEDRATE + #else + 45 + #endif + )); + const float rval = parser.seenval('R') ? parser.value_linear_units() : _PHOTO_RETRACT_MM, + sval = parser.seenval('S') ? MMM_TO_MMS(parser.value_feedrate()) : rfr; + e_move_m240(-rval, sval); + #endif + + float fr_mm_s = MMM_TO_MMS(parser.linearval('F')); + if (fr_mm_s) NOLESS(fr_mm_s, 10.0f); + + constexpr float photo_position[XYZ] = PHOTO_POSITION; + float raw[XYZ] = { + parser.seenval('X') ? RAW_X_POSITION(parser.value_linear_units()) : photo_position[X_AXIS], + 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] + }; + apply_motion_limits(raw); + do_blocking_move_to(raw, fr_mm_s); + + #ifdef PHOTO_SWITCH_POSITION + constexpr float photo_switch_position[2] = PHOTO_SWITCH_POSITION; + const float sraw[] = { + parser.seenval('I') ? RAW_X_POSITION(parser.value_linear_units()) : photo_switch_position[X_AXIS], + parser.seenval('J') ? RAW_Y_POSITION(parser.value_linear_units()) : photo_switch_position[Y_AXIS] + }; + do_blocking_move_to_xy(sraw[X_AXIS], sraw[Y_AXIS], get_homing_bump_feedrate(X_AXIS)); + #if PHOTO_SWITCH_MS > 0 + safe_delay(parser.intval('D', PHOTO_SWITCH_MS)); + #endif + do_blocking_move_to(raw); + #endif + + #endif + #if PIN_EXISTS(CHDK) OUT_WRITE(CHDK_PIN, HIGH); - chdk_timeout = millis() + CHDK_DELAY; - chdk_active = true; + chdk_timeout = millis() + PHOTO_SWITCH_MS; #elif HAS_PHOTOGRAPH - const uint8_t NUM_PULSES = 16; - const float PULSE_LENGTH = 0.01524; - for (int i = 0; i < NUM_PULSES; i++) { - WRITE(PHOTOGRAPH_PIN, HIGH); - _delay_ms(PULSE_LENGTH); - WRITE(PHOTOGRAPH_PIN, LOW); - _delay_ms(PULSE_LENGTH); - } + spin_photo_pin(); delay(7.33); - for (int i = 0; i < NUM_PULSES; i++) { - WRITE(PHOTOGRAPH_PIN, HIGH); - _delay_ms(PULSE_LENGTH); - WRITE(PHOTOGRAPH_PIN, LOW); - _delay_ms(PULSE_LENGTH); - } + spin_photo_pin(); + + #endif + #ifdef PHOTO_POSITION + #if PHOTO_DELAY_MS > 0 + safe_delay(parser.intval('P', PHOTO_DELAY_MS)); + #endif + do_blocking_move_to(old_pos, fr_mm_s); + #ifdef PHOTO_RETRACT_MM + e_move_m240(rval, sval); + #endif #endif } -#endif // CHDK_PIN || HAS_PHOTOGRAPH +#endif // PHOTO_GCODE diff --git a/Marlin/src/gcode/feature/caselight/M355.cpp b/Marlin/src/gcode/feature/caselight/M355.cpp index f22936d13c84..d3bc2c839946 100644 --- a/Marlin/src/gcode/feature/caselight/M355.cpp +++ b/Marlin/src/gcode/feature/caselight/M355.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -26,22 +26,20 @@ #if HAS_CASE_LIGHT #include "../../../feature/caselight.h" -#endif -/** - * M355: Turn case light on/off and set brightness - * - * P Set case light brightness (PWM pin required - ignored otherwise) - * - * S Set case light on/off - * - * When S turns on the light on a PWM pin then the current brightness level is used/restored - * - * M355 P200 S0 turns off the light & sets the brightness level - * M355 S1 turns on the light with a brightness of 200 (assuming a PWM pin) - */ -void GcodeSuite::M355() { - #if HAS_CASE_LIGHT + /** + * M355: Turn case light on/off and set brightness + * + * P Set case light brightness (PWM pin required - ignored otherwise) + * + * S Set case light on/off + * + * When S turns on the light on a PWM pin then the current brightness level is used/restored + * + * M355 P200 S0 turns off the light & sets the brightness level + * M355 S1 turns on the light with a brightness of 200 (assuming a PWM pin) + */ + void GcodeSuite::M355() { uint8_t args = 0; if (parser.seenval('P')) { ++args, case_light_brightness = parser.value_byte(); @@ -59,11 +57,8 @@ void GcodeSuite::M355() { 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); } - #else - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM(MSG_ERR_M355_NONE); - #endif -} + } +#endif // HAS_CASE_LIGHT diff --git a/Marlin/src/gcode/feature/clean/G12.cpp b/Marlin/src/gcode/feature/clean/G12.cpp index dbd9dd3ce346..7a9985214a27 100644 --- a/Marlin/src/gcode/feature/clean/G12.cpp +++ b/Marlin/src/gcode/feature/clean/G12.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/feature/digipot/M907-M910.cpp b/Marlin/src/gcode/feature/digipot/M907-M910.cpp index 10849f2eb877..107c77f41cac 100644 --- a/Marlin/src/gcode/feature/digipot/M907-M910.cpp +++ b/Marlin/src/gcode/feature/digipot/M907-M910.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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" @@ -44,37 +44,37 @@ void GcodeSuite::M907() { #if HAS_DIGIPOTSS - LOOP_XYZE(i) if (parser.seen(axis_codes[i])) stepper.digipot_current(i, parser.value_int()); - if (parser.seen('B')) stepper.digipot_current(4, parser.value_int()); - if (parser.seen('S')) for (uint8_t i = 0; i <= 4; i++) stepper.digipot_current(i, parser.value_int()); + LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) stepper.digipot_current(i, parser.value_int()); + if (parser.seenval('B')) stepper.digipot_current(4, parser.value_int()); + if (parser.seenval('S')) for (uint8_t i = 0; i <= 4; i++) stepper.digipot_current(i, parser.value_int()); #elif HAS_MOTOR_CURRENT_PWM - #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) - if (parser.seen('X')) stepper.digipot_current(0, parser.value_int()); + #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) - if (parser.seen('Z')) stepper.digipot_current(1, parser.value_int()); + if (parser.seenval('Z')) stepper.digipot_current(1, parser.value_int()); #endif #if PIN_EXISTS(MOTOR_CURRENT_PWM_E) - if (parser.seen('E')) stepper.digipot_current(2, parser.value_int()); + if (parser.seenval('E')) stepper.digipot_current(2, parser.value_int()); #endif #endif #if ENABLED(DIGIPOT_I2C) // this one uses actual amps in floating point - LOOP_XYZE(i) if (parser.seen(axis_codes[i])) digipot_i2c_set_current(i, parser.value_float()); + LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) digipot_i2c_set_current(i, parser.value_float()); // for each additional extruder (named B,C,D,E..., channels 4,5,6,7...) - for (uint8_t i = NUM_AXIS; i < DIGIPOT_I2C_NUM_CHANNELS; i++) if (parser.seen('B' + i - (NUM_AXIS))) digipot_i2c_set_current(i, parser.value_float()); + for (uint8_t i = NUM_AXIS; i < DIGIPOT_I2C_NUM_CHANNELS; i++) if (parser.seenval('B' + i - (NUM_AXIS))) digipot_i2c_set_current(i, parser.value_float()); #endif #if ENABLED(DAC_STEPPER_CURRENT) - if (parser.seen('S')) { + if (parser.seenval('S')) { const float dac_percent = parser.value_float(); for (uint8_t i = 0; i <= 4; i++) dac_current_percent(i, dac_percent); } - LOOP_XYZE(i) if (parser.seen(axis_codes[i])) dac_current_percent(i, parser.value_float()); + LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) dac_current_percent(i, parser.value_float()); #endif } diff --git a/Marlin/src/gcode/feature/filwidth/M404-M407.cpp b/Marlin/src/gcode/feature/filwidth/M404-M407.cpp index a096feef175e..f93fdaea5825 100644 --- a/Marlin/src/gcode/feature/filwidth/M404-M407.cpp +++ b/Marlin/src/gcode/feature/filwidth/M404-M407.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -38,10 +38,8 @@ void GcodeSuite::M404() { filament_width_nominal = parser.value_linear_units(); planner.volumetric_area_nominal = CIRCLE_AREA(filament_width_nominal * 0.5); } - else { - SERIAL_PROTOCOLPGM("Filament dia (nominal mm):"); - SERIAL_PROTOCOLLN(filament_width_nominal); - } + else + SERIAL_ECHOLNPAIR("Filament dia (nominal mm):", filament_width_nominal); } /** @@ -79,8 +77,7 @@ void GcodeSuite::M406() { * M407: Get measured filament diameter on serial output */ void GcodeSuite::M407() { - SERIAL_PROTOCOLPGM("Filament dia (measured mm):"); - SERIAL_PROTOCOLLN(filament_width_meas); + SERIAL_ECHOLNPAIR("Filament dia (measured mm):", filament_width_meas); } #endif // FILAMENT_WIDTH_SENSOR diff --git a/Marlin/src/gcode/feature/fwretract/G10_G11.cpp b/Marlin/src/gcode/feature/fwretract/G10_G11.cpp index 9231386d351f..06bce1764f05 100644 --- a/Marlin/src/gcode/feature/fwretract/G10_G11.cpp +++ b/Marlin/src/gcode/feature/fwretract/G10_G11.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -30,6 +30,7 @@ /** * G10 - Retract filament according to settings of M207 + * TODO: Handle 'G10 P' for tool settings and 'G10 L' for workspace settings */ void GcodeSuite::G10() { #if EXTRUDERS > 1 diff --git a/Marlin/src/gcode/feature/fwretract/M207-M209.cpp b/Marlin/src/gcode/feature/fwretract/M207-M209.cpp index b6f94f2edf4e..b142972490f4 100644 --- a/Marlin/src/gcode/feature/fwretract/M207-M209.cpp +++ b/Marlin/src/gcode/feature/fwretract/M207-M209.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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/i2c/M260_M261.cpp b/Marlin/src/gcode/feature/i2c/M260_M261.cpp index 918e764c408f..0f7a35ad34da 100644 --- a/Marlin/src/gcode/feature/i2c/M260_M261.cpp +++ b/Marlin/src/gcode/feature/i2c/M260_M261.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -68,13 +68,10 @@ void GcodeSuite::M261() { uint8_t bytes = parser.byteval('B', 1); - if (i2c.addr && bytes && bytes <= TWIBUS_BUFFER_SIZE) { + if (i2c.addr && bytes && bytes <= TWIBUS_BUFFER_SIZE) i2c.relay(bytes); - } - else { - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM("Bad i2c request"); - } + else + SERIAL_ERROR_MSG("Bad i2c request"); } #endif diff --git a/Marlin/src/gcode/feature/leds/M150.cpp b/Marlin/src/gcode/feature/leds/M150.cpp index 7eb8eb70de01..28488cc63346 100644 --- a/Marlin/src/gcode/feature/leds/M150.cpp +++ b/Marlin/src/gcode/feature/leds/M150.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/feature/leds/M7219.cpp b/Marlin/src/gcode/feature/leds/M7219.cpp index 2a141185e056..cdc481db8b27 100644 --- a/Marlin/src/gcode/feature/leds/M7219.cpp +++ b/Marlin/src/gcode/feature/leds/M7219.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/feature/macro/M810-M819.cpp b/Marlin/src/gcode/feature/macro/M810-M819.cpp index 3e8a0e04b431..df41dffe8c9a 100644 --- a/Marlin/src/gcode/feature/macro/M810-M819.cpp +++ b/Marlin/src/gcode/feature/macro/M810-M819.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -45,10 +45,8 @@ void GcodeSuite::M810_819() { if (len) { // Set a macro - if (len > GCODE_MACROS_SLOT_SIZE) { - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM("Macro too long."); - } + if (len > GCODE_MACROS_SLOT_SIZE) + SERIAL_ERROR_MSG("Macro too long."); else { char c, *s = parser.string_arg, *d = gcode_macros[index]; do { diff --git a/Marlin/src/gcode/feature/mixing/M163-M165.cpp b/Marlin/src/gcode/feature/mixing/M163-M165.cpp index 2e744d70f1c1..ff25cdc479e9 100644 --- a/Marlin/src/gcode/feature/mixing/M163-M165.cpp +++ b/Marlin/src/gcode/feature/mixing/M163-M165.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -38,7 +38,7 @@ void GcodeSuite::M163() { const int mix_index = parser.intval('S'); if (mix_index < MIXING_STEPPERS) - mixer.set_M163_collector(mix_index, MAX(parser.floatval('P'), 0.0)); + mixer.set_collector(mix_index, parser.floatval('P')); } /** @@ -53,10 +53,12 @@ void GcodeSuite::M164() { #else constexpr int tool_index = 0; #endif - if (WITHIN(tool_index, 0, MIXING_VIRTUAL_TOOLS - 1)) - mixer.normalize(tool_index); + if (tool_index >= 0) { + if (tool_index < MIXING_VIRTUAL_TOOLS) + mixer.normalize(tool_index); + } else - mixer.normalize(mixer.get_current_v_tool()); + mixer.normalize(); } #if ENABLED(DIRECT_MIXING_IN_G1) @@ -95,15 +97,15 @@ void GcodeSuite::M164() { MIXER_STEPPER_LOOP(i) { if (parser.seenval(mixing_codes[i])) { SBI(mix_bits, i); - mixer.set_M163_collector(i, MAX(parser.value_float(), 0.0f)); + mixer.set_collector(i, parser.value_float()); } } // If any mixing factors were included, clear the rest // If none were included, preserve the last mix if (mix_bits) { MIXER_STEPPER_LOOP(i) - if (!TEST(mix_bits, i)) mixer.set_M163_collector(i, 0.0f); - mixer.normalize(mixer.get_current_v_tool()); + if (!TEST(mix_bits, i)) mixer.set_collector(i, 0.0f); + mixer.normalize(); } } diff --git a/Marlin/src/gcode/feature/mixing/M166.cpp b/Marlin/src/gcode/feature/mixing/M166.cpp new file mode 100644 index 000000000000..30d2c563e83c --- /dev/null +++ b/Marlin/src/gcode/feature/mixing/M166.cpp @@ -0,0 +1,99 @@ +/** + * 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(GRADIENT_MIX) + +#include "../../gcode.h" +#include "../../../module/motion.h" +#include "../../../module/planner.h" +#include "../../../feature/mixing.h" + +inline void echo_mix() { + SERIAL_ECHOPAIR(" (", int(mixer.mix[0])); + SERIAL_ECHOPAIR("%|", int(mixer.mix[1])); + SERIAL_ECHOPGM("%)"); +} + +inline void echo_zt(const int t, const float &z) { + mixer.update_mix_from_vtool(t); + SERIAL_ECHOPAIR(" Z", z); + SERIAL_ECHOPAIR(" T", t); + echo_mix(); +} + +/** + * M166: Set a simple gradient mix for a two-component mixer + * based on the Geeetech A10M implementation by Jone Liu. + * + * S[bool] - Enable / disable gradients + * A[float] - Starting Z for the gradient + * Z[float] - Ending Z for the gradient. (Must be greater than the starting Z.) + * I[index] - V-Tool to use as the starting mix. + * J[index] - V-Tool to use as the ending mix. + * + * T[index] - A V-Tool index to use as an alias for the Gradient (Requires GRADIENT_VTOOL) + * T with no index clears the setting. Note: This can match the I or J value. + * + * Example: M166 S1 A0 Z20 I0 J1 + */ +void GcodeSuite::M166() { + if (parser.seenval('A')) mixer.gradient.start_z = parser.value_float(); + if (parser.seenval('Z')) mixer.gradient.end_z = parser.value_float(); + if (parser.seenval('I')) mixer.gradient.start_vtool = (uint8_t)constrain(parser.value_int(), 0, MIXING_VIRTUAL_TOOLS); + if (parser.seenval('J')) mixer.gradient.end_vtool = (uint8_t)constrain(parser.value_int(), 0, MIXING_VIRTUAL_TOOLS); + + #if ENABLED(GRADIENT_VTOOL) + if (parser.seen('T')) mixer.gradient.vtool_index = parser.byteval('T', -1); + #endif + + if (parser.seen('S')) mixer.gradient.enabled = parser.value_bool(); + + mixer.refresh_gradient(); + + SERIAL_ECHOPGM("Gradient Mix "); + serialprint_onoff(mixer.gradient.enabled); + if (mixer.gradient.enabled) { + + #if ENABLED(GRADIENT_VTOOL) + if (mixer.gradient.vtool_index >= 0) { + SERIAL_ECHOPAIR(" (T", int(mixer.gradient.vtool_index)); + SERIAL_CHAR(')'); + } + #endif + + SERIAL_ECHOPGM(" ; Start"); + echo_zt(mixer.gradient.start_vtool, mixer.gradient.start_z); + + SERIAL_ECHOPGM(" ; End"); + echo_zt(mixer.gradient.end_vtool, mixer.gradient.end_z); + + mixer.update_mix_from_gradient(); + SERIAL_ECHOPAIR(" ; Current Z", planner.get_axis_position_mm(Z_AXIS)); + echo_mix(); + } + + SERIAL_EOL(); +} + +#endif // GRADIENT_MIX diff --git a/Marlin/src/gcode/feature/pause/G27.cpp b/Marlin/src/gcode/feature/pause/G27.cpp index b7e77928a2f3..41ce2905e0c9 100644 --- a/Marlin/src/gcode/feature/pause/G27.cpp +++ b/Marlin/src/gcode/feature/pause/G27.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/feature/pause/M125.cpp b/Marlin/src/gcode/feature/pause/M125.cpp index ed98b8fc2ce3..7c6c3c54aa72 100644 --- a/Marlin/src/gcode/feature/pause/M125.cpp +++ b/Marlin/src/gcode/feature/pause/M125.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -31,15 +31,19 @@ #include "../../../sd/cardreader.h" #include "../../../module/printcounter.h" +#if HAS_LCD_MENU + #include "../../../lcd/ultralcd.h" +#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. * - * If Marlin is compiled without SD Card support, M125 can be - * used directly to pause the print and move to park position, - * resuming with a button click or M108. + * When not actively SD printing, M125 simply moves to the park + * position and waits, resuming with a button click or M108. + * Without PARK_HEAD_ON_PAUSE the M125 command does nothing. * * L = override retract length * X = override X @@ -57,26 +61,35 @@ void GcodeSuite::M125() { point_t park_point = NOZZLE_PARK_POINT; // Move XY axes to filament change position or given position - if (parser.seenval('X')) park_point.x = parser.linearval('X'); - if (parser.seenval('Y')) park_point.y = parser.linearval('Y'); + if (parser.seenval('X')) park_point.x = RAW_X_POSITION(parser.linearval('X')); + if (parser.seenval('Y')) park_point.y = RAW_X_POSITION(parser.linearval('Y')); // 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) + const bool sd_printing = IS_SD_PRINTING(); + #else + constexpr bool sd_printing = false; #endif - const bool job_running = print_job_timer.isRunning(), - sd_printing = IS_SD_PRINTING(); + #if HAS_LCD_MENU + 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)) { - if (!sd_printing) { - wait_for_confirmation(); - resume_print(); + if (pause_print(retract, park_point, 0, show_lcd)) { + if (!sd_printing || show_lcd) { + wait_for_confirmation(false, 0); + resume_print(0, 0, PAUSE_PARK_RETRACT_LENGTH, 0); } - if (job_running) print_job_timer.start(); } } diff --git a/Marlin/src/gcode/feature/pause/M600.cpp b/Marlin/src/gcode/feature/pause/M600.cpp index 850bbb34418c..78e7e8e6587f 100644 --- a/Marlin/src/gcode/feature/pause/M600.cpp +++ b/Marlin/src/gcode/feature/pause/M600.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -37,6 +37,10 @@ #include "../../../lcd/ultralcd.h" #endif +#if ENABLED(MMU2_MENUS) + #include "../../../lcd/menu/menu_mmu2.h" +#endif + /** * M600: Pause for filament change * @@ -61,7 +65,7 @@ void GcodeSuite::M600() { int8_t DXC_ext = target_extruder; if (!parser.seen('T')) { // If no tool index is specified, M600 was (probably) sent in response to filament runout. // In this case, for duplicating modes set DXC_ext to the extruder that ran out. - #if ENABLED(FILAMENT_RUNOUT_SENSOR) && NUM_RUNOUT_SENSORS > 1 + #if HAS_FILAMENT_SENSOR && NUM_RUNOUT_SENSORS > 1 if (dxc_is_duplicating()) DXC_ext = (READ(FIL_RUNOUT2_PIN) == FIL_RUNOUT_INVERTING) ? 1 : 0; #else @@ -71,8 +75,8 @@ void GcodeSuite::M600() { #endif // Show initial "wait for start" message - #if HAS_LCD_MENU - lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INIT, ADVANCED_PAUSE_MODE_PAUSE_PRINT, target_extruder); + #if HAS_LCD_MENU && DISABLED(MMU2_MENUS) + lcd_pause_show_message(PAUSE_MESSAGE_CHANGING, PAUSE_MODE_PAUSE_PRINT, target_extruder); #endif #if ENABLED(HOME_BEFORE_FILAMENT_CHANGE) @@ -86,9 +90,9 @@ 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, true); + ) tool_change(target_extruder, 0, false); #endif // Initial retract before move to filament change position @@ -105,21 +109,28 @@ 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 - // Unload filament - const float unload_length = -ABS(parser.seen('U') ? parser.value_axis_units(E_AXIS) - : fc_settings[active_extruder].unload_length); - - // Slow load filament - constexpr float slow_load_length = FILAMENT_CHANGE_SLOW_LOAD_LENGTH; - - // Fast load filament - const float fast_load_length = ABS(parser.seen('L') ? parser.value_axis_units(E_AXIS) - : fc_settings[active_extruder].load_length); + #if ENABLED(MMU2_MENUS) + // For MMU2 reset retract and load/unload values so they don't mess with MMU filament handling + constexpr float unload_length = 0.5f, + slow_load_length = 0.0f, + fast_load_length = 0.0f; + #else + // Unload filament + const float unload_length = -ABS(parser.seen('U') ? parser.value_axis_units(E_AXIS) + : fc_settings[active_extruder].unload_length); + + // Slow load filament + constexpr float slow_load_length = FILAMENT_CHANGE_SLOW_LOAD_LENGTH; + + // Fast load filament + const float fast_load_length = ABS(parser.seen('L') ? parser.value_axis_units(E_AXIS) + : fc_settings[active_extruder].load_length); + #endif const int beep_count = parser.intval('B', #ifdef FILAMENT_CHANGE_ALERT_BEEPS @@ -129,21 +140,21 @@ void GcodeSuite::M600() { #endif ); - const bool job_running = print_job_timer.isRunning(); - if (pause_print(retract, park_point, unload_length, true DXC_PASS)) { - wait_for_confirmation(true, beep_count DXC_PASS); - resume_print(slow_load_length, fast_load_length, ADVANCED_PAUSE_PURGE_LENGTH, beep_count DXC_PASS); + #if ENABLED(MMU2_MENUS) + mmu2_M600(); + resume_print(slow_load_length, fast_load_length, 0, beep_count DXC_PASS); + #else + wait_for_confirmation(true, beep_count DXC_PASS); + resume_print(slow_load_length, fast_load_length, ADVANCED_PAUSE_PURGE_LENGTH, beep_count DXC_PASS); + #endif } #if EXTRUDERS > 1 // Restore toolhead if it was changed if (active_extruder_before_filament_change != active_extruder) - tool_change(active_extruder_before_filament_change, 0, true); + tool_change(active_extruder_before_filament_change, 0, false); #endif - - // Resume the print job timer if it was running - if (job_running) print_job_timer.start(); } #endif // ADVANCED_PAUSE_FEATURE diff --git a/Marlin/src/gcode/feature/pause/M603.cpp b/Marlin/src/gcode/feature/pause/M603.cpp index e4a5e5eaa9f1..a3053e901a62 100644 --- a/Marlin/src/gcode/feature/pause/M603.cpp +++ b/Marlin/src/gcode/feature/pause/M603.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/feature/pause/M701_M702.cpp b/Marlin/src/gcode/feature/pause/M701_M702.cpp index fa9be253e226..a09d8aa710ad 100644 --- a/Marlin/src/gcode/feature/pause/M701_M702.cpp +++ b/Marlin/src/gcode/feature/pause/M701_M702.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -38,6 +38,10 @@ #include "../../../lcd/ultralcd.h" #endif +#if ENABLED(PRUSA_MMU2) + #include "../../../feature/prusa_MMU2/mmu2.h" +#endif + /** * M701: Load filament * @@ -64,14 +68,14 @@ 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 + #if EXTRUDERS > 1 && DISABLED(PRUSA_MMU2) // Change toolhead if specified uint8_t active_extruder_before_filament_change = active_extruder; if (active_extruder != target_extruder) - tool_change(target_extruder, 0, true); + tool_change(target_extruder, 0, false); #endif // Lift Z axis @@ -79,29 +83,33 @@ void GcodeSuite::M701() { do_blocking_move_to_z(MIN(current_position[Z_AXIS] + park_point.z, Z_MAX_POS), NOZZLE_PARK_Z_FEEDRATE); // Load filament - constexpr float slow_load_length = FILAMENT_CHANGE_SLOW_LOAD_LENGTH; - const float fast_load_length = ABS(parser.seen('L') ? parser.value_axis_units(E_AXIS) - : 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 - #if ENABLED(DUAL_X_CARRIAGE) - , target_extruder - #endif - ); + #if ENABLED(PRUSA_MMU2) + mmu2.load_filament_to_nozzle(target_extruder); + #else + constexpr float slow_load_length = FILAMENT_CHANGE_SLOW_LOAD_LENGTH; + const float fast_load_length = ABS(parser.seen('L') ? parser.value_axis_units(E_AXIS) + : 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), PAUSE_MODE_LOAD_FILAMENT + #if ENABLED(DUAL_X_CARRIAGE) + , target_extruder + #endif + ); + #endif // Restore Z axis if (park_point.z > 0) do_blocking_move_to_z(MAX(current_position[Z_AXIS] - park_point.z, 0), NOZZLE_PARK_Z_FEEDRATE); - #if EXTRUDERS > 1 + #if EXTRUDERS > 1 && DISABLED(PRUSA_MMU2) // Restore toolhead if it was changed if (active_extruder_before_filament_change != active_extruder) - tool_change(active_extruder_before_filament_change, 0, true); + tool_change(active_extruder_before_filament_change, 0, false); #endif // Show status screen #if HAS_LCD_MENU - lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_STATUS); + lcd_pause_show_message(PAUSE_MESSAGE_STATUS); #endif } @@ -131,14 +139,14 @@ 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 + #if EXTRUDERS > 1 && DISABLED(PRUSA_MMU2) // Change toolhead if specified uint8_t active_extruder_before_filament_change = active_extruder; if (active_extruder != target_extruder) - tool_change(target_extruder, 0, true); + tool_change(target_extruder, 0, false); #endif // Lift Z axis @@ -146,36 +154,40 @@ void GcodeSuite::M702() { do_blocking_move_to_z(MIN(current_position[Z_AXIS] + park_point.z, Z_MAX_POS), NOZZLE_PARK_Z_FEEDRATE); // Unload filament - #if EXTRUDERS > 1 && ENABLED(FILAMENT_UNLOAD_ALL_EXTRUDERS) - if (!parser.seenval('T')) { - HOTEND_LOOP() { - if (e != active_extruder) tool_change(e, 0, true); - unload_filament(-fc_settings[e].unload_length, true, ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT); + #if ENABLED(PRUSA_MMU2) + mmu2.unload(); + #else + #if EXTRUDERS > 1 && ENABLED(FILAMENT_UNLOAD_ALL_EXTRUDERS) + if (!parser.seenval('T')) { + HOTEND_LOOP() { + if (e != active_extruder) tool_change(e, 0, false); + unload_filament(-fc_settings[e].unload_length, true, PAUSE_MODE_UNLOAD_FILAMENT); + } } + else + #endif + { + // Unload length + 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, PAUSE_MODE_UNLOAD_FILAMENT); } - else #endif - { - // Unload length - 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); - } // Restore Z axis if (park_point.z > 0) do_blocking_move_to_z(MAX(current_position[Z_AXIS] - park_point.z, 0), NOZZLE_PARK_Z_FEEDRATE); - #if EXTRUDERS > 1 + #if EXTRUDERS > 1 && DISABLED(PRUSA_MMU2) // Restore toolhead if it was changed if (active_extruder_before_filament_change != active_extruder) - tool_change(active_extruder_before_filament_change, 0, true); + tool_change(active_extruder_before_filament_change, 0, false); #endif // 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 21862aa55251..dfa55fc759fd 100644 --- a/Marlin/src/gcode/feature/powerloss/M1000.cpp +++ b/Marlin/src/gcode/feature/powerloss/M1000.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -29,17 +29,20 @@ #include "../../../module/motion.h" #include "../../../lcd/ultralcd.h" -void menu_job_recovery(); +#define DEBUG_OUT ENABLED(DEBUG_POWER_LOSS_RECOVERY) +#include "../../../core/debug_out.h" -#if ENABLED(DEBUG_POWER_LOSS_RECOVERY) +void menu_job_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 b63645a2a689..4b7c253a7d75 100644 --- a/Marlin/src/gcode/feature/powerloss/M413.cpp +++ b/Marlin/src/gcode/feature/powerloss/M413.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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/feature/prusa_MMU2/M403.cpp b/Marlin/src/gcode/feature/prusa_MMU2/M403.cpp new file mode 100644 index 000000000000..c186c1ff2f4d --- /dev/null +++ b/Marlin/src/gcode/feature/prusa_MMU2/M403.cpp @@ -0,0 +1,49 @@ +/** + * 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(PRUSA_MMU2) + +#include "../../gcode.h" +#include "../../../feature/prusa_MMU2/mmu2.h" + +/** + * M403: Set filament type for MMU2 + * + * Valid filament type values: + * + * 0 Default + * 1 Flexible + * 2 PVA + */ +void GcodeSuite::M403() { + int8_t index = parser.intval('E', -1), + type = parser.intval('F', -1); + + if (WITHIN(index, 0, 4) && WITHIN(type, 0, 2)) + mmu2.set_filament_type(index, type); + else + SERIAL_ECHO_MSG("M403 - bad arguments."); +} + +#endif // PRUSA_MMU2 diff --git a/Marlin/src/gcode/feature/runout/M412.cpp b/Marlin/src/gcode/feature/runout/M412.cpp index 577f9d705dd8..749ce2a3b592 100644 --- a/Marlin/src/gcode/feature/runout/M412.cpp +++ b/Marlin/src/gcode/feature/runout/M412.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -22,7 +22,7 @@ #include "../../../inc/MarlinConfig.h" -#if ENABLED(FILAMENT_RUNOUT_SENSOR) +#if HAS_FILAMENT_SENSOR #include "../../gcode.h" #include "../../../feature/runout.h" @@ -31,9 +31,17 @@ * M412: Enable / Disable filament runout detection */ void GcodeSuite::M412() { - if (parser.seen('S')) { - runout.reset(); - runout.enabled = parser.value_bool(); + if (parser.seen("HS" + #if ENABLED(HOST_ACTION_COMMANDS) + "R" + #endif + )) { + #if ENABLED(HOST_ACTION_COMMANDS) + if (parser.seen('H')) runout.host_handling = parser.value_bool(); + #endif + const bool seenR = parser.seen('R'), seenS = parser.seen('S'); + if (seenR || seenS) runout.reset(); + if (seenS) runout.enabled = parser.value_bool(); } else { SERIAL_ECHO_START(); @@ -42,4 +50,4 @@ void GcodeSuite::M412() { } } -#endif // FILAMENT_RUNOUT_SENSOR +#endif // HAS_FILAMENT_SENSOR diff --git a/Marlin/src/gcode/feature/trinamic/M122.cpp b/Marlin/src/gcode/feature/trinamic/M122.cpp index 73e6b3c84689..3333e5bd352c 100644 --- a/Marlin/src/gcode/feature/trinamic/M122.cpp +++ b/Marlin/src/gcode/feature/trinamic/M122.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -22,7 +22,7 @@ #include "../../../inc/MarlinConfig.h" -#if ENABLED(TMC_DEBUG) +#if HAS_TRINAMIC #include "../../gcode.h" #include "../../../feature/tmc_util.h" @@ -31,14 +31,26 @@ * M122: Debug TMC drivers */ void GcodeSuite::M122() { + bool print_axis[XYZE] = { false, false, false, false }, + print_all = true; + LOOP_XYZE(i) if (parser.seen(axis_codes[i])) { print_axis[i] = true; print_all = false; } - #if ENABLED(MONITOR_DRIVER_STATUS) - if (parser.seen('S')) - tmc_set_report_status(parser.value_bool()); + if (print_all) LOOP_XYZE(i) print_axis[i] = true; + + #if ENABLED(TMC_DEBUG) + #if ENABLED(MONITOR_DRIVER_STATUS) + const bool sflag = parser.seen('S'), s0 = sflag && !parser.value_bool(); + if (sflag) tmc_set_report_interval(s0 ? 0 : MONITOR_DRIVER_STATUS_INTERVAL_MS); + if (!s0 && parser.seenval('P')) tmc_set_report_interval(MIN(parser.value_ushort(), MONITOR_DRIVER_STATUS_INTERVAL_MS)); + #endif + + if (parser.seen('V')) + tmc_get_registers(print_axis[X_AXIS], print_axis[Y_AXIS], print_axis[Z_AXIS], print_axis[E_AXIS]); else + tmc_report_all(print_axis[X_AXIS], print_axis[Y_AXIS], print_axis[Z_AXIS], print_axis[E_AXIS]); #endif - tmc_report_all(); + test_tmc_connection(print_axis[X_AXIS], print_axis[Y_AXIS], print_axis[Z_AXIS], print_axis[E_AXIS]); } -#endif // TMC_DEBUG +#endif // HAS_TRINAMIC diff --git a/Marlin/src/gcode/feature/trinamic/M569.cpp b/Marlin/src/gcode/feature/trinamic/M569.cpp new file mode 100644 index 000000000000..83b6405cb3c6 --- /dev/null +++ b/Marlin/src/gcode/feature/trinamic/M569.cpp @@ -0,0 +1,165 @@ +/** + * 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 HAS_STEALTHCHOP + +#include "../../gcode.h" +#include "../../../feature/tmc_util.h" +#include "../../../module/stepper_indirection.h" + +template +void tmc_say_stealth_status(TMC &st) { + st.printLabel(); + SERIAL_ECHOPGM(" driver mode:\t"); + serialprintPGM(st.get_stealthChop_status() ? PSTR("stealthChop") : PSTR("spreadCycle")); + SERIAL_EOL(); +} +template +void tmc_set_stealthChop(TMC &st, const bool enable) { + st.stored.stealthChop_enabled = enable; + st.refresh_stepping_mode(); +} + +static void set_stealth_status(const bool enable, const int8_t target_extruder) { + #define TMC_SET_STEALTH(Q) tmc_set_stealthChop(stepper##Q, enable) + + #if AXIS_HAS_STEALTHCHOP(X) || AXIS_HAS_STEALTHCHOP(X2) || AXIS_HAS_STEALTHCHOP(Y) || AXIS_HAS_STEALTHCHOP(Y2) || AXIS_HAS_STEALTHCHOP(Z) || AXIS_HAS_STEALTHCHOP(Z2) || AXIS_HAS_STEALTHCHOP(Z3) + const uint8_t index = parser.byteval('I'); + #endif + + LOOP_XYZE(i) if (parser.seen(axis_codes[i])) { + switch (i) { + case X_AXIS: + #if AXIS_HAS_STEALTHCHOP(X) + if (index == 0) TMC_SET_STEALTH(X); + #endif + #if AXIS_HAS_STEALTHCHOP(X2) + if (index == 1) TMC_SET_STEALTH(X2); + #endif + break; + case Y_AXIS: + #if AXIS_HAS_STEALTHCHOP(Y) + if (index == 0) TMC_SET_STEALTH(Y); + #endif + #if AXIS_HAS_STEALTHCHOP(Y2) + if (index == 1) TMC_SET_STEALTH(Y2); + #endif + break; + case Z_AXIS: + #if AXIS_HAS_STEALTHCHOP(Z) + if (index == 0) TMC_SET_STEALTH(Z); + #endif + #if AXIS_HAS_STEALTHCHOP(Z2) + if (index == 1) TMC_SET_STEALTH(Z2); + #endif + #if AXIS_HAS_STEALTHCHOP(Z3) + if (index == 2) TMC_SET_STEALTH(Z3); + #endif + break; + case E_AXIS: { + if (target_extruder < 0) return; + switch (target_extruder) { + #if AXIS_HAS_STEALTHCHOP(E0) + case 0: TMC_SET_STEALTH(E0); break; + #endif + #if AXIS_HAS_STEALTHCHOP(E1) + case 1: TMC_SET_STEALTH(E1); break; + #endif + #if AXIS_HAS_STEALTHCHOP(E2) + case 2: TMC_SET_STEALTH(E2); break; + #endif + #if AXIS_HAS_STEALTHCHOP(E3) + case 3: TMC_SET_STEALTH(E3); break; + #endif + #if AXIS_HAS_STEALTHCHOP(E4) + case 4: TMC_SET_STEALTH(E4); break; + #endif + #if AXIS_HAS_STEALTHCHOP(E5) + case 5: TMC_SET_STEALTH(E5); break; + #endif + } + } break; + } + } +} + +static void say_stealth_status() { + #define TMC_SAY_STEALTH_STATUS(Q) tmc_say_stealth_status(stepper##Q) + + #if AXIS_HAS_STEALTHCHOP(X) + TMC_SAY_STEALTH_STATUS(X); + #endif + #if AXIS_HAS_STEALTHCHOP(X2) + TMC_SAY_STEALTH_STATUS(X2); + #endif + #if AXIS_HAS_STEALTHCHOP(Y) + TMC_SAY_STEALTH_STATUS(Y); + #endif + #if AXIS_HAS_STEALTHCHOP(Y2) + TMC_SAY_STEALTH_STATUS(Y2); + #endif + #if AXIS_HAS_STEALTHCHOP(Z) + TMC_SAY_STEALTH_STATUS(Z); + #endif + #if AXIS_HAS_STEALTHCHOP(Z2) + TMC_SAY_STEALTH_STATUS(Z2); + #endif + #if AXIS_HAS_STEALTHCHOP(Z3) + TMC_SAY_STEALTH_STATUS(Z3); + #endif + #if AXIS_HAS_STEALTHCHOP(E0) + TMC_SAY_STEALTH_STATUS(E0); + #endif + #if AXIS_HAS_STEALTHCHOP(E1) + TMC_SAY_STEALTH_STATUS(E1); + #endif + #if AXIS_HAS_STEALTHCHOP(E2) + TMC_SAY_STEALTH_STATUS(E2); + #endif + #if AXIS_HAS_STEALTHCHOP(E3) + TMC_SAY_STEALTH_STATUS(E3); + #endif + #if AXIS_HAS_STEALTHCHOP(E4) + TMC_SAY_STEALTH_STATUS(E4); + #endif + #if AXIS_HAS_STEALTHCHOP(E5) + TMC_SAY_STEALTH_STATUS(E5); + #endif +} + +/** + * M569: Enable stealthChop on an axis + * + * S[1|0] to enable or disable + * XYZE to target an axis + * No arguments reports the stealthChop status of all capable drivers. + */ +void GcodeSuite::M569() { + if (parser.seen('S')) + set_stealth_status(parser.value_bool(), get_target_extruder_from_command()); + else + say_stealth_status(); +} + +#endif // HAS_STEALTHCHOP diff --git a/Marlin/src/gcode/feature/trinamic/M906.cpp b/Marlin/src/gcode/feature/trinamic/M906.cpp index 1ff28254663d..0466bfff4e35 100644 --- a/Marlin/src/gcode/feature/trinamic/M906.cpp +++ b/Marlin/src/gcode/feature/trinamic/M906.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -29,8 +29,18 @@ #include "../../../module/stepper_indirection.h" /** - * M906: Set motor current in milliamps using axis codes X, Y, Z, E - * Report driver currents when no axis specified + * M906: Set motor current in milliamps. + * + * Parameters: + * X[current] - Set mA current for X driver(s) + * Y[current] - Set mA current for Y driver(s) + * Z[current] - Set mA current for Z driver(s) + * E[current] - Set mA current for E driver(s) + * + * I[index] - Axis sub-index (Omit or 0 for X, Y, Z; 1 for X2, Y2, Z2; 2 for Z3.) + * T[index] - Extruder index (Zero-based. Omit for E0 only.) + * + * With no parameters report driver currents. */ void GcodeSuite::M906() { #define TMC_SAY_CURRENT(Q) tmc_get_current(stepper##Q) diff --git a/Marlin/src/gcode/feature/trinamic/M911-M915.cpp b/Marlin/src/gcode/feature/trinamic/M911-M914.cpp similarity index 81% rename from Marlin/src/gcode/feature/trinamic/M911-M915.cpp rename to Marlin/src/gcode/feature/trinamic/M911-M914.cpp index ee134067e3c1..ce07bb24f0b6 100644 --- a/Marlin/src/gcode/feature/trinamic/M911-M915.cpp +++ b/Marlin/src/gcode/feature/trinamic/M911-M914.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -32,7 +32,7 @@ #if ENABLED(MONITOR_DRIVER_STATUS) - #define M91x_USE(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2208) || AXIS_DRIVER_TYPE(ST, TMC2660)) + #define M91x_USE(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2160) || AXIS_DRIVER_TYPE(ST, TMC2208) || AXIS_DRIVER_TYPE(ST, TMC2660) || AXIS_DRIVER_TYPE(ST, TMC5130) || AXIS_DRIVER_TYPE(ST, TMC5160)) #define M91x_USE_E(N) (E_STEPPERS > N && M91x_USE(E##N)) #define M91x_SOME_X (M91x_USE(X) || M91x_USE(X2)) @@ -232,28 +232,30 @@ #endif break; case E_AXIS: { - const int8_t target_extruder = get_target_extruder_from_command(); - if (target_extruder < 0) return; - switch (target_extruder) { - #if AXIS_HAS_STEALTHCHOP(E0) - case 0: TMC_SET_PWMTHRS_E(0); break; - #endif - #if E_STEPPERS > 1 && AXIS_HAS_STEALTHCHOP(E1) - case 1: TMC_SET_PWMTHRS_E(1); break; - #endif - #if E_STEPPERS > 2 && AXIS_HAS_STEALTHCHOP(E2) - case 2: TMC_SET_PWMTHRS_E(2); break; - #endif - #if E_STEPPERS > 3 && AXIS_HAS_STEALTHCHOP(E3) - case 3: TMC_SET_PWMTHRS_E(3); break; - #endif - #if E_STEPPERS > 4 && AXIS_HAS_STEALTHCHOP(E4) - case 4: TMC_SET_PWMTHRS_E(4); break; - #endif - #if E_STEPPERS > 5 && AXIS_HAS_STEALTHCHOP(E5) - case 5: TMC_SET_PWMTHRS_E(5); break; - #endif - } + #if E_STEPPERS + const int8_t target_extruder = get_target_extruder_from_command(); + if (target_extruder < 0) return; + switch (target_extruder) { + #if AXIS_HAS_STEALTHCHOP(E0) + case 0: TMC_SET_PWMTHRS_E(0); break; + #endif + #if E_STEPPERS > 1 && AXIS_HAS_STEALTHCHOP(E1) + case 1: TMC_SET_PWMTHRS_E(1); break; + #endif + #if E_STEPPERS > 2 && AXIS_HAS_STEALTHCHOP(E2) + case 2: TMC_SET_PWMTHRS_E(2); break; + #endif + #if E_STEPPERS > 3 && AXIS_HAS_STEALTHCHOP(E3) + case 3: TMC_SET_PWMTHRS_E(3); break; + #endif + #if E_STEPPERS > 4 && AXIS_HAS_STEALTHCHOP(E4) + case 4: TMC_SET_PWMTHRS_E(4); break; + #endif + #if E_STEPPERS > 5 && AXIS_HAS_STEALTHCHOP(E5) + case 5: TMC_SET_PWMTHRS_E(5); break; + #endif + } + #endif // E_STEPPERS } break; } } @@ -280,7 +282,7 @@ #if AXIS_HAS_STEALTHCHOP(Z3) TMC_SAY_PWMTHRS(Z,Z3); #endif - #if AXIS_HAS_STEALTHCHOP(E0) + #if E_STEPPERS && AXIS_HAS_STEALTHCHOP(E0) TMC_SAY_PWMTHRS_E(0); #endif #if E_STEPPERS > 1 && AXIS_HAS_STEALTHCHOP(E1) @@ -384,54 +386,4 @@ } #endif // USE_SENSORLESS -/** - * TMC Z axis calibration routine - */ -#if ENABLED(TMC_Z_CALIBRATION) - void GcodeSuite::M915() { - const uint16_t _rms = parser.seenval('S') ? parser.value_int() : CALIBRATION_CURRENT, - _z = parser.seenval('Z') ? parser.value_linear_units() : CALIBRATION_EXTRA_HEIGHT; - - if (!TEST(axis_known_position, Z_AXIS)) { - SERIAL_ECHOLNPGM("\nPlease home Z axis first"); - return; - } - - #if AXIS_IS_TMC(Z) - const uint16_t Z_current_1 = stepperZ.getMilliamps(); - stepperZ.rms_current(_rms); - #endif - #if AXIS_IS_TMC(Z2) - const uint16_t Z2_current_1 = stepperZ2.getMilliamps(); - stepperZ2.rms_current(_rms); - #endif - #if AXIS_IS_TMC(Z3) - const uint16_t Z3_current_1 = stepperZ3.getMilliamps(); - stepperZ3.rms_current(_rms); - #endif - - SERIAL_ECHOPAIR("\nCalibration current: Z", _rms); - - soft_endstops_enabled = false; - - do_blocking_move_to_z(Z_MAX_POS+_z); - - #if AXIS_IS_TMC(Z) - stepperZ.rms_current(Z_current_1); - #endif - #if AXIS_IS_TMC(Z2) - stepperZ2.rms_current(Z2_current_1); - #endif - #if AXIS_IS_TMC(Z3) - stepperZ3.rms_current(Z3_current_1); - #endif - - do_blocking_move_to_z(Z_MAX_POS); - soft_endstops_enabled = true; - - SERIAL_ECHOLNPGM("\nHoming Z because we lost steps"); - enqueue_and_echo_commands_P(PSTR("G28 Z")); - } -#endif - #endif // HAS_TRINAMIC diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index e1e3f1065844..546898433a23 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -36,6 +36,15 @@ GcodeSuite gcode; #include "../module/printcounter.h" #endif +#if ENABLED(HOST_PROMPT_SUPPORT) + #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; @@ -82,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 @@ -93,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()); @@ -102,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 } @@ -128,27 +143,17 @@ void GcodeSuite::dwell(millis_t time) { void GcodeSuite::G29_with_retry() { uint8_t retries = G29_MAX_RETRIES; while (G29()) { // G29 should return true for failed probes ONLY - if (retries--) { - #ifdef G29_ACTION_ON_RECOVER - SERIAL_ECHOLNPGM("//action:" G29_ACTION_ON_RECOVER); - #endif - #ifdef G29_RECOVER_COMMANDS - process_subcommands_now_P(PSTR(G29_RECOVER_COMMANDS)); - #endif - } + if (retries--) event_probe_recover(); else { - #ifdef G29_FAILURE_COMMANDS - process_subcommands_now_P(PSTR(G29_FAILURE_COMMANDS)); - #endif - #ifdef G29_ACTION_ON_FAILURE - SERIAL_ECHOLNPGM("//action:" G29_ACTION_ON_FAILURE); - #endif - #if ENABLED(G29_HALT_ON_FAILURE) - kill(PSTR(MSG_ERR_PROBING_FAILED)); - #endif + event_probe_failure(); return; } } + + #if ENABLED(HOST_PROMPT_SUPPORT) + host_action_prompt_end(); + #endif + #ifdef G29_SUCCESS_COMMANDS process_subcommands_now_P(PSTR(G29_SUCCESS_COMMANDS)); #endif @@ -212,6 +217,8 @@ void GcodeSuite::process_parsed_command( #if ENABLED(INCH_MODE_SUPPORT) case 20: G20(); break; // G20: Inch Mode case 21: G21(); break; // G21: MM Mode + #else + case 21: NOOP; break; // No error on unknown G21 #endif #if ENABLED(G26_MESH_VALIDATION) @@ -251,12 +258,27 @@ 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 + #if ENABLED(CNC_COORDINATE_SYSTEMS) + case 53: G53(); break; + case 54: G54(); break; + case 55: G55(); break; + case 56: G56(); break; + case 57: G57(); break; + case 58: G58(); break; + case 59: G59(); break; + #endif + #if ENABLED(GCODE_MOTION_MODES) case 80: G80(); break; // G80: Reset the current motion mode #endif @@ -270,6 +292,10 @@ void GcodeSuite::process_parsed_command( case 42: G42(); break; // G42: Coordinated move to a mesh point #endif + #if ENABLED(CALIBRATION_GCODE) + case 425: G425(); break; // G425: Perform calibration with calibration cube + #endif + #if ENABLED(DEBUG_GCODE_PARSER) case 800: parser.debug(); break; // G800: GCode Parser Test for G #endif @@ -285,8 +311,8 @@ void GcodeSuite::process_parsed_command( #endif #if ENABLED(SPINDLE_LASER_ENABLE) - case 3: M3_M4(true ); break; // M3: turn spindle/laser on, set laser/spindle power/speed, set rotation direction CW - case 4: M3_M4(false); break; // M4: turn spindle/laser on, set laser/spindle power/speed, set rotation direction CCW + case 3: M3_M4(false); break; // M3: turn spindle/laser on, set laser/spindle power/speed, set rotation direction CW + case 4: M3_M4(true ); break; // M4: turn spindle/laser on, set laser/spindle power/speed, set rotation direction CCW case 5: M5(); break; // M5 - turn spindle/laser off #endif @@ -314,7 +340,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,11 +358,7 @@ 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(ULTRA_LCD) && ENABLED(LCD_SET_PROGRESS_MANUALLY) + #if ENABLED(LCD_SET_PROGRESS_MANUALLY) case 73: M73(); break; // M73: Set progress percentage (for display on LCD) #endif @@ -361,8 +383,15 @@ void GcodeSuite::process_parsed_command( case 108: M108(); break; // M108: Cancel Waiting case 112: M112(); break; // M112: Emergency Stop case 410: M410(); break; // M410: Quickstop - Abort all the planned moves. + #if ENABLED(HOST_PROMPT_SUPPORT) + case 876: M876(); break; // M876: Handle Host prompt responses + #endif #else - case 108: case 112: case 410: break; + case 108: case 112: case 410: + #if ENABLED(HOST_PROMPT_SUPPORT) + case 876: + #endif + break; #endif #if ENABLED(HOST_KEEPALIVE_FEATURE) @@ -374,6 +403,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 @@ -439,6 +473,9 @@ void GcodeSuite::process_parsed_command( #if ENABLED(DIRECT_MIXING_IN_G1) case 165: M165(); break; // M165: Set multiple mix weights #endif + #if ENABLED(GRADIENT_MIX) + case 166: M166(); break; // M166: Set Gradient Mix + #endif #endif #if DISABLED(NO_VOLUMETRICS) @@ -463,7 +500,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 @@ -485,7 +522,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 @@ -516,8 +553,8 @@ void GcodeSuite::process_parsed_command( case 304: M304(); break; // M304: Set bed PID parameters #endif - #if PIN_EXISTS(CHDK) || HAS_PHOTOGRAPH - case 240: M240(); break; // M240: Trigger a camera by emulating a Canon RC-1 : http://www.doc-diy.net/photo/rc-1_hacked/ + #if ENABLED(PHOTO_GCODE) + case 240: M240(); break; // M240: Trigger a camera #endif #if HAS_LCD_CONTRAST @@ -545,9 +582,9 @@ 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 + case 381: M381(); break; // M381: Disable all solenoids or, if MANUAL_SOLENOID_CONTROL, active (or specified) solenoid #endif case 400: M400(); break; // M400: Finish all moves @@ -557,6 +594,10 @@ void GcodeSuite::process_parsed_command( case 402: M402(); break; // M402: Stow probe #endif + #if ENABLED(PRUSA_MMU2) + case 403: M403(); break; + #endif + #if ENABLED(FILAMENT_WIDTH_SENSOR) case 404: M404(); break; // M404: Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or display nominal filament width case 405: M405(); break; // M405: Turn on filament sensor for control @@ -564,7 +605,7 @@ void GcodeSuite::process_parsed_command( case 407: M407(); break; // M407: Display measured filament diameter #endif - #if ENABLED(FILAMENT_RUNOUT_SENSOR) + #if HAS_FILAMENT_SENSOR case 412: M412(); break; // M412: Enable/Disable filament runout detection #endif @@ -576,6 +617,10 @@ void GcodeSuite::process_parsed_command( case 421: M421(); break; // M421: Set a Mesh Bed Leveling Z coordinate #endif + #if ENABLED(BACKLASH_GCODE) + case 425: M425(); break; // M425: Tune backlash compensation + #endif + #if HAS_M206_COMMAND case 428: M428(); break; // M428: Apply current_position to home_offset #endif @@ -611,7 +656,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 @@ -634,7 +679,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. @@ -646,10 +691,11 @@ void GcodeSuite::process_parsed_command( #endif #if HAS_TRINAMIC - #if ENABLED(TMC_DEBUG) - case 122: M122(); break; - #endif + case 122: M122(); break; // M122: Report driver configuration and status case 906: M906(); break; // M906: Set motor current in milliamps using axis codes X, Y, Z, E + #if HAS_STEALTHCHOP + case 569: M569(); break; // M569: Enable stealthChop on an axis. + #endif #if ENABLED(MONITOR_DRIVER_STATUS) case 911: M911(); break; // M911: Report TMC2130 prewarn triggered flags case 912: M912(); break; // M912: Clear TMC2130 prewarn triggered flags @@ -660,9 +706,14 @@ void GcodeSuite::process_parsed_command( #if USE_SENSORLESS case 914: M914(); break; // M914: Set StallGuard sensitivity. #endif - #if ENABLED(TMC_Z_CALIBRATION) - case 915: M915(); break; // M915: TMC Z axis calibration. - #endif + #endif + + #if HAS_DRIVER(L6470) + case 122: M122(); break; // M122: Report status + case 906: M906(); break; // M906: Set or get motor drive level + case 916: M916(); break; // M916: L6470 tuning: Increase drive level until thermal warning + case 917: M917(); break; // M917: L6470 tuning: Find minimum current thresholds + case 918: M918(); break; // M918: L6470 tuning: Increase speed until max or error #endif #if HAS_MICROSTEPS @@ -670,7 +721,9 @@ void GcodeSuite::process_parsed_command( case 351: M351(); break; // M351: Toggle MS1 MS2 pins directly, S# determines MS1 or MS2, X# sets the pin high/low. #endif - case 355: M355(); break; // M355: Set case light brightness + #if HAS_CASE_LIGHT + case 355: M355(); break; // M355: Set case light brightness + #endif #if ENABLED(DEBUG_GCODE_PARSER) case 800: parser.debug(); break; // M800: GCode Parser Test for M @@ -689,10 +742,18 @@ void GcodeSuite::process_parsed_command( case 869: M869(); break; // M869: Report axis error #endif + #if ENABLED(MAGNETIC_PARKING_EXTRUDER) + case 951: M951(); break; // M951: Set Magnetic Parking Extruder parameters + #endif + #if ENABLED(Z_STEPPER_AUTO_ALIGN) case 422: M422(); break; // M422: Set Z Stepper automatic alignment position using probe #endif + #if ENABLED(PLATFORM_M997_SUPPORT) + case 997: M997(); break; // M997: Perform in-application firmware update + #endif + case 999: M999(); break; // M999: Restart after being Stopped #if ENABLED(POWER_LOSS_RECOVERY) @@ -724,6 +785,8 @@ void GcodeSuite::process_parsed_command( void GcodeSuite::process_next_command() { char * const current_command = command_queue[cmd_queue_index_r]; + PORT_REDIRECT(command_queue_port[cmd_queue_index_r]); + if (DEBUGGING(ECHO)) { SERIAL_ECHO_START(); SERIAL_ECHOLN(current_command); @@ -790,16 +853,13 @@ void GcodeSuite::process_next_command() { switch (busy_state) { case IN_HANDLER: case IN_PROCESS: - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM(MSG_BUSY_PROCESSING); + SERIAL_ECHO_MSG(MSG_BUSY_PROCESSING); break; case PAUSED_FOR_USER: - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM(MSG_BUSY_PAUSED_FOR_USER); + SERIAL_ECHO_MSG(MSG_BUSY_PAUSED_FOR_USER); break; case PAUSED_FOR_INPUT: - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM(MSG_BUSY_PAUSED_FOR_INPUT); + SERIAL_ECHO_MSG(MSG_BUSY_PAUSED_FOR_INPUT); break; default: break; diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 42671b6243d8..af99e4fbed1b 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -144,11 +144,12 @@ * 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) * M165 - Set the mix for the mixing extruder (and current virtual tool) with parameters ABCDHI. (Requires MIXING_EXTRUDER and DIRECT_MIXING_IN_G1) + * M166 - Set the Gradient Mix for the mixing extruder. (Requires GRADIENT_MIX) * M190 - Sxxx Wait for bed current temp to reach target temp. ** Waits only when heating! ** * Rxxx Wait for bed current temp to reach target temp. ** Waits for heating or cooling. ** * M200 - Set filament diameter, D, setting E axis units to cubic. (Use S0 to revert to linear units.) @@ -171,7 +172,7 @@ * M220 - Set Feedrate Percentage: "M220 S" (i.e., "FR" on the LCD) * M221 - Set Flow Percentage: "M221 S" * M226 - Wait until a pin is in a given state: "M226 P S" - * M240 - Trigger a camera to take a photograph. (Requires CHDK_PIN or PHOTOGRAPH_PIN) + * M240 - Trigger a camera to take a photograph. (Requires PHOTO_GCODE) * M250 - Set LCD contrast: "M250 C" (0-63). (Requires LCD support) * M260 - i2c Send Data (Requires EXPERIMENTAL_I2CBUS) * M261 - i2c Request Data (Requires EXPERIMENTAL_I2CBUS) @@ -191,6 +192,7 @@ * M400 - Finish all moves. * M401 - Deploy and activate Z probe. (Requires a probe) * M402 - Deactivate and stow Z probe. (Requires a probe) + * M403 - Set filament type for PRUSA MMU2 * M404 - Display or set the Nominal Filament Width: "W". (Requires FILAMENT_WIDTH_SENSOR) * M405 - Enable Filament Sensor flow control. "M405 D". (Requires FILAMENT_WIDTH_SENSOR) * M406 - Disable Filament Sensor flow control. (Requires FILAMENT_WIDTH_SENSOR) @@ -201,6 +203,7 @@ * M420 - Enable/Disable Leveling (with current values) S1=enable S0=disable (Requires MESH_BED_LEVELING or ABL) * M421 - Set a single Z coordinate in the Mesh Leveling grid. X Y Z (Requires MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, or AUTO_BED_LEVELING_UBL) * M422 - Set Z Stepper automatic alignment position using probe. X Y A (Requires Z_STEPPER_AUTO_ALIGN) + * M425 - Enable/Disable and tune backlash correction. (Requires BACKLASH_COMPENSATION and BACKLASH_GCODE) * M428 - Set the home_offset based on the current_position. Nearest edge applies. (Disabled by NO_WORKSPACE_OFFSETS or DELTA) * M500 - Store parameters in EEPROM. (Requires EEPROM_SETTINGS) * M501 - Restore parameters from EEPROM. (Requires EEPROM_SETTINGS) @@ -208,6 +211,7 @@ * M503 - Print the current settings (in memory): "M503 S". S0 specifies compact output. * M524 - Abort the current SD print job (started with M24) * M540 - Enable/disable SD card abort on endstop hit: "M540 S". (Requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) + * M569 - Enable stealthChop on an axis. (Requires at least one #_X_DRIVER_TYPE to be TMC2130 or TMC2208) * M600 - Pause for filament change: "M600 X Y Z E L". (Requires ADVANCED_PAUSE_FEATURE) * M603 - Configure filament change: "M603 T U L". (Requires ADVANCED_PAUSE_FEATURE) * M605 - Set Dual X-Carriage movement mode: "M605 S [X] [R]". (Requires DUAL_X_CARRIAGE) @@ -238,6 +242,9 @@ * M912 - Clear stepper driver overtemperature pre-warn condition flag. (Requires at least one _DRIVER_TYPE defined as TMC2130/TMC2208/TMC2660) * M913 - Set HYBRID_THRESHOLD speed. (Requires HYBRID_THRESHOLD) * M914 - Set StallGuard sensitivity. (Requires SENSORLESS_HOMING or SENSORLESS_PROBING) + * M917 - L6470 tuning: Find minimum current thresholds + * M918 - L6470 tuning: Increase speed until max or error + * M951 - Set Magnetic Parking Extruder parameters. (Requires MAGNETIC_PARKING_EXTRUDER) * * M360 - SCARA calibration: Move to cal-position ThetaA (0 deg calibration) * M361 - SCARA calibration: Move to cal-position ThetaB (90 deg calibration - steps per degree) @@ -247,6 +254,7 @@ * * ************ Custom codes - This can change to suit future G-code regulations * M928 - Start SD logging: "M928 filename.gco". Stop with M29. (Requires SDSUPPORT) + * M997 - Perform in-application firmware update * M999 - Restart after being stopped by error * * "T" Codes @@ -407,7 +415,7 @@ class GcodeSuite { #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 @@ -430,12 +438,16 @@ class GcodeSuite { static void G92(); + #if ENABLED(CALIBRATION_GCODE) + static void G425(); + #endif + #if HAS_RESUME_CONTINUE static void M0_M1(); #endif #if ENABLED(SPINDLE_LASER_ENABLE) - static void M3_M4(bool is_M3); + static void M3_M4(const bool is_M4); static void M5(); #endif @@ -468,7 +480,7 @@ class GcodeSuite { #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 @@ -483,11 +495,7 @@ class GcodeSuite { static void M48(); #endif - #if ENABLED(G26_MESH_VALIDATION) - static void M49(); - #endif - - #if ENABLED(ULTRA_LCD) && ENABLED(LCD_SET_PROGRESS_MANUALLY) + #if ENABLED(LCD_SET_PROGRESS_MANUALLY) static void M73(); #endif @@ -522,6 +530,9 @@ class GcodeSuite { static void M108(); static void M112(); static void M410(); + #if ENABLED(HOST_PROMPT_SUPPORT) + static void M876(); + #endif #endif static void M109(); @@ -561,6 +572,11 @@ class GcodeSuite { static void M190(); #endif + #if HAS_HEATED_CHAMBER + static void M141(); + //static void M191(); + #endif + #if HAS_LCD_MENU static void M145(); #endif @@ -583,6 +599,9 @@ class GcodeSuite { #if ENABLED(DIRECT_MIXING_IN_G1) static void M165(); #endif + #if ENABLED(GRADIENT_MIX) + static void M166(); + #endif #endif static void M200(); @@ -614,7 +633,7 @@ class GcodeSuite { static void M217(); #endif - #if HOTENDS > 1 + #if HAS_HOTEND_OFFSET static void M218(); #endif @@ -622,7 +641,7 @@ class GcodeSuite { static void M221(); static void M226(); - #if PIN_EXISTS(CHDK) || HAS_PHOTOGRAPH + #if ENABLED(PHOTO_GCODE) static void M240(); #endif @@ -671,7 +690,9 @@ class GcodeSuite { static void M351(); #endif - static void M355(); + #if HAS_CASE_LIGHT + static void M355(); + #endif #if ENABLED(MORGAN_SCARA) static bool M360(); @@ -681,7 +702,7 @@ class GcodeSuite { 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 @@ -693,6 +714,10 @@ class GcodeSuite { static void M402(); #endif + #if ENABLED(PRUSA_MMU2) + static void M403(); + #endif + #if ENABLED(FILAMENT_WIDTH_SENSOR) static void M404(); static void M405(); @@ -700,7 +725,7 @@ class GcodeSuite { static void M407(); #endif - #if ENABLED(FILAMENT_RUNOUT_SENSOR) + #if HAS_FILAMENT_SENSOR static void M412(); #endif @@ -709,6 +734,10 @@ class GcodeSuite { static void M421(); #endif + #if ENABLED(BACKLASH_GCODE) + static void M425(); + #endif + #if HAS_M206_COMMAND static void M428(); #endif @@ -736,7 +765,7 @@ class GcodeSuite { static void M603(); #endif - #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE) + #if HAS_DUPLICATION_MODE static void M605(); #endif @@ -744,7 +773,7 @@ class GcodeSuite { static void M665(); #endif - #if ENABLED(DELTA) || ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS + #if ENABLED(DELTA) || HAS_EXTRA_ENDSTOPS static void M666(); #endif @@ -787,10 +816,11 @@ class GcodeSuite { #endif #if HAS_TRINAMIC - #if ENABLED(TMC_DEBUG) - static void M122(); - #endif + static void M122(); static void M906(); + #if HAS_STEALTHCHOP + static void M569(); + #endif #if ENABLED(MONITOR_DRIVER_STATUS) static void M911(); static void M912(); @@ -801,12 +831,17 @@ class GcodeSuite { #if USE_SENSORLESS static void M914(); #endif - #if ENABLED(TMC_Z_CALIBRATION) - static void M915(); - #endif #endif - #if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM || ENABLED(DIGIPOT_I2C) || ENABLED(DAC_STEPPER_CURRENT) + #if HAS_DRIVER(L6470) + static void M122(); + static void M906(); + static void M916(); + static void M917(); + static void M918(); + #endif + + #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(); @@ -821,6 +856,14 @@ class GcodeSuite { static void M928(); #endif + #if ENABLED(MAGNETIC_PARKING_EXTRUDER) + static void M951(); + #endif + + #if ENABLED(PLATFORM_M997_SUPPORT) + static void M997(); + #endif + static void M999(); #if ENABLED(POWER_LOSS_RECOVERY) diff --git a/Marlin/src/gcode/geometry/G17-G19.cpp b/Marlin/src/gcode/geometry/G17-G19.cpp index d386e2eed234..43bff298b14c 100644 --- a/Marlin/src/gcode/geometry/G17-G19.cpp +++ b/Marlin/src/gcode/geometry/G17-G19.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/geometry/G53-G59.cpp b/Marlin/src/gcode/geometry/G53-G59.cpp index f1e9ff27d055..38765f2e1b0f 100644 --- a/Marlin/src/gcode/geometry/G53-G59.cpp +++ b/Marlin/src/gcode/geometry/G53-G59.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -59,7 +59,7 @@ bool GcodeSuite::select_coordinate_system(const int8_t _new) { * * Marlin also uses G53 on a line by itself to go back to native space. */ -inline void GcodeSuite::G53() { +void GcodeSuite::G53() { const int8_t _system = active_coordinate_system; active_coordinate_system = -1; if (parser.chain()) { // If this command has more following... @@ -80,7 +80,7 @@ inline void GcodeSuite::G53() { void G54_59(uint8_t subcode=0) { const int8_t _space = parser.codenum - 54 + subcode; if (gcode.select_coordinate_system(_space)) { - SERIAL_PROTOCOLLNPAIR("Select workspace ", _space); + SERIAL_ECHOLNPAIR("Select workspace ", _space); report_current_position(); } } diff --git a/Marlin/src/gcode/geometry/G92.cpp b/Marlin/src/gcode/geometry/G92.cpp index 8e0b341316be..01d42f7c239f 100644 --- a/Marlin/src/gcode/geometry/G92.cpp +++ b/Marlin/src/gcode/geometry/G92.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -33,9 +33,23 @@ */ void GcodeSuite::G92() { - #if ENABLED(CNC_COORDINATE_SYSTEMS) - switch (parser.subcode) { - case 1: + bool didE = false; + #if IS_SCARA || !HAS_POSITION_SHIFT + bool didXYZ = false; + #else + constexpr bool didXYZ = false; + #endif + + #if USE_GCODE_SUBCODES + const uint8_t subcode_G92 = parser.subcode; + #else + constexpr uint8_t subcode_G92 = 0; + #endif + + switch (subcode_G92) { + default: break; + #if ENABLED(CNC_COORDINATE_SYSTEMS) + case 1: { // Zero the G92 values and restore current position #if !IS_SCARA LOOP_XYZ(i) { @@ -46,44 +60,46 @@ void GcodeSuite::G92() { } } #endif // Not SCARA - return; - } - #endif - - #if ENABLED(CNC_COORDINATE_SYSTEMS) - #define IS_G92_0 (parser.subcode == 0) - #else - #define IS_G92_0 true - #endif - - bool didE = false; - #if IS_SCARA || !HAS_POSITION_SHIFT - bool didXYZ = false; - #else - constexpr bool didXYZ = false; - #endif - - if (IS_G92_0) LOOP_XYZE(i) { - if (parser.seenval(axis_codes[i])) { - const float l = parser.value_axis_units((AxisEnum)i), - v = i == E_AXIS ? l : LOGICAL_TO_NATIVE(l, i), - d = v - current_position[i]; - if (!NEAR_ZERO(d)) { - #if IS_SCARA || !HAS_POSITION_SHIFT - if (i == E_AXIS) didE = true; else didXYZ = true; - current_position[i] = v; // Without workspaces revert to Marlin 1.0 behavior - #elif HAS_POSITION_SHIFT - if (i == E_AXIS) { - didE = true; - current_position[E_AXIS] = v; // When using coordinate spaces, only E is set directly + } return; + #endif + #if ENABLED(POWER_LOSS_RECOVERY) + case 9: { + LOOP_XYZE(i) { + if (parser.seenval(axis_codes[i])) { + current_position[i] = parser.value_axis_units((AxisEnum)i); + #if IS_SCARA || !HAS_POSITION_SHIFT + if (i == E_AXIS) didE = true; else didXYZ = true; + #elif HAS_POSITION_SHIFT + if (i == E_AXIS) didE = true; + #endif } - else { - position_shift[i] += d; // Other axes simply offset the coordinate space - update_workspace_offset((AxisEnum)i); + } + } break; + #endif + case 0: { + LOOP_XYZE(i) { + if (parser.seenval(axis_codes[i])) { + const float l = parser.value_axis_units((AxisEnum)i), + v = i == E_AXIS ? l : LOGICAL_TO_NATIVE(l, i), + d = v - current_position[i]; + if (!NEAR_ZERO(d)) { + #if IS_SCARA || !HAS_POSITION_SHIFT + if (i == E_AXIS) didE = true; else didXYZ = true; + current_position[i] = v; // Without workspaces revert to Marlin 1.0 behavior + #elif HAS_POSITION_SHIFT + if (i == E_AXIS) { + didE = true; + current_position[E_AXIS] = v; // When using coordinate spaces, only E is set directly + } + else { + position_shift[i] += d; // Other axes simply offset the coordinate space + update_workspace_offset((AxisEnum)i); + } + #endif } - #endif + } } - } + } break; } #if ENABLED(CNC_COORDINATE_SYSTEMS) diff --git a/Marlin/src/gcode/geometry/M206_M428.cpp b/Marlin/src/gcode/geometry/M206_M428.cpp index 086108b18fa7..8ef9eb057d3e 100644 --- a/Marlin/src/gcode/geometry/M206_M428.cpp +++ b/Marlin/src/gcode/geometry/M206_M428.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -69,8 +69,7 @@ void GcodeSuite::M428() { if (!WITHIN(diff[i], -20, 20) && home_dir((AxisEnum)i) > 0) diff[i] = -current_position[i]; if (!WITHIN(diff[i], -20, 20)) { - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM(MSG_ERR_M428_TOO_FAR); + SERIAL_ERROR_MSG(MSG_ERR_M428_TOO_FAR); LCD_ALERTMESSAGEPGM("Err: Too far!"); BUZZ(200, 40); return; diff --git a/Marlin/src/gcode/host/M110.cpp b/Marlin/src/gcode/host/M110.cpp index fc53611d90ec..108f414d2bec 100644 --- a/Marlin/src/gcode/host/M110.cpp +++ b/Marlin/src/gcode/host/M110.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/host/M113.cpp b/Marlin/src/gcode/host/M113.cpp index 97a827de0ec5..f3d885e3d244 100644 --- a/Marlin/src/gcode/host/M113.cpp +++ b/Marlin/src/gcode/host/M113.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/host/M114.cpp b/Marlin/src/gcode/host/M114.cpp index 9d1a48b55b93..57ba258333a3 100644 --- a/Marlin/src/gcode/host/M114.cpp +++ b/Marlin/src/gcode/host/M114.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -28,13 +28,21 @@ #if ENABLED(M114_DETAIL) + #if HAS_DRIVER(L6470) + //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) { char str[12]; for (uint8_t i = 0; i < n; i++) { SERIAL_CHAR(' '); SERIAL_CHAR(axis_codes[i]); SERIAL_CHAR(':'); - SERIAL_PROTOCOL(dtostrf(pos[i], 8, precision, str)); + SERIAL_ECHO(dtostrf(pos[i], 8, precision, str)); } SERIAL_EOL(); } @@ -43,7 +51,7 @@ void report_current_position_detail() { - SERIAL_PROTOCOLPGM("\nLogical:"); + SERIAL_ECHOPGM("\nLogical:"); const float logical[XYZ] = { LOGICAL_X_POSITION(current_position[X_AXIS]), LOGICAL_Y_POSITION(current_position[Y_AXIS]), @@ -51,17 +59,17 @@ }; report_xyz(logical); - SERIAL_PROTOCOLPGM("Raw: "); + SERIAL_ECHOPGM("Raw: "); report_xyz(current_position); float leveled[XYZ] = { current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] }; #if HAS_LEVELING - SERIAL_PROTOCOLPGM("Leveled:"); + SERIAL_ECHOPGM("Leveled:"); planner.apply_leveling(leveled); report_xyz(leveled); - SERIAL_PROTOCOLPGM("UnLevel:"); + SERIAL_ECHOPGM("UnLevel:"); float unleveled[XYZ] = { leveled[X_AXIS], leveled[Y_AXIS], leveled[Z_AXIS] }; planner.unapply_leveling(unleveled); report_xyz(unleveled); @@ -69,9 +77,9 @@ #if IS_KINEMATIC #if IS_SCARA - SERIAL_PROTOCOLPGM("ScaraK: "); + SERIAL_ECHOPGM("ScaraK: "); #else - SERIAL_PROTOCOLPGM("DeltaK: "); + SERIAL_ECHOPGM("DeltaK: "); #endif inverse_kinematics(leveled); // writes delta[] report_xyz(delta); @@ -79,12 +87,68 @@ planner.synchronize(); - SERIAL_PROTOCOLPGM("Stepper:"); + #if HAS_DRIVER(L6470) + char temp_buf[80]; + int32_t temp; + //#define ABS_POS_SIGN_MASK 0b1111 1111 1110 0000 0000 0000 0000 0000 + #define ABS_POS_SIGN_MASK 0b11111111111000000000000000000000 + #define REPORT_ABSOLUTE_POS(Q) do{ \ + L6470.say_axis(Q, false); \ + 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); \ + DEBUG_ECHO(temp_buf); \ + }while(0) + + DEBUG_ECHOPGM("\nL6470:"); + #if AXIS_DRIVER_TYPE_X(L6470) + REPORT_ABSOLUTE_POS(X); + #endif + #if AXIS_DRIVER_TYPE_X2(L6470) + REPORT_ABSOLUTE_POS(X2); + #endif + #if AXIS_DRIVER_TYPE_Y(L6470) + REPORT_ABSOLUTE_POS(Y); + #endif + #if AXIS_DRIVER_TYPE_Y2(L6470) + REPORT_ABSOLUTE_POS(Y2); + #endif + #if AXIS_DRIVER_TYPE_Z(L6470) + REPORT_ABSOLUTE_POS(Z); + #endif + #if AXIS_DRIVER_TYPE_Z2(L6470) + REPORT_ABSOLUTE_POS(Z2); + #endif + #if AXIS_DRIVER_TYPE_Z3(L6470) + REPORT_ABSOLUTE_POS(Z3); + #endif + #if AXIS_DRIVER_TYPE_E0(L6470) + REPORT_ABSOLUTE_POS(E0); + #endif + #if AXIS_DRIVER_TYPE_E1(L6470) + REPORT_ABSOLUTE_POS(E1); + #endif + #if AXIS_DRIVER_TYPE_E2(L6470) + REPORT_ABSOLUTE_POS(E2); + #endif + #if AXIS_DRIVER_TYPE_E3(L6470) + REPORT_ABSOLUTE_POS(E3); + #endif + #if AXIS_DRIVER_TYPE_E4(L6470) + REPORT_ABSOLUTE_POS(E4); + #endif + #if AXIS_DRIVER_TYPE_E5(L6470) + REPORT_ABSOLUTE_POS(E5); + #endif + SERIAL_EOL(); + #endif // HAS_DRIVER(L6470) + + SERIAL_ECHOPGM("Stepper:"); LOOP_XYZE(i) { SERIAL_CHAR(' '); SERIAL_CHAR(axis_codes[i]); SERIAL_CHAR(':'); - SERIAL_PROTOCOL(stepper.position((AxisEnum)i)); + SERIAL_ECHO(stepper.position((AxisEnum)i)); } SERIAL_EOL(); @@ -93,11 +157,11 @@ planner.get_axis_position_degrees(A_AXIS), planner.get_axis_position_degrees(B_AXIS) }; - SERIAL_PROTOCOLPGM("Degrees:"); + SERIAL_ECHOPGM("Degrees:"); report_xyze(deg, 2); #endif - SERIAL_PROTOCOLPGM("FromStp:"); + SERIAL_ECHOPGM("FromStp:"); get_cartesian_from_steppers(); // writes cartes[XYZ] (with forward kinematics) const float from_steppers[XYZE] = { cartes[X_AXIS], cartes[Y_AXIS], cartes[Z_AXIS], planner.get_axis_position_mm(E_AXIS) }; report_xyze(from_steppers); @@ -108,7 +172,7 @@ from_steppers[Z_AXIS] - leveled[Z_AXIS], from_steppers[E_AXIS] - current_position[E_AXIS] }; - SERIAL_PROTOCOLPGM("Differ: "); + SERIAL_ECHOPGM("Differ: "); report_xyze(diff); } diff --git a/Marlin/src/gcode/host/M115.cpp b/Marlin/src/gcode/host/M115.cpp index 8b4758808a04..c3702ab4814a 100644 --- a/Marlin/src/gcode/host/M115.cpp +++ b/Marlin/src/gcode/host/M115.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -23,16 +23,12 @@ #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_PROTOCOLPGM("Cap:"); + SERIAL_ECHOPGM("Cap:"); serialprintPGM(name); SERIAL_CHAR(':'); - SERIAL_PROTOCOLLN(int(ena ? 1 : 0)); + SERIAL_ECHOLN(int(ena ? 1 : 0)); } #endif @@ -40,14 +36,8 @@ * M115: Capabilities string */ void GcodeSuite::M115() { - #if NUM_SERIAL > 1 - const int8_t port = command_queue_port[cmd_queue_index_r]; - #define CAPLINE(STR,...) cap_line(PSTR(STR), port, __VA_ARGS__) - #else - #define CAPLINE(STR,...) cap_line(PSTR(STR), __VA_ARGS__) - #endif - SERIAL_PROTOCOLLNPGM_P(port, MSG_M115_REPORT); + SERIAL_ECHOLNPGM(MSG_M115_REPORT); #if ENABLED(EXTENDED_CAPABILITIES_REPORT) @@ -58,6 +48,13 @@ void GcodeSuite::M115() { #endif ); + // BINARY_FILE_TRANSFER (M28 B1) + cap_line(PSTR("BINARY_FILE_TRANSFER") + #if ENABLED(BINARY_FILE_TRANSFER) + , true + #endif + ); + // EEPROM (M500, M501) cap_line(PSTR("EEPROM") #if ENABLED(EEPROM_SETTINGS) @@ -128,17 +125,24 @@ 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 ); - // EMERGENCY_PARSER (M108, M112, M410) + // EMERGENCY_PARSER (M108, M112, M410, M876) cap_line(PSTR("EMERGENCY_PARSER") #if ENABLED(EMERGENCY_PARSER) , true #endif ); + // PROMPT SUPPORT (M876) + cap_line(PSTR("PROMPT_SUPPORT") + #if ENABLED(HOST_PROMPT_SUPPORT) + , true + #endif + ); + // AUTOREPORT_SD_STATUS (M27 extension) cap_line(PSTR("AUTOREPORT_SD_STATUS") #if ENABLED(AUTO_REPORT_SD_STATUS) @@ -148,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 ); @@ -160,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/host/M118.cpp b/Marlin/src/gcode/host/M118.cpp index 1bd132a3a6fa..0c64debbb7e7 100644 --- a/Marlin/src/gcode/host/M118.cpp +++ b/Marlin/src/gcode/host/M118.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/host/M119.cpp b/Marlin/src/gcode/host/M119.cpp index 7e2399e1695f..e889a10999d2 100644 --- a/Marlin/src/gcode/host/M119.cpp +++ b/Marlin/src/gcode/host/M119.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/host/M876.cpp b/Marlin/src/gcode/host/M876.cpp new file mode 100644 index 000000000000..7f7d4c8c4024 --- /dev/null +++ b/Marlin/src/gcode/host/M876.cpp @@ -0,0 +1,37 @@ +/** + * 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(HOST_PROMPT_SUPPORT) && DISABLED(EMERGENCY_PARSER) + +#include "../../feature/host_actions.h" +#include "../gcode.h" +#include "../../Marlin.h" + +/** + * M876: Handle Prompt Response + */ +void GcodeSuite::M876() { + if (parser.seenval('S')) host_response_handler((uint8_t)parser.value_int()); +} + +#endif // HOST_PROMPT_SUPPORT && !EMERGENCY_PARSER diff --git a/Marlin/src/gcode/lcd/M0_M1.cpp b/Marlin/src/gcode/lcd/M0_M1.cpp index 04ee285ce5c2..9b8b859e24c9 100644 --- a/Marlin/src/gcode/lcd/M0_M1.cpp +++ b/Marlin/src/gcode/lcd/M0_M1.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -31,12 +31,20 @@ #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 #include "../../feature/leds/printer_event_leds.h" #endif +#if ENABLED(HOST_PROMPT_SUPPORT) + #include "../../feature/host_actions.h" +#endif + /** * M0: Unconditional stop - Wait for user button press on LCD * M1: Conditional stop - Wait for user button press on LCD @@ -70,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) { @@ -82,6 +94,10 @@ void GcodeSuite::M0_M1() { KEEPALIVE_STATE(PAUSED_FOR_USER); wait_for_user = true; + #if ENABLED(HOST_PROMPT_SUPPORT) + host_prompt_do(PROMPT_USER_CONTINUE, PSTR("M0/1 Break Called"), PSTR("Continue")); + #endif + if (ms > 0) { ms += millis(); // wait until this time for a click while (PENDING(millis(), ms) && wait_for_user) idle(); @@ -89,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/M117.cpp b/Marlin/src/gcode/lcd/M117.cpp index 1db6b004f9e1..9e9e4a4d66a4 100644 --- a/Marlin/src/gcode/lcd/M117.cpp +++ b/Marlin/src/gcode/lcd/M117.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/lcd/M145.cpp b/Marlin/src/gcode/lcd/M145.cpp index 35fb525f4836..3350f7256f2c 100644 --- a/Marlin/src/gcode/lcd/M145.cpp +++ b/Marlin/src/gcode/lcd/M145.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -37,10 +37,8 @@ */ void GcodeSuite::M145() { const uint8_t material = (uint8_t)parser.intval('S'); - if (material >= COUNT(ui.preheat_hotend_temp)) { - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM(MSG_ERR_MATERIAL_INDEX); - } + if (material >= COUNT(ui.preheat_hotend_temp)) + SERIAL_ERROR_MSG(MSG_ERR_MATERIAL_INDEX); else { int v; if (parser.seenval('H')) { @@ -54,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/M250.cpp b/Marlin/src/gcode/lcd/M250.cpp index 9444779f5425..dc03911f14dd 100644 --- a/Marlin/src/gcode/lcd/M250.cpp +++ b/Marlin/src/gcode/lcd/M250.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -32,7 +32,7 @@ */ void GcodeSuite::M250() { if (parser.seen('C')) ui.set_contrast(parser.value_int()); - SERIAL_PROTOCOLLNPAIR("LCD Contrast: ", ui.contrast); + SERIAL_ECHOLNPAIR("LCD Contrast: ", ui.contrast); } #endif // HAS_LCD_CONTRAST diff --git a/Marlin/src/gcode/lcd/M300.cpp b/Marlin/src/gcode/lcd/M300.cpp index 0e56587934a6..31520905a845 100644 --- a/Marlin/src/gcode/lcd/M300.cpp +++ b/Marlin/src/gcode/lcd/M300.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/lcd/M73.cpp b/Marlin/src/gcode/lcd/M73.cpp index 78697aecf380..e2f17c438403 100644 --- a/Marlin/src/gcode/lcd/M73.cpp +++ b/Marlin/src/gcode/lcd/M73.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -22,7 +22,7 @@ #include "../../inc/MarlinConfig.h" -#if ENABLED(ULTRA_LCD) && ENABLED(LCD_SET_PROGRESS_MANUALLY) +#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 // ULTRA_LCD && LCD_SET_PROGRESS_MANUALLY +#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 32e9e6f6a59f..7e0e9f7b9003 100644 --- a/Marlin/src/gcode/motion/G0_G1.cpp +++ b/Marlin/src/gcode/motion/G0_G1.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 b592b31baa6b..da07525dcfc9 100644 --- a/Marlin/src/gcode/motion/G2_G3.cpp +++ b/Marlin/src/gcode/motion/G2_G3.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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, @@ -184,12 +194,13 @@ void plan_arc( raw[q_axis] = center_Q + r_Q; #if ENABLED(AUTO_BED_LEVELING_UBL) raw[l_axis] = start_L; + UNUSED(linear_per_segment); #else raw[l_axis] += linear_per_segment; #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); @@ -293,10 +304,9 @@ void GcodeSuite::G2_G3(const bool clockwise) { #if ENABLED(ARC_P_CIRCLES) // P indicates number of circles to do int8_t circles_to_do = parser.byteval('P'); - if (!WITHIN(circles_to_do, 0, 100)) { - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM(MSG_ERR_ARC_ARGS); - } + if (!WITHIN(circles_to_do, 0, 100)) + SERIAL_ERROR_MSG(MSG_ERR_ARC_ARGS); + while (circles_to_do--) plan_arc(current_position, arc_offset, clockwise); #endif @@ -305,11 +315,8 @@ void GcodeSuite::G2_G3(const bool clockwise) { plan_arc(destination, arc_offset, clockwise); reset_stepper_timeout(); } - else { - // Bad arguments - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM(MSG_ERR_ARC_ARGS); - } + else + SERIAL_ERROR_MSG(MSG_ERR_ARC_ARGS); } } diff --git a/Marlin/src/gcode/motion/G4.cpp b/Marlin/src/gcode/motion/G4.cpp index fcee5df40197..3b88eadad504 100644 --- a/Marlin/src/gcode/motion/G4.cpp +++ b/Marlin/src/gcode/motion/G4.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/motion/G5.cpp b/Marlin/src/gcode/motion/G5.cpp index 8cd70da15d38..f98dc4998a0b 100644 --- a/Marlin/src/gcode/motion/G5.cpp +++ b/Marlin/src/gcode/motion/G5.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,8 +50,7 @@ void GcodeSuite::G5() { #if ENABLED(CNC_WORKSPACE_PLANES) if (workspace_plane != PLANE_XY) { - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM(MSG_ERR_BAD_PLANE_MODE); + SERIAL_ERROR_MSG(MSG_ERR_BAD_PLANE_MODE); return; } #endif diff --git a/Marlin/src/gcode/motion/G80.cpp b/Marlin/src/gcode/motion/G80.cpp index e51bf1e8cb75..7db63534cb93 100644 --- a/Marlin/src/gcode/motion/G80.cpp +++ b/Marlin/src/gcode/motion/G80.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/motion/M290.cpp b/Marlin/src/gcode/motion/M290.cpp index 1647e0071045..4dd1fc4475d4 100644 --- a/Marlin/src/gcode/motion/M290.cpp +++ b/Marlin/src/gcode/motion/M290.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -25,6 +25,7 @@ #if ENABLED(BABYSTEPPING) #include "../gcode.h" +#include "../../feature/babystep.h" #include "../../module/probe.h" #include "../../module/temperature.h" #include "../../module/planner.h" @@ -49,7 +50,7 @@ else { hotend_offset[Z_AXIS][active_extruder] -= offs; SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR(MSG_IDEX_Z_OFFSET ": ", hotend_offset[Z_AXIS][active_extruder]); + SERIAL_ECHOLNPAIR(MSG_Z_OFFSET ": ", hotend_offset[Z_AXIS][active_extruder]); } #endif } @@ -64,7 +65,7 @@ void GcodeSuite::M290() { for (uint8_t a = X_AXIS; a <= Z_AXIS; a++) if (parser.seenval(axis_codes[a]) || (a == Z_AXIS && parser.seenval('S'))) { const float offs = constrain(parser.value_axis_units((AxisEnum)a), -2, 2); - thermalManager.babystep_axis((AxisEnum)a, offs * planner.settings.axis_steps_per_mm[a]); + babystep.add_mm((AxisEnum)a, offs); #if ENABLED(BABYSTEP_ZPROBE_OFFSET) if (a == Z_AXIS && (!parser.seen('P') || parser.value_bool())) mod_zprobe_zoffset(offs); #endif @@ -72,7 +73,7 @@ void GcodeSuite::M290() { #else if (parser.seenval('Z') || parser.seenval('S')) { const float offs = constrain(parser.value_axis_units(Z_AXIS), -2, 2); - thermalManager.babystep_axis(Z_AXIS, offs * planner.settings.axis_steps_per_mm[Z_AXIS]); + babystep.add_mm(Z_AXIS, offs); #if ENABLED(BABYSTEP_ZPROBE_OFFSET) if (!parser.seen('P') || parser.value_bool()) mod_zprobe_zoffset(offs); #endif diff --git a/Marlin/src/gcode/parser.cpp b/Marlin/src/gcode/parser.cpp index 2b678d7e2093..8d4c16795112 100644 --- a/Marlin/src/gcode/parser.cpp +++ b/Marlin/src/gcode/parser.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -143,12 +143,27 @@ void GCodeParser::parse(char *p) { while (*p == ' ') p++; // Bail if there's no command code number - if (!NUMERIC(*p)) return; + // Prusa MMU2 has T?/Tx/Tc commands + #if DISABLED(PRUSA_MMU2) + if (!NUMERIC(*p)) return; + #endif // Save the command letter at this point // A '?' signifies an unknown command command_letter = letter; + + #if ENABLED(PRUSA_MMU2) + if (letter == 'T') { + // check for special MMU2 T?/Tx/Tc commands + if (*p == '?' || *p == 'x' || *p == 'c') { + string_arg = p; + return; + } + } + #endif + + // Get the code number - integer digits only codenum = 0; do { codenum *= 10, codenum += *p++ - '0'; } while (NUMERIC(*p)); @@ -257,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 @@ -313,55 +327,46 @@ void GCodeParser::parse(char *p) { #endif // CNC_COORDINATE_SYSTEMS void GCodeParser::unknown_command_error() { - #if NUM_SERIAL > 1 - const int16_t port = command_queue_port[cmd_queue_index_r]; - #endif - SERIAL_ECHO_START_P(port); - SERIAL_ECHOPAIR_P(port, MSG_UNKNOWN_COMMAND, command_ptr); - SERIAL_CHAR_P(port, '"'); - SERIAL_EOL_P(port); + SERIAL_ECHO_START(); + 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('"'); - } - SERIAL_ECHOPGM("\n\n"); + 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)"); - SERIAL_ECHOPGM("\n\n"); + SERIAL_ECHOLNPGM("\n"); } } } diff --git a/Marlin/src/gcode/parser.h b/Marlin/src/gcode/parser.h index c13da8a28c11..c5a473df6e63 100644 --- a/Marlin/src/gcode/parser.h +++ b/Marlin/src/gcode/parser.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -120,8 +120,7 @@ class GCodeParser { 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/G30.cpp b/Marlin/src/gcode/probe/G30.cpp index 0c8472e05c7f..b4b785bd1444 100644 --- a/Marlin/src/gcode/probe/G30.cpp +++ b/Marlin/src/gcode/probe/G30.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -55,9 +55,9 @@ void GcodeSuite::G30() { const float measured_z = probe_pt(xpos, ypos, raise_after, 1); if (!isnan(measured_z)) { - SERIAL_PROTOCOLPAIR_F("Bed X: ", xpos); - SERIAL_PROTOCOLPAIR_F(" Y: ", ypos); - SERIAL_PROTOCOLLNPAIR_F(" Z: ", measured_z); + SERIAL_ECHOPAIR("Bed X: ", FIXFLOAT(xpos)); + SERIAL_ECHOPAIR(" Y: ", FIXFLOAT(ypos)); + SERIAL_ECHOLNPAIR(" Z: ", FIXFLOAT(measured_z)); } clean_up_after_endstop_or_probe_move(); diff --git a/Marlin/src/gcode/probe/G31_G32.cpp b/Marlin/src/gcode/probe/G31_G32.cpp index 751efca5b398..db1336736e4e 100644 --- a/Marlin/src/gcode/probe/G31_G32.cpp +++ b/Marlin/src/gcode/probe/G31_G32.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/probe/G38.cpp b/Marlin/src/gcode/probe/G38.cpp index 6bf09b8bac3d..be9c58e86179 100644 --- a/Marlin/src/gcode/probe/G38.cpp +++ b/Marlin/src/gcode/probe/G38.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 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; + // Move flag value + #if ENABLED(G38_PROBE_AWAY) + const uint8_t move_value = parser.subcode; + #else + constexpr uint8_t move_value = 1; + #endif - endstops.hit_on_purpose(); - set_current_from_steppers_for_axis(ALL_AXES); - sync_plan_position(); + G38_did_trigger = false; - if (G38_endstop_hit) { + // Move until destination reached or target hit + G38_single_probe(move_value); + + if (G38_did_trigger) { G38_pass_fail = true; @@ -70,48 +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 + * + * G38.2 - Probe toward workpiece, stop on contact, signal error if failure + * G38.3 - Probe toward workpiece, stop on contact * - * Like G28 except uses Z min probe for all axes + * 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_START(); - SERIAL_ERRORLNPGM("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/probe/M401_M402.cpp b/Marlin/src/gcode/probe/M401_M402.cpp index 1e81e6b4a75e..4eb94d631d41 100644 --- a/Marlin/src/gcode/probe/M401_M402.cpp +++ b/Marlin/src/gcode/probe/M401_M402.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/probe/M851.cpp b/Marlin/src/gcode/probe/M851.cpp index 7699b5b5de68..9bc310cd8cce 100644 --- a/Marlin/src/gcode/probe/M851.cpp +++ b/Marlin/src/gcode/probe/M851.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -32,18 +32,13 @@ void GcodeSuite::M851() { if (parser.seenval('Z')) { const float value = parser.value_linear_units(); if (WITHIN(value, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) - { zprobe_zoffset = value; - } - else { - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM("?Z out of range (" STRINGIFY(Z_PROBE_OFFSET_RANGE_MIN) " to " STRINGIFY(Z_PROBE_OFFSET_RANGE_MAX) ")"); - } + else + SERIAL_ERROR_MSG("?Z out of range (" STRINGIFY(Z_PROBE_OFFSET_RANGE_MIN) " to " STRINGIFY(Z_PROBE_OFFSET_RANGE_MAX) ")"); return; } SERIAL_ECHO_START(); - SERIAL_ECHOPGM(MSG_PROBE_Z_OFFSET); - SERIAL_ECHOLNPAIR(": ", zprobe_zoffset); + SERIAL_ECHOLNPAIR(MSG_PROBE_Z_OFFSET ": ", zprobe_zoffset); } #endif // HAS_BED_PROBE diff --git a/Marlin/src/gcode/probe/M951.cpp b/Marlin/src/gcode/probe/M951.cpp new file mode 100644 index 000000000000..a6e38f2dd812 --- /dev/null +++ b/Marlin/src/gcode/probe/M951.cpp @@ -0,0 +1,76 @@ +/** + * 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(MAGNETIC_PARKING_EXTRUDER) + +#include "../gcode.h" +#include "../../module/tool_change.h" +#include "../../module/motion.h" + + +mpe_settings_t mpe_settings; + +inline void mpe_settings_report() { + SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("Magnetic Parking Extruder"); + SERIAL_ECHO_START(); SERIAL_ECHOLNPAIR("L: Left parking :", mpe_settings.parking_xpos[0]); + SERIAL_ECHO_START(); SERIAL_ECHOLNPAIR("R: Right parking :", mpe_settings.parking_xpos[1]); + SERIAL_ECHO_START(); SERIAL_ECHOLNPAIR("I: Grab Offset :", mpe_settings.grab_distance); + SERIAL_ECHO_START(); SERIAL_ECHOLNPAIR("J: Normal speed :", long(MMS_TO_MMM(mpe_settings.slow_feedrate))); + SERIAL_ECHO_START(); SERIAL_ECHOLNPAIR("H: High speed :", long(MMS_TO_MMM(mpe_settings.fast_feedrate))); + SERIAL_ECHO_START(); SERIAL_ECHOLNPAIR("D: Distance trav.:", mpe_settings.travel_distance); + SERIAL_ECHO_START(); SERIAL_ECHOLNPAIR("C: Compenstion :", mpe_settings.compensation_factor); +} + +void mpe_settings_init() { + constexpr float pex[2] = PARKING_EXTRUDER_PARKING_X; + mpe_settings.parking_xpos[0] = pex[0]; // M951 L + mpe_settings.parking_xpos[1] = pex[1]; // M951 R + mpe_settings.grab_distance = PARKING_EXTRUDER_GRAB_DISTANCE; // M951 I + #if HAS_HOME_OFFSET + set_home_offset(X_AXIS, mpe_settings.grab_distance * -1); + #endif + mpe_settings.slow_feedrate = MMM_TO_MMS(MPE_SLOW_SPEED); // M951 J + mpe_settings.fast_feedrate = MMM_TO_MMS(MPE_FAST_SPEED); // M951 H + mpe_settings.travel_distance = MPE_TRAVEL_DISTANCE; // M951 D + mpe_settings.compensation_factor = MPE_COMPENSATION; // M951 C + mpe_settings_report(); +} + +void GcodeSuite::M951() { + if (parser.seenval('L')) mpe_settings.parking_xpos[0] = parser.value_linear_units(); + if (parser.seenval('R')) mpe_settings.parking_xpos[1] = parser.value_linear_units(); + if (parser.seenval('I')) { + mpe_settings.grab_distance = parser.value_linear_units(); + #if HAS_HOME_OFFSET + set_home_offset(X_AXIS, mpe_settings.grab_distance * -1); + #endif + } + if (parser.seenval('J')) mpe_settings.slow_feedrate = MMM_TO_MMS(parser.value_linear_units()); + if (parser.seenval('H')) mpe_settings.fast_feedrate = MMM_TO_MMS(parser.value_linear_units()); + if (parser.seenval('D')) mpe_settings.travel_distance = parser.value_linear_units(); + if (parser.seenval('C')) mpe_settings.compensation_factor = parser.value_float(); + if (!parser.seen("CDHIJLR")) mpe_settings_report(); +} + +#endif // MAGNETIC_PARKING_EXTRUDER diff --git a/Marlin/src/gcode/queue.cpp b/Marlin/src/gcode/queue.cpp index 0b6bb4ba77d0..817d6bca183e 100644 --- a/Marlin/src/gcode/queue.cpp +++ b/Marlin/src/gcode/queue.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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. @@ -144,15 +140,13 @@ bool enqueue_and_echo_command(const char* cmd) { //SERIAL_ECHOPGM("\") \n"); if (*cmd == 0 || *cmd == '\n' || *cmd == '\r') { - //SERIAL_ECHOPGM("Null command found... Did not queue!\n"); + //SERIAL_ECHOLNPGM("Null command found... Did not queue!"); return true; } if (_enqueuecommand(cmd)) { SERIAL_ECHO_START(); - SERIAL_ECHOPAIR(MSG_ENQUEUEING, cmd); - SERIAL_CHAR('"'); - SERIAL_EOL(); + SERIAL_ECHOLNPAIR(MSG_ENQUEUEING, cmd, "\""); return true; } return false; @@ -219,21 +213,22 @@ void ok_to_send() { #if NUM_SERIAL > 1 const int16_t port = command_queue_port[cmd_queue_index_r]; if (port < 0) return; + PORT_REDIRECT(port); #endif if (!send_ok[cmd_queue_index_r]) return; - SERIAL_PROTOCOLPGM_P(port, MSG_OK); + SERIAL_ECHOPGM(MSG_OK); #if ENABLED(ADVANCED_OK) char* p = command_queue[cmd_queue_index_r]; if (*p == 'N') { - SERIAL_PROTOCOL_P(port, ' '); - SERIAL_ECHO_P(port, *p++); + SERIAL_ECHO(' '); + SERIAL_ECHO(*p++); while (NUMERIC_SIGNED(*p)) - SERIAL_ECHO_P(port, *p++); + SERIAL_ECHO(*p++); } - SERIAL_PROTOCOLPGM_P(port, " P"); SERIAL_PROTOCOL_P(port, int(BLOCK_BUFFER_SIZE - planner.movesplanned() - 1)); - SERIAL_PROTOCOLPGM_P(port, " B"); SERIAL_PROTOCOL_P(port, BUFSIZE - commands_in_queue); + SERIAL_ECHOPGM(" P"); SERIAL_ECHO(int(BLOCK_BUFFER_SIZE - planner.movesplanned() - 1)); + SERIAL_ECHOPGM(" B"); SERIAL_ECHO(BUFSIZE - commands_in_queue); #endif - SERIAL_EOL_P(port); + SERIAL_EOL(); } /** @@ -244,22 +239,15 @@ void flush_and_request_resend() { #if NUM_SERIAL > 1 const int16_t port = command_queue_port[cmd_queue_index_r]; if (port < 0) return; + PORT_REDIRECT(port); #endif - SERIAL_FLUSH_P(port); - SERIAL_PROTOCOLPGM_P(port, MSG_RESEND); - SERIAL_PROTOCOLLN_P(port, gcode_LastN + 1); + SERIAL_FLUSH(); + SERIAL_ECHOPGM(MSG_RESEND); + SERIAL_ECHOLN(gcode_LastN + 1); ok_to_send(); } -void gcode_line_error(PGM_P err, uint8_t port) { - SERIAL_ERROR_START_P(port); - serialprintPGM_P(port, err); - SERIAL_ERRORLN_P(port, gcode_LastN); - flush_and_request_resend(); - serial_count[port] = 0; -} - -static bool serial_data_available() { +inline bool serial_data_available() { return false || MYSERIAL0.available() #if NUM_SERIAL > 1 @@ -268,7 +256,7 @@ static bool serial_data_available() { ; } -static int read_serial(const uint8_t index) { +inline int read_serial(const uint8_t index) { switch (index) { case 0: return MYSERIAL0.read(); #if NUM_SERIAL > 1 @@ -278,15 +266,19 @@ static int read_serial(const uint8_t index) { } } -#if ENABLED(FAST_FILE_TRANSFER) +void gcode_line_error(PGM_P const err, const int8_t port) { + PORT_REDIRECT(port); + SERIAL_ERROR_START(); + serialprintPGM(err); + SERIAL_ECHOLN(gcode_LastN); + while (read_serial(port) != -1); // clear out the RX buffer + flush_and_request_resend(); + serial_count[port] = 0; +} - #if ENABLED(SDSUPPORT) - #define CARD_CHAR_P(C) SERIAL_CHAR_P(card.transfer_port, C) - #define CARD_ECHO_P(V) SERIAL_ECHO_P(card.transfer_port, V) - #define CARD_ECHOLN_P(V) SERIAL_ECHOLN_P(card.transfer_port, V) - #endif +#if ENABLED(BINARY_FILE_TRANSFER) - static bool serial_data_available(const uint8_t index) { + inline bool serial_data_available(const uint8_t index) { switch (index) { case 0: return MYSERIAL0.available(); #if NUM_SERIAL > 1 @@ -369,8 +361,8 @@ static int read_serial(const uint8_t index) { stream_state = StreamState::PACKET_TIMEOUT; return false; } - if (!serial_data_available(card.transfer_port)) return false; - data = read_serial(card.transfer_port); + if (!serial_data_available(card.transfer_port_index)) return false; + data = read_serial(card.transfer_port_index); packet.timeout = millis() + STREAM_MAX_WAIT; return true; } @@ -378,8 +370,13 @@ static int read_serial(const uint8_t index) { template void receive(char (&buffer)[buffer_size]) { uint8_t data = 0; - millis_t tranfer_timeout = millis() + RX_TIMESLICE; - while (PENDING(millis(), tranfer_timeout)) { + millis_t transfer_timeout = millis() + RX_TIMESLICE; + + #if ENABLED(SDSUPPORT) + PORT_REDIRECT(card.transfer_port_index); + #endif + + while (PENDING(millis(), transfer_timeout)) { switch (stream_state) { case StreamState::STREAM_RESET: stream_reset(); @@ -387,24 +384,21 @@ static int read_serial(const uint8_t index) { packet_reset(); stream_state = StreamState::PACKET_HEADER; break; - case StreamState::STREAM_HEADER: // we could also transfer the filename in this packet, rather than handling it in the gcode - for (size_t i = 0; i < sizeof(stream_header); ++i) { + case StreamState::STREAM_HEADER: // The filename could also be in this packet, rather than handling it in the gcode + for (size_t i = 0; i < sizeof(stream_header); ++i) stream_header_bytes[i] = buffer[i]; - } + if (stream_header.token == 0x1234) { stream_state = StreamState::PACKET_RESET; bytes_received = 0; time_stream_start = millis(); - CARD_ECHO_P("echo: Datastream initialized ("); - CARD_ECHO_P(stream_header.filesize); - CARD_ECHOLN_P("Bytes expected)"); - CARD_ECHO_P("so"); // confirm active stream and the maximum block size supported - CARD_CHAR_P(static_cast(buffer_size & 0xFF)); - CARD_CHAR_P(static_cast((buffer_size >> 8) & 0xFF)); - CARD_CHAR_P('\n'); + // 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 { - CARD_ECHOLN_P("echo: Datastream initialization error (invalid token)"); + SERIAL_ECHO_MSG("Datastream init error (invalid token)"); stream_state = StreamState::STREAM_FAILED; } buffer_next_index = 0; @@ -420,7 +414,7 @@ static int read_serial(const uint8_t index) { stream_state = StreamState::PACKET_DATA; } else { - CARD_ECHO_P("echo: Datastream packet out of order"); + SERIAL_ECHO_MSG("Datastream packet out of order"); stream_state = StreamState::PACKET_FLUSHRX; } } @@ -428,61 +422,58 @@ static int read_serial(const uint8_t index) { case StreamState::PACKET_DATA: if (!stream_read(data)) break; - if (buffer_next_index < buffer_size) { + if (buffer_next_index < buffer_size) buffer[buffer_next_index] = data; - } else { - CARD_ECHO_P("echo: Datastream packet data buffer overrun"); + SERIAL_ECHO_MSG("Datastream packet data buffer overrun"); stream_state = StreamState::STREAM_FAILED; break; } packet.checksum = checksum(packet.checksum, data); - packet.bytes_received ++; - buffer_next_index ++; + packet.bytes_received++; + buffer_next_index++; - if (packet.bytes_received == packet.header.size) { + if (packet.bytes_received == packet.header.size) stream_state = StreamState::PACKET_VALIDATE; - } + break; case StreamState::PACKET_VALIDATE: if (packet.header.checksum == packet.checksum) { packet_retries = 0; - packets_received ++; + packets_received++; bytes_received += packet.header.size; - if (packet.header.id == 0) { // id 0 is always the stream descriptor + if (packet.header.id == 0) // id 0 is always the stream descriptor stream_state = StreamState::STREAM_HEADER; // defer packet confirmation to STREAM_HEADER state - } else { if (bytes_received < stream_header.filesize) { - stream_state = StreamState::PACKET_RESET; // reset and receive next packet - CARD_ECHOLN_P("ok"); // transmit confirm packet received and valid token + stream_state = StreamState::PACKET_RESET; // reset and receive next packet + SERIAL_ECHOLNPAIR("ok", packet.header.id); // transmit confirm packet received and valid token } - else { + else stream_state = StreamState::STREAM_COMPLETE; // no more data required - } + if (card.write(buffer, buffer_next_index) < 0) { stream_state = StreamState::STREAM_FAILED; - CARD_ECHO_P("echo: IO ERROR"); + SERIAL_ECHO_MSG("SDCard IO Error"); break; }; } } else { - CARD_ECHO_P("echo: Block("); - CARD_ECHO_P(packet.header.id); - CARD_ECHOLN_P(") Corrupt"); + SERIAL_ECHO_START(); + SERIAL_ECHOLNPAIR("Block(", packet.header.id, ") Corrupt"); stream_state = StreamState::PACKET_FLUSHRX; } break; case StreamState::PACKET_RESEND: if (packet_retries < MAX_RETRIES) { - packet_retries ++; + packet_retries++; stream_state = StreamState::PACKET_RESET; - CARD_ECHO_P("echo: Resend request "); - CARD_ECHOLN_P(packet_retries); - CARD_ECHOLN_P("rs"); // transmit resend packet token + SERIAL_ECHO_START(); + SERIAL_ECHOLNPAIR("Resend request ", int(packet_retries)); + SERIAL_ECHOLNPAIR("rs", packet.header.id); // transmit resend packet token } else { stream_state = StreamState::STREAM_FAILED; @@ -493,32 +484,32 @@ static int read_serial(const uint8_t index) { stream_state = StreamState::PACKET_RESEND; break; } - if (!serial_data_available(card.transfer_port)) break; - read_serial(card.transfer_port); // throw away data + if (!serial_data_available(card.transfer_port_index)) break; + read_serial(card.transfer_port_index); // throw away data packet.timeout = millis() + STREAM_MAX_WAIT; break; case StreamState::PACKET_TIMEOUT: - CARD_ECHOLN_P("echo: Datastream timeout"); + SERIAL_ECHO_START(); + SERIAL_ECHOLNPGM("Datastream timeout"); stream_state = StreamState::PACKET_RESEND; break; case StreamState::STREAM_COMPLETE: stream_state = StreamState::STREAM_RESET; card.flag.binary_mode = false; + SERIAL_ECHO_START(); + SERIAL_ECHO(card.filename); + SERIAL_ECHOLNPAIR(" transfer completed @ ", ((bytes_received / (millis() - time_stream_start) * 1000) / 1024), "KiB/s"); + SERIAL_ECHOLNPGM("sc"); // transmit stream complete token card.closefile(); - CARD_ECHO_P("echo: "); - CARD_ECHO_P(card.filename); - CARD_ECHO_P(" transfer completed @ "); - CARD_ECHO_P(((bytes_received / (millis() - time_stream_start) * 1000) / 1024 )); - CARD_ECHOLN_P("KiB/s"); - CARD_ECHOLN_P("sc"); // transmit stream complete token return; case StreamState::STREAM_FAILED: stream_state = StreamState::STREAM_RESET; card.flag.binary_mode = false; card.closefile(); card.removeFile(card.filename); - CARD_ECHOLN_P("echo: File transfer failed"); - CARD_ECHOLN_P("sf"); // transmit stream failed token + SERIAL_ECHO_START(); + SERIAL_ECHOLNPGM("File transfer failed"); + SERIAL_ECHOLNPGM("sf"); // transmit stream failed token return; } } @@ -533,7 +524,12 @@ static int read_serial(const uint8_t index) { } binaryStream{}; -#endif // FAST_FILE_TRANSFER +#endif // BINARY_FILE_TRANSFER + +FORCE_INLINE bool is_M29(const char * const cmd) { // matches "M29" & "M29 ", but not "M290", etc + const char * const m29 = strstr_P(cmd, PSTR("M29")); + return m29 && !NUMERIC(m29[3]); +} /** * Get all commands waiting on the serial port and queue them. @@ -548,14 +544,14 @@ inline void get_serial_commands() { #endif ; - #if ENABLED(FAST_FILE_TRANSFER) + #if ENABLED(BINARY_FILE_TRANSFER) if (card.flag.saving && card.flag.binary_mode) { /** * For binary stream file transfer, use serial_line_buffer as the working * receive buffer (which limits the packet size to MAX_CMD_SIZE). * The receive buffer also limits the packet size for reliable transmission. */ - binaryStream.receive(serial_line_buffer[card.transfer_port]); + binaryStream.receive(serial_line_buffer[card.transfer_port_index]); return; } #endif @@ -630,7 +626,8 @@ inline void get_serial_commands() { gcode_LastN = gcode_N; } #if ENABLED(SDSUPPORT) - else if (card.flag.saving && strcmp(command, "M29") != 0) // No line number with M29 in Pronterface + // Pronterface "M29" and "M29 " has no line number + else if (card.flag.saving && !is_M29(command)) return gcode_line_error(PSTR(MSG_ERR_NO_CHECKSUM), i); #endif @@ -648,7 +645,7 @@ inline void get_serial_commands() { #if ENABLED(BEZIER_CURVE_SUPPORT) case 5: #endif - SERIAL_ERRORLNPGM(MSG_ERR_STOPPED); + SERIAL_ECHOLNPGM(MSG_ERR_STOPPED); LCD_MESSAGEPGM(MSG_STOPPED); break; } @@ -754,7 +751,7 @@ inline void get_serial_commands() { if (IS_SD_PRINTING()) sd_count = 0; // If a sub-file was printing, continue from call point else { - SERIAL_PROTOCOLLNPGM(MSG_FILE_PRINTED); + SERIAL_ECHOLNPGM(MSG_FILE_PRINTED); #if ENABLED(PRINTER_EVENT_LEDS) printerEventLEDs.onPrintCompleted(); #if HAS_RESUME_CONTINUE @@ -769,10 +766,9 @@ inline void get_serial_commands() { #endif // PRINTER_EVENT_LEDS } } - else if (n == -1) { - SERIAL_ERROR_START(); - SERIAL_ECHOLNPGM(MSG_SD_ERR_READ); - } + else if (n == -1) + SERIAL_ERROR_MSG(MSG_SD_ERR_READ); + if (sd_char == '#') stop_buffering = true; sd_comment_mode = false; // for new command @@ -840,10 +836,10 @@ void advance_command_queue() { if (card.flag.saving) { char* command = command_queue[cmd_queue_index_r]; - if (strstr_P(command, PSTR("M29"))) { + if (is_M29(command)) { // M29 closes the file card.closefile(); - SERIAL_PROTOCOLLNPGM(MSG_FILE_SAVED); + SERIAL_ECHOLNPGM(MSG_FILE_SAVED); #if !defined(__AVR__) || !defined(USBCON) #if ENABLED(SERIAL_STATS_DROPPED_RX) @@ -866,12 +862,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 0f4f95cd0fd7..ac519bc77bfc 100644 --- a/Marlin/src/gcode/queue.h +++ b/Marlin/src/gcode/queue.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 471fdf871d14..463d303af105 100644 --- a/Marlin/src/gcode/scara/M360-M364.cpp +++ b/Marlin/src/gcode/scara/M360-M364.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 eac8707f9963..000000000000 --- a/Marlin/src/gcode/sdcard/M20-M30_M32-M34_M524_M928.cpp +++ /dev/null @@ -1,302 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -#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 - -/** - * M20: List SD card to serial output - */ -void GcodeSuite::M20() { - #if NUM_SERIAL > 1 - const int16_t port = command_queue_port[cmd_queue_index_r]; - #endif - - SERIAL_PROTOCOLLNPGM_P(port, MSG_BEGIN_FILE_LIST); - card.ls( - #if NUM_SERIAL > 1 - port - #endif - ); - SERIAL_PROTOCOLLNPGM_P(port, 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(PARK_HEAD_ON_PAUSE) - resume_print(); - #endif - - #if ENABLED(POWER_LOSS_RECOVERY) - if (parser.seenval('S')) card.setIndex(parser.value_long()); - #endif - - card.startFileprint(); - - #if ENABLED(POWER_LOSS_RECOVERY) - if (parser.seenval('T')) - print_job_timer.resume(parser.value_long()); - else - #endif - print_job_timer.start(); - - ui.reset_status(); -} - -/** - * M25: Pause SD Print - */ -void GcodeSuite::M25() { - card.pauseSDPrint(); - print_job_timer.pause(); - - #if ENABLED(PARK_HEAD_ON_PAUSE) - enqueue_and_echo_commands_P(PSTR("M125")); // Must be enqueued with pauseSDPrint set to be last in the buffer - #endif -} - -/** - * M26: Set SD Card file index - */ -void GcodeSuite::M26() { - if (card.flag.cardOK && 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 NUM_SERIAL > 1 - const int16_t port = command_queue_port[cmd_queue_index_r]; - #endif - - if (parser.seen('C')) { - SERIAL_ECHOPGM_P(port, "Current file: "); - card.printFilename(); - } - - #if ENABLED(AUTO_REPORT_SD_STATUS) - else if (parser.seenval('S')) - card.set_auto_report_interval(parser.value_byte() - #if NUM_SERIAL > 1 - , port - #endif - ); - #endif - - else - card.getStatus( - #if NUM_SERIAL > 1 - port - #endif - ); -} - -/** - * M28: Start SD Write - */ -void GcodeSuite::M28() { - - #if ENABLED(FAST_FILE_TRANSFER) - - const int16_t port = - #if NUM_SERIAL > 1 - command_queue_port[cmd_queue_index_r] - #else - 0 - #endif - ; - - bool binary_mode = false; - char *p = parser.string_arg; - if (p[0] == 'B' && NUMERIC(p[1])) { - binary_mode = p[1] > '0'; - p += 2; - while (*p == ' ') ++p; - } - - // Binary transfer mode - if ((card.flag.binary_mode = binary_mode)) { - SERIAL_ECHO_START_P(port); - SERIAL_ECHO_P(port, " preparing to receive: "); - SERIAL_ECHOLN_P(port, p); - card.openFile(p, false); - #if NUM_SERIAL > 1 - card.transfer_port = port; - #endif - } - else - card.openFile(p, false); - - #else - - card.openFile(parser.string_arg, false); - - #endif -} - -/** - * M29: Stop SD Write - * Processed in write to file routine - */ -void GcodeSuite::M29() { - // card.flag.saving = false; -} - -/** - * M30 : Delete SD Card file - */ -void GcodeSuite::M30() { - if (card.flag.cardOK) { - 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.flag.cardOK) { - 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 - #if NUM_SERIAL > 1 - , command_queue_port[cmd_queue_index_r] - #endif - ); - } - -#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 000000000000..0ca21c91c87f --- /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 000000000000..e59106bb1757 --- /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 000000000000..7cdc97669009 --- /dev/null +++ b/Marlin/src/gcode/sdcard/M23.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" + +/** + * M23: Open a file + */ +void GcodeSuite::M23() { + // 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 000000000000..34543fb43e13 --- /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 000000000000..e41c081d0c8d --- /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 000000000000..e9d897229dd0 --- /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 000000000000..815a43ae0c4d --- /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 000000000000..9b8b8874f54a --- /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 000000000000..0dea320c83a8 --- /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 000000000000..df729aa9b396 --- /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 000000000000..979ed88a145f --- /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/sdcard/M524.cpp b/Marlin/src/gcode/sdcard/M524.cpp new file mode 100644 index 000000000000..3bcd527bd39e --- /dev/null +++ b/Marlin/src/gcode/sdcard/M524.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" + +/** + * M524: Abort the current SD print job (started with M24) + */ +void GcodeSuite::M524() { + + if (IS_SD_PRINTING()) + card.flag.abort_sd_printing = true; + +} + +#endif // SDSUPPORT diff --git a/Marlin/src/gcode/sdcard/M928.cpp b/Marlin/src/gcode/sdcard/M928.cpp new file mode 100644 index 000000000000..4cbd5db5759c --- /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 98eb3a973b32..dbda27e09969 100644 --- a/Marlin/src/gcode/stats/M31.cpp +++ b/Marlin/src/gcode/stats/M31.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -26,22 +26,15 @@ #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) */ void GcodeSuite::M31() { - #if NUM_SERIAL > 1 - const int16_t port = command_queue_port[cmd_queue_index_r]; - #endif char buffer[21]; duration_t elapsed = print_job_timer.duration(); elapsed.toString(buffer); ui.set_status(buffer); - SERIAL_ECHO_START_P(port); - SERIAL_ECHOLNPAIR_P(port, "Print time: ", buffer); + SERIAL_ECHO_START(); + SERIAL_ECHOLNPAIR("Print time: ", buffer); } diff --git a/Marlin/src/gcode/stats/M75-M78.cpp b/Marlin/src/gcode/stats/M75-M78.cpp index 0f06b8a6dfec..0726a08a318d 100644 --- a/Marlin/src/gcode/stats/M75-M78.cpp +++ b/Marlin/src/gcode/stats/M75-M78.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -22,6 +22,7 @@ #include "../gcode.h" #include "../../module/printcounter.h" +#include "../../lcd/ultralcd.h" #if ENABLED(EXTENSIBLE_UI) #include "../../lcd/extensible_ui/ui_api.h" @@ -63,10 +64,21 @@ void GcodeSuite::M77() { * M78: Show print statistics */ void GcodeSuite::M78() { - if (parser.intval('S') == 78) // "M78 S78" will reset the statistics + if (parser.intval('S') == 78) { // "M78 S78" will reset the statistics print_job_timer.initStats(); - else - print_job_timer.showStats(); + ui.reset_status(); + return; + } + + #if HAS_SERVICE_INTERVALS + if (parser.seenval('R')) { + print_job_timer.resetServiceInterval(parser.value_int()); + ui.reset_status(); + return; + } + #endif + + print_job_timer.showStats(); } #endif // PRINTCOUNTER diff --git a/Marlin/src/gcode/temperature/M104_M109.cpp b/Marlin/src/gcode/temperature/M104_M109.cpp index 39d65dc1a646..1b8fb2ab73d1 100644 --- a/Marlin/src/gcode/temperature/M104_M109.cpp +++ b/Marlin/src/gcode/temperature/M104_M109.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -125,7 +125,7 @@ void GcodeSuite::M109() { print_job_timer.start(); #endif - #if ENABLED(ULTRA_LCD) + #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 c0678c03c62b..ea613e6316db 100644 --- a/Marlin/src/gcode/temperature/M105.cpp +++ b/Marlin/src/gcode/temperature/M105.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 */ @@ -35,21 +31,12 @@ void GcodeSuite::M105() { const int8_t target_extruder = get_target_extruder_from_command(); if (target_extruder < 0) return; - #if NUM_SERIAL > 1 - const int16_t port = command_queue_port[cmd_queue_index_r]; - #endif - #if HAS_TEMP_SENSOR - SERIAL_PROTOCOLPGM_P(port, MSG_OK); - thermalManager.print_heater_states(target_extruder - #if NUM_SERIAL > 1 - , port - #endif - ); + SERIAL_ECHOPGM(MSG_OK); + thermalManager.print_heater_states(target_extruder); #else // !HAS_TEMP_SENSOR - SERIAL_ERROR_START_P(port); - SERIAL_ERRORLNPGM_P(port, MSG_ERR_NO_THERMISTORS); + SERIAL_ERROR_MSG(MSG_ERR_NO_THERMISTORS); #endif - SERIAL_EOL_P(port); + SERIAL_EOL(); } diff --git a/Marlin/src/gcode/temperature/M106_M107.cpp b/Marlin/src/gcode/temperature/M106_M107.cpp index 12e2dc4f26bb..9e8012fcc1fe 100644 --- a/Marlin/src/gcode/temperature/M106_M107.cpp +++ b/Marlin/src/gcode/temperature/M106_M107.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -25,11 +25,15 @@ #if FAN_COUNT > 0 #include "../gcode.h" -#include "../../Marlin.h" // for fan_speed — should move those to Planner +#include "../../module/motion.h" +#include "../../module/temperature.h" #if ENABLED(SINGLENOZZLE) - #include "../../module/motion.h" - #include "../../module/tool_change.h" + #define _ALT_P active_extruder + #define _CNT_P EXTRUDERS +#else + #define _ALT_P MIN(active_extruder, FAN_COUNT - 1) + #define _CNT_P FAN_COUNT #endif /** @@ -46,36 +50,19 @@ * 3-255 = Set the speed for use with T2 */ void GcodeSuite::M106() { - const uint8_t p = parser.byteval('P'); - const uint16_t s = parser.ushortval('S', 255); + const uint8_t p = parser.byteval('P', _ALT_P); - #if ENABLED(SINGLENOZZLE) - if (p != active_extruder) { - if (p < EXTRUDERS) singlenozzle_fan_speed[p] = MIN(s, 255U); - return; - } - #endif + if (p < _CNT_P) { - if (p < FAN_COUNT) { #if ENABLED(EXTRA_FAN_SPEED) - const int16_t t = parser.intval('T'); - if (t > 0) { - switch (t) { - case 1: - fan_speed[p] = old_fan_speed[p]; - break; - case 2: - old_fan_speed[p] = fan_speed[p]; - fan_speed[p] = new_fan_speed[p]; - break; - default: - new_fan_speed[p] = MIN(t, 255U); - break; - } - return; - } - #endif // EXTRA_FAN_SPEED - fan_speed[p] = MIN(s, 255U); + const uint16_t t = parser.intval('T'); + if (t > 0) return thermalManager.set_temp_fan_speed(p, t); + #endif + 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); } } @@ -83,15 +70,8 @@ void GcodeSuite::M106() { * M107: Fan Off */ void GcodeSuite::M107() { - const uint16_t p = parser.ushortval('P'); - #if ENABLED(SINGLENOZZLE) - if (p != active_extruder) { - if (p < EXTRUDERS) singlenozzle_fan_speed[p] = 0; - return; - } - #endif - - if (p < FAN_COUNT) fan_speed[p] = 0; + const uint8_t p = parser.byteval('P', _ALT_P); + thermalManager.set_fan_speed(p, 0); } #endif // FAN_COUNT > 0 diff --git a/Marlin/src/gcode/temperature/M140_M190.cpp b/Marlin/src/gcode/temperature/M140_M190.cpp index 2da964f05ab2..7db75df27633 100644 --- a/Marlin/src/gcode/temperature/M140_M190.cpp +++ b/Marlin/src/gcode/temperature/M140_M190.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/temperature/M141_M191.cpp b/Marlin/src/gcode/temperature/M141_M191.cpp new file mode 100644 index 000000000000..d65dc7c62fad --- /dev/null +++ b/Marlin/src/gcode/temperature/M141_M191.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 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/gcode/temperature/M155.cpp b/Marlin/src/gcode/temperature/M155.cpp index 611676a6729f..9067aa8ae448 100644 --- a/Marlin/src/gcode/temperature/M155.cpp +++ b/Marlin/src/gcode/temperature/M155.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/temperature/M303.cpp b/Marlin/src/gcode/temperature/M303.cpp index f70127785485..55ad03d42d8f 100644 --- a/Marlin/src/gcode/temperature/M303.cpp +++ b/Marlin/src/gcode/temperature/M303.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -32,7 +32,7 @@ * * S sets the target temperature. (default 150C / 70C) * E (-1 for the bed) (default 0) - * C + * C Minimum 3. Default 5. * U with a non-zero value will apply the result to current settings */ void GcodeSuite::M303() { diff --git a/Marlin/src/gcode/units/G20_G21.cpp b/Marlin/src/gcode/units/G20_G21.cpp index 74ff343af5cc..52c153131437 100644 --- a/Marlin/src/gcode/units/G20_G21.cpp +++ b/Marlin/src/gcode/units/G20_G21.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/units/M149.cpp b/Marlin/src/gcode/units/M149.cpp index 307258816f25..ed518cc03e07 100644 --- a/Marlin/src/gcode/units/M149.cpp +++ b/Marlin/src/gcode/units/M149.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/units/M82_M83.cpp b/Marlin/src/gcode/units/M82_M83.cpp index b68d6a28ee7e..0fdd94f7f7c3 100644 --- a/Marlin/src/gcode/units/M82_M83.cpp +++ b/Marlin/src/gcode/units/M82_M83.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index ad0a8d35d096..81c0678e3fd2 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 @@ -87,8 +87,8 @@ #define U8GLIB_LM6059_AF #define SD_DETECT_INVERTED #elif ENABLED(AZSMZ_12864) - #define LCD_CONTRAST_MIN 120 - #define LCD_CONTRAST_MAX 255 + #define LCD_CONTRAST_MIN 120 + #define LCD_CONTRAST_MAX 255 #define DEFAULT_LCD_CONTRAST 190 #define U8GLIB_ST7565_64128N #endif @@ -138,13 +138,26 @@ #elif ENABLED(MKS_MINI_12864) #define MINIPANEL + #define DEFAULT_LCD_CONTRAST 150 + #define LCD_CONTRAST_MAX 255 + +#elif ENABLED(FYSETC_MINI_12864) + + #define DOGLCD + #define ULTIPANEL + #define LCD_CONTRAST_MIN 0 + #define LCD_CONTRAST_MAX 255 + #define DEFAULT_LCD_CONTRAST 255 + #define LED_COLORS_REDUCE_GREEN #endif -#if ENABLED(MAKRPANEL) || ENABLED(MINIPANEL) +#if EITHER(MAKRPANEL, MINIPANEL) #define DOGLCD #define ULTIPANEL - #define DEFAULT_LCD_CONTRAST 17 + #ifndef DEFAULT_LCD_CONTRAST + #define DEFAULT_LCD_CONTRAST 17 + #endif #endif #if ENABLED(ULTI_CONTROLLER) @@ -158,13 +171,14 @@ #define ENCODER_STEPS_PER_MENU_ITEM 2 #endif -// Generic support for SSD1306 / SSD1309 / SH1106 OLED based LCDs. -#if ENABLED(U8GLIB_SSD1306) || ENABLED(U8GLIB_SSD1309) || ENABLED(U8GLIB_SH1106) - #define ULTRA_LCD //general LCD support, also 16x2 - #define DOGLCD // Support for I2C LCD 128x64 (Controller SSD1306 / SSD1309 / SH1106 graphic Display Family) +// 128x64 I2C OLED LCDs - SSD1306/SSD1309/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 @@ -176,17 +190,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 @@ -209,11 +219,20 @@ #define NEWPANEL #endif + /** + * FSMC/SPI TFT PANELS + */ + #if ENABLED(MKS_ROBIN_TFT) + #define ULTRA_LCD + #define DOGLCD + #define ULTIPANEL + #endif + /** * 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 @@ -257,15 +276,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 @@ -288,6 +303,10 @@ // --------------------- // 2 wire Non-latching LCD SR from: // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection +#if ENABLED(FF_INTERFACEBOARD) + #define SR_LCD_3W_NL // Non latching 3 wire shift register + #define ULTIPANEL +#endif #if ENABLED(SAV_3DLCD) #define SR_LCD_2W_NL // Non latching 2 wire shift register @@ -306,43 +325,21 @@ #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 - /** - * Default LCD contrast for Graphical LCD displays - */ - #define HAS_LCD_CONTRAST ( \ - ENABLED(MAKRPANEL) \ - || ENABLED(CARTESIO_UI) \ - || ENABLED(VIKI2) \ - || ENABLED(AZSMZ_12864) \ - || ENABLED(miniVIKI) \ - || ENABLED(ELB_FULL_GRAPHIC_CONTROLLER) \ - ) - #if HAS_LCD_CONTRAST - #ifndef LCD_CONTRAST_MIN - #define LCD_CONTRAST_MIN 0 - #endif - #ifndef LCD_CONTRAST_MAX - #define LCD_CONTRAST_MAX 63 - #endif - #ifndef DEFAULT_LCD_CONTRAST - #define DEFAULT_LCD_CONTRAST 32 - #endif +/** + * Default LCD contrast for Graphical LCD displays + */ +#define HAS_LCD_CONTRAST (HAS_GRAPHICAL_LCD && defined(DEFAULT_LCD_CONTRAST)) +#if HAS_LCD_CONTRAST + #ifndef LCD_CONTRAST_MIN + #define LCD_CONTRAST_MIN 0 + #endif + #ifndef LCD_CONTRAST_MAX + #define LCD_CONTRAST_MAX 63 + #endif + #ifndef DEFAULT_LCD_CONTRAST + #define DEFAULT_LCD_CONTRAST 32 #endif -#endif - -// Boot screens -#if !HAS_SPI_LCD - #undef SHOW_BOOTSCREEN -#elif !defined(BOOTSCREEN_TIMEOUT) - #define BOOTSCREEN_TIMEOUT 2500 #endif /** @@ -355,7 +352,18 @@ * E_MANUAL - Number of E steppers for LCD move options * */ -#if ENABLED(SWITCHING_EXTRUDER) // One stepper for every two EXTRUDERS + +#if EXTRUDERS == 0 + #undef DISTINCT_E_FACTORS + #undef SINGLENOZZLE + #undef SWITCHING_EXTRUDER + #undef SWITCHING_NOZZLE + #undef MIXING_EXTRUDER + #undef MK2_MULTIPLEXER + #undef PRUSA_MMU2 +#endif + +#if ENABLED(SWITCHING_EXTRUDER) // One stepper for every two EXTRUDERS #if EXTRUDERS > 4 #define E_STEPPERS 3 #elif EXTRUDERS > 2 @@ -369,22 +377,28 @@ #elif ENABLED(MIXING_EXTRUDER) #define E_STEPPERS MIXING_STEPPERS #define E_MANUAL 1 + #define DUAL_MIXING_EXTRUDER (MIXING_STEPPERS == 2) #elif ENABLED(SWITCHING_TOOLHEAD) #define E_STEPPERS EXTRUDERS #define E_MANUAL EXTRUDERS +#elif ENABLED(PRUSA_MMU2) + #define E_STEPPERS 1 + #ifndef TOOLCHANGE_ZRAISE + #define TOOLCHANGE_ZRAISE 0 + #endif #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 -// MK2 Multiplexer forces SINGLENOZZLE -#if ENABLED(MK2_MULTIPLEXER) +// Prusa MK2 Multiplexer and MMU 2.0 force SINGLENOZZLE +#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 @@ -407,19 +421,21 @@ #define HOTEND_LOOP() for (int8_t e = 0; e < HOTENDS; e++) #define DO_SWITCH_EXTRUDER (ENABLED(SWITCHING_EXTRUDER) && (DISABLED(SWITCHING_NOZZLE) || SWITCHING_EXTRUDER_SERVO_NR != SWITCHING_NOZZLE_SERVO_NR)) +#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 */ #if ENABLED(DISTINCT_E_FACTORS) && E_STEPPERS > 1 #define XYZE_N (XYZ + E_STEPPERS) - #define E_AXIS_N(E) (uint8_t(E_AXIS) + E) + #define E_AXIS_N(E) AxisEnum(E_AXIS + E) #else #undef DISTINCT_E_FACTORS #define XYZE_N XYZE - #define E_AXIS_N(E) uint8_t(E_AXIS) + #define E_AXIS_N(E) E_AXIS #endif /** @@ -441,25 +457,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 @@ -479,10 +483,11 @@ /** * 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) #ifndef Z_PROBE_LOW_POINT #define Z_PROBE_LOW_POINT -5 #endif @@ -492,7 +497,6 @@ #else // Clear probe pin settings when no probe is selected #undef Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN - #undef Z_MIN_PROBE_ENDSTOP #endif #define HOMING_Z_WITH_PROBE (HAS_BED_PROBE && Z_HOME_DIR < 0 && ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)) @@ -501,15 +505,66 @@ #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(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 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 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_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 (ENABLED(MORGAN_SCARA) || ENABLED(MAKERARM_SCARA)) +#define IS_SCARA EITHER(MORGAN_SCARA, MAKERARM_SCARA) #define IS_KINEMATIC (ENABLED(DELTA) || IS_SCARA) #define IS_CARTESIAN !IS_KINEMATIC + +#ifndef INVERT_X_DIR + #define INVERT_X_DIR false +#endif +#ifndef INVERT_Y_DIR + #define INVERT_Y_DIR false +#endif +#ifndef INVERT_Z_DIR + #define INVERT_Z_DIR false +#endif +#ifndef INVERT_E_DIR + #define INVERT_E_DIR false +#endif + +#if ENABLED(HOST_ACTION_COMMANDS) + #ifndef ACTION_ON_PAUSE + #define ACTION_ON_PAUSE "pause" + #endif + #ifndef ACTION_ON_RESUME + #define ACTION_ON_RESUME "resume" + #endif + #ifndef ACTION_ON_PAUSED + #define ACTION_ON_PAUSED "paused" + #endif + #ifndef ACTION_ON_RESUMED + #define ACTION_ON_RESUMED "resumed" + #endif + #ifndef ACTION_ON_CANCEL + #define ACTION_ON_CANCEL "cancel" + #endif + #if ENABLED(G29_RETRY_AND_RECOVER) + #ifndef ACTION_ON_G29_RECOVER + #define ACTION_ON_G29_RECOVER "probe_rewipe" + #endif + #ifndef ACTION_ON_G29_FAILURE + #define ACTION_ON_G29_FAILURE "probe_failed" + #endif + #endif +#endif + +#if ENABLED(SLIM_LCD_MENUS) + #define BOOT_MARLIN_LOGO_SMALL +#endif + +#define IS_RE_ARM_BOARD (MB(RAMPS_14_RE_ARM_EFB) || MB(RAMPS_14_RE_ARM_EEB) || MB(RAMPS_14_RE_ARM_EFF) || MB(RAMPS_14_RE_ARM_EEF) || MB(RAMPS_14_RE_ARM_SF)) diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index edafe6e23dc8..909e2aefc49e 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -42,3 +42,40 @@ // SERIAL_XON_XOFF not supported on USB-native devices #undef SERIAL_XON_XOFF #endif + +#if ENABLED(HOST_ACTION_COMMANDS) + #ifndef ACTION_ON_PAUSE + #define ACTION_ON_PAUSE "pause" + #endif + #ifndef ACTION_ON_PAUSED + #define ACTION_ON_PAUSED "paused" + #endif + #ifndef ACTION_ON_RESUME + #define ACTION_ON_RESUME "resume" + #endif + #ifndef ACTION_ON_RESUMED + #define ACTION_ON_RESUMED "resumed" + #endif + #ifndef ACTION_ON_CANCEL + #define ACTION_ON_CANCEL "cancel" + #endif + #ifndef ACTION_ON_KILL + #define ACTION_ON_KILL "poweroff" + #endif + #if HAS_FILAMENT_SENSOR + #ifndef ACTION_ON_FILAMENT_RUNOUT + #define ACTION_ON_FILAMENT_RUNOUT "filament_runout" + #endif + #ifndef ACTION_REASON_ON_FILAMENT_RUNOUT + #define ACTION_REASON_ON_FILAMENT_RUNOUT "filament_runout" + #endif + #endif + #if ENABLED(G29_RETRY_AND_RECOVER) + #ifndef ACTION_ON_G29_RECOVER + #define ACTION_ON_G29_RECOVER "probe_rewipe" + #endif + #ifndef ACTION_ON_G29_FAILURE + #define ACTION_ON_G29_FAILURE "probe_failed" + #endif + #endif +#endif diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 4e1097f93b57..a4789f7d977f 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -43,6 +43,16 @@ #define NOT_A_PIN 0 // For PINS_DEBUGGING #endif +#if EXTRUDERS == 0 + #define NO_VOLUMETRICS + #undef FWRETRACT + #undef LIN_ADVANCE + #undef ADVANCED_PAUSE_FEATURE + #undef DISABLE_INACTIVE_EXTRUDER + #undef EXTRUDER_RUNOUT_PREVENT + #undef FILAMENT_LOAD_UNLOAD_GCODES +#endif + #define HAS_CLASSIC_JERK (IS_KINEMATIC || DISABLED(JUNCTION_DEVIATION)) /** @@ -96,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 @@ -114,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) @@ -145,7 +155,7 @@ #if ENABLED(DELTA) #define X_HOME_POS 0 #else - #define X_HOME_POS ((X_BED_SIZE) * (X_HOME_DIR) * 0.5) + #define X_HOME_POS (X_HOME_DIR < 0 ? X_MIN_POS : X_MAX_POS) #endif #else #if ENABLED(DELTA) @@ -161,7 +171,7 @@ #if ENABLED(DELTA) #define Y_HOME_POS 0 #else - #define Y_HOME_POS ((Y_BED_SIZE) * (Y_HOME_DIR) * 0.5) + #define Y_HOME_POS (Y_HOME_DIR < 0 ? Y_MIN_POS : Y_MAX_POS) #endif #else #if ENABLED(DELTA) @@ -203,11 +213,17 @@ * Safe Homing Options */ #if ENABLED(Z_SAFE_HOMING) + #if ENABLED(AUTO_BED_LEVELING_UBL) + // Home close to center so grid points have z heights very close to 0 + #define _SAFE_POINT(A) (((GRID_MAX_POINTS_##A) / 2) * (A##_BED_SIZE - 2 * (MESH_INSET)) / (GRID_MAX_POINTS_##A - 1) + MESH_INSET) + #else + #define _SAFE_POINT(A) A##_CENTER + #endif #ifndef Z_SAFE_HOMING_X_POINT - #define Z_SAFE_HOMING_X_POINT X_CENTER + #define Z_SAFE_HOMING_X_POINT _SAFE_POINT(X) #endif #ifndef Z_SAFE_HOMING_Y_POINT - #define Z_SAFE_HOMING_Y_POINT Y_CENTER + #define Z_SAFE_HOMING_Y_POINT _SAFE_POINT(Y) #endif #define X_TILT_FULCRUM Z_SAFE_HOMING_X_POINT #define Y_TILT_FULCRUM Z_SAFE_HOMING_Y_POINT @@ -410,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 @@ -445,7 +461,7 @@ * Preserve this ordering when adding new drivers. */ -#define TRINAMICS (HAS_TRINAMIC || HAS_DRIVER(TMC2130_STANDALONE) || HAS_DRIVER(TMC2208_STANDALONE) || HAS_DRIVER(TMC26X_STANDALONE) || HAS_DRIVER(TMC2660_STANDALONE)) +#define TRINAMICS (HAS_TRINAMIC || HAS_DRIVER(TMC2130_STANDALONE) || HAS_DRIVER(TMC2208_STANDALONE) || HAS_DRIVER(TMC26X_STANDALONE) || HAS_DRIVER(TMC2660_STANDALONE) || HAS_DRIVER(TMC5130_STANDALONE) || HAS_DRIVER(TMC5160_STANDALONE) || HAS_DRIVER(TMC2160_STANDALONE)) #ifndef MINIMUM_STEPPER_DIR_DELAY #if HAS_DRIVER(TB6560) @@ -719,12 +735,12 @@ // Is an endstop plug used for the Z2 endstop or the bed probe? #define IS_Z2_OR_PROBE(A,M) ( \ (Z_MULTI_ENDSTOPS && Z2_USE_ENDSTOP == _##A##M##_) \ - || (ENABLED(Z_MIN_PROBE_ENDSTOP) && Z_MIN_PROBE_PIN == A##_##M##_PIN ) ) + || (USES_Z_MIN_PROBE_ENDSTOP && Z_MIN_PROBE_PIN == A##_##M##_PIN ) ) // Is an endstop plug used for the Z3 endstop or the bed probe? #define IS_Z3_OR_PROBE(A,M) ( \ (ENABLED(Z_TRIPLE_ENDSTOPS) && Z3_USE_ENDSTOP == _##A##M##_) \ - || (ENABLED(Z_MIN_PROBE_ENDSTOP) && Z_MIN_PROBE_PIN == A##_##M##_PIN ) ) + || (USES_Z_MIN_PROBE_ENDSTOP && Z_MIN_PROBE_PIN == A##_##M##_PIN ) ) /** * Set ENDSTOPPULLUPS for active endstop switches @@ -779,73 +795,73 @@ */ // Steppers -#define HAS_X_ENABLE (PIN_EXISTS(X_ENABLE)) +#define HAS_X_ENABLE (PIN_EXISTS(X_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(X))) #define HAS_X_DIR (PIN_EXISTS(X_DIR)) #define HAS_X_STEP (PIN_EXISTS(X_STEP)) #define HAS_X_MICROSTEPS (PIN_EXISTS(X_MS1)) -#define HAS_X2_ENABLE (PIN_EXISTS(X2_ENABLE)) +#define HAS_X2_ENABLE (PIN_EXISTS(X2_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(X2))) #define HAS_X2_DIR (PIN_EXISTS(X2_DIR)) #define HAS_X2_STEP (PIN_EXISTS(X2_STEP)) #define HAS_X2_MICROSTEPS (PIN_EXISTS(X2_MS1)) -#define HAS_Y_ENABLE (PIN_EXISTS(Y_ENABLE)) +#define HAS_Y_ENABLE (PIN_EXISTS(Y_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Y))) #define HAS_Y_DIR (PIN_EXISTS(Y_DIR)) #define HAS_Y_STEP (PIN_EXISTS(Y_STEP)) #define HAS_Y_MICROSTEPS (PIN_EXISTS(Y_MS1)) -#define HAS_Y2_ENABLE (PIN_EXISTS(Y2_ENABLE)) +#define HAS_Y2_ENABLE (PIN_EXISTS(Y2_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Y2))) #define HAS_Y2_DIR (PIN_EXISTS(Y2_DIR)) #define HAS_Y2_STEP (PIN_EXISTS(Y2_STEP)) #define HAS_Y2_MICROSTEPS (PIN_EXISTS(Y2_MS1)) -#define HAS_Z_ENABLE (PIN_EXISTS(Z_ENABLE)) +#define HAS_Z_ENABLE (PIN_EXISTS(Z_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z))) #define HAS_Z_DIR (PIN_EXISTS(Z_DIR)) #define HAS_Z_STEP (PIN_EXISTS(Z_STEP)) #define HAS_Z_MICROSTEPS (PIN_EXISTS(Z_MS1)) -#define HAS_Z2_ENABLE (PIN_EXISTS(Z2_ENABLE)) +#define HAS_Z2_ENABLE (PIN_EXISTS(Z2_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z2))) #define HAS_Z2_DIR (PIN_EXISTS(Z2_DIR)) #define HAS_Z2_STEP (PIN_EXISTS(Z2_STEP)) #define HAS_Z2_MICROSTEPS (PIN_EXISTS(Z2_MS1)) -#define HAS_Z3_ENABLE (PIN_EXISTS(Z3_ENABLE)) +#define HAS_Z3_ENABLE (PIN_EXISTS(Z3_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z3))) #define HAS_Z3_DIR (PIN_EXISTS(Z3_DIR)) #define HAS_Z3_STEP (PIN_EXISTS(Z3_STEP)) #define HAS_Z3_MICROSTEPS (PIN_EXISTS(Z3_MS1)) // Extruder steppers and solenoids -#define HAS_E0_ENABLE (PIN_EXISTS(E0_ENABLE)) +#define HAS_E0_ENABLE (PIN_EXISTS(E0_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E0))) #define HAS_E0_DIR (PIN_EXISTS(E0_DIR)) #define HAS_E0_STEP (PIN_EXISTS(E0_STEP)) #define HAS_E0_MICROSTEPS (PIN_EXISTS(E0_MS1)) #define HAS_SOLENOID_0 (PIN_EXISTS(SOL0)) -#define HAS_E1_ENABLE (PIN_EXISTS(E1_ENABLE)) +#define HAS_E1_ENABLE (PIN_EXISTS(E1_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E1))) #define HAS_E1_DIR (PIN_EXISTS(E1_DIR)) #define HAS_E1_STEP (PIN_EXISTS(E1_STEP)) #define HAS_E1_MICROSTEPS (PIN_EXISTS(E1_MS1)) #define HAS_SOLENOID_1 (PIN_EXISTS(SOL1)) -#define HAS_E2_ENABLE (PIN_EXISTS(E2_ENABLE)) +#define HAS_E2_ENABLE (PIN_EXISTS(E2_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E2))) #define HAS_E2_DIR (PIN_EXISTS(E2_DIR)) #define HAS_E2_STEP (PIN_EXISTS(E2_STEP)) #define HAS_E2_MICROSTEPS (PIN_EXISTS(E2_MS1)) #define HAS_SOLENOID_2 (PIN_EXISTS(SOL2)) -#define HAS_E3_ENABLE (PIN_EXISTS(E3_ENABLE)) +#define HAS_E3_ENABLE (PIN_EXISTS(E3_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E3))) #define HAS_E3_DIR (PIN_EXISTS(E3_DIR)) #define HAS_E3_STEP (PIN_EXISTS(E3_STEP)) #define HAS_E3_MICROSTEPS (PIN_EXISTS(E3_MS1)) #define HAS_SOLENOID_3 (PIN_EXISTS(SOL3)) -#define HAS_E4_ENABLE (PIN_EXISTS(E4_ENABLE)) +#define HAS_E4_ENABLE (PIN_EXISTS(E4_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E4))) #define HAS_E4_DIR (PIN_EXISTS(E4_DIR)) #define HAS_E4_STEP (PIN_EXISTS(E4_STEP)) #define HAS_E4_MICROSTEPS (PIN_EXISTS(E4_MS1)) #define HAS_SOLENOID_4 (PIN_EXISTS(SOL4)) -#define HAS_E5_ENABLE (PIN_EXISTS(E5_ENABLE)) +#define HAS_E5_ENABLE (PIN_EXISTS(E5_ENABLE) || (ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E5))) #define HAS_E5_DIR (PIN_EXISTS(E5_DIR)) #define HAS_E5_STEP (PIN_EXISTS(E5_STEP)) #define HAS_E5_MICROSTEPS (PIN_EXISTS(E5_MS1)) @@ -853,14 +869,13 @@ // Trinamic Stepper Drivers #if HAS_TRINAMIC - #define TMC_HAS_SPI (HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2660)) - #define HAS_STALLGUARD (HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2660)) - #define HAS_STEALTHCHOP (HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2208)) - #define AXIS_HAS_SPI(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2660)) - #define AXIS_HAS_STALLGUARD(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2660)) - #define AXIS_HAS_STEALTHCHOP(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2208)) - - #define USE_SENSORLESS (ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING)) + #define HAS_TMCX1X0 (HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2160) || HAS_DRIVER(TMC5130) || HAS_DRIVER(TMC5160)) + #define TMC_HAS_SPI (HAS_TMCX1X0 || HAS_DRIVER(TMC2660)) + #define HAS_STALLGUARD (HAS_TMCX1X0 || HAS_DRIVER(TMC2660)) + #define HAS_STEALTHCHOP (HAS_TMCX1X0 || HAS_DRIVER(TMC2208)) + + #define 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 @@ -886,7 +901,8 @@ #define HAS_Z2_MAX (PIN_EXISTS(Z2_MAX)) #define HAS_Z3_MIN (PIN_EXISTS(Z3_MIN)) #define HAS_Z3_MAX (PIN_EXISTS(Z3_MAX)) -#define HAS_Z_MIN_PROBE_PIN (PIN_EXISTS(Z_MIN_PROBE)) +#define HAS_Z_MIN_PROBE_PIN (USES_Z_MIN_PROBE_ENDSTOP && PIN_EXISTS(Z_MIN_PROBE)) +#define HAS_CALIBRATION_PIN (PIN_EXISTS(CALIBRATION)) // ADC Temp Sensors (Thermistor or Thermocouple with amplifier ADC interface) #define HAS_ADC_TEST(P) (PIN_EXISTS(TEMP_##P) && TEMP_SENSOR_##P != 0 && DISABLED(HEATER_##P##_USES_MAX6675)) @@ -895,12 +911,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(HEATER_CHAMBER)) // Heaters #define HAS_HEATER_0 (PIN_EXISTS(HEATER_0)) @@ -908,6 +926,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 @@ -918,13 +937,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)) @@ -935,27 +955,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)) @@ -974,21 +973,27 @@ #define Z_PROBE_SERVO_NR -1 #endif +#define HAS_SERVO_ANGLES (EITHER(SWITCHING_EXTRUDER, SWITCHING_NOZZLE) || (HAS_Z_SERVO_PROBE && defined(Z_PROBE_SERVO_NR))) + +#if !HAS_SERVO_ANGLES || ENABLED(BLTOUCH) + #undef EDITABLE_SERVO_ANGLES +#endif + // Sensors #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_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) @@ -1047,7 +1052,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 @@ -1081,6 +1086,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 */ @@ -1120,9 +1129,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 @@ -1134,14 +1160,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) @@ -1167,6 +1193,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 */ @@ -1208,50 +1241,44 @@ #define _SKEW_FACTOR(a,b,c) _SKEW_SIDE(float(a),_GET_SIDE(float(a),float(b),float(c)),float(c)) #ifndef XY_SKEW_FACTOR - constexpr float XY_SKEW_FACTOR = ( - #if defined(XY_DIAG_AC) && defined(XY_DIAG_BD) && defined(XY_SIDE_AD) - _SKEW_FACTOR(XY_DIAG_AC, XY_DIAG_BD, XY_SIDE_AD) - #else - 0.0 - #endif - ); + #if defined(XY_DIAG_AC) && defined(XY_DIAG_BD) && defined(XY_SIDE_AD) + #define XY_SKEW_FACTOR _SKEW_FACTOR(XY_DIAG_AC, XY_DIAG_BD, XY_SIDE_AD) + #else + #define XY_SKEW_FACTOR 0.0 + #endif #endif #ifndef XZ_SKEW_FACTOR #if defined(XY_SIDE_AD) && !defined(XZ_SIDE_AD) #define XZ_SIDE_AD XY_SIDE_AD #endif - constexpr float XZ_SKEW_FACTOR = ( - #if defined(XZ_DIAG_AC) && defined(XZ_DIAG_BD) && defined(XZ_SIDE_AD) - _SKEW_FACTOR(XZ_DIAG_AC, XZ_DIAG_BD, XZ_SIDE_AD) - #else - 0.0 - #endif - ); + #if defined(XZ_DIAG_AC) && defined(XZ_DIAG_BD) && defined(XZ_SIDE_AD) + #define XZ_SKEW_FACTOR _SKEW_FACTOR(XZ_DIAG_AC, XZ_DIAG_BD, XZ_SIDE_AD) + #else + #define XZ_SKEW_FACTOR 0.0 + #endif #endif #ifndef YZ_SKEW_FACTOR - constexpr float YZ_SKEW_FACTOR = ( - #if defined(YZ_DIAG_AC) && defined(YZ_DIAG_BD) && defined(YZ_SIDE_AD) - _SKEW_FACTOR(YZ_DIAG_AC, YZ_DIAG_BD, YZ_SIDE_AD) - #else - 0.0 - #endif - ); + #if defined(YZ_DIAG_AC) && defined(YZ_DIAG_BD) && defined(YZ_SIDE_AD) + #define YZ_SKEW_FACTOR _SKEW_FACTOR(YZ_DIAG_AC, YZ_DIAG_BD, YZ_SIDE_AD) + #else + #define YZ_SKEW_FACTOR 0.0 + #endif #endif #endif // SKEW_CORRECTION /** * 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 OLDSCHOOL_ABL (ABL_PLANAR || ABL_GRID) -#define HAS_ABL (OLDSCHOOL_ABL || ENABLED(AUTO_BED_LEVELING_UBL)) -#define HAS_LEVELING (HAS_ABL || ENABLED(MESH_BED_LEVELING)) -#define HAS_AUTOLEVEL (HAS_ABL && DISABLED(PROBE_MANUALLY)) -#define HAS_MESH (ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(MESH_BED_LEVELING)) +#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 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 || ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST)) +#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)) #if ENABLED(AUTO_BED_LEVELING_UBL) @@ -1259,18 +1286,25 @@ #endif /** - * Heater & Fan Pausing + * Heater, Fan, and Probe interactions */ #if FAN_COUNT == 0 #undef PROBING_FANS_OFF + #undef ADAPTIVE_FAN_SLOWING + #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 #endif +#if EXTRUDERS > 1 && !defined(TOOLCHANGE_FIL_EXTRA_PRIME) + #define TOOLCHANGE_FIL_EXTRA_PRIME 0 +#endif + /** * Only constrain Z on DELTA / SCARA machines */ @@ -1363,7 +1397,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!") @@ -1403,7 +1437,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 @@ -1451,7 +1485,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 @@ -1486,9 +1520,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 @@ -1545,7 +1579,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) @@ -1587,8 +1621,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 @@ -1629,7 +1663,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)) +#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 @@ -1642,7 +1676,7 @@ // Get LCD character width/height, which may be overridden by pins, configs, etc. #ifndef LCD_WIDTH #if HAS_GRAPHICAL_LCD - #define LCD_WIDTH 22 + #define LCD_WIDTH 21 #elif ENABLED(ULTIPANEL) #define LCD_WIDTH 20 #elif HAS_SPI_LCD diff --git a/Marlin/src/inc/MarlinConfig.h b/Marlin/src/inc/MarlinConfig.h index 226af65a2d45..28d6029b27a4 100644 --- a/Marlin/src/inc/MarlinConfig.h +++ b/Marlin/src/inc/MarlinConfig.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/inc/MarlinConfigPre.h b/Marlin/src/inc/MarlinConfigPre.h index 3bca46ed096c..4936c519b50d 100644 --- a/Marlin/src/inc/MarlinConfigPre.h +++ b/Marlin/src/inc/MarlinConfigPre.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 98923030124a..d76c28bbf221 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -240,7 +240,7 @@ #error "Remove DELTA_PROBEABLE_RADIUS and use MIN_PROBE_EDGE to inset the probe area instead." #elif defined(UBL_MESH_INSET) #error "UBL_MESH_INSET is now just MESH_INSET. Please update your configuration." -#elif defined(UBL_MESH_MIN_X) || defined(UBL_MESH_MIN_Y) || defined(UBL_MESH_MAX_X) || defined(UBL_MESH_MAX_Y) +#elif defined(UBL_MESH_MIN_X) || defined(UBL_MESH_MIN_Y) || defined(UBL_MESH_MAX_X) || defined(UBL_MESH_MAX_Y) #error "UBL_MESH_(MIN|MAX)_[XY] is now just MESH_(MIN|MAX)_[XY]. Please update your configuration." #elif defined(ABL_PROBE_PT_1_X) || defined(ABL_PROBE_PT_1_Y) || defined(ABL_PROBE_PT_2_X) || defined(ABL_PROBE_PT_2_Y) || defined(ABL_PROBE_PT_3_X) || defined(ABL_PROBE_PT_3_Y) #error "ABL_PROBE_PT_[123]_[XY] is now PROBE_PT_[123]_[XY]. Please update your configuration." @@ -264,6 +264,8 @@ #error "MEASURED_(UPPER|LOWER)_LIMIT is now FILWIDTH_ERROR_MARGIN. Please update your configuration." #elif defined(HAVE_TMCDRIVER) #error "HAVE_TMCDRIVER is now [AXIS]_DRIVER_TYPE TMC26X. Please update your Configuration.h." +#elif defined(STEALTHCHOP) + #error "STEALTHCHOP is now STEALTHCHOP_(XY|Z|E). Please update your Configuration_adv.h." #elif defined(HAVE_TMC26X) #error "HAVE_TMC26X is now [AXIS]_DRIVER_TYPE TMC26X. Please update your Configuration.h." #elif defined(HAVE_TMC2130) @@ -339,6 +341,16 @@ #error "MAX6675_SS is now MAX6675_SS_PIN. Please update your configuration and/or pins." #elif defined(MAX6675_SS2) #error "MAX6675_SS2 is now MAX6675_SS2_PIN. Please update your configuration and/or pins." +#elif defined(SPINDLE_LASER_ENABLE_PIN) + #error "SPINDLE_LASER_ENABLE_PIN is now SPINDLE_LASER_ENA_PIN. Please update your configuration and/or pins." +#elif defined(CHAMBER_HEATER_PIN) + #error "CHAMBER_HEATER_PIN is now HEATER_CHAMBER_PIN. Please update your configuration and/or pins." +#elif defined(TMC_Z_CALIBRATION) + #error "TMC_Z_CALIBRATION has been deprecated in favor of Z_STEPPER_AUTO_ALIGN. Please update your configuration." +#elif defined(Z_MIN_PROBE_ENDSTOP) + #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 @@ -385,9 +397,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 @@ -402,7 +414,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)." @@ -421,8 +433,8 @@ /** * Validate that the bed size fits */ -static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, - "Movement bounds ([XY]_MIN_POS, [XY]_MAX_POS) are too narrow to contain [XY]_BED_SIZE."); +static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS) are too narrow to contain X_BED_SIZE."); +static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS) are too narrow to contain Y_BED_SIZE."); /** * Granular software endstops (Marlin >= 1.1.7) @@ -430,7 +442,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #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 @@ -438,7 +450,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #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 @@ -454,21 +466,21 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #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 @@ -487,7 +499,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, * 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." @@ -498,17 +510,24 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #elif PROGRESS_MSG_EXPIRE < 0 #error "PROGRESS_MSG_EXPIRE must be greater than or equal to 0." #endif -#elif ENABLED(LCD_SET_PROGRESS_MANUALLY) && !HAS_GRAPHICAL_LCD - #error "LCD_SET_PROGRESS_MANUALLY requires LCD_PROGRESS_BAR or Graphical LCD." +#elif ENABLED(LCD_SET_PROGRESS_MANUALLY) && !HAS_GRAPHICAL_LCD && DISABLED(EXTENSIBLE_UI) + #error "LCD_SET_PROGRESS_MANUALLY requires LCD_PROGRESS_BAR, Graphical LCD, or EXTENSIBLE_UI." #endif /** * 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 +/** + * LCD Lightweight Screen Style + */ +#if ENABLED(LIGHTWEIGHT_UI) && DISABLED(U8GLIB_ST7920) + #error "LIGHTWEIGHT_UI requires a U8GLIB_ST7920-based display." +#endif + /** * SD File Sorting */ @@ -536,6 +555,10 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #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 */ @@ -553,9 +576,9 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #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." @@ -565,13 +588,15 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #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 BOTH(BABYSTEP_ALWAYS_AVAILABLE, MOVE_Z_WHEN_IDLE) + #error "BABYSTEP_ALWAYS_AVAILABLE and MOVE_Z_WHEN_IDLE are incompatible." #endif #endif /** * Filament Runout needs one or more pins and either SD Support or Auto print start detection */ -#if ENABLED(FILAMENT_RUNOUT_SENSOR) +#if HAS_FILAMENT_SENSOR #if !PIN_EXISTS(FIL_RUNOUT) #error "FILAMENT_RUNOUT_SENSOR requires FIL_RUNOUT_PIN." #elif NUM_RUNOUT_SENSORS > E_STEPPERS @@ -586,7 +611,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #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."); @@ -601,7 +626,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #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." @@ -624,7 +649,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, /** * 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 @@ -691,6 +716,10 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #error "SWITCHING_NOZZLE requires exactly 2 EXTRUDERS." #elif NUM_SERVOS < 1 #error "SWITCHING_NOZZLE requires NUM_SERVOS >= 1." + #endif + + #ifndef SWITCHING_NOZZLE_SERVO_NR + #error "SWITCHING_NOZZLE requires SWITCHING_NOZZLE_SERVO_NR." #elif SWITCHING_NOZZLE_SERVO_NR == 0 && !PIN_EXISTS(SERVO0) #error "SERVO0_PIN must be defined for your SWITCHING_NOZZLE." #elif SWITCHING_NOZZLE_SERVO_NR == 1 && !PIN_EXISTS(SERVO1) @@ -700,6 +729,20 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #elif SWITCHING_NOZZLE_SERVO_NR == 3 && !PIN_EXISTS(SERVO3) #error "SERVO3_PIN must be defined for your SWITCHING_NOZZLE." #endif + + #ifdef SWITCHING_NOZZLE_E1_SERVO_NR + #if SWITCHING_NOZZLE_E1_SERVO_NR == SWITCHING_NOZZLE_SERVO_NR + #error "SWITCHING_NOZZLE_E1_SERVO_NR must be different from SWITCHING_NOZZLE_SERVO_NR." + #elif SWITCHING_NOZZLE_E1_SERVO_NR == 0 && !PIN_EXISTS(SERVO0) + #error "SERVO0_PIN must be defined for your SWITCHING_NOZZLE." + #elif SWITCHING_NOZZLE_E1_SERVO_NR == 1 && !PIN_EXISTS(SERVO1) + #error "SERVO1_PIN must be defined for your SWITCHING_NOZZLE." + #elif SWITCHING_NOZZLE_E1_SERVO_NR == 2 && !PIN_EXISTS(SERVO2) + #error "SERVO2_PIN must be defined for your SWITCHING_NOZZLE." + #elif SWITCHING_NOZZLE_E1_SERVO_NR == 3 && !PIN_EXISTS(SERVO3) + #error "SERVO3_PIN must be defined for your SWITCHING_NOZZLE." + #endif + #endif #endif /** @@ -762,7 +805,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #endif /** - * Parking Extruder requirements + * (Magnetic) Parking Extruder requirements */ #if ENABLED(PARKING_EXTRUDER) #if ENABLED(DUAL_X_CARRIAGE) @@ -771,9 +814,11 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #error "PARKING_EXTRUDER and SINGLENOZZLE are incompatible." #elif ENABLED(EXT_SOLENOID) #error "PARKING_EXTRUDER and EXT_SOLENOID are incompatible. (Pins are used twice.)" + #elif ENABLED(MAGNETIC_PARKING_EXTRUDER) + #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." @@ -786,6 +831,22 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #elif !defined(PARKING_EXTRUDER_SOLENOIDS_DELAY) || !WITHIN(PARKING_EXTRUDER_SOLENOIDS_DELAY, 0, 2000) #error "PARKING_EXTRUDER_SOLENOIDS_DELAY must be between 0 and 2000 (ms)." #endif +#elif ENABLED(MAGNETIC_PARKING_EXTRUDER) + #if ENABLED(DUAL_X_CARRIAGE) + #error "MAGNETIC_PARKING_EXTRUDER and DUAL_X_CARRIAGE are incompatible." + #elif ENABLED(SINGLENOZZLE) + #error "MAGNETIC_PARKING_EXTRUDER and SINGLENOZZLE are incompatible." + #elif ENABLED(EXT_SOLENOID) + #error "MAGNETIC_PARKING_EXTRUDER and EXT_SOLENOID are incompatible. (Pins are used twice.)" + #elif EXTRUDERS != 2 + #error "MAGNETIC_PARKING_EXTRUDER requires exactly 2 EXTRUDERS." + #elif !defined(PARKING_EXTRUDER_PARKING_X) + #error "MAGNETIC_PARKING_EXTRUDER requires PARKING_EXTRUDER_PARKING_X." + #elif !defined(TOOLCHANGE_ZRAISE) + #error "MAGNETIC_PARKING_EXTRUDER requires TOOLCHANGE_ZRAISE." + #elif TOOLCHANGE_ZRAISE < 0 + #error "TOOLCHANGE_ZRAISE must be 0 or higher." + #endif #endif /** @@ -854,7 +915,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, /** * 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 @@ -882,7 +943,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, * 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." @@ -921,7 +982,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, /** * 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 @@ -969,21 +1030,15 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #error "SENSORLESS_PROBING requires a TMC2130 driver on Z." #endif #elif ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) - #if ENABLED(Z_MIN_PROBE_ENDSTOP) - #error "Enable only one option: Z_MIN_PROBE_ENDSTOP or Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN." - #elif DISABLED(USE_ZMIN_PLUG) + #if DISABLED(USE_ZMIN_PLUG) #error "Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN requires USE_ZMIN_PLUG to be enabled." #elif !HAS_Z_MIN #error "Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN requires the Z_MIN_PIN to be defined." #elif Z_MIN_PROBE_ENDSTOP_INVERTING != Z_MIN_ENDSTOP_INVERTING #error "Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN requires Z_MIN_ENDSTOP_INVERTING to match Z_MIN_PROBE_ENDSTOP_INVERTING." #endif - #elif ENABLED(Z_MIN_PROBE_ENDSTOP) - #if !HAS_Z_MIN_PROBE_PIN - #error "Z_MIN_PROBE_ENDSTOP requires the Z_MIN_PROBE_PIN to be defined." - #endif - #else - #error "You must enable either Z_MIN_PROBE_ENDSTOP or Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN to use a probe." + #elif !HAS_Z_MIN_PROBE_PIN + #error "Z_MIN_PROBE_PIN must be defined if Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN is not enabled." #endif /** @@ -1014,7 +1069,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, /** * Require some kind of probe for bed leveling and probe testing */ - #if OLDSCHOOL_ABL && !PROBE_SELECTED + #if HAS_ABL_NOT_UBL && !PROBE_SELECTED #error "Auto Bed Leveling requires one of these: PROBE_MANUALLY, FIX_MOUNTED_PROBE, BLTOUCH, SOLENOID_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, or a Z Servo." #endif @@ -1040,7 +1095,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, * 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."); @@ -1068,7 +1123,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #error "AUTO_BED_LEVELING_UBL used to enable RESTORE_LEVELING_AFTER_G28. To keep this behavior enable RESTORE_LEVELING_AFTER_G28. Otherwise define it as 'false'." #endif -#elif OLDSCHOOL_ABL +#elif HAS_ABL_NOT_UBL /** * Auto Bed Leveling @@ -1093,7 +1148,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, static_assert(FRONT_PROBE_BED_POSITION >= MIN_PROBE_Y, "FRONT_PROBE_BED_POSITION is outside the probe region."); static_assert(BACK_PROBE_BED_POSITION <= MAX_PROBE_Y, "BACK_PROBE_BED_POSITION is outside the probe region."); - #endif // AUTO_BED_LEVELING_3POINT + #endif #elif ENABLED(MESH_BED_LEVELING) @@ -1113,7 +1168,9 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #endif #if HAS_MESH - static_assert(DEFAULT_ZJERK > 0.1, "Low DEFAULT_ZJERK values are incompatible with mesh-based leveling."); + #if DISABLED(JUNCTION_DEVIATION) + static_assert(DEFAULT_ZJERK > 0.1, "Low DEFAULT_ZJERK values are incompatible with mesh-based leveling."); + #endif #elif ENABLED(G26_MESH_VALIDATION) #error "G26_MESH_VALIDATION requires MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, or AUTO_BED_LEVELING_UBL." #endif @@ -1122,8 +1179,12 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #error "MESH_EDIT_GFX_OVERLAY requires AUTO_BED_LEVELING_UBL and a Graphical LCD." #endif -#if ENABLED(G29_RETRY_AND_RECOVER) && HAS_LEVELING && !OLDSCHOOL_ABL - #error "G29_RETRY_AND_RECOVER currently only supports ABL" +#if ENABLED(G29_RETRY_AND_RECOVER) + #if ENABLED(AUTO_BED_LEVELING_UBL) + #error "G29_RETRY_AND_RECOVER is not compatible with UBL." + #elif ENABLED(MESH_BED_LEVELING) + #error "G29_RETRY_AND_RECOVER is not compatible with MESH_BED_LEVELING." + #endif #endif /** @@ -1132,7 +1193,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #if ENABLED(LCD_BED_LEVELING) #if !HAS_LCD_MENU #error "LCD_BED_LEVELING requires a programmable LCD controller." - #elif !(ENABLED(MESH_BED_LEVELING) || OLDSCHOOL_ABL) + #elif !(ENABLED(MESH_BED_LEVELING) || HAS_ABL_NOT_UBL) #error "LCD_BED_LEVELING requires MESH_BED_LEVELING or AUTO_BED_LEVELING." #endif #endif @@ -1168,8 +1229,8 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, /** * 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 @@ -1188,7 +1249,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, /** * 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 @@ -1200,9 +1261,9 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, * 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 @@ -1281,11 +1342,11 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, */ #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) || !PIN_EXISTS(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." @@ -1303,7 +1364,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #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 @@ -1381,7 +1442,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, /** * 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 @@ -1389,23 +1450,23 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, * 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 @@ -1414,27 +1475,27 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, */ #if DISABLED(MK2_MULTIPLEXER) // MK2_MULTIPLEXER uses E0 stepper only #if E_STEPPERS - #if !(PIN_EXISTS(E0_STEP) && PIN_EXISTS(E0_DIR) && PIN_EXISTS(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) && PIN_EXISTS(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) && PIN_EXISTS(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) && PIN_EXISTS(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) && PIN_EXISTS(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) && PIN_EXISTS(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 @@ -1449,7 +1510,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, * 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 @@ -1622,9 +1683,9 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, /** * RGB_LED Requirements */ -#define _RGB_TEST (PIN_EXISTS(RGB_LED_R) && PIN_EXISTS(RGB_LED_G) && PIN_EXISTS(RGB_LED_B)) +#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." @@ -1647,13 +1708,13 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #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 @@ -1705,7 +1766,8 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, + ENABLED(G3D_PANEL) \ + (ENABLED(MINIPANEL) && DISABLED(MKS_MINI_12864)) \ + ENABLED(MKS_MINI_12864) \ - + (ENABLED(REPRAPWORLD_KEYPAD) && DISABLED(CARTESIO_UI) && DISABLED(ZONESTAR_LCD)) \ + + ENABLED(FYSETC_MINI_12864) \ + + (ENABLED(REPRAPWORLD_KEYPAD) && DISABLED(CARTESIO_UI, ZONESTAR_LCD)) \ + ENABLED(RIGIDBOT_PANEL) \ + ENABLED(RA_CONTROL_PANEL) \ + ENABLED(LCD_SAINSMART_I2C_1602) \ @@ -1713,13 +1775,14 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, + 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 @@ -1759,7 +1822,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, /** * 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) @@ -1833,8 +1896,8 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, // 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) && DISABLED(STEALTHCHOP) - #error "SENSORLESS_HOMING on DELTA currently requires STEALTHCHOP." + #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." #elif X_SENSORLESS && X_HOME_DIR == 1 && (!X_MAX_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_XMAX)) @@ -1855,7 +1918,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, // 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." @@ -1871,16 +1934,18 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #endif // Other TMC feature requirements -#if ENABLED(HYBRID_THRESHOLD) && DISABLED(STEALTHCHOP) - #error "Enable STEALTHCHOP to use HYBRID_THRESHOLD." -#elif ENABLED(TMC_Z_CALIBRATION) && !AXIS_IS_TMC(Z) && !AXIS_IS_TMC(Z2) && !AXIS_IS_TMC(Z3) - #error "TMC_Z_CALIBRATION requires at least one TMC driver on Z axis" +#if ENABLED(HYBRID_THRESHOLD) && !STEALTHCHOP_ENABLED + #error "Enable STEALTHCHOP_(XY|Z|E) to use HYBRID_THRESHOLD." #elif ENABLED(SENSORLESS_HOMING) && !HAS_STALLGUARD - #error "SENSORLESS_HOMING requires TMC2130 stepper drivers." + #error "SENSORLESS_HOMING requires TMC2130 or TMC2160 or TMC5160 stepper drivers." #elif ENABLED(SENSORLESS_PROBING) && !HAS_STALLGUARD #error "SENSORLESS_PROBING requires TMC2130 stepper drivers." -#elif ENABLED(STEALTHCHOP) && !HAS_STEALTHCHOP - #error "STEALTHCHOP requires TMC2130 or TMC2208 stepper drivers." +#elif STEALTHCHOP_ENABLED && !HAS_STEALTHCHOP + #error "STEALTHCHOP requires TMC2130 or TMC2160 or TMC2208 or TMC5160 stepper drivers." +#endif + +#if ENABLED(DELTA) && (ENABLED(STEALTHCHOP_XY) != ENABLED(STEALTHCHOP_Z)) + #error "STEALTHCHOP_XY and STEALTHCHOP_Z must be the same on DELTA." #endif /** @@ -1894,19 +1959,38 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, #endif /** - * Require 4 or more elements in per-axis initializers + * Check per-axis initializers for errors */ constexpr float sanity_arr_1[] = DEFAULT_AXIS_STEPS_PER_UNIT, sanity_arr_2[] = DEFAULT_MAX_FEEDRATE, sanity_arr_3[] = DEFAULT_MAX_ACCELERATION; -static_assert(COUNT(sanity_arr_1) >= XYZE, "DEFAULT_AXIS_STEPS_PER_UNIT requires 4 (or more) elements."); -static_assert(COUNT(sanity_arr_2) >= XYZE, "DEFAULT_MAX_FEEDRATE requires 4 (or more) elements."); -static_assert(COUNT(sanity_arr_3) >= XYZE, "DEFAULT_MAX_ACCELERATION requires 4 (or more) elements."); + +#define _ARR_TEST(N,I) (sanity_arr_##N[MIN(I,int(COUNT(sanity_arr_##N))-1)] > 0) + +static_assert(COUNT(sanity_arr_1) >= XYZE, "DEFAULT_AXIS_STEPS_PER_UNIT requires X, Y, Z and E elements."); static_assert(COUNT(sanity_arr_1) <= XYZE_N, "DEFAULT_AXIS_STEPS_PER_UNIT has too many elements. (Did you forget to enable DISTINCT_E_FACTORS?)"); +static_assert( _ARR_TEST(1,0) && _ARR_TEST(1,1) && _ARR_TEST(1,2) + && _ARR_TEST(1,3) && _ARR_TEST(1,4) && _ARR_TEST(1,5) + && _ARR_TEST(1,6) && _ARR_TEST(1,7) && _ARR_TEST(1,8), + "DEFAULT_AXIS_STEPS_PER_UNIT values must be positive."); + +static_assert(COUNT(sanity_arr_2) >= XYZE, "DEFAULT_MAX_FEEDRATE requires X, Y, Z and E elements."); static_assert(COUNT(sanity_arr_2) <= XYZE_N, "DEFAULT_MAX_FEEDRATE has too many elements. (Did you forget to enable DISTINCT_E_FACTORS?)"); +static_assert( _ARR_TEST(2,0) && _ARR_TEST(2,1) && _ARR_TEST(2,2) + && _ARR_TEST(2,3) && _ARR_TEST(2,4) && _ARR_TEST(2,5) + && _ARR_TEST(2,6) && _ARR_TEST(2,7) && _ARR_TEST(2,8), + "DEFAULT_MAX_FEEDRATE values must be positive."); + +static_assert(COUNT(sanity_arr_3) >= XYZE, "DEFAULT_MAX_ACCELERATION requires X, Y, Z and E elements."); static_assert(COUNT(sanity_arr_3) <= XYZE_N, "DEFAULT_MAX_ACCELERATION has too many elements. (Did you forget to enable DISTINCT_E_FACTORS?)"); +static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2) + && _ARR_TEST(3,3) && _ARR_TEST(3,4) && _ARR_TEST(3,5) + && _ARR_TEST(3,6) && _ARR_TEST(3,7) && _ARR_TEST(3,8), + "DEFAULT_MAX_ACCELERATION values must be positive."); + +#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 @@ -1940,10 +2024,6 @@ static_assert(COUNT(sanity_arr_3) <= XYZE_N, "DEFAULT_MAX_ACCELERATION has too m #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." @@ -1961,7 +2041,7 @@ static_assert(COUNT(sanity_arr_3) <= XYZE_N, "DEFAULT_MAX_ACCELERATION has too m #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 @@ -1972,3 +2052,88 @@ static_assert(COUNT(sanity_arr_3) <= XYZE_N, "DEFAULT_MAX_ACCELERATION has too m #if ENABLED(GCODE_MACROS) && !WITHIN(GCODE_MACROS_SLOTS, 1, 10) #error "GCODE_MACROS_SLOTS must be a number from 1 to 10." #endif + +#if ENABLED(CUSTOM_USER_MENUS) + #ifdef USER_GCODE_1 + constexpr char _chr1 = USER_GCODE_1[strlen(USER_GCODE_1) - 1]; + static_assert(_chr1 != '\n' && _chr1 != '\r', "USER_GCODE_1 cannot have a newline at the end. Please remove it."); + #endif + #ifdef USER_GCODE_2 + constexpr char _chr2 = USER_GCODE_2[strlen(USER_GCODE_2) - 1]; + static_assert(_chr2 != '\n' && _chr2 != '\r', "USER_GCODE_2 cannot have a newline at the end. Please remove it."); + #endif + #ifdef USER_GCODE_3 + constexpr char _chr3 = USER_GCODE_3[strlen(USER_GCODE_3) - 1]; + static_assert(_chr3 != '\n' && _chr3 != '\r', "USER_GCODE_3 cannot have a newline at the end. Please remove it."); + #endif + #ifdef USER_GCODE_4 + constexpr char _chr4 = USER_GCODE_4[strlen(USER_GCODE_4) - 1]; + static_assert(_chr4 != '\n' && _chr4 != '\r', "USER_GCODE_4 cannot have a newline at the end. Please remove it."); + #endif + #ifdef USER_GCODE_5 + constexpr char _chr5 = USER_GCODE_5[strlen(USER_GCODE_5) - 1]; + static_assert(_chr5 != '\n' && _chr5 != '\r', "USER_GCODE_5 cannot have a newline at the end. Please remove it."); + #endif +#endif + +#if ENABLED(BACKLASH_COMPENSATION) && IS_CORE + #error "BACKLASH_COMPENSATION is incompatible with CORE kinematics." +#endif + +#if ENABLED(GRADIENT_MIX) && MIXING_VIRTUAL_TOOLS < 2 + #error "GRADIENT_MIX requires 2 or more MIXING_VIRTUAL_TOOLS." +#endif + +/** + * Photo G-code requirements + */ +#if ENABLED(PHOTO_GCODE) + #if (PIN_EXISTS(CHDK) + PIN_EXISTS(PHOTOGRAPH_PIN) + defined(PHOTO_SWITCH_POSITION)) > 1 + #error "Please define only one of CHDK_PIN, PHOTOGRAPH_PIN, or PHOTO_SWITCH_POSITION." + #elif defined(PHOTO_SWITCH_POSITION) && !defined(PHOTO_POSITION) + #error "PHOTO_SWITCH_POSITION requires PHOTO_POSITION. Please update your Configuration_adv.h." + #elif PIN_EXISTS(CHDK) && defined(CHDK_DELAY) + #error "CHDK_DELAY has been replaced by PHOTO_SWITCH_MS. Please update your Configuration_adv.h." + #elif PIN_EXISTS(CHDK) && !defined(PHOTO_SWITCH_MS) + #error "PHOTO_SWITCH_MS is required with CHDK_PIN. Please update your Configuration_adv.h." + #elif defined(PHOTO_RETRACT_MM) + static_assert(PHOTO_RETRACT_MM + 0 >= 0, "PHOTO_RETRACT_MM must be >= 0."); + #endif +#endif + +/** + * Prusa MMU2 requirements + */ +#if ENABLED(PRUSA_MMU2) + #if DISABLED(NOZZLE_PARK_FEATURE) + #error "PRUSA_MMU2 requires NOZZLE_PARK_FEATURE." + #elif EXTRUDERS != 5 + #error "PRUSA_MMU2 requires EXTRUDERS = 5." + #elif DISABLED(ADVANCED_PAUSE_FEATURE) + static_assert(NULL == strstr(MMU2_FILAMENT_RUNOUT_SCRIPT, "M600"), "ADVANCED_PAUSE_FEATURE is required to use M600 with PRUSA_MMU2."); + #endif +#endif + +/** + * Advanced PRINTCOUNTER settings + */ +#if ENABLED(PRINTCOUNTER) + #if defined(SERVICE_INTERVAL_1) != defined(SERVICE_NAME_1) + #error "Both SERVICE_NAME_1 and SERVICE_INTERVAL_1 are required." + #elif defined(SERVICE_INTERVAL_2) != defined(SERVICE_NAME_2) + #error "Both SERVICE_NAME_2 and SERVICE_INTERVAL_2 are required." + #elif defined(SERVICE_INTERVAL_3) != defined(SERVICE_NAME_3) + #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 5b023079fc6e..0ff190e67c08 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp b/Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp index c309500b137a..c8927725c509 100644 --- a/Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp +++ b/Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 @@ -80,6 +80,14 @@ #endif ); +#elif ENABLED(SR_LCD_3W_NL) + + // NewLiquidCrystal was not working + // https://github.com/mikeshub/SailfishLCD + // uses the code directly from Sailfish + + LCD_CLASS lcd(SR_STROBE_PIN, SR_DATA_PIN, SR_CLK_PIN); + #elif ENABLED(LCM1602) LCD_CLASS lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); @@ -103,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 @@ -507,9 +515,9 @@ 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(" ")); + lcd_put_u8str_P(axis == Z_AXIS ? PSTR(" ") : PSTR(" ")); else #endif lcd_put_u8str(value); @@ -528,7 +536,7 @@ FORCE_INLINE void _draw_heater_status(const int8_t heater, const char prefix, co if (prefix >= 0) lcd_put_wchar(prefix); - lcd_put_u8str(itostr3(t1 + 0.5)); + lcd_put_u8str(i16tostr3(t1 + 0.5)); lcd_put_wchar('/'); #if !HEATER_IDLE_HANDLER @@ -536,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) { @@ -548,7 +556,7 @@ FORCE_INLINE void _draw_heater_status(const int8_t heater, const char prefix, co } else #endif - lcd_put_u8str(itostr3left(t2 + 0.5)); + lcd_put_u8str(i16tostr3left(t2 + 0.5)); if (prefix >= 0) { lcd_put_wchar(LCD_STR_DEGREE[0]); @@ -578,7 +586,7 @@ FORCE_INLINE void _draw_bed_status(const bool blink) { #endif )); if (progress) - lcd_put_u8str(itostr3(progress)); + lcd_put_u8str(ui8tostr3(progress)); else lcd_put_u8str_P(PSTR("---")); lcd_put_wchar('%'); @@ -620,14 +628,14 @@ 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)) { lcd_put_u8str_P(PSTR("Dia ")); lcd_put_u8str(ftostr12ns(filament_width_meas)); lcd_put_u8str_P(PSTR(" V")); - lcd_put_u8str(itostr3(100.0 * ( + lcd_put_u8str(i16tostr3(100.0 * ( parser.volumetric_enabled ? planner.volumetric_area_nominal / planner.volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM] : planner.volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM] @@ -652,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; - - // 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 + // 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 + + // 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 @@ -686,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 @@ -733,7 +722,7 @@ void MarlinUI::draw_status_message(const bool blink) { * |F---% SD---% T--:--| * |01234567890123456789| * - * LCD_INFO_SCREEN_STYLE 1 : Prusa-style Status Screen + * LCD_INFO_SCREEN_STYLE 1 : Průša-style Status Screen * * |T000/000° Z 000.00 | * |B000/000° F---% | @@ -824,11 +813,35 @@ void MarlinUI::draw_status_screen() { #else // HOTENDS <= 2 && (HOTENDS <= 1 || !HAS_HEATED_BED) - _draw_axis_value(X_AXIS, ftostr4sign(LOGICAL_X_POSITION(current_position[X_AXIS])), blink); + #if DUAL_MIXING_EXTRUDER - lcd_put_wchar(' '); + // Two-component mix / gradient instead of XY + + char mixer_messages[12]; + const char *mix_label; + #if ENABLED(GRADIENT_MIX) + if (mixer.gradient.enabled) { + mixer.update_mix_from_gradient(); + mix_label = "Gr"; + } + else + #endif + { + mixer.update_mix_from_vtool(); + mix_label = "Mx"; + } + sprintf_P(mixer_messages, PSTR("%s %d;%d%% "), mix_label, int(mixer.mix[0]), int(mixer.mix[1])); + lcd_put_u8str(mixer_messages); + + #else + + _draw_axis_value(X_AXIS, ftostr4sign(LOGICAL_X_POSITION(current_position[X_AXIS])), blink); + + lcd_put_wchar(' '); - _draw_axis_value(Y_AXIS, ftostr4sign(LOGICAL_Y_POSITION(current_position[Y_AXIS])), blink); + _draw_axis_value(Y_AXIS, ftostr4sign(LOGICAL_Y_POSITION(current_position[Y_AXIS])), blink); + + #endif #endif // HOTENDS <= 2 && (HOTENDS <= 1 || !HAS_HEATED_BED) @@ -849,7 +862,7 @@ void MarlinUI::draw_status_screen() { lcd_moveto(0, 2); lcd_put_wchar(LCD_STR_FEEDRATE[0]); - lcd_put_u8str(itostr3(feedrate_percentage)); + lcd_put_u8str(i16tostr3(feedrate_percentage)); lcd_put_wchar('%'); char buffer[14]; @@ -866,11 +879,15 @@ void MarlinUI::draw_status_screen() { _draw_print_progress(); #else char c; - int per; + uint16_t per; #if HAS_FAN0 - if (blink) { - c = 'F'; - per = ((int(fan_speed[0]) + 1) * 100) / 256; + if (blink || thermalManager.fan_speed_scaler[0] < 128) { + uint16_t spd = thermalManager.fan_speed[0]; + if (blink) c = 'F'; + #if ENABLED(ADAPTIVE_FAN_SLOWING) + else { c = '*'; spd = (spd * thermalManager.fan_speed_scaler[0]) >> 7; } + #endif + per = thermalManager.fanPercent(spd); } else #endif @@ -879,7 +896,7 @@ void MarlinUI::draw_status_screen() { per = planner.flow_percentage[0]; } lcd_put_wchar(c); - lcd_put_u8str(itostr3(per)); + lcd_put_u8str(i16tostr3(per)); lcd_put_wchar('%'); #endif #endif @@ -920,7 +937,7 @@ void MarlinUI::draw_status_screen() { lcd_moveto(LCD_WIDTH - 9, 1); lcd_put_wchar(LCD_STR_FEEDRATE[0]); - lcd_put_u8str(itostr3(feedrate_percentage)); + lcd_put_u8str(i16tostr3(feedrate_percentage)); lcd_put_wchar('%'); // ========== Line 3 ========== @@ -969,7 +986,7 @@ void MarlinUI::draw_status_screen() { void MarlinUI::draw_hotend_status(const uint8_t row, const uint8_t extruder) { if (row < LCD_HEIGHT) { lcd_moveto(LCD_WIDTH - 9, row); - _draw_heater_status(extruder, LCD_STR_THERMOMETER[0], ui.get_blink()); + _draw_heater_status(extruder, LCD_STR_THERMOMETER[0], get_blink()); } } @@ -1008,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(':'); @@ -1020,6 +1037,16 @@ void MarlinUI::draw_status_screen() { } } + void draw_select_screen(PGM_P const yes, PGM_P const no, const bool yesno, PGM_P const pref, const char * const string, PGM_P const suff) { + SETCURSOR(0, 0); lcd_put_u8str_P(pref); + if (string) wrap_string(1, string); + if (suff) lcd_put_u8str_P(suff); + SETCURSOR(0, LCD_HEIGHT - 1); + lcd_put_wchar(yesno ? ' ' : '['); lcd_put_u8str_P(no); lcd_put_wchar(yesno ? ' ' : ']'); + SETCURSOR_RJ(utf8_strlen_P(yes) + 2, LCD_HEIGHT - 1); + lcd_put_wchar(yesno ? '[' : ' '); lcd_put_u8str_P(yes); lcd_put_wchar(yesno ? ']' : ' '); + } + #if ENABLED(SDSUPPORT) void draw_sd_menu_item(const bool sel, const uint8_t row, PGM_P const pstr, CardReader &theCard, const bool isDir) { @@ -1049,13 +1076,13 @@ void MarlinUI::draw_status_screen() { #if FAN_COUNT > 0 if (0 #if HAS_FAN0 - || fan_speed[0] + || thermalManager.fan_speed[0] #endif #if HAS_FAN1 - || fan_speed[1] + || thermalManager.fan_speed[1] #endif #if HAS_FAN2 - || fan_speed[2] + || thermalManager.fan_speed[2] #endif ) leds |= LED_C; #endif // FAN_COUNT > 0 @@ -1374,9 +1401,9 @@ void MarlinUI::draw_status_screen() { */ lcd_moveto(_LCD_W_POS, 0); lcd_put_wchar('('); - lcd_put_u8str(itostr3(x)); + lcd_put_u8str(ui8tostr3(x)); lcd_put_wchar(','); - lcd_put_u8str(itostr3(inverted_y)); + lcd_put_u8str(ui8tostr3(inverted_y)); lcd_put_wchar(')'); #if LCD_HEIGHT <= 3 // 16x2 or 20x2 display diff --git a/Marlin/src/lcd/HD44780/ultralcd_HD44780.h b/Marlin/src/lcd/HD44780/ultralcd_HD44780.h index 9829619f54d0..5ca36cb2263e 100644 --- a/Marlin/src/lcd/HD44780/ultralcd_HD44780.h +++ b/Marlin/src/lcd/HD44780/ultralcd_HD44780.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -80,10 +80,19 @@ #elif ENABLED(SR_LCD_2W_NL) // 2 wire Non-latching LCD SR from: // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection - extern "C" void __cxa_pure_virtual() { while (1); } +// extern "C" void __cxa_pure_virtual() { while (1); } #include #include #define LCD_CLASS LiquidCrystal_SR +#elif ENABLED(SR_LCD_3W_NL) + +//NewLiquidCrystal was not working for me, but this worked first try +//https://github.com/mikeshub/SailfishLCD +//uses the code directly from Sailfish + + #include + #include + #define LCD_CLASS LiquidCrystalSerial #elif ENABLED(LCM1602) #include diff --git a/Marlin/src/lcd/dogm/HAL_LCD_class_defines.h b/Marlin/src/lcd/dogm/HAL_LCD_class_defines.h index e1a2ea98060e..d25b58d9a4f9 100644 --- a/Marlin/src/lcd/dogm/HAL_LCD_class_defines.h +++ b/Marlin/src/lcd/dogm/HAL_LCD_class_defines.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -81,3 +81,29 @@ class U8GLIB_SSD1306_128X64_2X_I2C_2_WIRE : public U8GLIB { : U8GLIB(&u8g_dev_ssd1306_128x64_2x_i2c_2_wire, options) { } }; + +// +// Very basic support for 320x240 TFT screen +// Tested on MKS Robin TFT_V2.0 with ST7789V controller +// +extern u8g_dev_t u8g_dev_tft_320x240_upscale_from_128x64; + +class U8GLIB_TFT_320X240_UPSCALE_FROM_128X64 : public U8GLIB { +public: + U8GLIB_TFT_320X240_UPSCALE_FROM_128X64(uint8_t cs, uint8_t rs, uint8_t reset = U8G_PIN_NONE) + : U8GLIB(&u8g_dev_tft_320x240_upscale_from_128x64, cs, rs, reset) + { } +}; + + +extern u8g_dev_t u8g_dev_uc1701_mini12864_HAL_2x_sw_spi, u8g_dev_uc1701_mini12864_HAL_2x_hw_spi; + +class U8GLIB_MINI12864_2X_HAL : public U8GLIB { +public: + U8GLIB_MINI12864_2X_HAL(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) + : U8GLIB(&u8g_dev_uc1701_mini12864_HAL_2x_sw_spi, sck, mosi, cs, a0, reset) + { } + U8GLIB_MINI12864_2X_HAL(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) + : U8GLIB(&u8g_dev_uc1701_mini12864_HAL_2x_hw_spi, cs, a0, reset) + { } +}; diff --git a/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h b/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h index 7095307cebc0..79f7f2f35857 100644 --- a/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h +++ b/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -47,6 +47,12 @@ 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 + #ifdef 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 + #define U8G_COM_HAL_FSMC_FN u8g_com_null_fn + #endif #elif TARGET_LPC1768 uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); #define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_LPC1768_sw_spi_fn @@ -63,6 +69,8 @@ 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_HAL_LPC1768_ssd_hw_i2c_fn + #define U8G_COM_HAL_FSMC_FN u8g_com_null_fn + #else // need to give them some definition or else get compiler errors uint8_t u8g_com_null_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); #define U8G_COM_HAL_SW_SPI_FN u8g_com_null_fn @@ -70,4 +78,5 @@ #define U8G_COM_ST7920_HAL_SW_SPI u8g_com_null_fn #define U8G_COM_ST7920_HAL_HW_SPI u8g_com_null_fn #define U8G_COM_SSD_I2C_HAL u8g_com_null_fn + #define U8G_COM_HAL_FSMC_FN u8g_com_null_fn #endif diff --git a/Marlin/src/lcd/dogm/dogm_Bootscreen.h b/Marlin/src/lcd/dogm/dogm_Bootscreen.h index efb299b359fe..aafe6dfbfdfa 100644 --- a/Marlin/src/lcd/dogm/dogm_Bootscreen.h +++ b/Marlin/src/lcd/dogm/dogm_Bootscreen.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -27,111 +27,99 @@ * http://marlinfw.org/tools/u8glib/converter.html */ -#include - #include "../../inc/MarlinConfig.h" -#if ENABLED(SHOW_BOOTSCREEN) - - //#define START_BMPHIGH // Costs 399 bytes more flash - - #if ENABLED(SHOW_CUSTOM_BOOTSCREEN) - - #include "../../../_Bootscreen.h" +#if ENABLED(SHOW_CUSTOM_BOOTSCREEN) - #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 +#endif - static_assert(sizeof(start_bmp) == (START_BMP_BYTEWIDTH) * (START_BMPHEIGHT), "Bootscreen (start_bmp) dimensions don't match data."); +#if ENABLED(BOOT_MARLIN_LOGO_SMALL) + + #define START_BMPWIDTH 56 + + const unsigned char start_bmp[] PROGMEM = { + B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111, + B01100000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111, + B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111, + B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111, + B10000011,B11001111,B00000000,B00000000,B00001100,B00110000,B00111111, + B10000111,B11111111,B10000000,B00000000,B00001100,B00110000,B00011111, + B10000110,B01111001,B10000000,B00000000,B00001100,B00000000,B00001111, + B10001100,B00110000,B11000111,B10000011,B10001100,B00110000,B11100111, + B10001100,B00110000,B11001111,B11000111,B11001100,B00110001,B11110011, + B10001100,B00110000,B11011100,B11101100,B11101100,B00110011,B10111001, + B10001100,B00110000,B11011000,B01101100,B01101100,B00110011,B00011001, + B10001100,B00110000,B11010000,B01101100,B00001100,B00110011,B00011001, + B10001100,B00110000,B11011000,B01101100,B00001100,B00110011,B00011001, + B10001100,B00110000,B11011100,B01101100,B00001110,B00111011,B00011001, + B10001100,B00110000,B11001111,B01111100,B00000111,B10011111,B00011001, + B10001100,B00110000,B11000111,B01111100,B00000011,B10001111,B00011001, + B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000010, + B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110, + B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111000 + }; + +#else + + #define START_BMPWIDTH 112 + + 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 + }; #endif -#ifndef CUSTOM_BOOTSCREEN_BMP_BYTEWIDTH - #define CUSTOM_BOOTSCREEN_BMP_BYTEWIDTH ((CUSTOM_BOOTSCREEN_BMPWIDTH + 7) / 8) +#ifndef START_BMP_BYTEWIDTH + #define START_BMP_BYTEWIDTH ((START_BMPWIDTH + 7) / 8) #endif -#ifndef CUSTOM_BOOTSCREEN_BMPHEIGHT - #define CUSTOM_BOOTSCREEN_BMPHEIGHT (sizeof(custom_start_bmp) / (CUSTOM_BOOTSCREEN_BMP_BYTEWIDTH)) +#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 9a0f07944230..438d57ac7f56 100644 --- a/Marlin/src/lcd/dogm/dogm_Statusscreen.h +++ b/Marlin/src/lcd/dogm/dogm_Statusscreen.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -27,8 +27,6 @@ * http://marlinfw.org/tools/u8glib/converter.html */ -#include - #include "../../inc/MarlinConfig.h" #define BW(N) ((N + 7) / 8) @@ -74,25 +72,25 @@ #if HAS_HEATED_BED && HOTENDS <= 3 - #define STATUS_BED_WIDTH 18 + #define STATUS_BED_WIDTH 21 #if HOTENDS == 0 - #define STATUS_HEATERS_WIDTH 18 + #define STATUS_HEATERS_WIDTH 21 const unsigned char status_heaters_bmp[] PROGMEM = { - B00100000,B10000010,B00000000, + B00000100,B00010000,B01000000, + B00000010,B00001000,B00100000, + B00000010,B00001000,B00100000, + B00000100,B00010000,B01000000, + B00001000,B00100000,B10000000, B00010000,B01000001,B00000000, B00010000,B01000001,B00000000, - B00100000,B10000010,B00000000, - B01000001,B00000100,B00000000, - B10000010,B00001000,B00000000, - B10000010,B00001000,B00000000, - B01000001,B00000100,B00000000, - B00100000,B10000010,B00000000, + B00001000,B00100000,B10000000, + B00000100,B00010000,B01000000, B00000000,B00000000,B00000000, - B11111111,B11111111,B11000000, - B11111111,B11111111,B11000000 + B00011111,B11111111,B11111000, + B00011111,B11111111,B11111000 }; #elif HOTENDS == 1 @@ -101,18 +99,18 @@ #define STATUS_BED_X 80 const unsigned char status_heaters_bmp[] PROGMEM = { - B00011111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000, - B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00010000,B01000001,B00000000, + B00011111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000100,B00010000,B01000000, + B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000010,B00001000,B00100000, + B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000010,B00001000,B00100000, + B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000100,B00010000,B01000000, + B00011111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001000,B00100000,B10000000, + B00011111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00010000,B01000001,B00000000, B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00010000,B01000001,B00000000, - B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000, - B00011111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01000001,B00000100,B00000000, - B00011111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B10000010,B00001000,B00000000, - B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B10000010,B00001000,B00000000, - B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01000001,B00000100,B00000000, - B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000, + B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001000,B00100000,B10000000, + B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000100,B00010000,B01000000, B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, - B00000111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000, - B00000011,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000 + B00000111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011111,B11111111,B11111000, + B00000011,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011111,B11111111,B11111000 }; #elif HOTENDS == 2 @@ -120,18 +118,18 @@ #define STATUS_HEATERS_WIDTH 90 const unsigned char status_heaters_bmp[] PROGMEM = { - B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000, - B00111110,B11110000,B00000000,B00111100,B11110000,B00000000,B00000000,B00000000,B00000000,B00010000,B01000001,B00000000, - B00111100,B11110000,B00000000,B00111011,B01110000,B00000000,B00000000,B00000000,B00000000,B00010000,B01000001,B00000000, - B00111010,B11110000,B00000000,B00111111,B01110000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000, - B00011110,B11100000,B00000000,B00011110,B11100000,B00000000,B00000000,B00000000,B00000000,B01000001,B00000100,B00000000, - B00011110,B11100000,B00000000,B00011101,B11100000,B00000000,B00000000,B00000000,B00000000,B10000010,B00001000,B00000000, - B00111110,B11110000,B00000000,B00111011,B11110000,B00000000,B00000000,B00000000,B00000000,B10000010,B00001000,B00000000, - B00111110,B11110000,B00000000,B00111000,B01110000,B00000000,B00000000,B00000000,B00000000,B01000001,B00000100,B00000000, - B00111111,B11110000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00100000,B10000010,B00000000, + B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000100,B00010000,B01000000, + B00111110,B11110000,B00000000,B00111100,B11110000,B00000000,B00000000,B00000000,B00000000,B00000010,B00001000,B00100000, + B00111100,B11110000,B00000000,B00111011,B01110000,B00000000,B00000000,B00000000,B00000000,B00000010,B00001000,B00100000, + B00111010,B11110000,B00000000,B00111111,B01110000,B00000000,B00000000,B00000000,B00000000,B00000100,B00010000,B01000000, + B00011110,B11100000,B00000000,B00011110,B11100000,B00000000,B00000000,B00000000,B00000000,B00001000,B00100000,B10000000, + B00011110,B11100000,B00000000,B00011101,B11100000,B00000000,B00000000,B00000000,B00000000,B00010000,B01000001,B00000000, + B00111110,B11110000,B00000000,B00111011,B11110000,B00000000,B00000000,B00000000,B00000000,B00010000,B01000001,B00000000, + B00111110,B11110000,B00000000,B00111000,B01110000,B00000000,B00000000,B00000000,B00000000,B00001000,B00100000,B10000000, + B00111111,B11110000,B00000000,B00111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000100,B00010000,B01000000, B00001111,B11000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, - B00000111,B10000000,B00000000,B00000111,B10000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000, - B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,B11000000 + B00000111,B10000000,B00000000,B00000111,B10000000,B00000000,B00000000,B00000000,B00000000,B00011111,B11111111,B11111000, + B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B00000000,B00000000,B00000000,B00011111,B11111111,B11111000 }; #else // HOTENDS > 2 @@ -139,18 +137,18 @@ #define STATUS_HEATERS_WIDTH 90 const unsigned char status_heaters_bmp[] PROGMEM = { - B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00100000,B10000010,B00000000, - B00111110,B11110000,B00000000,B00111100,B11110000,B00000000,B00111100,B11110000,B00000000,B00010000,B01000001,B00000000, - B00111100,B11110000,B00000000,B00111011,B01110000,B00000000,B00111011,B01110000,B00000000,B00010000,B01000001,B00000000, - B00111010,B11110000,B00000000,B00111111,B01110000,B00000000,B00111111,B01110000,B00000000,B00100000,B10000010,B00000000, - B00011110,B11100000,B00000000,B00011110,B11100000,B00000000,B00011100,B11100000,B00000000,B01000001,B00000100,B00000000, - B00011110,B11100000,B00000000,B00011101,B11100000,B00000000,B00011111,B01100000,B00000000,B10000010,B00001000,B00000000, - B00111110,B11110000,B00000000,B00111011,B11110000,B00000000,B00111011,B01110000,B00000000,B10000010,B00001000,B00000000, - B00111110,B11110000,B00000000,B00111000,B01110000,B00000000,B00111100,B11110000,B00000000,B01000001,B00000100,B00000000, - B00111111,B11110000,B00000000,B00111111,B11110000,B00000000,B00111111,B11110000,B00000000,B00100000,B10000010,B00000000, + B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00011111,B11100000,B00000000,B00000100,B00010000,B01000000, + B00111110,B11110000,B00000000,B00111100,B11110000,B00000000,B00111100,B11110000,B00000000,B00000010,B00001000,B00100000, + B00111100,B11110000,B00000000,B00111011,B01110000,B00000000,B00111011,B01110000,B00000000,B00000010,B00001000,B00100000, + B00111010,B11110000,B00000000,B00111111,B01110000,B00000000,B00111111,B01110000,B00000000,B00000100,B00010000,B01000000, + B00011110,B11100000,B00000000,B00011110,B11100000,B00000000,B00011100,B11100000,B00000000,B00001000,B00100000,B10000000, + B00011110,B11100000,B00000000,B00011101,B11100000,B00000000,B00011111,B01100000,B00000000,B00010000,B01000001,B00000000, + B00111110,B11110000,B00000000,B00111011,B11110000,B00000000,B00111011,B01110000,B00000000,B00010000,B01000001,B00000000, + B00111110,B11110000,B00000000,B00111000,B01110000,B00000000,B00111100,B11110000,B00000000,B00001000,B00100000,B10000000, + B00111111,B11110000,B00000000,B00111111,B11110000,B00000000,B00111111,B11110000,B00000000,B00000100,B00010000,B01000000, B00001111,B11000000,B00000000,B00001111,B11000000,B00000000,B00001111,B11000000,B00000000,B00000000,B00000000,B00000000, - B00000111,B10000000,B00000000,B00000111,B10000000,B00000000,B00000111,B10000000,B00000000,B11111111,B11111111,B11000000, - B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B11111111,B11111111,B11000000 + B00000111,B10000000,B00000000,B00000111,B10000000,B00000000,B00000111,B10000000,B00000000,B00011111,B11111111,B11111000, + B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B00000011,B00000000,B00000000,B00011111,B11111111,B11111000 }; #endif // HOTENDS @@ -582,7 +580,7 @@ #ifndef STATUS_BED_X #define STATUS_BED_X 72 #endif - #define STATUS_BED_TEXT_X STATUS_BED_X + 13 + #define STATUS_BED_TEXT_X (STATUS_BED_X + 13) const unsigned char status_bed_bmp[] PROGMEM = { B11111111,B11111111,B11000000, @@ -611,7 +609,7 @@ #else - #define STATUS_BED_WIDTH 18 + #define STATUS_BED_WIDTH 21 #ifndef STATUS_BED_X #define STATUS_BED_X 80 #endif @@ -619,40 +617,40 @@ #ifdef STATUS_BED_ANIM const unsigned char status_bed_bmp[] PROGMEM = { - B11111111,B11111111,B11000000, - B11111111,B11111111,B11000000 + B00011111,B11111111,B11111000, + B00011111,B11111111,B11111000 }; const unsigned char status_bed_on_bmp[] PROGMEM = { - B00100000,B10000010,B00000000, + B00000100,B00010000,B01000000, + B00000010,B00001000,B00100000, + B00000010,B00001000,B00100000, + B00000100,B00010000,B01000000, + B00001000,B00100000,B10000000, B00010000,B01000001,B00000000, B00010000,B01000001,B00000000, - B00100000,B10000010,B00000000, - B01000001,B00000100,B00000000, - B10000010,B00001000,B00000000, - B10000010,B00001000,B00000000, - B01000001,B00000100,B00000000, - B00100000,B10000010,B00000000, + B00001000,B00100000,B10000000, + B00000100,B00010000,B01000000, B00000000,B00000000,B00000000, - B11111111,B11111111,B11000000, - B11111111,B11111111,B11000000 + B00011111,B11111111,B11111000, + B00011111,B11111111,B11111000 }; #else const unsigned char status_bed_bmp[] PROGMEM = { - B00100000,B10000010,B00000000, + B00000100,B00010000,B01000000, + B00000010,B00001000,B00100000, + B00000010,B00001000,B00100000, + B00000100,B00010000,B01000000, + B00001000,B00100000,B10000000, B00010000,B01000001,B00000000, B00010000,B01000001,B00000000, - B00100000,B10000010,B00000000, - B01000001,B00000100,B00000000, - B10000010,B00001000,B00000000, - B10000010,B00001000,B00000000, - B01000001,B00000100,B00000000, - B00100000,B10000010,B00000000, + B00001000,B00100000,B10000000, + B00000100,B00010000,B01000000, B00000000,B00000000,B00000000, - B11111111,B11111111,B11000000, - B11111111,B11111111,B11000000 + B00011111,B11111111,B11111000, + B00011111,B11111111,B11111000 }; #endif @@ -668,8 +666,8 @@ #undef STATUS_FAN_FRAMES #elif !defined(STATUS_FAN_FRAMES) #define STATUS_FAN_FRAMES 2 -#elif STATUS_FAN_FRAMES > 3 - #error "Only 3 fan animation frames currently supported." +#elif STATUS_FAN_FRAMES > 4 + #error "A maximum of 4 fan animation frames is currently supported." #endif // @@ -684,206 +682,417 @@ #define STATUS_FAN_Y 2 #define STATUS_FAN_WIDTH 20 - const unsigned char status_fan0_bmp[] PROGMEM = { - B00111111,B11111111,B11110000, - B00111000,B00000000,B01110000, - B00110000,B11111100,B00110000, - B00100000,B11111100,B00010000, - B00100000,B01111000,B00010000, - B00100000,B00110000,B00010000, - B00101100,B00000000,B11010000, - B00101110,B00110001,B11010000, - B00101111,B01111011,B11010000, - B00101111,B01111011,B11010000, - B00101110,B00110001,B11010000, - B00101100,B00000000,B11010000, - B00100000,B00110000,B00010000, - B00100000,B01111000,B00010000, - B00100000,B11111100,B00010000, - B00110000,B11111100,B00110000, - B00111000,B00000000,B01110000, - B00111111,B11111111,B11110000 - }; + #if ENABLED(STATUS_ALT_FAN_BITMAP) - #if STATUS_FAN_FRAMES == 2 - const unsigned char status_fan1_bmp[] PROGMEM = { + const unsigned char status_fan0_bmp[] PROGMEM = { + B00000001,B11111110,B00000000, + B00000110,B00000001,B10000000, + B00001000,B11111100,B01000000, + B00010000,B11111100,B00100000, + B00010000,B01111000,B00100000, + B00100000,B00110000,B00010000, + B00101100,B00000000,B11010000, + B00101110,B00110001,B11010000, + B00101111,B01111011,B11010000, + B00101111,B01111011,B11010000, + B00101110,B00110001,B11010000, + B00101100,B00000000,B11010000, + B00100000,B00110000,B00010000, + B00010000,B01111000,B00100000, + B00010000,B11111100,B00100000, + B00001000,B11111100,B01000000, + B00000110,B00000001,B10000000, + B00000001,B11111110,B00000000 + }; + + #if STATUS_FAN_FRAMES == 2 + const unsigned char status_fan1_bmp[] PROGMEM = { + B00000001,B11111110,B00000000, + B00000110,B00000001,B10000000, + B00001001,B10000110,B01000000, + B00010011,B10000111,B00100000, + B00010111,B10000111,B10100000, + B00101111,B10000111,B11010000, + B00101111,B00000011,B11010000, + B00100000,B00110000,B00010000, + B00100000,B01111000,B00010000, + B00100000,B01111000,B00010000, + B00100000,B00110000,B00010000, + B00101111,B00000011,B11010000, + B00101111,B10000111,B11010000, + B00010111,B10000111,B10100000, + B00010011,B10000111,B00100000, + B00001001,B10000110,B01000000, + B00000110,B00000001,B10000000, + B00000001,B11111110,B00000000 + }; + #endif + + #else // !STATUS_ALT_FAN_BITMAP + + const unsigned char status_fan0_bmp[] PROGMEM = { B00111111,B11111111,B11110000, B00111000,B00000000,B01110000, - B00110001,B10000110,B00110000, - B00100011,B10000111,B00010000, - B00100111,B10000111,B10010000, - B00101111,B10000111,B11010000, - B00101111,B00000011,B11010000, - B00100000,B00110000,B00010000, - B00100000,B01111000,B00010000, + B00110000,B11111100,B00110000, + B00100000,B11111100,B00010000, B00100000,B01111000,B00010000, B00100000,B00110000,B00010000, - B00101111,B00000011,B11010000, - B00101111,B10000111,B11010000, - B00100111,B10000111,B10010000, - B00100011,B10000111,B00010000, - B00110001,B10000110,B00110000, + B00101100,B00000000,B11010000, + B00101110,B00110001,B11010000, + B00101111,B01111011,B11010000, + B00101111,B01111011,B11010000, + B00101110,B00110001,B11010000, + B00101100,B00000000,B11010000, + B00100000,B00110000,B00010000, + B00100000,B01111000,B00010000, + B00100000,B11111100,B00010000, + B00110000,B11111100,B00110000, B00111000,B00000000,B01110000, B00111111,B11111111,B11110000 }; - #endif + + #if STATUS_FAN_FRAMES == 2 + const unsigned char status_fan1_bmp[] PROGMEM = { + B00111111,B11111111,B11110000, + B00111000,B00000000,B01110000, + B00110001,B10000110,B00110000, + B00100011,B10000111,B00010000, + B00100111,B10000111,B10010000, + B00101111,B10000111,B11010000, + B00101111,B00000011,B11010000, + B00100000,B00110000,B00010000, + B00100000,B01111000,B00010000, + B00100000,B01111000,B00010000, + B00100000,B00110000,B00010000, + B00101111,B00000011,B11010000, + B00101111,B10000111,B11010000, + B00100111,B10000111,B10010000, + B00100011,B10000111,B00010000, + B00110001,B10000110,B00110000, + B00111000,B00000000,B01110000, + B00111111,B11111111,B11110000 + }; + #endif + + #endif // !STATUS_ALT_FAN_BITMAP #elif STATUS_FAN_FRAMES == 3 #define STATUS_FAN_WIDTH 21 - const unsigned char status_fan0_bmp[] PROGMEM = { - B00111111,B11111111,B11111000, - B00111110,B00000000,B11111000, - B00111001,B00000001,B00111000, - B00110111,B10000011,B11011000, - B00110111,B10000011,B11011000, - B00101111,B11000111,B11101000, - B00100111,B11000111,B11001000, - B00100001,B11111111,B00001000, - B00100000,B01111100,B00001000, - B00100000,B01111100,B00001000, - B00100000,B01111100,B00001000, - B00100001,B11111111,B00001000, - B00100111,B11000111,B11001000, - B00101111,B11000111,B11101000, - B00110111,B10000011,B11011000, - B00110111,B10000011,B11011000, - B00111001,B00000001,B00111000, - B00111110,B00000000,B11111000, - B00111111,B11111111,B11111000 - }; - const unsigned char status_fan1_bmp[] PROGMEM = { - B00111111,B11111111,B11111000, - B00111110,B00110000,B11111000, - B00111001,B11110000,B00111000, - B00110001,B11110000,B00011000, - B00110000,B11110000,B00011000, - B00100000,B11110000,B01101000, - B00100000,B00110001,B11101000, - B00100000,B00111001,B11101000, - B00100000,B01111111,B11111000, - B00111111,B11111111,B11111000, - B00111111,B11111100,B00001000, - B00101111,B00111000,B00001000, - B00101110,B00011000,B00001000, - B00101100,B00011110,B00001000, - B00110000,B00011110,B00011000, - B00110000,B00011111,B00011000, - B00111000,B00011111,B00111000, - B00111110,B00011000,B11111000, - B00111111,B11111111,B11111000 - }; - const unsigned char status_fan2_bmp[] PROGMEM = { - B00111111,B11111111,B11111000, - B00111110,B00011000,B11111000, - B00111000,B00011111,B00111000, - B00110000,B00011111,B10011000, - B00110100,B00011111,B00011000, - B00101110,B00011110,B00001000, - B00101111,B00011100,B00001000, - B00101111,B10111000,B00001000, - B00111111,B11111100,B00001000, - B00111111,B11111111,B11111000, - B00100000,B01111111,B11111000, - B00100000,B00111011,B11101000, - B00100000,B01110001,B11101000, - B00100000,B11110000,B11101000, - B00110001,B11110000,B01011000, - B00110011,B11110000,B00011000, - B00111001,B11110000,B00111000, - B00111110,B00110000,B11111000, - B00111111,B11111111,B11111000 - }; + #if ENABLED(STATUS_ALT_FAN_BITMAP) + + const unsigned char status_fan0_bmp[] PROGMEM = { + B00000001,B11111111,B00000000, + B00000110,B00000000,B11000000, + B00001001,B00000001,B00100000, + B00010111,B10000011,B11010000, + B00010111,B10000011,B11010000, + B00101111,B11000111,B11101000, + B00100111,B11000111,B11001000, + B00100001,B11111111,B00001000, + B00100000,B01111100,B00001000, + B00100000,B01111100,B00001000, + B00100000,B01111100,B00001000, + B00100001,B11111111,B00001000, + B00100111,B11000111,B11001000, + B00101111,B11000111,B11101000, + B00010111,B10000011,B11010000, + B00010111,B10000011,B11010000, + B00001001,B00000001,B00100000, + B00000110,B00000000,B11000000, + B00000001,B11111111,B00000000 + }; + const unsigned char status_fan1_bmp[] PROGMEM = { + B00000001,B11111111,B00000000, + B00000110,B00110000,B11000000, + B00001001,B11110000,B00100000, + B00010001,B11110000,B00010000, + B00010000,B11110000,B00010000, + B00100000,B11110000,B01101000, + B00100000,B00110001,B11101000, + B00100000,B00111001,B11101000, + B00100000,B01111111,B11111000, + B00111111,B11111111,B11111000, + B00111111,B11111100,B00001000, + B00101111,B00111000,B00001000, + B00101110,B00011000,B00001000, + B00101100,B00011110,B00001000, + B00010000,B00011110,B00010000, + B00010000,B00011111,B00010000, + B00001000,B00011111,B00100000, + B00000110,B00011000,B11000000, + B00000001,B11111111,B00000000 + }; + const unsigned char status_fan2_bmp[] PROGMEM = { + B00000001,B11111111,B00000000, + B00000110,B00011000,B11000000, + B00001000,B00011111,B00100000, + B00010000,B00011111,B10010000, + B00010100,B00011111,B00010000, + B00101110,B00011110,B00001000, + B00101111,B00011100,B00001000, + B00101111,B10111000,B00001000, + B00111111,B11111100,B00001000, + B00111111,B11111111,B11111000, + B00100000,B01111111,B11111000, + B00100000,B00111011,B11101000, + B00100000,B01110001,B11101000, + B00100000,B11110000,B11101000, + B00010001,B11110000,B01010000, + B00010011,B11110000,B00010000, + B00001001,B11110000,B00100000, + B00000110,B00110000,B11000000, + B00000001,B11111111,B00000000 + }; + + #else // !STATUS_ALT_FAN_BITMAP + + const unsigned char status_fan0_bmp[] PROGMEM = { + B00111111,B11111111,B11111000, + B00111110,B00000000,B11111000, + B00111001,B00000001,B00111000, + B00110111,B10000011,B11011000, + B00110111,B10000011,B11011000, + B00101111,B11000111,B11101000, + B00100111,B11000111,B11001000, + B00100001,B11111111,B00001000, + B00100000,B01111100,B00001000, + B00100000,B01111100,B00001000, + B00100000,B01111100,B00001000, + B00100001,B11111111,B00001000, + B00100111,B11000111,B11001000, + B00101111,B11000111,B11101000, + B00110111,B10000011,B11011000, + B00110111,B10000011,B11011000, + B00111001,B00000001,B00111000, + B00111110,B00000000,B11111000, + B00111111,B11111111,B11111000 + }; + const unsigned char status_fan1_bmp[] PROGMEM = { + B00111111,B11111111,B11111000, + B00111110,B00110000,B11111000, + B00111001,B11110000,B00111000, + B00110001,B11110000,B00011000, + B00110000,B11110000,B00011000, + B00100000,B11110000,B01101000, + B00100000,B00110001,B11101000, + B00100000,B00111001,B11101000, + B00100000,B01111111,B11111000, + B00111111,B11111111,B11111000, + B00111111,B11111100,B00001000, + B00101111,B00111000,B00001000, + B00101110,B00011000,B00001000, + B00101100,B00011110,B00001000, + B00110000,B00011110,B00011000, + B00110000,B00011111,B00011000, + B00111000,B00011111,B00111000, + B00111110,B00011000,B11111000, + B00111111,B11111111,B11111000 + }; + const unsigned char status_fan2_bmp[] PROGMEM = { + B00111111,B11111111,B11111000, + B00111110,B00011000,B11111000, + B00111000,B00011111,B00111000, + B00110000,B00011111,B10011000, + B00110100,B00011111,B00011000, + B00101110,B00011110,B00001000, + B00101111,B00011100,B00001000, + B00101111,B10111000,B00001000, + B00111111,B11111100,B00001000, + B00111111,B11111111,B11111000, + B00100000,B01111111,B11111000, + B00100000,B00111011,B11101000, + B00100000,B01110001,B11101000, + B00100000,B11110000,B11101000, + B00110001,B11110000,B01011000, + B00110011,B11110000,B00011000, + B00111001,B11110000,B00111000, + B00111110,B00110000,B11111000, + B00111111,B11111111,B11111000 + }; + + #endif // !STATUS_ALT_FAN_BITMAP #elif STATUS_FAN_FRAMES == 4 #define STATUS_FAN_WIDTH 21 - const unsigned char status_fan0_bmp[] PROGMEM = { - B00111111,B11111111,B11111000, - B00111110,B00000000,B11111000, - B00111000,B00111111,B00111000, - B00110000,B01111110,B00011000, - B00110000,B01111100,B00011000, - B00101000,B01111100,B00001000, - B00101100,B00111000,B00001000, - B00101111,B00111001,B11001000, - B00101111,B11111111,B11101000, - B00101111,B11000111,B11101000, - B00101111,B11111111,B11101000, - B00100111,B00111001,B11101000, - B00100000,B00111000,B01101000, - B00100000,B01111100,B00101000, - B00110000,B01111100,B00011000, - B00110000,B11111100,B00011000, - B00111001,B11111000,B00111000, - B00111110,B00000000,B11111000, - B00111111,B11111111,B11111000 - }; - const unsigned char status_fan1_bmp[] PROGMEM = { - B00111111,B11111111,B11111000, - B00111110,B00000000,B11111000, - B00111000,B00001111,B00111000, - B00110100,B00011111,B11011000, - B00110110,B00011111,B10011000, - B00101111,B00011111,B00001000, - B00101111,B10011110,B00001000, - B00101111,B11111100,B00001000, - B00101111,B11011100,B00001000, - B00100111,B11101111,B11001000, - B00100000,B01110111,B11101000, - B00100000,B01111111,B11101000, - B00100000,B11110011,B11101000, - B00100001,B11110001,B11101000, - B00110011,B11110000,B11011000, - B00110111,B11110000,B01011000, - B00111001,B11100000,B00111000, - B00111110,B00000000,B11111000, - B00111111,B11111111,B11111000 - }; - const unsigned char status_fan2_bmp[] PROGMEM = { - B00111111,B11111111,B11111000, - B00111110,B10000000,B11111000, - B00111001,B10000000,B00111000, - B00110111,B10000001,B11011000, - B00110111,B11000011,B11011000, - B00100111,B11000111,B11101000, - B00100011,B11000111,B11111000, - B00100001,B11111111,B10001000, - B00100000,B01101100,B00001000, - B00100000,B01101100,B00001000, - B00100000,B01101100,B00001000, - B00100011,B11111111,B00001000, - B00111111,B11000111,B10001000, - B00101111,B11000111,B11001000, - B00110111,B10000111,B11011000, - B00110111,B00000011,B11011000, - B00111000,B00000011,B00111000, - B00111110,B00000010,B11111000, - B00111111,B11111111,B11111000 - }; - const unsigned char status_fan3_bmp[] PROGMEM = { - B00111111,B11111111,B11111000, - B00111110,B00000000,B11111000, - B00111001,B11110000,B00111000, - B00110001,B11100000,B00011000, - B00110001,B11100000,B00011000, - B00100001,B11100001,B11101000, - B00100000,B11110011,B11101000, - B00100000,B01111111,B11101000, - B00100000,B01110111,B11101000, - B00101000,B11101110,B00101000, - B00101111,B11011100,B00001000, - B00101111,B11111100,B00001000, - B00101111,B10011110,B00001000, - B00101111,B00001111,B00001000, - B00110000,B00001111,B00011000, - B00110000,B00001111,B00011000, - B00111000,B00011111,B00111000, - B00111110,B00000000,B11111000, - B00111111,B11111111,B11111000 - }; + #if ENABLED(STATUS_ALT_FAN_BITMAP) + + const unsigned char status_fan0_bmp[] PROGMEM = { + B00000001,B11111111,B00000000, + B00000110,B00000000,B11000000, + B00001000,B00111111,B00100000, + B00010000,B01111110,B00010000, + B00010000,B01111100,B00010000, + B00101000,B01111100,B00001000, + B00101100,B00111000,B00001000, + B00101111,B00111001,B11001000, + B00101111,B11111111,B11101000, + B00101111,B11000111,B11101000, + B00101111,B11111111,B11101000, + B00100111,B00111001,B11101000, + B00100000,B00111000,B01101000, + B00100000,B01111100,B00101000, + B00010000,B01111100,B00010000, + B00010000,B11111100,B00010000, + B00001001,B11111000,B00100000, + B00000110,B00000000,B11000000, + B00000001,B11111111,B00000000 + }; + const unsigned char status_fan1_bmp[] PROGMEM = { + B00000001,B11111111,B00000000, + B00000110,B00000000,B11000000, + B00001000,B00001111,B00100000, + B00010100,B00011111,B11010000, + B00010110,B00011111,B10010000, + B00101111,B00011111,B00001000, + B00101111,B10011110,B00001000, + B00101111,B11111100,B00001000, + B00101111,B11011100,B00001000, + B00100111,B11101111,B11001000, + B00100000,B01110111,B11101000, + B00100000,B01111111,B11101000, + B00100000,B11110011,B11101000, + B00100001,B11110001,B11101000, + B00010011,B11110000,B11010000, + B00010111,B11110000,B01010000, + B00001001,B11100000,B00100000, + B00000110,B00000000,B11000000, + B00000001,B11111111,B00000000 + }; + const unsigned char status_fan2_bmp[] PROGMEM = { + B00000001,B11111111,B00000000, + B00000110,B10000000,B11000000, + B00001001,B10000000,B00100000, + B00010111,B10000001,B11010000, + B00010111,B11000011,B11010000, + B00100111,B11000111,B11101000, + B00100011,B11000111,B11111000, + B00100001,B11111111,B10001000, + B00100000,B01101100,B00001000, + B00100000,B01101100,B00001000, + B00100000,B01101100,B00001000, + B00100011,B11111111,B00001000, + B00111111,B11000111,B10001000, + B00101111,B11000111,B11001000, + B00010111,B10000111,B11010000, + B00010111,B00000011,B11010000, + B00001000,B00000011,B00100000, + B00000110,B00000010,B11000000, + B00000001,B11111111,B00000000 + }; + const unsigned char status_fan3_bmp[] PROGMEM = { + B00000001,B11111111,B00000000, + B00000110,B00000000,B11000000, + B00001001,B11110000,B00100000, + B00010001,B11100000,B00010000, + B00010001,B11100000,B00010000, + B00100001,B11100001,B11101000, + B00100000,B11110011,B11101000, + B00100000,B01111111,B11101000, + B00100000,B01110111,B11101000, + B00101000,B11101110,B00101000, + B00101111,B11011100,B00001000, + B00101111,B11111100,B00001000, + B00101111,B10011110,B00001000, + B00101111,B00001111,B00001000, + B00010000,B00001111,B00010000, + B00010000,B00001111,B00010000, + B00001000,B00011111,B00100000, + B00000110,B00000000,B11000000, + B00000001,B11111111,B00000000 + }; + + #else // !STATUS_ALT_FAN_BITMAP + + const unsigned char status_fan0_bmp[] PROGMEM = { + B00111111,B11111111,B11111000, + B00111110,B00000000,B11111000, + B00111000,B00111111,B00111000, + B00110000,B01111110,B00011000, + B00110000,B01111100,B00011000, + B00101000,B01111100,B00001000, + B00101100,B00111000,B00001000, + B00101111,B00111001,B11001000, + B00101111,B11111111,B11101000, + B00101111,B11000111,B11101000, + B00101111,B11111111,B11101000, + B00100111,B00111001,B11101000, + B00100000,B00111000,B01101000, + B00100000,B01111100,B00101000, + B00110000,B01111100,B00011000, + B00110000,B11111100,B00011000, + B00111001,B11111000,B00111000, + B00111110,B00000000,B11111000, + B00111111,B11111111,B11111000 + }; + const unsigned char status_fan1_bmp[] PROGMEM = { + B00111111,B11111111,B11111000, + B00111110,B00000000,B11111000, + B00111000,B00001111,B00111000, + B00110100,B00011111,B11011000, + B00110110,B00011111,B10011000, + B00101111,B00011111,B00001000, + B00101111,B10011110,B00001000, + B00101111,B11111100,B00001000, + B00101111,B11011100,B00001000, + B00100111,B11101111,B11001000, + B00100000,B01110111,B11101000, + B00100000,B01111111,B11101000, + B00100000,B11110011,B11101000, + B00100001,B11110001,B11101000, + B00110011,B11110000,B11011000, + B00110111,B11110000,B01011000, + B00111001,B11100000,B00111000, + B00111110,B00000000,B11111000, + B00111111,B11111111,B11111000 + }; + const unsigned char status_fan2_bmp[] PROGMEM = { + B00111111,B11111111,B11111000, + B00111110,B10000000,B11111000, + B00111001,B10000000,B00111000, + B00110111,B10000001,B11011000, + B00110111,B11000011,B11011000, + B00100111,B11000111,B11101000, + B00100011,B11000111,B11111000, + B00100001,B11111111,B10001000, + B00100000,B01101100,B00001000, + B00100000,B01101100,B00001000, + B00100000,B01101100,B00001000, + B00100011,B11111111,B00001000, + B00111111,B11000111,B10001000, + B00101111,B11000111,B11001000, + B00110111,B10000111,B11011000, + B00110111,B00000011,B11011000, + B00111000,B00000011,B00111000, + B00111110,B00000010,B11111000, + B00111111,B11111111,B11111000 + }; + const unsigned char status_fan3_bmp[] PROGMEM = { + B00111111,B11111111,B11111000, + B00111110,B00000000,B11111000, + B00111001,B11110000,B00111000, + B00110001,B11100000,B00011000, + B00110001,B11100000,B00011000, + B00100001,B11100001,B11101000, + B00100000,B11110011,B11101000, + B00100000,B01111111,B11101000, + B00100000,B01110111,B11101000, + B00101000,B11101110,B00101000, + B00101111,B11011100,B00001000, + B00101111,B11111100,B00001000, + B00101111,B10011110,B00001000, + B00101111,B00001111,B00001000, + B00110000,B00001111,B00011000, + B00110000,B00001111,B00011000, + B00111000,B00011111,B00111000, + B00111110,B00000000,B11111000, + B00111111,B11111111,B11111000 + }; + + #endif // !STATUS_ALT_FAN_BITMAP #endif @@ -1121,7 +1330,7 @@ #endif #ifndef STATUS_BED_TEXT_X - #define STATUS_BED_TEXT_X (STATUS_BED_X + 8) + #define STATUS_BED_TEXT_X (STATUS_BED_X + 11) #endif static_assert( diff --git a/Marlin/src/lcd/dogm/fontdata/fontdata_6x9_marlin.h b/Marlin/src/lcd/dogm/fontdata/fontdata_6x9_marlin.h index f298a6ac7882..911966d9149a 100644 --- a/Marlin/src/lcd/dogm/fontdata/fontdata_6x9_marlin.h +++ b/Marlin/src/lcd/dogm/fontdata/fontdata_6x9_marlin.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/lcd/dogm/fontdata/fontdata_ISO10646_1.h b/Marlin/src/lcd/dogm/fontdata/fontdata_ISO10646_1.h index 257ac3c34274..13e7c309576e 100644 --- a/Marlin/src/lcd/dogm/fontdata/fontdata_ISO10646_1.h +++ b/Marlin/src/lcd/dogm/fontdata/fontdata_ISO10646_1.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2018 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -32,91 +32,90 @@ X Font ascent = 8 descent=-2 Max Font ascent = 8 descent=-2 */ -const u8g_fntpgm_uint8_t ISO10646_1_5x7[1328] U8G_FONT_SECTION("ISO10646_1_5x7") = { - 0x00,0x06,0x0c,0x00,0xfe,0x07,0x02,0x29,0x03,0xbf,0x01,0x7f,0xfe,0x08,0xfe,0x08, +const u8g_fntpgm_uint8_t ISO10646_1_5x7[1325] U8G_FONT_SECTION("ISO10646_1_5x7") = { + 0x00,0x06,0x0c,0x00,0xfe,0x07,0x02,0x26,0x03,0xbc,0x01,0x7f,0xfe,0x08,0xfe,0x08, 0xfe,0x05,0x08,0x08,0x06,0x00,0x00,0x40,0xf0,0xc8,0x88,0x88,0x98,0x78,0x10,0x05, 0x08,0x08,0x06,0x00,0x00,0xc0,0xf8,0x88,0x88,0x88,0x88,0x88,0xf8,0x05,0x05,0x05, 0x06,0x00,0x01,0x20,0x30,0xf8,0x30,0x20,0x05,0x08,0x08,0x06,0x00,0x00,0x20,0x70, 0xf8,0x20,0x20,0x20,0x20,0xe0,0x05,0x09,0x09,0x06,0x00,0xff,0x20,0x70,0xa8,0xa8, - 0xb8,0x88,0x88,0x70,0x20,0x05,0x09,0x09,0x06,0x00,0xff,0xe0,0x80,0xc0,0xb0,0xa8, - 0x28,0x30,0x28,0x28,0x05,0x09,0x09,0x06,0x00,0xff,0xf8,0xa8,0x88,0x88,0x88,0x88, - 0x88,0xa8,0xf8,0x05,0x0a,0x0a,0x06,0x00,0xfe,0x20,0x50,0x50,0x50,0x50,0x88,0xa8, - 0xa8,0x88,0x70,0x03,0x03,0x03,0x06,0x00,0x03,0x40,0xa0,0x40,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0x00,0x00,0x00,0x06,0x05,0xff,0x01,0x07,0x07,0x06,0x02,0x00,0x80,0x80, - 0x80,0x80,0x80,0x00,0x80,0x03,0x03,0x03,0x06,0x01,0x05,0xa0,0xa0,0xa0,0x05,0x06, - 0x06,0x06,0x00,0x00,0x50,0xf8,0x50,0x50,0xf8,0x50,0x05,0x09,0x09,0x06,0x00,0xff, - 0x20,0x70,0xa8,0xa0,0x70,0x28,0xa8,0x70,0x20,0x05,0x07,0x07,0x06,0x00,0x00,0xc8, - 0xc8,0x10,0x20,0x40,0x98,0x98,0x05,0x07,0x07,0x06,0x00,0x00,0x40,0xa0,0xa0,0x40, - 0xa8,0x90,0x68,0x01,0x03,0x03,0x06,0x02,0x05,0x80,0x80,0x80,0x03,0x09,0x09,0x06, - 0x01,0xff,0x20,0x40,0x40,0x80,0x80,0x80,0x40,0x40,0x20,0x03,0x09,0x09,0x06,0x01, - 0xff,0x80,0x40,0x40,0x20,0x20,0x20,0x40,0x40,0x80,0x05,0x07,0x07,0x06,0x00,0x00, - 0x20,0xa8,0x70,0x20,0x70,0xa8,0x20,0x05,0x05,0x05,0x06,0x00,0x01,0x20,0x20,0xf8, - 0x20,0x20,0x02,0x03,0x03,0x06,0x01,0xff,0xc0,0x40,0x80,0x05,0x01,0x01,0x06,0x00, - 0x03,0xf8,0x02,0x02,0x02,0x06,0x01,0x00,0xc0,0xc0,0x05,0x07,0x07,0x06,0x00,0x00, - 0x08,0x10,0x10,0x20,0x40,0x40,0x80,0x05,0x07,0x07,0x06,0x00,0x00,0x70,0x88,0x98, - 0xa8,0xc8,0x88,0x70,0x03,0x07,0x07,0x06,0x01,0x00,0x40,0xc0,0x40,0x40,0x40,0x40, - 0xe0,0x05,0x07,0x07,0x06,0x00,0x00,0x70,0x88,0x08,0x10,0x20,0x40,0xf8,0x05,0x07, - 0x07,0x06,0x00,0x00,0xf8,0x08,0x10,0x30,0x08,0x88,0x70,0x05,0x07,0x07,0x06,0x00, - 0x00,0x10,0x30,0x50,0x90,0xf8,0x10,0x10,0x05,0x07,0x07,0x06,0x00,0x00,0xf8,0x80, - 0xf0,0x08,0x08,0x88,0x70,0x05,0x07,0x07,0x06,0x00,0x00,0x30,0x40,0x80,0xf0,0x88, - 0x88,0x70,0x05,0x07,0x07,0x06,0x00,0x00,0xf8,0x08,0x10,0x10,0x20,0x20,0x20,0x05, - 0x07,0x07,0x06,0x00,0x00,0x70,0x88,0x88,0x70,0x88,0x88,0x70,0x05,0x07,0x07,0x06, - 0x00,0x00,0x70,0x88,0x88,0x78,0x08,0x10,0x60,0x02,0x05,0x05,0x06,0x01,0x00,0xc0, - 0xc0,0x00,0xc0,0xc0,0x02,0x06,0x06,0x06,0x01,0xff,0xc0,0xc0,0x00,0xc0,0x40,0x80, - 0x03,0x05,0x05,0x06,0x01,0x01,0x20,0x40,0x80,0x40,0x20,0x05,0x03,0x03,0x06,0x00, - 0x02,0xf8,0x00,0xf8,0x03,0x05,0x05,0x06,0x01,0x01,0x80,0x40,0x20,0x40,0x80,0x05, - 0x07,0x07,0x06,0x00,0x00,0x70,0x88,0x10,0x20,0x20,0x00,0x20,0x05,0x07,0x07,0x06, - 0x00,0x00,0x70,0x88,0xb8,0xa8,0xb8,0x80,0x70,0x05,0x07,0x07,0x06,0x00,0x00,0x70, - 0x88,0x88,0xf8,0x88,0x88,0x88,0x05,0x07,0x07,0x06,0x00,0x00,0xf0,0x48,0x48,0x70, - 0x48,0x48,0xf0,0x05,0x07,0x07,0x06,0x00,0x00,0x70,0x88,0x80,0x80,0x80,0x88,0x70, - 0x05,0x07,0x07,0x06,0x00,0x00,0xf0,0x48,0x48,0x48,0x48,0x48,0xf0,0x05,0x07,0x07, - 0x06,0x00,0x00,0xf8,0x80,0x80,0xf0,0x80,0x80,0xf8,0x05,0x07,0x07,0x06,0x00,0x00, - 0xf8,0x80,0x80,0xf0,0x80,0x80,0x80,0x05,0x07,0x07,0x06,0x00,0x00,0x70,0x88,0x80, - 0x80,0x98,0x88,0x70,0x05,0x07,0x07,0x06,0x00,0x00,0x88,0x88,0x88,0xf8,0x88,0x88, - 0x88,0x03,0x07,0x07,0x06,0x01,0x00,0xe0,0x40,0x40,0x40,0x40,0x40,0xe0,0x05,0x07, - 0x07,0x06,0x00,0x00,0x38,0x10,0x10,0x10,0x10,0x90,0x60,0x05,0x07,0x07,0x06,0x00, - 0x00,0x88,0x90,0xa0,0xc0,0xa0,0x90,0x88,0x05,0x07,0x07,0x06,0x00,0x00,0x80,0x80, - 0x80,0x80,0x80,0x80,0xf8,0x05,0x07,0x07,0x06,0x00,0x00,0x88,0xd8,0xa8,0x88,0x88, - 0x88,0x88,0x05,0x07,0x07,0x06,0x00,0x00,0x88,0x88,0xc8,0xa8,0x98,0x88,0x88,0x05, - 0x07,0x07,0x06,0x00,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x05,0x07,0x07,0x06, - 0x00,0x00,0xf0,0x88,0x88,0xf0,0x80,0x80,0x80,0x05,0x07,0x07,0x06,0x00,0x00,0x70, - 0x88,0x88,0x88,0xa8,0x90,0x68,0x05,0x07,0x07,0x06,0x00,0x00,0xf0,0x88,0x88,0xf0, - 0xa0,0x90,0x88,0x05,0x07,0x07,0x06,0x00,0x00,0x70,0x88,0x80,0x70,0x08,0x88,0x70, - 0x05,0x07,0x07,0x06,0x00,0x00,0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x05,0x07,0x07, - 0x06,0x00,0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x05,0x07,0x07,0x06,0x00,0x00, - 0x88,0x88,0x88,0x88,0x50,0x50,0x20,0x05,0x07,0x07,0x06,0x00,0x00,0x88,0x88,0x88, - 0x88,0xa8,0xa8,0x50,0x05,0x07,0x07,0x06,0x00,0x00,0x88,0x88,0x50,0x20,0x50,0x88, - 0x88,0x05,0x07,0x07,0x06,0x00,0x00,0x88,0x88,0x50,0x20,0x20,0x20,0x20,0x05,0x07, - 0x07,0x06,0x00,0x00,0xf8,0x08,0x10,0x20,0x40,0x80,0xf8,0x03,0x09,0x09,0x06,0x01, - 0xff,0xe0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xe0,0x05,0x07,0x07,0x06,0x00,0x00, - 0x80,0x40,0x40,0x20,0x10,0x10,0x08,0x03,0x09,0x09,0x06,0x01,0xff,0xe0,0x20,0x20, - 0x20,0x20,0x20,0x20,0x20,0xe0,0x05,0x03,0x03,0x06,0x00,0x05,0x20,0x50,0x88,0x05, - 0x01,0x01,0x06,0x00,0xfe,0xf8,0x03,0x03,0x03,0x06,0x01,0x05,0x80,0x40,0x20,0x05, - 0x05,0x05,0x06,0x00,0x00,0x70,0x08,0x78,0x88,0x78,0x05,0x07,0x07,0x06,0x00,0x00, - 0x80,0x80,0xf0,0x88,0x88,0x88,0xf0,0x05,0x05,0x05,0x06,0x00,0x00,0x70,0x80,0x80, - 0x88,0x70,0x05,0x07,0x07,0x06,0x00,0x00,0x08,0x08,0x78,0x88,0x88,0x88,0x78,0x05, - 0x05,0x05,0x06,0x00,0x00,0x70,0x88,0xf0,0x80,0x70,0x05,0x07,0x07,0x06,0x00,0x00, - 0x30,0x48,0x40,0xe0,0x40,0x40,0x40,0x05,0x07,0x07,0x06,0x00,0xfe,0x70,0x88,0x88, - 0x88,0x78,0x08,0x70,0x05,0x07,0x07,0x06,0x00,0x00,0x80,0x80,0xf0,0x88,0x88,0x88, - 0x88,0x03,0x07,0x07,0x06,0x01,0x00,0x40,0x00,0xc0,0x40,0x40,0x40,0xe0,0x04,0x09, - 0x09,0x06,0x01,0xfe,0x10,0x00,0x30,0x10,0x10,0x10,0x10,0x90,0x60,0x05,0x07,0x07, - 0x06,0x00,0x00,0x80,0x80,0x88,0x90,0xe0,0x90,0x88,0x03,0x07,0x07,0x06,0x01,0x00, - 0xc0,0x40,0x40,0x40,0x40,0x40,0xe0,0x05,0x05,0x05,0x06,0x00,0x00,0xd0,0xa8,0xa8, - 0xa8,0xa8,0x05,0x05,0x05,0x06,0x00,0x00,0xb0,0xc8,0x88,0x88,0x88,0x05,0x05,0x05, - 0x06,0x00,0x00,0x70,0x88,0x88,0x88,0x70,0x05,0x07,0x07,0x06,0x00,0xfe,0xf0,0x88, - 0x88,0x88,0xf0,0x80,0x80,0x05,0x07,0x07,0x06,0x00,0xfe,0x78,0x88,0x88,0x88,0x78, - 0x08,0x08,0x05,0x05,0x05,0x06,0x00,0x00,0xb0,0xc8,0x80,0x80,0x80,0x05,0x05,0x05, - 0x06,0x00,0x00,0x78,0x80,0x70,0x08,0xf0,0x05,0x07,0x07,0x06,0x00,0x00,0x20,0x20, - 0xf8,0x20,0x20,0x20,0x18,0x05,0x05,0x05,0x06,0x00,0x00,0x88,0x88,0x88,0x98,0x68, - 0x05,0x05,0x05,0x06,0x00,0x00,0x88,0x88,0x88,0x50,0x20,0x05,0x05,0x05,0x06,0x00, - 0x00,0x88,0x88,0xa8,0xa8,0x50,0x05,0x05,0x05,0x06,0x00,0x00,0x88,0x50,0x20,0x50, - 0x88,0x05,0x07,0x07,0x06,0x00,0xfe,0x88,0x88,0x88,0x50,0x20,0x40,0x80,0x05,0x05, - 0x05,0x06,0x00,0x00,0xf8,0x10,0x20,0x40,0xf8,0x03,0x09,0x09,0x06,0x01,0xff,0x20, - 0x40,0x40,0x40,0x80,0x40,0x40,0x40,0x20,0x01,0x09,0x09,0x06,0x02,0xff,0x80,0x80, - 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x03,0x09,0x09,0x06,0x01,0xff,0x80,0x40,0x40, - 0x40,0x20,0x40,0x40,0x40,0x80,0x05,0x03,0x03,0x06,0x00,0x02,0x48,0xa8,0x90,0xff - }; + 0xb8,0x88,0x88,0x70,0x20,0x05,0x06,0x06,0x06,0x00,0x01,0xe0,0x8c,0xea,0x8c,0x8a, + 0x0a,0x05,0x09,0x09,0x06,0x00,0xff,0xf8,0xa8,0x88,0x88,0x88,0x88,0x88,0xa8,0xf8, + 0x05,0x0a,0x0a,0x06,0x00,0xfe,0x20,0x50,0x50,0x50,0x50,0x88,0xa8,0xa8,0x88,0x70, + 0x03,0x03,0x03,0x06,0x00,0x03,0x40,0xa0,0x40,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00, + 0x00,0x00,0x06,0x05,0xff,0x01,0x07,0x07,0x06,0x02,0x00,0x80,0x80,0x80,0x80,0x80, + 0x00,0x80,0x03,0x03,0x03,0x06,0x01,0x05,0xa0,0xa0,0xa0,0x05,0x06,0x06,0x06,0x00, + 0x00,0x50,0xf8,0x50,0x50,0xf8,0x50,0x05,0x09,0x09,0x06,0x00,0xff,0x20,0x70,0xa8, + 0xa0,0x70,0x28,0xa8,0x70,0x20,0x05,0x07,0x07,0x06,0x00,0x00,0xc8,0xc8,0x10,0x20, + 0x40,0x98,0x98,0x05,0x07,0x07,0x06,0x00,0x00,0x40,0xa0,0xa0,0x40,0xa8,0x90,0x68, + 0x01,0x03,0x03,0x06,0x02,0x05,0x80,0x80,0x80,0x03,0x09,0x09,0x06,0x01,0xff,0x20, + 0x40,0x40,0x80,0x80,0x80,0x40,0x40,0x20,0x03,0x09,0x09,0x06,0x01,0xff,0x80,0x40, + 0x40,0x20,0x20,0x20,0x40,0x40,0x80,0x05,0x07,0x07,0x06,0x00,0x00,0x20,0xa8,0x70, + 0x20,0x70,0xa8,0x20,0x05,0x05,0x05,0x06,0x00,0x01,0x20,0x20,0xf8,0x20,0x20,0x02, + 0x03,0x03,0x06,0x01,0xff,0xc0,0x40,0x80,0x05,0x01,0x01,0x06,0x00,0x03,0xf8,0x02, + 0x02,0x02,0x06,0x01,0x00,0xc0,0xc0,0x05,0x07,0x07,0x06,0x00,0x00,0x08,0x10,0x10, + 0x20,0x40,0x40,0x80,0x05,0x07,0x07,0x06,0x00,0x00,0x70,0x88,0x98,0xa8,0xc8,0x88, + 0x70,0x03,0x07,0x07,0x06,0x01,0x00,0x40,0xc0,0x40,0x40,0x40,0x40,0xe0,0x05,0x07, + 0x07,0x06,0x00,0x00,0x70,0x88,0x08,0x10,0x20,0x40,0xf8,0x05,0x07,0x07,0x06,0x00, + 0x00,0xf8,0x08,0x10,0x30,0x08,0x88,0x70,0x05,0x07,0x07,0x06,0x00,0x00,0x10,0x30, + 0x50,0x90,0xf8,0x10,0x10,0x05,0x07,0x07,0x06,0x00,0x00,0xf8,0x80,0xf0,0x08,0x08, + 0x88,0x70,0x05,0x07,0x07,0x06,0x00,0x00,0x30,0x40,0x80,0xf0,0x88,0x88,0x70,0x05, + 0x07,0x07,0x06,0x00,0x00,0xf8,0x08,0x10,0x10,0x20,0x20,0x20,0x05,0x07,0x07,0x06, + 0x00,0x00,0x70,0x88,0x88,0x70,0x88,0x88,0x70,0x05,0x07,0x07,0x06,0x00,0x00,0x70, + 0x88,0x88,0x78,0x08,0x10,0x60,0x02,0x05,0x05,0x06,0x01,0x00,0xc0,0xc0,0x00,0xc0, + 0xc0,0x02,0x06,0x06,0x06,0x01,0xff,0xc0,0xc0,0x00,0xc0,0x40,0x80,0x03,0x05,0x05, + 0x06,0x01,0x01,0x20,0x40,0x80,0x40,0x20,0x05,0x03,0x03,0x06,0x00,0x02,0xf8,0x00, + 0xf8,0x03,0x05,0x05,0x06,0x01,0x01,0x80,0x40,0x20,0x40,0x80,0x05,0x07,0x07,0x06, + 0x00,0x00,0x70,0x88,0x10,0x20,0x20,0x00,0x20,0x05,0x07,0x07,0x06,0x00,0x00,0x70, + 0x88,0xb8,0xa8,0xb8,0x80,0x70,0x05,0x07,0x07,0x06,0x00,0x00,0x70,0x88,0x88,0xf8, + 0x88,0x88,0x88,0x05,0x07,0x07,0x06,0x00,0x00,0xf0,0x48,0x48,0x70,0x48,0x48,0xf0, + 0x05,0x07,0x07,0x06,0x00,0x00,0x70,0x88,0x80,0x80,0x80,0x88,0x70,0x05,0x07,0x07, + 0x06,0x00,0x00,0xf0,0x48,0x48,0x48,0x48,0x48,0xf0,0x05,0x07,0x07,0x06,0x00,0x00, + 0xf8,0x80,0x80,0xf0,0x80,0x80,0xf8,0x05,0x07,0x07,0x06,0x00,0x00,0xf8,0x80,0x80, + 0xf0,0x80,0x80,0x80,0x05,0x07,0x07,0x06,0x00,0x00,0x70,0x88,0x80,0x80,0x98,0x88, + 0x70,0x05,0x07,0x07,0x06,0x00,0x00,0x88,0x88,0x88,0xf8,0x88,0x88,0x88,0x03,0x07, + 0x07,0x06,0x01,0x00,0xe0,0x40,0x40,0x40,0x40,0x40,0xe0,0x05,0x07,0x07,0x06,0x00, + 0x00,0x38,0x10,0x10,0x10,0x10,0x90,0x60,0x05,0x07,0x07,0x06,0x00,0x00,0x88,0x90, + 0xa0,0xc0,0xa0,0x90,0x88,0x05,0x07,0x07,0x06,0x00,0x00,0x80,0x80,0x80,0x80,0x80, + 0x80,0xf8,0x05,0x07,0x07,0x06,0x00,0x00,0x88,0xd8,0xa8,0x88,0x88,0x88,0x88,0x05, + 0x07,0x07,0x06,0x00,0x00,0x88,0x88,0xc8,0xa8,0x98,0x88,0x88,0x05,0x07,0x07,0x06, + 0x00,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x05,0x07,0x07,0x06,0x00,0x00,0xf0, + 0x88,0x88,0xf0,0x80,0x80,0x80,0x05,0x07,0x07,0x06,0x00,0x00,0x70,0x88,0x88,0x88, + 0xa8,0x90,0x68,0x05,0x07,0x07,0x06,0x00,0x00,0xf0,0x88,0x88,0xf0,0xa0,0x90,0x88, + 0x05,0x07,0x07,0x06,0x00,0x00,0x70,0x88,0x80,0x70,0x08,0x88,0x70,0x05,0x07,0x07, + 0x06,0x00,0x00,0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x05,0x07,0x07,0x06,0x00,0x00, + 0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x05,0x07,0x07,0x06,0x00,0x00,0x88,0x88,0x88, + 0x88,0x50,0x50,0x20,0x05,0x07,0x07,0x06,0x00,0x00,0x88,0x88,0x88,0x88,0xa8,0xa8, + 0x50,0x05,0x07,0x07,0x06,0x00,0x00,0x88,0x88,0x50,0x20,0x50,0x88,0x88,0x05,0x07, + 0x07,0x06,0x00,0x00,0x88,0x88,0x50,0x20,0x20,0x20,0x20,0x05,0x07,0x07,0x06,0x00, + 0x00,0xf8,0x08,0x10,0x20,0x40,0x80,0xf8,0x03,0x09,0x09,0x06,0x01,0xff,0xe0,0x80, + 0x80,0x80,0x80,0x80,0x80,0x80,0xe0,0x05,0x07,0x07,0x06,0x00,0x00,0x80,0x40,0x40, + 0x20,0x10,0x10,0x08,0x03,0x09,0x09,0x06,0x01,0xff,0xe0,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0xe0,0x05,0x03,0x03,0x06,0x00,0x05,0x20,0x50,0x88,0x05,0x01,0x01,0x06, + 0x00,0xfe,0xf8,0x03,0x03,0x03,0x06,0x01,0x05,0x80,0x40,0x20,0x05,0x05,0x05,0x06, + 0x00,0x00,0x70,0x08,0x78,0x88,0x78,0x05,0x07,0x07,0x06,0x00,0x00,0x80,0x80,0xf0, + 0x88,0x88,0x88,0xf0,0x05,0x05,0x05,0x06,0x00,0x00,0x70,0x80,0x80,0x88,0x70,0x05, + 0x07,0x07,0x06,0x00,0x00,0x08,0x08,0x78,0x88,0x88,0x88,0x78,0x05,0x05,0x05,0x06, + 0x00,0x00,0x70,0x88,0xf0,0x80,0x70,0x05,0x07,0x07,0x06,0x00,0x00,0x30,0x48,0x40, + 0xe0,0x40,0x40,0x40,0x05,0x07,0x07,0x06,0x00,0xfe,0x70,0x88,0x88,0x88,0x78,0x08, + 0x70,0x05,0x07,0x07,0x06,0x00,0x00,0x80,0x80,0xf0,0x88,0x88,0x88,0x88,0x03,0x07, + 0x07,0x06,0x01,0x00,0x40,0x00,0xc0,0x40,0x40,0x40,0xe0,0x04,0x09,0x09,0x06,0x01, + 0xfe,0x10,0x00,0x30,0x10,0x10,0x10,0x10,0x90,0x60,0x05,0x07,0x07,0x06,0x00,0x00, + 0x80,0x80,0x88,0x90,0xe0,0x90,0x88,0x03,0x07,0x07,0x06,0x01,0x00,0xc0,0x40,0x40, + 0x40,0x40,0x40,0xe0,0x05,0x05,0x05,0x06,0x00,0x00,0xd0,0xa8,0xa8,0xa8,0xa8,0x05, + 0x05,0x05,0x06,0x00,0x00,0xb0,0xc8,0x88,0x88,0x88,0x05,0x05,0x05,0x06,0x00,0x00, + 0x70,0x88,0x88,0x88,0x70,0x05,0x07,0x07,0x06,0x00,0xfe,0xf0,0x88,0x88,0x88,0xf0, + 0x80,0x80,0x05,0x07,0x07,0x06,0x00,0xfe,0x78,0x88,0x88,0x88,0x78,0x08,0x08,0x05, + 0x05,0x05,0x06,0x00,0x00,0xb0,0xc8,0x80,0x80,0x80,0x05,0x05,0x05,0x06,0x00,0x00, + 0x78,0x80,0x70,0x08,0xf0,0x05,0x07,0x07,0x06,0x00,0x00,0x20,0x20,0xf8,0x20,0x20, + 0x20,0x18,0x05,0x05,0x05,0x06,0x00,0x00,0x88,0x88,0x88,0x98,0x68,0x05,0x05,0x05, + 0x06,0x00,0x00,0x88,0x88,0x88,0x50,0x20,0x05,0x05,0x05,0x06,0x00,0x00,0x88,0x88, + 0xa8,0xa8,0x50,0x05,0x05,0x05,0x06,0x00,0x00,0x88,0x50,0x20,0x50,0x88,0x05,0x07, + 0x07,0x06,0x00,0xfe,0x88,0x88,0x88,0x50,0x20,0x40,0x80,0x05,0x05,0x05,0x06,0x00, + 0x00,0xf8,0x10,0x20,0x40,0xf8,0x03,0x09,0x09,0x06,0x01,0xff,0x20,0x40,0x40,0x40, + 0x80,0x40,0x40,0x40,0x20,0x01,0x09,0x09,0x06,0x02,0xff,0x80,0x80,0x80,0x80,0x80, + 0x80,0x80,0x80,0x80,0x03,0x09,0x09,0x06,0x01,0xff,0x80,0x40,0x40,0x40,0x20,0x40, + 0x40,0x40,0x80,0x05,0x03,0x03,0x06,0x00,0x02,0x48,0xa8,0x90,0xff}; #else // extended (original) font (symbols 1 - 255) @@ -131,172 +130,172 @@ const u8g_fntpgm_uint8_t ISO10646_1_5x7[1328] U8G_FONT_SECTION("ISO10646_1_5x7") X Font ascent = 8 descent=-2 Max Font ascent =10 descent=-2 */ -const u8g_fntpgm_uint8_t ISO10646_1_5x7[2651] U8G_FONT_SECTION("ISO10646_1_5x7") = { - 0x00,0x06,0x0c,0x00,0xfe,0x07,0x02,0x29,0x03,0xbf,0x01,0xff,0xfe,0x0a,0xfe,0x08, +const u8g_fntpgm_uint8_t ISO10646_1_5x7[2648] U8G_FONT_SECTION("ISO10646_1_5x7") = { + 0x00,0x06,0x0c,0x00,0xfe,0x07,0x02,0x26,0x03,0xbc,0x01,0xff,0xfe,0x0a,0xfe,0x08, 0xfe,0x05,0x08,0x08,0x06,0x00,0x00,0x40,0xf0,0xc8,0x88,0x88,0x98,0x78,0x10,0x05, 0x08,0x08,0x06,0x00,0x00,0xc0,0xf8,0x88,0x88,0x88,0x88,0x88,0xf8,0x05,0x05,0x05, 0x06,0x00,0x01,0x20,0x30,0xf8,0x30,0x20,0x05,0x08,0x08,0x06,0x00,0x00,0x20,0x70, 0xf8,0x20,0x20,0x20,0x20,0xe0,0x05,0x09,0x09,0x06,0x00,0xff,0x20,0x70,0xa8,0xa8, - 0xb8,0x88,0x88,0x70,0x20,0x05,0x09,0x09,0x06,0x00,0xff,0xe0,0x80,0xc0,0xb0,0xa8, - 0x28,0x30,0x28,0x28,0x05,0x09,0x09,0x06,0x00,0xff,0xf8,0xa8,0x88,0x88,0x88,0x88, - 0x88,0xa8,0xf8,0x05,0x0a,0x0a,0x06,0x00,0xfe,0x20,0x50,0x50,0x50,0x50,0x88,0xa8, - 0xa8,0x88,0x70,0x03,0x03,0x03,0x06,0x00,0x03,0x40,0xa0,0x40,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0x00,0x00,0x00,0x06,0x05,0xff,0x01,0x07,0x07,0x06,0x02,0x00,0x80,0x80, - 0x80,0x80,0x80,0x00,0x80,0x03,0x03,0x03,0x06,0x01,0x05,0xa0,0xa0,0xa0,0x05,0x06, - 0x06,0x06,0x00,0x00,0x50,0xf8,0x50,0x50,0xf8,0x50,0x05,0x09,0x09,0x06,0x00,0xff, - 0x20,0x70,0xa8,0xa0,0x70,0x28,0xa8,0x70,0x20,0x05,0x07,0x07,0x06,0x00,0x00,0xc8, - 0xc8,0x10,0x20,0x40,0x98,0x98,0x05,0x07,0x07,0x06,0x00,0x00,0x40,0xa0,0xa0,0x40, - 0xa8,0x90,0x68,0x01,0x03,0x03,0x06,0x02,0x05,0x80,0x80,0x80,0x03,0x09,0x09,0x06, - 0x01,0xff,0x20,0x40,0x40,0x80,0x80,0x80,0x40,0x40,0x20,0x03,0x09,0x09,0x06,0x01, - 0xff,0x80,0x40,0x40,0x20,0x20,0x20,0x40,0x40,0x80,0x05,0x07,0x07,0x06,0x00,0x00, - 0x20,0xa8,0x70,0x20,0x70,0xa8,0x20,0x05,0x05,0x05,0x06,0x00,0x01,0x20,0x20,0xf8, - 0x20,0x20,0x02,0x03,0x03,0x06,0x01,0xff,0xc0,0x40,0x80,0x05,0x01,0x01,0x06,0x00, - 0x03,0xf8,0x02,0x02,0x02,0x06,0x01,0x00,0xc0,0xc0,0x05,0x07,0x07,0x06,0x00,0x00, - 0x08,0x10,0x10,0x20,0x40,0x40,0x80,0x05,0x07,0x07,0x06,0x00,0x00,0x70,0x88,0x98, - 0xa8,0xc8,0x88,0x70,0x03,0x07,0x07,0x06,0x01,0x00,0x40,0xc0,0x40,0x40,0x40,0x40, - 0xe0,0x05,0x07,0x07,0x06,0x00,0x00,0x70,0x88,0x08,0x10,0x20,0x40,0xf8,0x05,0x07, - 0x07,0x06,0x00,0x00,0xf8,0x08,0x10,0x30,0x08,0x88,0x70,0x05,0x07,0x07,0x06,0x00, - 0x00,0x10,0x30,0x50,0x90,0xf8,0x10,0x10,0x05,0x07,0x07,0x06,0x00,0x00,0xf8,0x80, - 0xf0,0x08,0x08,0x88,0x70,0x05,0x07,0x07,0x06,0x00,0x00,0x30,0x40,0x80,0xf0,0x88, - 0x88,0x70,0x05,0x07,0x07,0x06,0x00,0x00,0xf8,0x08,0x10,0x10,0x20,0x20,0x20,0x05, - 0x07,0x07,0x06,0x00,0x00,0x70,0x88,0x88,0x70,0x88,0x88,0x70,0x05,0x07,0x07,0x06, - 0x00,0x00,0x70,0x88,0x88,0x78,0x08,0x10,0x60,0x02,0x05,0x05,0x06,0x01,0x00,0xc0, - 0xc0,0x00,0xc0,0xc0,0x02,0x06,0x06,0x06,0x01,0xff,0xc0,0xc0,0x00,0xc0,0x40,0x80, - 0x03,0x05,0x05,0x06,0x01,0x01,0x20,0x40,0x80,0x40,0x20,0x05,0x03,0x03,0x06,0x00, - 0x02,0xf8,0x00,0xf8,0x03,0x05,0x05,0x06,0x01,0x01,0x80,0x40,0x20,0x40,0x80,0x05, - 0x07,0x07,0x06,0x00,0x00,0x70,0x88,0x10,0x20,0x20,0x00,0x20,0x05,0x07,0x07,0x06, - 0x00,0x00,0x70,0x88,0xb8,0xa8,0xb8,0x80,0x70,0x05,0x07,0x07,0x06,0x00,0x00,0x70, - 0x88,0x88,0xf8,0x88,0x88,0x88,0x05,0x07,0x07,0x06,0x00,0x00,0xf0,0x48,0x48,0x70, - 0x48,0x48,0xf0,0x05,0x07,0x07,0x06,0x00,0x00,0x70,0x88,0x80,0x80,0x80,0x88,0x70, - 0x05,0x07,0x07,0x06,0x00,0x00,0xf0,0x48,0x48,0x48,0x48,0x48,0xf0,0x05,0x07,0x07, - 0x06,0x00,0x00,0xf8,0x80,0x80,0xf0,0x80,0x80,0xf8,0x05,0x07,0x07,0x06,0x00,0x00, - 0xf8,0x80,0x80,0xf0,0x80,0x80,0x80,0x05,0x07,0x07,0x06,0x00,0x00,0x70,0x88,0x80, - 0x80,0x98,0x88,0x70,0x05,0x07,0x07,0x06,0x00,0x00,0x88,0x88,0x88,0xf8,0x88,0x88, - 0x88,0x03,0x07,0x07,0x06,0x01,0x00,0xe0,0x40,0x40,0x40,0x40,0x40,0xe0,0x05,0x07, - 0x07,0x06,0x00,0x00,0x38,0x10,0x10,0x10,0x10,0x90,0x60,0x05,0x07,0x07,0x06,0x00, - 0x00,0x88,0x90,0xa0,0xc0,0xa0,0x90,0x88,0x05,0x07,0x07,0x06,0x00,0x00,0x80,0x80, - 0x80,0x80,0x80,0x80,0xf8,0x05,0x07,0x07,0x06,0x00,0x00,0x88,0xd8,0xa8,0x88,0x88, - 0x88,0x88,0x05,0x07,0x07,0x06,0x00,0x00,0x88,0x88,0xc8,0xa8,0x98,0x88,0x88,0x05, - 0x07,0x07,0x06,0x00,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x05,0x07,0x07,0x06, - 0x00,0x00,0xf0,0x88,0x88,0xf0,0x80,0x80,0x80,0x05,0x07,0x07,0x06,0x00,0x00,0x70, - 0x88,0x88,0x88,0xa8,0x90,0x68,0x05,0x07,0x07,0x06,0x00,0x00,0xf0,0x88,0x88,0xf0, - 0xa0,0x90,0x88,0x05,0x07,0x07,0x06,0x00,0x00,0x70,0x88,0x80,0x70,0x08,0x88,0x70, - 0x05,0x07,0x07,0x06,0x00,0x00,0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x05,0x07,0x07, - 0x06,0x00,0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x05,0x07,0x07,0x06,0x00,0x00, - 0x88,0x88,0x88,0x88,0x50,0x50,0x20,0x05,0x07,0x07,0x06,0x00,0x00,0x88,0x88,0x88, - 0x88,0xa8,0xa8,0x50,0x05,0x07,0x07,0x06,0x00,0x00,0x88,0x88,0x50,0x20,0x50,0x88, - 0x88,0x05,0x07,0x07,0x06,0x00,0x00,0x88,0x88,0x50,0x20,0x20,0x20,0x20,0x05,0x07, - 0x07,0x06,0x00,0x00,0xf8,0x08,0x10,0x20,0x40,0x80,0xf8,0x03,0x09,0x09,0x06,0x01, - 0xff,0xe0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xe0,0x05,0x07,0x07,0x06,0x00,0x00, - 0x80,0x40,0x40,0x20,0x10,0x10,0x08,0x03,0x09,0x09,0x06,0x01,0xff,0xe0,0x20,0x20, - 0x20,0x20,0x20,0x20,0x20,0xe0,0x05,0x03,0x03,0x06,0x00,0x05,0x20,0x50,0x88,0x05, - 0x01,0x01,0x06,0x00,0xfe,0xf8,0x03,0x03,0x03,0x06,0x01,0x05,0x80,0x40,0x20,0x05, - 0x05,0x05,0x06,0x00,0x00,0x70,0x08,0x78,0x88,0x78,0x05,0x07,0x07,0x06,0x00,0x00, - 0x80,0x80,0xf0,0x88,0x88,0x88,0xf0,0x05,0x05,0x05,0x06,0x00,0x00,0x70,0x80,0x80, - 0x88,0x70,0x05,0x07,0x07,0x06,0x00,0x00,0x08,0x08,0x78,0x88,0x88,0x88,0x78,0x05, - 0x05,0x05,0x06,0x00,0x00,0x70,0x88,0xf0,0x80,0x70,0x05,0x07,0x07,0x06,0x00,0x00, - 0x30,0x48,0x40,0xe0,0x40,0x40,0x40,0x05,0x07,0x07,0x06,0x00,0xfe,0x70,0x88,0x88, - 0x88,0x78,0x08,0x70,0x05,0x07,0x07,0x06,0x00,0x00,0x80,0x80,0xf0,0x88,0x88,0x88, - 0x88,0x03,0x07,0x07,0x06,0x01,0x00,0x40,0x00,0xc0,0x40,0x40,0x40,0xe0,0x04,0x09, - 0x09,0x06,0x01,0xfe,0x10,0x00,0x30,0x10,0x10,0x10,0x10,0x90,0x60,0x05,0x07,0x07, - 0x06,0x00,0x00,0x80,0x80,0x88,0x90,0xe0,0x90,0x88,0x03,0x07,0x07,0x06,0x01,0x00, - 0xc0,0x40,0x40,0x40,0x40,0x40,0xe0,0x05,0x05,0x05,0x06,0x00,0x00,0xd0,0xa8,0xa8, - 0xa8,0xa8,0x05,0x05,0x05,0x06,0x00,0x00,0xb0,0xc8,0x88,0x88,0x88,0x05,0x05,0x05, - 0x06,0x00,0x00,0x70,0x88,0x88,0x88,0x70,0x05,0x07,0x07,0x06,0x00,0xfe,0xf0,0x88, - 0x88,0x88,0xf0,0x80,0x80,0x05,0x07,0x07,0x06,0x00,0xfe,0x78,0x88,0x88,0x88,0x78, - 0x08,0x08,0x05,0x05,0x05,0x06,0x00,0x00,0xb0,0xc8,0x80,0x80,0x80,0x05,0x05,0x05, - 0x06,0x00,0x00,0x78,0x80,0x70,0x08,0xf0,0x05,0x07,0x07,0x06,0x00,0x00,0x20,0x20, - 0xf8,0x20,0x20,0x20,0x18,0x05,0x05,0x05,0x06,0x00,0x00,0x88,0x88,0x88,0x98,0x68, - 0x05,0x05,0x05,0x06,0x00,0x00,0x88,0x88,0x88,0x50,0x20,0x05,0x05,0x05,0x06,0x00, - 0x00,0x88,0x88,0xa8,0xa8,0x50,0x05,0x05,0x05,0x06,0x00,0x00,0x88,0x50,0x20,0x50, - 0x88,0x05,0x07,0x07,0x06,0x00,0xfe,0x88,0x88,0x88,0x50,0x20,0x40,0x80,0x05,0x05, - 0x05,0x06,0x00,0x00,0xf8,0x10,0x20,0x40,0xf8,0x03,0x09,0x09,0x06,0x01,0xff,0x20, - 0x40,0x40,0x40,0x80,0x40,0x40,0x40,0x20,0x01,0x09,0x09,0x06,0x02,0xff,0x80,0x80, - 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x03,0x09,0x09,0x06,0x01,0xff,0x80,0x40,0x40, - 0x40,0x20,0x40,0x40,0x40,0x80,0x05,0x03,0x03,0x06,0x00,0x02,0x48,0xa8,0x90,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xb8,0x88,0x88,0x70,0x20,0x05,0x06,0x06,0x06,0x00,0x01,0xe0,0x8c,0xea,0x8c,0x8a, + 0x0a,0x05,0x09,0x09,0x06,0x00,0xff,0xf8,0xa8,0x88,0x88,0x88,0x88,0x88,0xa8,0xf8, + 0x05,0x0a,0x0a,0x06,0x00,0xfe,0x20,0x50,0x50,0x50,0x50,0x88,0xa8,0xa8,0x88,0x70, + 0x03,0x03,0x03,0x06,0x00,0x03,0x40,0xa0,0x40,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00, + 0x00,0x00,0x06,0x05,0xff,0x01,0x07,0x07,0x06,0x02,0x00,0x80,0x80,0x80,0x80,0x80, + 0x00,0x80,0x03,0x03,0x03,0x06,0x01,0x05,0xa0,0xa0,0xa0,0x05,0x06,0x06,0x06,0x00, + 0x00,0x50,0xf8,0x50,0x50,0xf8,0x50,0x05,0x09,0x09,0x06,0x00,0xff,0x20,0x70,0xa8, + 0xa0,0x70,0x28,0xa8,0x70,0x20,0x05,0x07,0x07,0x06,0x00,0x00,0xc8,0xc8,0x10,0x20, + 0x40,0x98,0x98,0x05,0x07,0x07,0x06,0x00,0x00,0x40,0xa0,0xa0,0x40,0xa8,0x90,0x68, + 0x01,0x03,0x03,0x06,0x02,0x05,0x80,0x80,0x80,0x03,0x09,0x09,0x06,0x01,0xff,0x20, + 0x40,0x40,0x80,0x80,0x80,0x40,0x40,0x20,0x03,0x09,0x09,0x06,0x01,0xff,0x80,0x40, + 0x40,0x20,0x20,0x20,0x40,0x40,0x80,0x05,0x07,0x07,0x06,0x00,0x00,0x20,0xa8,0x70, + 0x20,0x70,0xa8,0x20,0x05,0x05,0x05,0x06,0x00,0x01,0x20,0x20,0xf8,0x20,0x20,0x02, + 0x03,0x03,0x06,0x01,0xff,0xc0,0x40,0x80,0x05,0x01,0x01,0x06,0x00,0x03,0xf8,0x02, + 0x02,0x02,0x06,0x01,0x00,0xc0,0xc0,0x05,0x07,0x07,0x06,0x00,0x00,0x08,0x10,0x10, + 0x20,0x40,0x40,0x80,0x05,0x07,0x07,0x06,0x00,0x00,0x70,0x88,0x98,0xa8,0xc8,0x88, + 0x70,0x03,0x07,0x07,0x06,0x01,0x00,0x40,0xc0,0x40,0x40,0x40,0x40,0xe0,0x05,0x07, + 0x07,0x06,0x00,0x00,0x70,0x88,0x08,0x10,0x20,0x40,0xf8,0x05,0x07,0x07,0x06,0x00, + 0x00,0xf8,0x08,0x10,0x30,0x08,0x88,0x70,0x05,0x07,0x07,0x06,0x00,0x00,0x10,0x30, + 0x50,0x90,0xf8,0x10,0x10,0x05,0x07,0x07,0x06,0x00,0x00,0xf8,0x80,0xf0,0x08,0x08, + 0x88,0x70,0x05,0x07,0x07,0x06,0x00,0x00,0x30,0x40,0x80,0xf0,0x88,0x88,0x70,0x05, + 0x07,0x07,0x06,0x00,0x00,0xf8,0x08,0x10,0x10,0x20,0x20,0x20,0x05,0x07,0x07,0x06, + 0x00,0x00,0x70,0x88,0x88,0x70,0x88,0x88,0x70,0x05,0x07,0x07,0x06,0x00,0x00,0x70, + 0x88,0x88,0x78,0x08,0x10,0x60,0x02,0x05,0x05,0x06,0x01,0x00,0xc0,0xc0,0x00,0xc0, + 0xc0,0x02,0x06,0x06,0x06,0x01,0xff,0xc0,0xc0,0x00,0xc0,0x40,0x80,0x03,0x05,0x05, + 0x06,0x01,0x01,0x20,0x40,0x80,0x40,0x20,0x05,0x03,0x03,0x06,0x00,0x02,0xf8,0x00, + 0xf8,0x03,0x05,0x05,0x06,0x01,0x01,0x80,0x40,0x20,0x40,0x80,0x05,0x07,0x07,0x06, + 0x00,0x00,0x70,0x88,0x10,0x20,0x20,0x00,0x20,0x05,0x07,0x07,0x06,0x00,0x00,0x70, + 0x88,0xb8,0xa8,0xb8,0x80,0x70,0x05,0x07,0x07,0x06,0x00,0x00,0x70,0x88,0x88,0xf8, + 0x88,0x88,0x88,0x05,0x07,0x07,0x06,0x00,0x00,0xf0,0x48,0x48,0x70,0x48,0x48,0xf0, + 0x05,0x07,0x07,0x06,0x00,0x00,0x70,0x88,0x80,0x80,0x80,0x88,0x70,0x05,0x07,0x07, + 0x06,0x00,0x00,0xf0,0x48,0x48,0x48,0x48,0x48,0xf0,0x05,0x07,0x07,0x06,0x00,0x00, + 0xf8,0x80,0x80,0xf0,0x80,0x80,0xf8,0x05,0x07,0x07,0x06,0x00,0x00,0xf8,0x80,0x80, + 0xf0,0x80,0x80,0x80,0x05,0x07,0x07,0x06,0x00,0x00,0x70,0x88,0x80,0x80,0x98,0x88, + 0x70,0x05,0x07,0x07,0x06,0x00,0x00,0x88,0x88,0x88,0xf8,0x88,0x88,0x88,0x03,0x07, + 0x07,0x06,0x01,0x00,0xe0,0x40,0x40,0x40,0x40,0x40,0xe0,0x05,0x07,0x07,0x06,0x00, + 0x00,0x38,0x10,0x10,0x10,0x10,0x90,0x60,0x05,0x07,0x07,0x06,0x00,0x00,0x88,0x90, + 0xa0,0xc0,0xa0,0x90,0x88,0x05,0x07,0x07,0x06,0x00,0x00,0x80,0x80,0x80,0x80,0x80, + 0x80,0xf8,0x05,0x07,0x07,0x06,0x00,0x00,0x88,0xd8,0xa8,0x88,0x88,0x88,0x88,0x05, + 0x07,0x07,0x06,0x00,0x00,0x88,0x88,0xc8,0xa8,0x98,0x88,0x88,0x05,0x07,0x07,0x06, + 0x00,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x05,0x07,0x07,0x06,0x00,0x00,0xf0, + 0x88,0x88,0xf0,0x80,0x80,0x80,0x05,0x07,0x07,0x06,0x00,0x00,0x70,0x88,0x88,0x88, + 0xa8,0x90,0x68,0x05,0x07,0x07,0x06,0x00,0x00,0xf0,0x88,0x88,0xf0,0xa0,0x90,0x88, + 0x05,0x07,0x07,0x06,0x00,0x00,0x70,0x88,0x80,0x70,0x08,0x88,0x70,0x05,0x07,0x07, + 0x06,0x00,0x00,0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x05,0x07,0x07,0x06,0x00,0x00, + 0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x05,0x07,0x07,0x06,0x00,0x00,0x88,0x88,0x88, + 0x88,0x50,0x50,0x20,0x05,0x07,0x07,0x06,0x00,0x00,0x88,0x88,0x88,0x88,0xa8,0xa8, + 0x50,0x05,0x07,0x07,0x06,0x00,0x00,0x88,0x88,0x50,0x20,0x50,0x88,0x88,0x05,0x07, + 0x07,0x06,0x00,0x00,0x88,0x88,0x50,0x20,0x20,0x20,0x20,0x05,0x07,0x07,0x06,0x00, + 0x00,0xf8,0x08,0x10,0x20,0x40,0x80,0xf8,0x03,0x09,0x09,0x06,0x01,0xff,0xe0,0x80, + 0x80,0x80,0x80,0x80,0x80,0x80,0xe0,0x05,0x07,0x07,0x06,0x00,0x00,0x80,0x40,0x40, + 0x20,0x10,0x10,0x08,0x03,0x09,0x09,0x06,0x01,0xff,0xe0,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0xe0,0x05,0x03,0x03,0x06,0x00,0x05,0x20,0x50,0x88,0x05,0x01,0x01,0x06, + 0x00,0xfe,0xf8,0x03,0x03,0x03,0x06,0x01,0x05,0x80,0x40,0x20,0x05,0x05,0x05,0x06, + 0x00,0x00,0x70,0x08,0x78,0x88,0x78,0x05,0x07,0x07,0x06,0x00,0x00,0x80,0x80,0xf0, + 0x88,0x88,0x88,0xf0,0x05,0x05,0x05,0x06,0x00,0x00,0x70,0x80,0x80,0x88,0x70,0x05, + 0x07,0x07,0x06,0x00,0x00,0x08,0x08,0x78,0x88,0x88,0x88,0x78,0x05,0x05,0x05,0x06, + 0x00,0x00,0x70,0x88,0xf0,0x80,0x70,0x05,0x07,0x07,0x06,0x00,0x00,0x30,0x48,0x40, + 0xe0,0x40,0x40,0x40,0x05,0x07,0x07,0x06,0x00,0xfe,0x70,0x88,0x88,0x88,0x78,0x08, + 0x70,0x05,0x07,0x07,0x06,0x00,0x00,0x80,0x80,0xf0,0x88,0x88,0x88,0x88,0x03,0x07, + 0x07,0x06,0x01,0x00,0x40,0x00,0xc0,0x40,0x40,0x40,0xe0,0x04,0x09,0x09,0x06,0x01, + 0xfe,0x10,0x00,0x30,0x10,0x10,0x10,0x10,0x90,0x60,0x05,0x07,0x07,0x06,0x00,0x00, + 0x80,0x80,0x88,0x90,0xe0,0x90,0x88,0x03,0x07,0x07,0x06,0x01,0x00,0xc0,0x40,0x40, + 0x40,0x40,0x40,0xe0,0x05,0x05,0x05,0x06,0x00,0x00,0xd0,0xa8,0xa8,0xa8,0xa8,0x05, + 0x05,0x05,0x06,0x00,0x00,0xb0,0xc8,0x88,0x88,0x88,0x05,0x05,0x05,0x06,0x00,0x00, + 0x70,0x88,0x88,0x88,0x70,0x05,0x07,0x07,0x06,0x00,0xfe,0xf0,0x88,0x88,0x88,0xf0, + 0x80,0x80,0x05,0x07,0x07,0x06,0x00,0xfe,0x78,0x88,0x88,0x88,0x78,0x08,0x08,0x05, + 0x05,0x05,0x06,0x00,0x00,0xb0,0xc8,0x80,0x80,0x80,0x05,0x05,0x05,0x06,0x00,0x00, + 0x78,0x80,0x70,0x08,0xf0,0x05,0x07,0x07,0x06,0x00,0x00,0x20,0x20,0xf8,0x20,0x20, + 0x20,0x18,0x05,0x05,0x05,0x06,0x00,0x00,0x88,0x88,0x88,0x98,0x68,0x05,0x05,0x05, + 0x06,0x00,0x00,0x88,0x88,0x88,0x50,0x20,0x05,0x05,0x05,0x06,0x00,0x00,0x88,0x88, + 0xa8,0xa8,0x50,0x05,0x05,0x05,0x06,0x00,0x00,0x88,0x50,0x20,0x50,0x88,0x05,0x07, + 0x07,0x06,0x00,0xfe,0x88,0x88,0x88,0x50,0x20,0x40,0x80,0x05,0x05,0x05,0x06,0x00, + 0x00,0xf8,0x10,0x20,0x40,0xf8,0x03,0x09,0x09,0x06,0x01,0xff,0x20,0x40,0x40,0x40, + 0x80,0x40,0x40,0x40,0x20,0x01,0x09,0x09,0x06,0x02,0xff,0x80,0x80,0x80,0x80,0x80, + 0x80,0x80,0x80,0x80,0x03,0x09,0x09,0x06,0x01,0xff,0x80,0x40,0x40,0x40,0x20,0x40, + 0x40,0x40,0x80,0x05,0x03,0x03,0x06,0x00,0x02,0x48,0xa8,0x90,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0x00,0x00,0x00,0x06,0x05,0xff,0x01,0x07,0x07,0x06,0x02,0x00,0x80,0x00,0x80,0x80, - 0x80,0x80,0x80,0x05,0x07,0x07,0x06,0x00,0xff,0x20,0x70,0xa8,0xa0,0xa8,0x70,0x20, - 0x05,0x07,0x07,0x06,0x00,0x00,0x30,0x48,0x40,0xe0,0x40,0x48,0xb0,0x05,0x05,0x05, - 0x06,0x00,0x00,0xa8,0x50,0x88,0x50,0xa8,0x05,0x07,0x07,0x06,0x00,0x00,0x88,0x50, - 0xf8,0x20,0xf8,0x20,0x20,0x01,0x07,0x07,0x06,0x02,0x00,0x80,0x80,0x80,0x00,0x80, - 0x80,0x80,0x04,0x08,0x08,0x06,0x01,0x00,0x70,0x80,0x60,0x90,0x90,0x60,0x10,0xe0, - 0x03,0x01,0x01,0x06,0x01,0x07,0xa0,0x06,0x07,0x07,0x06,0x00,0x00,0x78,0x84,0xb4, - 0xa4,0xb4,0x84,0x78,0x03,0x05,0x05,0x06,0x01,0x04,0x60,0xa0,0x60,0x00,0xe0,0x05, - 0x05,0x05,0x06,0x00,0x00,0x28,0x50,0xa0,0x50,0x28,0x05,0x03,0x03,0x06,0x00,0x01, - 0xf8,0x08,0x08,0x03,0x01,0x01,0x06,0x01,0x03,0xe0,0x06,0x07,0x07,0x06,0x00,0x00, - 0x78,0x84,0xb4,0xa4,0xa4,0x84,0x78,0x05,0x01,0x01,0x06,0x00,0x07,0xf8,0x04,0x04, - 0x04,0x06,0x01,0x05,0x60,0x90,0x90,0x60,0x05,0x07,0x07,0x06,0x00,0x00,0x20,0x20, - 0xf8,0x20,0x20,0x00,0xf8,0x03,0x05,0x05,0x06,0x01,0x04,0x40,0xa0,0x20,0x40,0xe0, - 0x03,0x05,0x05,0x06,0x01,0x04,0xc0,0x20,0x40,0x20,0xc0,0x03,0x03,0x03,0x06,0x01, - 0x05,0x20,0x40,0x80,0x05,0x07,0x07,0x06,0x00,0xfe,0x88,0x88,0x88,0x98,0xe8,0x80, - 0x80,0x05,0x08,0x08,0x06,0x00,0x00,0x78,0xe8,0xe8,0xe8,0x68,0x28,0x28,0x28,0x02, - 0x02,0x02,0x06,0x02,0x03,0xc0,0xc0,0x03,0x02,0x02,0x06,0x01,0xfe,0x20,0xc0,0x03, - 0x05,0x05,0x06,0x01,0x04,0x40,0xc0,0x40,0x40,0xe0,0x03,0x05,0x05,0x06,0x01,0x05, - 0x40,0xa0,0x40,0x00,0xe0,0x05,0x05,0x05,0x06,0x00,0x00,0xa0,0x50,0x28,0x50,0xa0, - 0x05,0x0a,0x0a,0x06,0x00,0x00,0x40,0xc0,0x48,0x50,0x60,0x50,0xb0,0x50,0x78,0x10, - 0x05,0x0a,0x0a,0x06,0x00,0x00,0x40,0xc0,0x48,0x50,0x60,0x50,0xa8,0x08,0x10,0x38, - 0x05,0x0a,0x0a,0x06,0x00,0x00,0xc0,0x20,0x48,0x30,0xe0,0x50,0xb0,0x50,0x78,0x10, - 0x05,0x07,0x07,0x06,0x00,0x00,0x20,0x00,0x20,0x20,0x40,0x88,0x70,0x05,0x0a,0x0a, - 0x06,0x00,0x00,0x40,0x20,0x00,0x70,0x88,0x88,0xf8,0x88,0x88,0x88,0x05,0x0a,0x0a, - 0x06,0x00,0x00,0x10,0x20,0x00,0x70,0x88,0x88,0xf8,0x88,0x88,0x88,0x05,0x0a,0x0a, - 0x06,0x00,0x00,0x20,0x50,0x00,0x70,0x88,0x88,0xf8,0x88,0x88,0x88,0x05,0x0a,0x0a, - 0x06,0x00,0x00,0x68,0xb0,0x00,0x70,0x88,0x88,0xf8,0x88,0x88,0x88,0x05,0x09,0x09, - 0x06,0x00,0x00,0x50,0x00,0x70,0x88,0x88,0xf8,0x88,0x88,0x88,0x05,0x0a,0x0a,0x06, - 0x00,0x00,0x20,0x50,0x20,0x70,0x88,0x88,0xf8,0x88,0x88,0x88,0x05,0x07,0x07,0x06, - 0x00,0x00,0x78,0xa0,0xa0,0xf0,0xa0,0xa0,0xb8,0x05,0x09,0x09,0x06,0x00,0xfe,0x70, - 0x88,0x80,0x80,0x80,0x88,0x70,0x10,0x60,0x05,0x0a,0x0a,0x06,0x00,0x00,0x40,0x20, - 0x00,0xf8,0x80,0x80,0xf0,0x80,0x80,0xf8,0x05,0x0a,0x0a,0x06,0x00,0x00,0x10,0x20, - 0x00,0xf8,0x80,0x80,0xf0,0x80,0x80,0xf8,0x05,0x0a,0x0a,0x06,0x00,0x00,0x20,0x50, - 0x00,0xf8,0x80,0x80,0xf0,0x80,0x80,0xf8,0x05,0x09,0x09,0x06,0x00,0x00,0x50,0x00, - 0xf8,0x80,0x80,0xf0,0x80,0x80,0xf8,0x03,0x0a,0x0a,0x06,0x01,0x00,0x80,0x40,0x00, - 0xe0,0x40,0x40,0x40,0x40,0x40,0xe0,0x03,0x0a,0x0a,0x06,0x01,0x00,0x20,0x40,0x00, - 0xe0,0x40,0x40,0x40,0x40,0x40,0xe0,0x03,0x0a,0x0a,0x06,0x01,0x00,0x40,0xa0,0x00, - 0xe0,0x40,0x40,0x40,0x40,0x40,0xe0,0x03,0x09,0x09,0x06,0x01,0x00,0xa0,0x00,0xe0, - 0x40,0x40,0x40,0x40,0x40,0xe0,0x05,0x07,0x07,0x06,0x00,0x00,0x70,0x48,0x48,0xe8, - 0x48,0x48,0x70,0x05,0x0a,0x0a,0x06,0x00,0x00,0x68,0xb0,0x00,0x88,0x88,0xc8,0xa8, - 0x98,0x88,0x88,0x05,0x0a,0x0a,0x06,0x00,0x00,0x40,0x20,0x00,0x70,0x88,0x88,0x88, - 0x88,0x88,0x70,0x05,0x0a,0x0a,0x06,0x00,0x00,0x10,0x20,0x00,0x70,0x88,0x88,0x88, - 0x88,0x88,0x70,0x05,0x0a,0x0a,0x06,0x00,0x00,0x20,0x50,0x00,0x70,0x88,0x88,0x88, - 0x88,0x88,0x70,0x05,0x0a,0x0a,0x06,0x00,0x00,0x68,0xb0,0x00,0x70,0x88,0x88,0x88, - 0x88,0x88,0x70,0x05,0x09,0x09,0x06,0x00,0x00,0x50,0x00,0x70,0x88,0x88,0x88,0x88, - 0x88,0x70,0x05,0x05,0x05,0x06,0x00,0x01,0x88,0x50,0x20,0x50,0x88,0x05,0x09,0x09, - 0x06,0x00,0xff,0x08,0x70,0x98,0xa8,0xa8,0xa8,0xc8,0x70,0x80,0x05,0x0a,0x0a,0x06, - 0x00,0x00,0x40,0x20,0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x05,0x0a,0x0a,0x06, - 0x00,0x00,0x10,0x20,0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x05,0x0a,0x0a,0x06, - 0x00,0x00,0x20,0x50,0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x05,0x09,0x09,0x06, - 0x00,0x00,0x50,0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x05,0x0a,0x0a,0x06,0x00, - 0x00,0x10,0x20,0x00,0x88,0x88,0x50,0x20,0x20,0x20,0x20,0x04,0x07,0x07,0x06,0x01, - 0x00,0x80,0xe0,0x90,0x90,0x90,0xe0,0x80,0x05,0x07,0x07,0x06,0x00,0x00,0x70,0x88, - 0x90,0xa0,0x90,0x88,0xb0,0x05,0x08,0x08,0x06,0x00,0x00,0x40,0x20,0x00,0x70,0x08, - 0x78,0x88,0x78,0x05,0x08,0x08,0x06,0x00,0x00,0x10,0x20,0x00,0x70,0x08,0x78,0x88, - 0x78,0x05,0x08,0x08,0x06,0x00,0x00,0x20,0x50,0x00,0x70,0x08,0x78,0x88,0x78,0x05, - 0x08,0x08,0x06,0x00,0x00,0x68,0xb0,0x00,0x70,0x08,0x78,0x88,0x78,0x05,0x07,0x07, - 0x06,0x00,0x00,0x50,0x00,0x70,0x08,0x78,0x88,0x78,0x05,0x08,0x08,0x06,0x00,0x00, - 0x20,0x50,0x20,0x70,0x08,0x78,0x88,0x78,0x05,0x05,0x05,0x06,0x00,0x00,0x70,0x28, - 0x70,0xa0,0x78,0x05,0x07,0x07,0x06,0x00,0xfe,0x70,0x88,0x80,0x88,0x70,0x10,0x60, - 0x05,0x08,0x08,0x06,0x00,0x00,0x40,0x20,0x00,0x70,0x88,0xf0,0x80,0x70,0x05,0x08, - 0x08,0x06,0x00,0x00,0x10,0x20,0x00,0x70,0x88,0xf0,0x80,0x70,0x05,0x08,0x08,0x06, - 0x00,0x00,0x20,0x50,0x00,0x70,0x88,0xf0,0x80,0x70,0x05,0x07,0x07,0x06,0x00,0x00, - 0x50,0x00,0x70,0x88,0xf0,0x80,0x70,0x03,0x08,0x08,0x06,0x01,0x00,0x80,0x40,0x00, - 0xc0,0x40,0x40,0x40,0xe0,0x03,0x08,0x08,0x06,0x01,0x00,0x20,0x40,0x00,0xc0,0x40, - 0x40,0x40,0xe0,0x03,0x08,0x08,0x06,0x01,0x00,0x40,0xa0,0x00,0xc0,0x40,0x40,0x40, - 0xe0,0x03,0x07,0x07,0x06,0x01,0x00,0xa0,0x00,0xc0,0x40,0x40,0x40,0xe0,0x05,0x09, - 0x09,0x06,0x00,0x00,0x50,0x20,0x50,0x08,0x78,0x88,0x88,0x88,0x70,0x05,0x08,0x08, - 0x06,0x00,0x00,0x68,0xb0,0x00,0xb0,0xc8,0x88,0x88,0x88,0x05,0x08,0x08,0x06,0x00, - 0x00,0x40,0x20,0x00,0x70,0x88,0x88,0x88,0x70,0x05,0x08,0x08,0x06,0x00,0x00,0x10, - 0x20,0x00,0x70,0x88,0x88,0x88,0x70,0x05,0x08,0x08,0x06,0x00,0x00,0x20,0x50,0x00, - 0x70,0x88,0x88,0x88,0x70,0x05,0x08,0x08,0x06,0x00,0x00,0x68,0xb0,0x00,0x70,0x88, - 0x88,0x88,0x70,0x05,0x07,0x07,0x06,0x00,0x00,0x50,0x00,0x70,0x88,0x88,0x88,0x70, - 0x05,0x05,0x05,0x06,0x00,0x01,0x20,0x00,0xf8,0x00,0x20,0x05,0x05,0x05,0x06,0x00, - 0x00,0x78,0x98,0xa8,0xc8,0xf0,0x05,0x08,0x08,0x06,0x00,0x00,0x40,0x20,0x00,0x88, - 0x88,0x88,0x88,0x70,0x05,0x08,0x08,0x06,0x00,0x00,0x10,0x20,0x00,0x88,0x88,0x88, - 0x88,0x70,0x05,0x08,0x08,0x06,0x00,0x00,0x20,0x50,0x00,0x88,0x88,0x88,0x88,0x70, - 0x05,0x07,0x07,0x06,0x00,0x00,0x50,0x00,0x88,0x88,0x88,0x88,0x70,0x05,0x0a,0x0a, - 0x06,0x00,0xfe,0x10,0x20,0x00,0x88,0x88,0x88,0x50,0x20,0x40,0x80,0x05,0x09,0x09, - 0x06,0x00,0xfe,0x80,0x80,0xf0,0x88,0x88,0x88,0xf0,0x80,0x80,0x05,0x09,0x09,0x06, - 0x00,0xfe,0x50,0x00,0x88,0x88,0x88,0x50,0x20,0x40,0x80}; + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00, + 0x06,0x05,0xff,0x01,0x07,0x07,0x06,0x02,0x00,0x80,0x00,0x80,0x80,0x80,0x80,0x80, + 0x05,0x07,0x07,0x06,0x00,0xff,0x20,0x70,0xa8,0xa0,0xa8,0x70,0x20,0x05,0x07,0x07, + 0x06,0x00,0x00,0x30,0x48,0x40,0xe0,0x40,0x48,0xb0,0x05,0x05,0x05,0x06,0x00,0x00, + 0xa8,0x50,0x88,0x50,0xa8,0x05,0x07,0x07,0x06,0x00,0x00,0x88,0x50,0xf8,0x20,0xf8, + 0x20,0x20,0x01,0x07,0x07,0x06,0x02,0x00,0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x04, + 0x08,0x08,0x06,0x01,0x00,0x70,0x80,0x60,0x90,0x90,0x60,0x10,0xe0,0x03,0x01,0x01, + 0x06,0x01,0x07,0xa0,0x06,0x07,0x07,0x06,0x00,0x00,0x78,0x84,0xb4,0xa4,0xb4,0x84, + 0x78,0x03,0x05,0x05,0x06,0x01,0x04,0x60,0xa0,0x60,0x00,0xe0,0x05,0x05,0x05,0x06, + 0x00,0x00,0x28,0x50,0xa0,0x50,0x28,0x05,0x03,0x03,0x06,0x00,0x01,0xf8,0x08,0x08, + 0x03,0x01,0x01,0x06,0x01,0x03,0xe0,0x06,0x07,0x07,0x06,0x00,0x00,0x78,0x84,0xb4, + 0xa4,0xa4,0x84,0x78,0x05,0x01,0x01,0x06,0x00,0x07,0xf8,0x04,0x04,0x04,0x06,0x01, + 0x05,0x60,0x90,0x90,0x60,0x05,0x07,0x07,0x06,0x00,0x00,0x20,0x20,0xf8,0x20,0x20, + 0x00,0xf8,0x03,0x05,0x05,0x06,0x01,0x04,0x40,0xa0,0x20,0x40,0xe0,0x03,0x05,0x05, + 0x06,0x01,0x04,0xc0,0x20,0x40,0x20,0xc0,0x03,0x03,0x03,0x06,0x01,0x05,0x20,0x40, + 0x80,0x05,0x07,0x07,0x06,0x00,0xfe,0x88,0x88,0x88,0x98,0xe8,0x80,0x80,0x05,0x08, + 0x08,0x06,0x00,0x00,0x78,0xe8,0xe8,0xe8,0x68,0x28,0x28,0x28,0x02,0x02,0x02,0x06, + 0x02,0x03,0xc0,0xc0,0x03,0x02,0x02,0x06,0x01,0xfe,0x20,0xc0,0x03,0x05,0x05,0x06, + 0x01,0x04,0x40,0xc0,0x40,0x40,0xe0,0x03,0x05,0x05,0x06,0x01,0x05,0x40,0xa0,0x40, + 0x00,0xe0,0x05,0x05,0x05,0x06,0x00,0x00,0xa0,0x50,0x28,0x50,0xa0,0x05,0x0a,0x0a, + 0x06,0x00,0x00,0x40,0xc0,0x48,0x50,0x60,0x50,0xb0,0x50,0x78,0x10,0x05,0x0a,0x0a, + 0x06,0x00,0x00,0x40,0xc0,0x48,0x50,0x60,0x50,0xa8,0x08,0x10,0x38,0x05,0x0a,0x0a, + 0x06,0x00,0x00,0xc0,0x20,0x48,0x30,0xe0,0x50,0xb0,0x50,0x78,0x10,0x05,0x07,0x07, + 0x06,0x00,0x00,0x20,0x00,0x20,0x20,0x40,0x88,0x70,0x05,0x0a,0x0a,0x06,0x00,0x00, + 0x40,0x20,0x00,0x70,0x88,0x88,0xf8,0x88,0x88,0x88,0x05,0x0a,0x0a,0x06,0x00,0x00, + 0x10,0x20,0x00,0x70,0x88,0x88,0xf8,0x88,0x88,0x88,0x05,0x0a,0x0a,0x06,0x00,0x00, + 0x20,0x50,0x00,0x70,0x88,0x88,0xf8,0x88,0x88,0x88,0x05,0x0a,0x0a,0x06,0x00,0x00, + 0x68,0xb0,0x00,0x70,0x88,0x88,0xf8,0x88,0x88,0x88,0x05,0x09,0x09,0x06,0x00,0x00, + 0x50,0x00,0x70,0x88,0x88,0xf8,0x88,0x88,0x88,0x05,0x0a,0x0a,0x06,0x00,0x00,0x20, + 0x50,0x20,0x70,0x88,0x88,0xf8,0x88,0x88,0x88,0x05,0x07,0x07,0x06,0x00,0x00,0x78, + 0xa0,0xa0,0xf0,0xa0,0xa0,0xb8,0x05,0x09,0x09,0x06,0x00,0xfe,0x70,0x88,0x80,0x80, + 0x80,0x88,0x70,0x10,0x60,0x05,0x0a,0x0a,0x06,0x00,0x00,0x40,0x20,0x00,0xf8,0x80, + 0x80,0xf0,0x80,0x80,0xf8,0x05,0x0a,0x0a,0x06,0x00,0x00,0x10,0x20,0x00,0xf8,0x80, + 0x80,0xf0,0x80,0x80,0xf8,0x05,0x0a,0x0a,0x06,0x00,0x00,0x20,0x50,0x00,0xf8,0x80, + 0x80,0xf0,0x80,0x80,0xf8,0x05,0x09,0x09,0x06,0x00,0x00,0x50,0x00,0xf8,0x80,0x80, + 0xf0,0x80,0x80,0xf8,0x03,0x0a,0x0a,0x06,0x01,0x00,0x80,0x40,0x00,0xe0,0x40,0x40, + 0x40,0x40,0x40,0xe0,0x03,0x0a,0x0a,0x06,0x01,0x00,0x20,0x40,0x00,0xe0,0x40,0x40, + 0x40,0x40,0x40,0xe0,0x03,0x0a,0x0a,0x06,0x01,0x00,0x40,0xa0,0x00,0xe0,0x40,0x40, + 0x40,0x40,0x40,0xe0,0x03,0x09,0x09,0x06,0x01,0x00,0xa0,0x00,0xe0,0x40,0x40,0x40, + 0x40,0x40,0xe0,0x05,0x07,0x07,0x06,0x00,0x00,0x70,0x48,0x48,0xe8,0x48,0x48,0x70, + 0x05,0x0a,0x0a,0x06,0x00,0x00,0x68,0xb0,0x00,0x88,0x88,0xc8,0xa8,0x98,0x88,0x88, + 0x05,0x0a,0x0a,0x06,0x00,0x00,0x40,0x20,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70, + 0x05,0x0a,0x0a,0x06,0x00,0x00,0x10,0x20,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70, + 0x05,0x0a,0x0a,0x06,0x00,0x00,0x20,0x50,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70, + 0x05,0x0a,0x0a,0x06,0x00,0x00,0x68,0xb0,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70, + 0x05,0x09,0x09,0x06,0x00,0x00,0x50,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x05, + 0x05,0x05,0x06,0x00,0x01,0x88,0x50,0x20,0x50,0x88,0x05,0x09,0x09,0x06,0x00,0xff, + 0x08,0x70,0x98,0xa8,0xa8,0xa8,0xc8,0x70,0x80,0x05,0x0a,0x0a,0x06,0x00,0x00,0x40, + 0x20,0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x05,0x0a,0x0a,0x06,0x00,0x00,0x10, + 0x20,0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x05,0x0a,0x0a,0x06,0x00,0x00,0x20, + 0x50,0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x05,0x09,0x09,0x06,0x00,0x00,0x50, + 0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x05,0x0a,0x0a,0x06,0x00,0x00,0x10,0x20, + 0x00,0x88,0x88,0x50,0x20,0x20,0x20,0x20,0x04,0x07,0x07,0x06,0x01,0x00,0x80,0xe0, + 0x90,0x90,0x90,0xe0,0x80,0x05,0x07,0x07,0x06,0x00,0x00,0x70,0x88,0x90,0xa0,0x90, + 0x88,0xb0,0x05,0x08,0x08,0x06,0x00,0x00,0x40,0x20,0x00,0x70,0x08,0x78,0x88,0x78, + 0x05,0x08,0x08,0x06,0x00,0x00,0x10,0x20,0x00,0x70,0x08,0x78,0x88,0x78,0x05,0x08, + 0x08,0x06,0x00,0x00,0x20,0x50,0x00,0x70,0x08,0x78,0x88,0x78,0x05,0x08,0x08,0x06, + 0x00,0x00,0x68,0xb0,0x00,0x70,0x08,0x78,0x88,0x78,0x05,0x07,0x07,0x06,0x00,0x00, + 0x50,0x00,0x70,0x08,0x78,0x88,0x78,0x05,0x08,0x08,0x06,0x00,0x00,0x20,0x50,0x20, + 0x70,0x08,0x78,0x88,0x78,0x05,0x05,0x05,0x06,0x00,0x00,0x70,0x28,0x70,0xa0,0x78, + 0x05,0x07,0x07,0x06,0x00,0xfe,0x70,0x88,0x80,0x88,0x70,0x10,0x60,0x05,0x08,0x08, + 0x06,0x00,0x00,0x40,0x20,0x00,0x70,0x88,0xf0,0x80,0x70,0x05,0x08,0x08,0x06,0x00, + 0x00,0x10,0x20,0x00,0x70,0x88,0xf0,0x80,0x70,0x05,0x08,0x08,0x06,0x00,0x00,0x20, + 0x50,0x00,0x70,0x88,0xf0,0x80,0x70,0x05,0x07,0x07,0x06,0x00,0x00,0x50,0x00,0x70, + 0x88,0xf0,0x80,0x70,0x03,0x08,0x08,0x06,0x01,0x00,0x80,0x40,0x00,0xc0,0x40,0x40, + 0x40,0xe0,0x03,0x08,0x08,0x06,0x01,0x00,0x20,0x40,0x00,0xc0,0x40,0x40,0x40,0xe0, + 0x03,0x08,0x08,0x06,0x01,0x00,0x40,0xa0,0x00,0xc0,0x40,0x40,0x40,0xe0,0x03,0x07, + 0x07,0x06,0x01,0x00,0xa0,0x00,0xc0,0x40,0x40,0x40,0xe0,0x05,0x09,0x09,0x06,0x00, + 0x00,0x50,0x20,0x50,0x08,0x78,0x88,0x88,0x88,0x70,0x05,0x08,0x08,0x06,0x00,0x00, + 0x68,0xb0,0x00,0xb0,0xc8,0x88,0x88,0x88,0x05,0x08,0x08,0x06,0x00,0x00,0x40,0x20, + 0x00,0x70,0x88,0x88,0x88,0x70,0x05,0x08,0x08,0x06,0x00,0x00,0x10,0x20,0x00,0x70, + 0x88,0x88,0x88,0x70,0x05,0x08,0x08,0x06,0x00,0x00,0x20,0x50,0x00,0x70,0x88,0x88, + 0x88,0x70,0x05,0x08,0x08,0x06,0x00,0x00,0x68,0xb0,0x00,0x70,0x88,0x88,0x88,0x70, + 0x05,0x07,0x07,0x06,0x00,0x00,0x50,0x00,0x70,0x88,0x88,0x88,0x70,0x05,0x05,0x05, + 0x06,0x00,0x01,0x20,0x00,0xf8,0x00,0x20,0x05,0x05,0x05,0x06,0x00,0x00,0x78,0x98, + 0xa8,0xc8,0xf0,0x05,0x08,0x08,0x06,0x00,0x00,0x40,0x20,0x00,0x88,0x88,0x88,0x88, + 0x70,0x05,0x08,0x08,0x06,0x00,0x00,0x10,0x20,0x00,0x88,0x88,0x88,0x88,0x70,0x05, + 0x08,0x08,0x06,0x00,0x00,0x20,0x50,0x00,0x88,0x88,0x88,0x88,0x70,0x05,0x07,0x07, + 0x06,0x00,0x00,0x50,0x00,0x88,0x88,0x88,0x88,0x70,0x05,0x0a,0x0a,0x06,0x00,0xfe, + 0x10,0x20,0x00,0x88,0x88,0x88,0x50,0x20,0x40,0x80,0x05,0x09,0x09,0x06,0x00,0xfe, + 0x80,0x80,0xf0,0x88,0x88,0x88,0xf0,0x80,0x80,0x05,0x09,0x09,0x06,0x00,0xfe,0x50, + 0x00,0x88,0x88,0x88,0x50,0x20,0x40,0x80}; #endif diff --git a/Marlin/src/lcd/dogm/fontdata/langdata_el-gr.h b/Marlin/src/lcd/dogm/fontdata/langdata_el-gr.h index 9343a9af7671..76a5c66cd952 100644 --- a/Marlin/src/lcd/dogm/fontdata/langdata_el-gr.h +++ b/Marlin/src/lcd/dogm/fontdata/langdata_el-gr.h @@ -40,26 +40,29 @@ const u8g_fntpgm_uint8_t fontpage_7_172_175[75] U8G_FONT_SECTION("fontpage_7_172 0x08,0x08,0x06,0x00,0x00,0x10,0x20,0x00,0x70,0x88,0x60,0x88,0x70,0x05,0x0a,0x0a, 0x06,0x00,0xfe,0x10,0x20,0x00,0xb0,0xc8,0x88,0x88,0x88,0x08,0x08,0x03,0x08,0x08, 0x06,0x01,0x00,0x40,0x80,0x00,0x80,0x80,0x80,0xa0,0x40}; -const u8g_fntpgm_uint8_t fontpage_7_177_199[303] U8G_FONT_SECTION("fontpage_7_177_199") = { - 0x00,0x06,0x0c,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xb1,0xc7,0x00,0x09,0xfe,0x00, +const u8g_fntpgm_uint8_t fontpage_7_177_181[80] U8G_FONT_SECTION("fontpage_7_177_181") = { + 0x00,0x06,0x0c,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xb1,0xb5,0x00,0x07,0xfe,0x00, 0x00,0x05,0x05,0x05,0x06,0x00,0x00,0x68,0x90,0x90,0x90,0x68,0x05,0x09,0x09,0x06, 0x00,0xfe,0x60,0x90,0x90,0xb0,0x88,0x88,0xf0,0x80,0x80,0x05,0x07,0x07,0x06,0x00, 0xfe,0x88,0x88,0x50,0x50,0x20,0x20,0x20,0x05,0x07,0x07,0x06,0x00,0x00,0x70,0x80, - 0x70,0x88,0x88,0x88,0x70,0x05,0x05,0x05,0x06,0x00,0x00,0x70,0x88,0x60,0x88,0x70, - 0x05,0x08,0x08,0x06,0x00,0xff,0xf8,0x20,0x40,0x40,0x40,0x30,0x08,0x30,0x05,0x07, - 0x07,0x06,0x00,0xfe,0xb0,0xc8,0x88,0x88,0x88,0x08,0x08,0x04,0x07,0x07,0x06,0x01, - 0x00,0x60,0x90,0x90,0xf0,0x90,0x90,0x60,0x03,0x05,0x05,0x06,0x02,0x00,0x80,0x80, - 0x80,0xa0,0x40,0x04,0x05,0x05,0x06,0x01,0x00,0x90,0xa0,0xc0,0xa0,0x90,0x05,0x09, - 0x09,0x06,0x00,0x00,0x80,0x40,0x40,0x20,0x20,0x50,0x50,0x88,0x88,0x05,0x07,0x07, - 0x06,0x00,0xfe,0x88,0x88,0x88,0x98,0xe8,0x80,0x80,0x05,0x05,0x05,0x06,0x00,0x00, - 0x88,0x88,0x50,0x50,0x20,0x05,0x09,0x09,0x06,0x00,0xfe,0xf8,0x20,0x40,0x70,0x80, - 0x80,0x70,0x08,0x10,0x05,0x05,0x05,0x06,0x00,0x00,0x70,0x88,0x88,0x88,0x70,0x06, - 0x05,0x05,0x06,0x00,0x00,0xf8,0x50,0x50,0x54,0x48,0x05,0x07,0x07,0x06,0x00,0xfe, - 0x70,0x88,0x88,0xc8,0xb0,0x80,0x80,0x05,0x07,0x07,0x06,0x00,0xfe,0x70,0x88,0x80, - 0x80,0x70,0x08,0x30,0x05,0x05,0x05,0x06,0x00,0x00,0x78,0x90,0x88,0x88,0x70,0x05, - 0x05,0x05,0x06,0x00,0x00,0xf8,0x20,0x20,0x28,0x10,0x05,0x05,0x05,0x06,0x00,0x00, - 0x90,0x88,0x88,0x88,0x70,0x05,0x07,0x07,0x06,0x00,0xfe,0x10,0xa8,0xa8,0xa8,0x70, - 0x20,0x20,0x05,0x07,0x07,0x06,0x00,0xfe,0x88,0x88,0x50,0x20,0x50,0x88,0x88}; + 0x70,0x88,0x88,0x88,0x70,0x05,0x05,0x05,0x06,0x00,0x00,0x70,0x88,0x60,0x88,0x70 + }; +const u8g_fntpgm_uint8_t fontpage_7_183_199[226] U8G_FONT_SECTION("fontpage_7_183_199") = { + 0x00,0x06,0x0c,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xb7,0xc7,0x00,0x09,0xfe,0x00, + 0x00,0x05,0x07,0x07,0x06,0x00,0xfe,0xb0,0xc8,0x88,0x88,0x88,0x08,0x08,0x04,0x07, + 0x07,0x06,0x01,0x00,0x60,0x90,0x90,0xf0,0x90,0x90,0x60,0x03,0x05,0x05,0x06,0x02, + 0x00,0x80,0x80,0x80,0xa0,0x40,0x04,0x05,0x05,0x06,0x01,0x00,0x90,0xa0,0xc0,0xa0, + 0x90,0x05,0x09,0x09,0x06,0x00,0x00,0x80,0x40,0x40,0x20,0x20,0x50,0x50,0x88,0x88, + 0x05,0x07,0x07,0x06,0x00,0xfe,0x88,0x88,0x88,0x98,0xe8,0x80,0x80,0x05,0x05,0x05, + 0x06,0x00,0x00,0x88,0x88,0x50,0x50,0x20,0x05,0x09,0x09,0x06,0x00,0xfe,0xf8,0x20, + 0x40,0x70,0x80,0x80,0x70,0x08,0x10,0x05,0x05,0x05,0x06,0x00,0x00,0x70,0x88,0x88, + 0x88,0x70,0x06,0x05,0x05,0x06,0x00,0x00,0xf8,0x50,0x50,0x54,0x48,0x05,0x07,0x07, + 0x06,0x00,0xfe,0x70,0x88,0x88,0xc8,0xb0,0x80,0x80,0x05,0x07,0x07,0x06,0x00,0xfe, + 0x70,0x88,0x80,0x80,0x70,0x08,0x30,0x05,0x05,0x05,0x06,0x00,0x00,0x78,0x90,0x88, + 0x88,0x70,0x05,0x05,0x05,0x06,0x00,0x00,0xf8,0x20,0x20,0x28,0x10,0x05,0x05,0x05, + 0x06,0x00,0x00,0x90,0x88,0x88,0x88,0x70,0x05,0x07,0x07,0x06,0x00,0xfe,0x10,0xa8, + 0xa8,0xa8,0x70,0x20,0x20,0x05,0x07,0x07,0x06,0x00,0xfe,0x88,0x88,0x50,0x20,0x50, + 0x88,0x88}; const u8g_fntpgm_uint8_t fontpage_7_201_201[28] U8G_FONT_SECTION("fontpage_7_201_201") = { 0x00,0x06,0x0c,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xc9,0xc9,0x00,0x05,0x00,0x00, 0x00,0x05,0x05,0x05,0x06,0x00,0x00,0x50,0x88,0xa8,0xa8,0x50}; @@ -79,7 +82,8 @@ static const uxg_fontinfo_t g_fontinfo[] PROGMEM = { FONTDATA_ITEM(7, 159, 161, fontpage_7_159_161), // 'Ο' -- 'Ρ' FONTDATA_ITEM(7, 163, 167, fontpage_7_163_167), // 'Σ' -- 'Χ' FONTDATA_ITEM(7, 172, 175, fontpage_7_172_175), // 'ά' -- 'ί' - FONTDATA_ITEM(7, 177, 199, fontpage_7_177_199), // 'α' -- 'χ' + FONTDATA_ITEM(7, 177, 181, fontpage_7_177_181), // 'α' -- 'ε' + FONTDATA_ITEM(7, 183, 199, fontpage_7_183_199), // 'η' -- 'χ' FONTDATA_ITEM(7, 201, 201, fontpage_7_201_201), // 'ω' -- 'ω' FONTDATA_ITEM(7, 204, 206, fontpage_7_204_206), // 'ό' -- 'ώ' FONTDATA_ITEM(64, 166, 166, fontpage_64_166_166), // '…' -- '…' diff --git a/Marlin/src/lcd/dogm/fontdata/langdata_el.h b/Marlin/src/lcd/dogm/fontdata/langdata_el.h index f0c041f36b14..858ec0f84f1b 100644 --- a/Marlin/src/lcd/dogm/fontdata/langdata_el.h +++ b/Marlin/src/lcd/dogm/fontdata/langdata_el.h @@ -43,26 +43,29 @@ const u8g_fntpgm_uint8_t fontpage_7_172_175[75] U8G_FONT_SECTION("fontpage_7_172 0x08,0x08,0x06,0x00,0x00,0x10,0x20,0x00,0x70,0x88,0x60,0x88,0x70,0x05,0x0a,0x0a, 0x06,0x00,0xfe,0x10,0x20,0x00,0xb0,0xc8,0x88,0x88,0x88,0x08,0x08,0x03,0x08,0x08, 0x06,0x01,0x00,0x40,0x80,0x00,0x80,0x80,0x80,0xa0,0x40}; -const u8g_fntpgm_uint8_t fontpage_7_177_199[303] U8G_FONT_SECTION("fontpage_7_177_199") = { - 0x00,0x06,0x0c,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xb1,0xc7,0x00,0x09,0xfe,0x00, +const u8g_fntpgm_uint8_t fontpage_7_177_181[80] U8G_FONT_SECTION("fontpage_7_177_181") = { + 0x00,0x06,0x0c,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xb1,0xb5,0x00,0x07,0xfe,0x00, 0x00,0x05,0x05,0x05,0x06,0x00,0x00,0x68,0x90,0x90,0x90,0x68,0x05,0x09,0x09,0x06, 0x00,0xfe,0x60,0x90,0x90,0xb0,0x88,0x88,0xf0,0x80,0x80,0x05,0x07,0x07,0x06,0x00, 0xfe,0x88,0x88,0x50,0x50,0x20,0x20,0x20,0x05,0x07,0x07,0x06,0x00,0x00,0x70,0x80, - 0x70,0x88,0x88,0x88,0x70,0x05,0x05,0x05,0x06,0x00,0x00,0x70,0x88,0x60,0x88,0x70, - 0x05,0x08,0x08,0x06,0x00,0xff,0xf8,0x20,0x40,0x40,0x40,0x30,0x08,0x30,0x05,0x07, - 0x07,0x06,0x00,0xfe,0xb0,0xc8,0x88,0x88,0x88,0x08,0x08,0x04,0x07,0x07,0x06,0x01, - 0x00,0x60,0x90,0x90,0xf0,0x90,0x90,0x60,0x03,0x05,0x05,0x06,0x02,0x00,0x80,0x80, - 0x80,0xa0,0x40,0x04,0x05,0x05,0x06,0x01,0x00,0x90,0xa0,0xc0,0xa0,0x90,0x05,0x09, - 0x09,0x06,0x00,0x00,0x80,0x40,0x40,0x20,0x20,0x50,0x50,0x88,0x88,0x05,0x07,0x07, - 0x06,0x00,0xfe,0x88,0x88,0x88,0x98,0xe8,0x80,0x80,0x05,0x05,0x05,0x06,0x00,0x00, - 0x88,0x88,0x50,0x50,0x20,0x05,0x09,0x09,0x06,0x00,0xfe,0xf8,0x20,0x40,0x70,0x80, - 0x80,0x70,0x08,0x10,0x05,0x05,0x05,0x06,0x00,0x00,0x70,0x88,0x88,0x88,0x70,0x06, - 0x05,0x05,0x06,0x00,0x00,0xf8,0x50,0x50,0x54,0x48,0x05,0x07,0x07,0x06,0x00,0xfe, - 0x70,0x88,0x88,0xc8,0xb0,0x80,0x80,0x05,0x07,0x07,0x06,0x00,0xfe,0x70,0x88,0x80, - 0x80,0x70,0x08,0x30,0x05,0x05,0x05,0x06,0x00,0x00,0x78,0x90,0x88,0x88,0x70,0x05, - 0x05,0x05,0x06,0x00,0x00,0xf8,0x20,0x20,0x28,0x10,0x05,0x05,0x05,0x06,0x00,0x00, - 0x90,0x88,0x88,0x88,0x70,0x05,0x07,0x07,0x06,0x00,0xfe,0x10,0xa8,0xa8,0xa8,0x70, - 0x20,0x20,0x05,0x07,0x07,0x06,0x00,0xfe,0x88,0x88,0x50,0x20,0x50,0x88,0x88}; + 0x70,0x88,0x88,0x88,0x70,0x05,0x05,0x05,0x06,0x00,0x00,0x70,0x88,0x60,0x88,0x70 + }; +const u8g_fntpgm_uint8_t fontpage_7_183_199[226] U8G_FONT_SECTION("fontpage_7_183_199") = { + 0x00,0x06,0x0c,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xb7,0xc7,0x00,0x09,0xfe,0x00, + 0x00,0x05,0x07,0x07,0x06,0x00,0xfe,0xb0,0xc8,0x88,0x88,0x88,0x08,0x08,0x04,0x07, + 0x07,0x06,0x01,0x00,0x60,0x90,0x90,0xf0,0x90,0x90,0x60,0x03,0x05,0x05,0x06,0x02, + 0x00,0x80,0x80,0x80,0xa0,0x40,0x04,0x05,0x05,0x06,0x01,0x00,0x90,0xa0,0xc0,0xa0, + 0x90,0x05,0x09,0x09,0x06,0x00,0x00,0x80,0x40,0x40,0x20,0x20,0x50,0x50,0x88,0x88, + 0x05,0x07,0x07,0x06,0x00,0xfe,0x88,0x88,0x88,0x98,0xe8,0x80,0x80,0x05,0x05,0x05, + 0x06,0x00,0x00,0x88,0x88,0x50,0x50,0x20,0x05,0x09,0x09,0x06,0x00,0xfe,0xf8,0x20, + 0x40,0x70,0x80,0x80,0x70,0x08,0x10,0x05,0x05,0x05,0x06,0x00,0x00,0x70,0x88,0x88, + 0x88,0x70,0x06,0x05,0x05,0x06,0x00,0x00,0xf8,0x50,0x50,0x54,0x48,0x05,0x07,0x07, + 0x06,0x00,0xfe,0x70,0x88,0x88,0xc8,0xb0,0x80,0x80,0x05,0x07,0x07,0x06,0x00,0xfe, + 0x70,0x88,0x80,0x80,0x70,0x08,0x30,0x05,0x05,0x05,0x06,0x00,0x00,0x78,0x90,0x88, + 0x88,0x70,0x05,0x05,0x05,0x06,0x00,0x00,0xf8,0x20,0x20,0x28,0x10,0x05,0x05,0x05, + 0x06,0x00,0x00,0x90,0x88,0x88,0x88,0x70,0x05,0x07,0x07,0x06,0x00,0xfe,0x10,0xa8, + 0xa8,0xa8,0x70,0x20,0x20,0x05,0x07,0x07,0x06,0x00,0xfe,0x88,0x88,0x50,0x20,0x50, + 0x88,0x88}; const u8g_fntpgm_uint8_t fontpage_7_201_201[28] U8G_FONT_SECTION("fontpage_7_201_201") = { 0x00,0x06,0x0c,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xc9,0xc9,0x00,0x05,0x00,0x00, 0x00,0x05,0x05,0x05,0x06,0x00,0x00,0x50,0x88,0xa8,0xa8,0x50}; @@ -83,7 +86,8 @@ static const uxg_fontinfo_t g_fontinfo[] PROGMEM = { FONTDATA_ITEM(7, 163, 167, fontpage_7_163_167), // 'Σ' -- 'Χ' FONTDATA_ITEM(7, 169, 169, fontpage_7_169_169), // 'Ω' -- 'Ω' FONTDATA_ITEM(7, 172, 175, fontpage_7_172_175), // 'ά' -- 'ί' - FONTDATA_ITEM(7, 177, 199, fontpage_7_177_199), // 'α' -- 'χ' + FONTDATA_ITEM(7, 177, 181, fontpage_7_177_181), // 'α' -- 'ε' + FONTDATA_ITEM(7, 183, 199, fontpage_7_183_199), // 'η' -- 'χ' FONTDATA_ITEM(7, 201, 201, fontpage_7_201_201), // 'ω' -- 'ω' FONTDATA_ITEM(7, 204, 206, fontpage_7_204_206), // 'ό' -- 'ώ' FONTDATA_ITEM(64, 166, 166, fontpage_64_166_166), // '…' -- '…' diff --git a/Marlin/src/lcd/dogm/fontdata/langdata_sk.h b/Marlin/src/lcd/dogm/fontdata/langdata_sk.h index 4786af15a829..a75fa2c92647 100644 --- a/Marlin/src/lcd/dogm/fontdata/langdata_sk.h +++ b/Marlin/src/lcd/dogm/fontdata/langdata_sk.h @@ -38,9 +38,6 @@ const u8g_fntpgm_uint8_t fontpage_2_228_229[49] U8G_FONT_SECTION("fontpage_2_228 0x00,0x05,0x0a,0x0a,0x06,0x00,0x00,0x50,0x20,0x00,0xf8,0x20,0x20,0x20,0x20,0x20, 0x20,0x05,0x0a,0x0a,0x06,0x00,0x00,0x50,0x20,0x00,0x20,0x20,0xf8,0x20,0x20,0x20, 0x18}; -const u8g_fntpgm_uint8_t fontpage_2_239_239[31] U8G_FONT_SECTION("fontpage_2_239_239") = { - 0x00,0x06,0x0c,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xef,0xef,0x00,0x08,0x00,0x00, - 0x00,0x05,0x08,0x08,0x06,0x00,0x00,0x20,0x50,0x20,0x88,0x88,0x88,0x88,0x70}; const u8g_fntpgm_uint8_t fontpage_2_253_254[47] U8G_FONT_SECTION("fontpage_2_253_254") = { 0x00,0x06,0x0c,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xfd,0xfe,0x00,0x0a,0x00,0x00, 0x00,0x05,0x0a,0x0a,0x06,0x00,0x00,0x50,0x20,0x00,0xf8,0x08,0x10,0x20,0x40,0x80, @@ -55,6 +52,5 @@ static const uxg_fontinfo_t g_fontinfo[] PROGMEM = { FONTDATA_ITEM(2, 212, 213, fontpage_2_212_213), // 'Ŕ' -- 'ŕ' FONTDATA_ITEM(2, 224, 225, fontpage_2_224_225), // 'Š' -- 'š' FONTDATA_ITEM(2, 228, 229, fontpage_2_228_229), // 'Ť' -- 'ť' - FONTDATA_ITEM(2, 239, 239, fontpage_2_239_239), // 'ů' -- 'ů' FONTDATA_ITEM(2, 253, 254, fontpage_2_253_254), // 'Ž' -- 'ž' }; diff --git a/Marlin/src/lcd/dogm/fontdata/langdata_tr.h b/Marlin/src/lcd/dogm/fontdata/langdata_tr.h index 3375e9decb4a..b85a19f54785 100644 --- a/Marlin/src/lcd/dogm/fontdata/langdata_tr.h +++ b/Marlin/src/lcd/dogm/fontdata/langdata_tr.h @@ -13,13 +13,14 @@ const u8g_fntpgm_uint8_t fontpage_2_176_177[43] U8G_FONT_SECTION("fontpage_2_176 0x00,0x06,0x0c,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xb0,0xb1,0x00,0x09,0x00,0x00, 0x00,0x03,0x09,0x09,0x06,0x01,0x00,0x40,0x00,0xe0,0x40,0x40,0x40,0x40,0x40,0xe0, 0x03,0x05,0x05,0x06,0x01,0x00,0xc0,0x40,0x40,0x40,0xe0}; -const u8g_fntpgm_uint8_t fontpage_2_223_223[30] U8G_FONT_SECTION("fontpage_2_223_223") = { - 0x00,0x06,0x0c,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xdf,0xdf,0x00,0x05,0xfe,0x00, - 0x00,0x05,0x07,0x07,0x06,0x00,0xfe,0x78,0x80,0x70,0x08,0xf0,0x10,0x60}; +const u8g_fntpgm_uint8_t fontpage_2_222_223[45] U8G_FONT_SECTION("fontpage_2_222_223") = { + 0x00,0x06,0x0c,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xde,0xdf,0x00,0x07,0xfe,0x00, + 0x00,0x05,0x09,0x09,0x06,0x00,0xfe,0x70,0x88,0x80,0x70,0x08,0x88,0x70,0x10,0x60, + 0x05,0x07,0x07,0x06,0x00,0xfe,0x78,0x80,0x70,0x08,0xf0,0x10,0x60}; #define FONTDATA_ITEM(page, begin, end, data) { page, begin, end, COUNT(data), data } static const uxg_fontinfo_t g_fontinfo[] PROGMEM = { FONTDATA_ITEM(2, 159, 159, fontpage_2_159_159), // 'ğ' -- 'ğ' FONTDATA_ITEM(2, 176, 177, fontpage_2_176_177), // 'İ' -- 'ı' - FONTDATA_ITEM(2, 223, 223, fontpage_2_223_223), // 'ş' -- 'ş' + FONTDATA_ITEM(2, 222, 223, fontpage_2_222_223), // 'Ş' -- 'ş' }; diff --git a/Marlin/src/lcd/dogm/fontdata/langdata_zh_CN.h b/Marlin/src/lcd/dogm/fontdata/langdata_zh_CN.h index 3fdd37d1c780..87183cd5df61 100644 --- a/Marlin/src/lcd/dogm/fontdata/langdata_zh_CN.h +++ b/Marlin/src/lcd/dogm/fontdata/langdata_zh_CN.h @@ -5,6 +5,9 @@ */ #include +const u8g_fntpgm_uint8_t fontpage_64_157_157[26] U8G_FONT_SECTION("fontpage_64_157_157") = { + 0x00,0x06,0x0c,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x9d,0x9d,0x00,0x07,0x00,0x00, + 0x00,0x05,0x03,0x03,0x06,0x00,0x04,0xd8,0x48,0x90}; const u8g_fntpgm_uint8_t fontpage_69_191_191[28] U8G_FONT_SECTION("fontpage_69_191_191") = { 0x00,0x06,0x0c,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xbf,0xbf,0x00,0x05,0x00,0x00, 0x00,0x05,0x05,0x05,0x06,0x00,0x00,0x08,0x18,0x28,0x48,0xf8}; @@ -261,6 +264,10 @@ const u8g_fntpgm_uint8_t fontpage_172_180_180[45] U8G_FONT_SECTION("fontpage_172 0x00,0x06,0x0c,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xb4,0xb4,0x00,0x0a,0xff,0x00, 0x00,0x0b,0x0b,0x16,0x0c,0x00,0xff,0x02,0xa0,0xeb,0xc0,0xaa,0xa0,0xbf,0xe0,0xa4, 0x80,0xaf,0xe0,0xf9,0x20,0x0f,0xe0,0x09,0x20,0x0f,0xe0,0x11,0x20}; +const u8g_fntpgm_uint8_t fontpage_172_244_244[45] U8G_FONT_SECTION("fontpage_172_244_244") = { + 0x00,0x06,0x0c,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xf4,0xf4,0x00,0x0a,0xff,0x00, + 0x00,0x0b,0x0b,0x16,0x0c,0x00,0xff,0x01,0x00,0xef,0xe0,0xa5,0x40,0xaf,0xe0,0xa4, + 0x40,0xa7,0xc0,0xe4,0x40,0x07,0xc0,0x04,0x40,0x07,0xc0,0x0c,0x60}; const u8g_fntpgm_uint8_t fontpage_173_222_222[45] U8G_FONT_SECTION("fontpage_173_222_222") = { 0x00,0x06,0x0c,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xde,0xde,0x00,0x0a,0xff,0x00, 0x00,0x0a,0x0b,0x16,0x0c,0x01,0xff,0xff,0xc0,0x80,0x40,0x80,0x40,0x9e,0x40,0x92, @@ -681,10 +688,6 @@ const u8g_fntpgm_uint8_t fontpage_223_192_192[45] U8G_FONT_SECTION("fontpage_223 0x00,0x06,0x0c,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xc0,0xc0,0x00,0x0a,0xff,0x00, 0x00,0x0b,0x0b,0x16,0x0c,0x00,0xff,0x44,0x80,0x3e,0x80,0x12,0xe0,0x9e,0xa0,0x53, 0xa0,0x3e,0xa0,0x28,0xa0,0xdf,0xa0,0x4a,0x40,0x52,0xa0,0x65,0x20}; -const u8g_fntpgm_uint8_t fontpage_224_237_237[43] U8G_FONT_SECTION("fontpage_224_237_237") = { - 0x00,0x06,0x0c,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xed,0xed,0x00,0x09,0xff,0x00, - 0x00,0x0b,0x0a,0x14,0x0c,0x00,0xff,0xff,0xe0,0x04,0x00,0x24,0x40,0x24,0x40,0x24, - 0x80,0x4a,0x00,0x0a,0x00,0x11,0x00,0x20,0xe0,0xc0,0x40}; const u8g_fntpgm_uint8_t fontpage_224_239_239[45] U8G_FONT_SECTION("fontpage_224_239_239") = { 0x00,0x06,0x0c,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xef,0xef,0x00,0x0a,0xff,0x00, 0x00,0x0b,0x0b,0x16,0x0c,0x00,0xff,0x10,0x00,0x17,0xe0,0x54,0x80,0x58,0x80,0x50, @@ -1033,6 +1036,7 @@ const u8g_fntpgm_uint8_t fontpage_510_154_154[30] U8G_FONT_SECTION("fontpage_510 #define FONTDATA_ITEM(page, begin, end, data) { page, begin, end, COUNT(data), data } static const uxg_fontinfo_t g_fontinfo[] PROGMEM = { + FONTDATA_ITEM(64, 157, 157, fontpage_64_157_157), // '”' -- '”' FONTDATA_ITEM(69, 191, 191, fontpage_69_191_191), // '⊿' -- '⊿' FONTDATA_ITEM(156, 128, 128, fontpage_156_128_128), // '一' -- '一' FONTDATA_ITEM(156, 137, 139, fontpage_156_137_139), // '三' -- '下' @@ -1095,6 +1099,7 @@ static const uxg_fontinfo_t g_fontinfo[] PROGMEM = { FONTDATA_ITEM(169, 140, 140, fontpage_169_140_140), // '和' -- '和' FONTDATA_ITEM(171, 183, 183, fontpage_171_183_183), // '喷' -- '喷' FONTDATA_ITEM(172, 180, 180, fontpage_172_180_180), // '嘴' -- '嘴' + FONTDATA_ITEM(172, 244, 244, fontpage_172_244_244), // '噴' -- '噴' FONTDATA_ITEM(173, 222, 222, fontpage_173_222_222), // '回' -- '回' FONTDATA_ITEM(173, 224, 224, fontpage_173_224_224), // '因' -- '因' FONTDATA_ITEM(173, 254, 254, fontpage_173_254_254), // '图' -- '图' @@ -1199,7 +1204,6 @@ static const uxg_fontinfo_t g_fontinfo[] PROGMEM = { FONTDATA_ITEM(220, 169, 169, fontpage_220_169_169), // '温' -- '温' FONTDATA_ITEM(221, 144, 144, fontpage_221_144_144), // '源' -- '源' FONTDATA_ITEM(223, 192, 192, fontpage_223_192_192), // '激' -- '激' - FONTDATA_ITEM(224, 237, 237, fontpage_224_237_237), // '灭' -- '灭' FONTDATA_ITEM(224, 239, 239, fontpage_224_239_239), // '灯' -- '灯' FONTDATA_ITEM(225, 185, 185, fontpage_225_185_185), // '点' -- '点' FONTDATA_ITEM(225, 237, 237, fontpage_225_237_237), // '热' -- '热' diff --git a/Marlin/src/lcd/dogm/fontdata/langdata_zh_TW.h b/Marlin/src/lcd/dogm/fontdata/langdata_zh_TW.h index ab264c82b940..e1bb97ea3d64 100644 --- a/Marlin/src/lcd/dogm/fontdata/langdata_zh_TW.h +++ b/Marlin/src/lcd/dogm/fontdata/langdata_zh_TW.h @@ -5,6 +5,9 @@ */ #include +const u8g_fntpgm_uint8_t fontpage_64_157_157[26] U8G_FONT_SECTION("fontpage_64_157_157") = { + 0x00,0x06,0x0c,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x9d,0x9d,0x00,0x07,0x00,0x00, + 0x00,0x05,0x03,0x03,0x06,0x00,0x04,0xd8,0x48,0x90}; const u8g_fntpgm_uint8_t fontpage_69_191_191[28] U8G_FONT_SECTION("fontpage_69_191_191") = { 0x00,0x06,0x0c,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xbf,0xbf,0x00,0x05,0x00,0x00, 0x00,0x05,0x05,0x05,0x06,0x00,0x00,0x08,0x18,0x28,0x48,0xf8}; @@ -663,10 +666,6 @@ const u8g_fntpgm_uint8_t fontpage_223_192_192[45] U8G_FONT_SECTION("fontpage_223 0x00,0x06,0x0c,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xc0,0xc0,0x00,0x0a,0xff,0x00, 0x00,0x0b,0x0b,0x16,0x0c,0x00,0xff,0x44,0x80,0x3e,0x80,0x12,0xe0,0x9e,0xa0,0x53, 0xa0,0x3e,0xa0,0x28,0xa0,0xdf,0xa0,0x4a,0x40,0x52,0xa0,0x65,0x20}; -const u8g_fntpgm_uint8_t fontpage_224_237_237[43] U8G_FONT_SECTION("fontpage_224_237_237") = { - 0x00,0x06,0x0c,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xed,0xed,0x00,0x09,0xff,0x00, - 0x00,0x0b,0x0a,0x14,0x0c,0x00,0xff,0xff,0xe0,0x04,0x00,0x24,0x40,0x24,0x40,0x24, - 0x80,0x4a,0x00,0x0a,0x00,0x11,0x00,0x20,0xe0,0xc0,0x40}; const u8g_fntpgm_uint8_t fontpage_224_239_239[45] U8G_FONT_SECTION("fontpage_224_239_239") = { 0x00,0x06,0x0c,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0xef,0xef,0x00,0x0a,0xff,0x00, 0x00,0x0b,0x0b,0x16,0x0c,0x00,0xff,0x10,0x00,0x17,0xe0,0x54,0x80,0x58,0x80,0x50, @@ -1095,6 +1094,7 @@ const u8g_fntpgm_uint8_t fontpage_510_154_154[30] U8G_FONT_SECTION("fontpage_510 #define FONTDATA_ITEM(page, begin, end, data) { page, begin, end, COUNT(data), data } static const uxg_fontinfo_t g_fontinfo[] PROGMEM = { + FONTDATA_ITEM(64, 157, 157, fontpage_64_157_157), // '”' -- '”' FONTDATA_ITEM(69, 191, 191, fontpage_69_191_191), // '⊿' -- '⊿' FONTDATA_ITEM(156, 128, 128, fontpage_156_128_128), // '一' -- '一' FONTDATA_ITEM(156, 137, 139, fontpage_156_137_139), // '三' -- '下' @@ -1257,7 +1257,6 @@ static const uxg_fontinfo_t g_fontinfo[] PROGMEM = { FONTDATA_ITEM(221, 150, 150, fontpage_221_150_150), // '準' -- '準' FONTDATA_ITEM(221, 171, 171, fontpage_221_171_171), // '溫' -- '溫' FONTDATA_ITEM(223, 192, 192, fontpage_223_192_192), // '激' -- '激' - FONTDATA_ITEM(224, 237, 237, fontpage_224_237_237), // '灭' -- '灭' FONTDATA_ITEM(224, 239, 239, fontpage_224_239_239), // '灯' -- '灯' FONTDATA_ITEM(226, 161, 161, fontpage_226_161_161), // '無' -- '無' FONTDATA_ITEM(227, 177, 177, fontpage_227_177_177), // '熱' -- '熱' diff --git a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp index bcccbf0793c7..a917bc2e84f3 100644 --- a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp +++ b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -51,14 +51,25 @@ #include "../../module/printcounter.h" #endif +#if DUAL_MIXING_EXTRUDER + #include "../../feature/mixing.h" +#endif + FORCE_INLINE void _draw_centered_temp(const int16_t temp, const uint8_t tx, const uint8_t ty) { - const char *str = itostr3(temp); + const char *str = i16tostr3(temp); const uint8_t len = str[0] != ' ' ? 3 : str[1] != ' ' ? 2 : 1; lcd_moveto(tx - len * (INFO_FONT_WIDTH) / 2 + 1, ty); lcd_put_u8str(&str[3-len]); lcd_put_wchar(LCD_STR_DEGREE[0]); } +#define X_LABEL_POS 3 +#define X_VALUE_POS 11 +#define XYZ_SPACING 37 +#define XYZ_BASELINE (30 + INFO_FONT_ASCENT) +#define EXTRAS_BASELINE (40 + INFO_FONT_ASCENT) +#define STATUS_BASELINE (LCD_PIXEL_HEIGHT - INFO_FONT_DESCENT) + #define DO_DRAW_BED (HAS_HEATED_BED && STATUS_BED_WIDTH && HOTENDS <= 3 && DISABLED(STATUS_COMBINE_HEATERS)) #define DO_DRAW_FAN (HAS_FAN0 && STATUS_FAN_WIDTH && STATUS_FAN_FRAMES) #define ANIM_HOTEND (HOTENDS && ENABLED(STATUS_HOTEND_ANIM)) @@ -81,6 +92,12 @@ FORCE_INLINE void _draw_centered_temp(const int16_t temp, const uint8_t tx, cons #define MAX_HOTEND_DRAW MIN(HOTENDS, ((LCD_PIXEL_WIDTH - (STATUS_LOGO_BYTEWIDTH + STATUS_FAN_BYTEWIDTH) * 8) / (STATUS_HEATERS_XSPACE))) #define STATUS_HEATERS_BOT (STATUS_HEATERS_Y + STATUS_HEATERS_HEIGHT - 1) +#if ENABLED(MARLIN_DEV_MODE) + #define SHOW_ON_STATE READ(X_MIN_PIN) +#else + #define SHOW_ON_STATE false +#endif + FORCE_INLINE void _draw_heater_status(const int8_t heater, const bool blink) { #if !HEATER_IDLE_HANDLER UNUSED(blink); @@ -93,10 +110,21 @@ FORCE_INLINE void _draw_heater_status(const int8_t heater, const bool blink) { #define IFBED(A,B) (B) #endif - const bool isHeat = IFBED(BED_ALT(), HOTEND_ALT(heater)); + #if ENABLED(MARLIN_DEV_MODE) + constexpr bool isHeat = true; + #else + const bool isHeat = IFBED(BED_ALT(), HOTEND_ALT(heater)); + #endif + const uint8_t tx = IFBED(STATUS_BED_TEXT_X, STATUS_HOTEND_TEXT_X(heater)); - const float temp = IFBED(thermalManager.degBed(), thermalManager.degHotend(heater)), - target = IFBED(thermalManager.degTargetBed(), thermalManager.degTargetHotend(heater)); + + #if ENABLED(MARLIN_DEV_MODE) + const float temp = 20 + (millis() >> 8) % IFBED(100, 200); + const float target = IFBED(100, 200); + #else + const float temp = IFBED(thermalManager.degBed(), thermalManager.degHotend(heater)), + target = IFBED(thermalManager.degTargetBed(), thermalManager.degTargetHotend(heater)); + #endif #if DISABLED(STATUS_HOTEND_ANIM) #define STATIC_HOTEND true @@ -180,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; @@ -205,15 +233,19 @@ FORCE_INLINE void _draw_heater_status(const int8_t heater, const bool blink) { // Homed and known, display constantly. // FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink) { + const uint8_t offs = (XYZ_SPACING) * axis; + lcd_moveto(X_LABEL_POS + offs, XYZ_BASELINE); + lcd_put_wchar('X' + axis); + lcd_moveto(X_VALUE_POS + offs, XYZ_BASELINE); if (blink) lcd_put_u8str(value); else { if (!TEST(axis_homed, axis)) while (const char c = *value++) lcd_put_wchar(c <= '.' ? c : '?'); else { - #if DISABLED(HOME_AFTER_DEACTIVATE) && DISABLED(DISABLE_REDUCED_ACCURACY_WARNING) + #if DISABLED(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) if (!TEST(axis_known_position, axis)) - lcd_put_u8str_P(axis == Z_AXIS ? PSTR(" ") : PSTR(" ")); + lcd_put_u8str_P(axis == Z_AXIS ? PSTR(" ") : PSTR(" ")); else #endif lcd_put_u8str(value); @@ -221,8 +253,17 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const } } +#if ENABLED(MARLIN_DEV_MODE) + uint16_t count_renders = 0; + uint32_t total_cycles = 0; +#endif + void MarlinUI::draw_status_screen() { + #if ENABLED(MARLIN_DEV_MODE) + if (first_page) count_renders++; + #endif + static char xstring[5], ystring[5], zstring[8]; #if ENABLED(FILAMENT_LCD_DISPLAY) static char wstring[5], mstring[4]; @@ -233,10 +274,10 @@ void MarlinUI::draw_status_screen() { #if ANIM_HOTEND || ANIM_BED uint8_t new_bits = 0; #if ANIM_HOTEND - HOTEND_LOOP() if (thermalManager.isHeatingHotend(e)) SBI(new_bits, e); + HOTEND_LOOP() if (thermalManager.isHeatingHotend(e) ^ SHOW_ON_STATE) SBI(new_bits, e); #endif #if ANIM_BED - if (thermalManager.isHeatingBed()) SBI(new_bits, 7); + if (thermalManager.isHeatingBed() ^ SHOW_ON_STATE) SBI(new_bits, 7); #endif heat_bits = new_bits; #endif @@ -245,7 +286,7 @@ void MarlinUI::draw_status_screen() { strcpy(zstring, ftostr52sp(LOGICAL_Z_POSITION(current_position[Z_AXIS]))); #if ENABLED(FILAMENT_LCD_DISPLAY) strcpy(wstring, ftostr12ns(filament_width_meas)); - strcpy(mstring, itostr3(100.0 * ( + strcpy(mstring, i16tostr3(100.0 * ( parser.volumetric_enabled ? planner.volumetric_area_nominal / planner.volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM] : planner.volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM] @@ -259,6 +300,10 @@ void MarlinUI::draw_status_screen() { // Status Menu Font set_font(FONT_STATUSMENU); + #if ENABLED(MARLIN_DEV_MODE) + TCNT5 = 0; + #endif + #if STATUS_LOGO_WIDTH if (PAGE_CONTAINS(STATUS_LOGO_Y, STATUS_LOGO_Y + STATUS_LOGO_HEIGHT - 1)) u8g.drawBitmapP(STATUS_LOGO_X, STATUS_LOGO_Y, STATUS_LOGO_BYTEWIDTH, STATUS_LOGO_HEIGHT, status_logo_bmp); @@ -287,7 +332,7 @@ void MarlinUI::draw_status_screen() { static uint8_t fan_frame; if (old_blink != blink) { old_blink = blink; - if (!fan_speed[0] || ++fan_frame >= STATUS_FAN_FRAMES) fan_frame = 0; + if (!thermalManager.fan_speed[0] || ++fan_frame >= STATUS_FAN_FRAMES) fan_frame = 0; } #endif if (PAGE_CONTAINS(STATUS_FAN_Y, STATUS_FAN_Y + STATUS_FAN_HEIGHT - 1)) @@ -301,7 +346,7 @@ void MarlinUI::draw_status_screen() { fan_frame == 3 ? status_fan3_bmp : #endif #elif STATUS_FAN_FRAMES > 1 - blink && fan_speed[0] ? status_fan1_bmp : + blink && thermalManager.fan_speed[0] ? status_fan1_bmp : #endif status_fan0_bmp ); @@ -323,17 +368,28 @@ void MarlinUI::draw_status_screen() { // Fan, if a bitmap was provided #if DO_DRAW_FAN - if (PAGE_CONTAINS(STATUS_FAN_TEXT_Y - INFO_FONT_ASCENT, STATUS_FAN_TEXT_Y)) { - const int per = ((int(fan_speed[0]) + 1) * 100) / 256; - if (per) { + if (PAGE_CONTAINS(STATUS_FAN_TEXT_Y - INFO_FONT_ASCENT, STATUS_FAN_TEXT_Y - 1)) { + char c = '%'; + uint16_t spd = thermalManager.fan_speed[0]; + if (spd) { + #if ENABLED(ADAPTIVE_FAN_SLOWING) + if (!blink && thermalManager.fan_speed_scaler[0] < 128) { + spd = (spd * thermalManager.fan_speed_scaler[0]) >> 7; + c = '*'; + } + #endif lcd_moveto(STATUS_FAN_TEXT_X, STATUS_FAN_TEXT_Y); - lcd_put_u8str(itostr3(per)); - lcd_put_wchar('%'); + lcd_put_u8str(i16tostr3(thermalManager.fanPercent(spd))); + lcd_put_wchar(c); } } #endif } + #if ENABLED(MARLIN_DEV_MODE) + total_cycles += TCNT5; + #endif + #if ENABLED(SDSUPPORT) // // SD Card Symbol @@ -382,7 +438,7 @@ void MarlinUI::draw_status_screen() { if (PAGE_CONTAINS(41, 48)) { // Percent complete lcd_moveto(55, 48); - lcd_put_u8str(itostr3(progress)); + lcd_put_u8str(ui8tostr3(progress)); lcd_put_wchar('%'); } #endif @@ -398,12 +454,12 @@ void MarlinUI::draw_status_screen() { #define SD_DURATION_X (LCD_PIXEL_WIDTH - len * MENU_FONT_WIDTH) #endif - if (PAGE_CONTAINS(41, 48)) { + if (PAGE_CONTAINS(EXTRAS_BASELINE - INFO_FONT_ASCENT, EXTRAS_BASELINE - 1)) { char buffer[13]; duration_t elapsed = print_job_timer.duration(); bool has_days = (elapsed.value >= 60*60*24L); uint8_t len = elapsed.toDigital(buffer, has_days); - lcd_moveto(SD_DURATION_X, 48); + lcd_moveto(SD_DURATION_X, EXTRAS_BASELINE); lcd_put_u8str(buffer); } @@ -413,8 +469,6 @@ void MarlinUI::draw_status_screen() { // XYZ Coordinates // - #define XYZ_BASELINE (30 + INFO_FONT_ASCENT) - #define X_LABEL_POS 3 #define X_VALUE_POS 11 #define XYZ_SPACING 37 @@ -441,19 +495,35 @@ void MarlinUI::draw_status_screen() { u8g.setColorIndex(0); // white on black #endif - lcd_moveto(0 * XYZ_SPACING + X_LABEL_POS, XYZ_BASELINE); - lcd_put_wchar('X'); - lcd_moveto(0 * XYZ_SPACING + X_VALUE_POS, XYZ_BASELINE); - _draw_axis_value(X_AXIS, xstring, blink); + #if DUAL_MIXING_EXTRUDER - lcd_moveto(1 * XYZ_SPACING + X_LABEL_POS, XYZ_BASELINE); - lcd_put_wchar('Y'); - lcd_moveto(1 * XYZ_SPACING + X_VALUE_POS, XYZ_BASELINE); - _draw_axis_value(Y_AXIS, ystring, blink); + // Two-component mix / gradient instead of XY + + lcd_moveto(X_LABEL_POS, XYZ_BASELINE); + + char mixer_messages[12]; + const char *mix_label; + #if ENABLED(GRADIENT_MIX) + if (mixer.gradient.enabled) { + mixer.update_mix_from_gradient(); + mix_label = "Gr"; + } + else + #endif + { + mixer.update_mix_from_vtool(); + mix_label = "Mx"; + } + sprintf_P(mixer_messages, PSTR("%s %d;%d%% "), mix_label, int(mixer.mix[0]), int(mixer.mix[1])); + lcd_put_u8str(mixer_messages); + + #else + + _draw_axis_value(X_AXIS, xstring, blink); + _draw_axis_value(Y_AXIS, ystring, blink); + + #endif - lcd_moveto(2 * XYZ_SPACING + X_LABEL_POS, XYZ_BASELINE); - lcd_put_wchar('Z'); - lcd_moveto(2 * XYZ_SPACING + X_VALUE_POS, XYZ_BASELINE); _draw_axis_value(Z_AXIS, zstring, blink); #if DISABLED(XYZ_HOLLOW_FRAME) @@ -465,31 +535,32 @@ void MarlinUI::draw_status_screen() { // // Feedrate // - #define EXTRAS_BASELINE 50 - if (PAGE_CONTAINS(EXTRAS_BASELINE - (INFO_FONT_HEIGHT - 1), EXTRAS_BASELINE)) { + #define EXTRAS_2_BASELINE (EXTRAS_BASELINE + 3) + + if (PAGE_CONTAINS(EXTRAS_2_BASELINE - INFO_FONT_ASCENT, EXTRAS_2_BASELINE - 1)) { set_font(FONT_MENU); - lcd_moveto(3, EXTRAS_BASELINE); + lcd_moveto(3, EXTRAS_2_BASELINE); lcd_put_wchar(LCD_STR_FEEDRATE[0]); set_font(FONT_STATUSMENU); - lcd_moveto(12, EXTRAS_BASELINE); - lcd_put_u8str(itostr3(feedrate_percentage)); + lcd_moveto(12, EXTRAS_2_BASELINE); + lcd_put_u8str(i16tostr3(feedrate_percentage)); lcd_put_wchar('%'); // // Filament sensor display if SD is disabled // #if ENABLED(FILAMENT_LCD_DISPLAY) && DISABLED(SDSUPPORT) - lcd_moveto(56, EXTRAS_BASELINE); + lcd_moveto(56, EXTRAS_2_BASELINE); lcd_put_u8str(wstring); - lcd_moveto(102, EXTRAS_BASELINE); + lcd_moveto(102, EXTRAS_2_BASELINE); lcd_put_u8str(mstring); lcd_put_wchar('%'); set_font(FONT_MENU); - lcd_moveto(47, EXTRAS_BASELINE); + lcd_moveto(47, EXTRAS_2_BASELINE); lcd_put_wchar(LCD_STR_FILAM_DIA[0]); // lcd_put_u8str_P(PSTR(LCD_STR_FILAM_DIA)); - lcd_moveto(93, EXTRAS_BASELINE); + lcd_moveto(93, EXTRAS_2_BASELINE); lcd_put_wchar(LCD_STR_FILAM_MUL[0]); #endif } @@ -498,12 +569,10 @@ void MarlinUI::draw_status_screen() { // Status line // - #define STATUS_BASELINE (LCD_PIXEL_HEIGHT - INFO_FONT_DESCENT) - - if (PAGE_CONTAINS(STATUS_BASELINE - (INFO_FONT_ASCENT - 1), STATUS_BASELINE)) { + 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)); @@ -522,6 +591,17 @@ void MarlinUI::draw_status_screen() { void MarlinUI::draw_status_message(const bool blink) { + #if ENABLED(MARLIN_DEV_MODE) + if (PAGE_CONTAINS(64-8, 64-1)) { + lcd_put_int(total_cycles); + lcd_put_wchar('/'); + lcd_put_int(count_renders); + lcd_put_wchar('='); + lcd_put_int(int(total_cycles / count_renders)); + return; + } + #endif + // Get the UTF8 character count of the string uint8_t slen = utf8_strlen(status_message); @@ -532,46 +612,32 @@ 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; - - // 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 + // and the string remaining length + uint8_t rlen; + const char *stat = status_and_len(rlen); + lcd_put_u8str_max(stat, LCD_PIXEL_WIDTH); + + // 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(' '); } } } 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 126ef00b51e0..8b12a83570d4 100644 --- a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp +++ b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp @@ -158,9 +158,7 @@ void ST7920_Lite_Status_Screen::entry_mode_select(const bool ac_increase, const // function for scroll_or_addr_select() void ST7920_Lite_Status_Screen::_scroll_or_addr_select(const bool sa) { extended_function_set(true); - cmd(0b00100010 | - (sa ? 0b000001 : 0) - ); + cmd(0b00000010 | (sa ? 0b00000001 : 0)); current_bits.sa = sa; } @@ -402,7 +400,7 @@ void ST7920_Lite_Status_Screen::draw_degree_symbol(uint8_t x, uint8_t y, const b const bool oddChar = x & 1; const uint8_t x_word = x >> 1, y_top = degree_symbol_y_top, - y_bot = y_top + sizeof(degree_symbol)/sizeof(degree_symbol[0]); + y_bot = y_top + COUNT(degree_symbol); for (uint8_t i = y_top; i < y_bot; i++) { uint8_t byte = pgm_read_byte(p_bytes++); set_gdram_address(x_word, i + y * 16); @@ -580,12 +578,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 +625,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 @@ -707,7 +684,7 @@ bool ST7920_Lite_Status_Screen::indicators_changed() { // them only during blinks we gain a bit of stability. const bool blink = ui.get_blink(); const uint16_t feedrate_perc = feedrate_percentage; - const uint8_t fs = (((uint16_t)fan_speed[0] + 1) * 100) / 256; + const uint16_t fs = (thermalManager.fan_speed[0] * uint16_t(thermalManager.fan_speed_scaler[0])) >> 7; const int16_t extruder_1_target = thermalManager.degTargetHotend(0); #if HOTENDS > 1 const int16_t extruder_2_target = thermalManager.degTargetHotend(1); @@ -734,7 +711,6 @@ void ST7920_Lite_Status_Screen::update_indicators(const bool forceUpdate) { const bool blink = ui.get_blink(); const duration_t elapsed = print_job_timer.duration(); const uint16_t feedrate_perc = feedrate_percentage; - const uint8_t fs = (((uint16_t)fan_speed[0] + 1) * 100) / 256; const int16_t extruder_1_temp = thermalManager.degHotend(0), extruder_1_target = thermalManager.degTargetHotend(0); #if HOTENDS > 1 @@ -753,12 +729,20 @@ void ST7920_Lite_Status_Screen::update_indicators(const bool forceUpdate) { #if HAS_HEATED_BED draw_bed_temp(bed_temp, bed_target, forceUpdate); #endif - draw_fan_speed(fs); + + uint16_t spd = thermalManager.fan_speed[0]; + + #if ENABLED(ADAPTIVE_FAN_SLOWING) + if (!blink && thermalManager.fan_speed_scaler[0] < 128) + spd = (spd * thermalManager.fan_speed_scaler[0]) >> 7; + #endif + + draw_fan_speed(thermalManager.fanPercent(spd)); draw_print_time(elapsed); draw_feedrate_percentage(feedrate_perc); // Update the fan and bed animations - if (fs) draw_fan_icon(blink); + if (spd) draw_fan_icon(blink); #if HAS_HEATED_BED draw_heat_icon(bed_target > 0 && blink, bed_target > 0); #endif @@ -860,7 +844,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 @@ -921,34 +905,6 @@ void ST7920_Lite_Status_Screen::clear_text_buffer() { ncs(); } -#if ENABLED(U8GLIB_ST7920) && !defined(U8G_HAL_LINKS) && !defined(__SAM3X8E__) - - #include "ultralcd_st7920_u8glib_rrd_AVR.h" - - void ST7920_Lite_Status_Screen::cs() { - ST7920_CS(); - current_bits.synced = false; - } - - void ST7920_Lite_Status_Screen::ncs() { - ST7920_NCS(); - current_bits.synced = false; - } - - void ST7920_Lite_Status_Screen::sync_cmd() { - ST7920_SET_CMD(); - } - - void ST7920_Lite_Status_Screen::sync_dat() { - ST7920_SET_DAT(); - } - - void ST7920_Lite_Status_Screen::write_byte(const uint8_t data) { - ST7920_WRITE_BYTE(data); - } - -#endif - void MarlinUI::draw_status_screen() { ST7920_Lite_Status_Screen::update(false); } diff --git a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.h b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.h index 8a19030d6b0e..1fb707ca1db1 100644 --- a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.h +++ b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.h @@ -15,6 +15,8 @@ */ #pragma once +#include "../../HAL/shared/HAL_ST7920.h" + #include "../../core/macros.h" #include "../../libs/duration_t.h" @@ -28,11 +30,11 @@ class ST7920_Lite_Status_Screen { uint8_t sa : 1; } current_bits; - static void cs(); - static void ncs(); - static void sync_cmd(); - static void sync_dat(); - static void write_byte(const uint8_t w); + static void cs() { ST7920_cs(); current_bits.synced = false; } + static void ncs() { ST7920_cs(); current_bits.synced = false; } + static void sync_cmd() { ST7920_set_cmd(); } + static void sync_dat() { ST7920_set_dat(); } + static void write_byte(const uint8_t w) { ST7920_write_byte(w); } FORCE_INLINE static void write_word(const uint16_t w) { write_byte((w >> 8) & 0xFF); diff --git a/Marlin/src/lcd/dogm/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp b/Marlin/src/lcd/dogm/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp index c0f8e10d0041..59ec0f2b28b5 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_ssd1306_sh1106_128x64_I2C.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -112,7 +112,7 @@ static const uint8_t u8g_dev_sh1106_128x64_init_seq_2_wire[] PROGMEM = { }; uint8_t u8g_dev_sh1106_128x64_2x_2_wire_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) { - switch(msg) { + switch (msg) { case U8G_DEV_MSG_INIT: u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS); u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_sh1106_128x64_init_seq_2_wire); @@ -180,7 +180,7 @@ static const uint8_t u8g_dev_ssd1306_128x64_init_seq_2_wire[] PROGMEM = { }; uint8_t u8g_dev_ssd1306_128x64_2x_2_wire_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) { - switch(msg) { + switch (msg) { case U8G_DEV_MSG_INIT: u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS); u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_ssd1306_128x64_init_seq_2_wire); @@ -227,7 +227,7 @@ u8g_dev_t u8g_dev_ssd1306_128x64_2x_i2c_2_wire = { u8g_dev_ssd1306_128x64_2x_2_w uint8_t u8g_WriteEscSeqP_2_wire(u8g_t *u8g, u8g_dev_t *dev, const uint8_t *esc_seq) { uint8_t is_escape = 0; uint8_t value; - for(;;) { + for (;;) { value = u8g_pgm_read(esc_seq); if (is_escape == 0) { if (value != 255) { 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 fce915a2b598..089a268f19ac 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -21,7 +21,7 @@ */ /** - * u8g_dev_st7565_64128n_HAL.c (Displaytech) + * Based on u8g_dev_st7565_64128n_HAL.c (Displaytech) * * Universal 8bit Graphics Library * @@ -149,7 +149,7 @@ static const uint8_t u8g_dev_st7565_64128n_HAL_sleep_off[] PROGMEM = { }; uint8_t u8g_dev_st7565_64128n_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, const uint8_t msg, void *arg) { - switch(msg) { + switch (msg) { case U8G_DEV_MSG_INIT: u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS); u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_64128n_HAL_init_seq); @@ -183,7 +183,7 @@ uint8_t u8g_dev_st7565_64128n_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, const uint8_t m } uint8_t u8g_dev_st7565_64128n_HAL_2x_fn(u8g_t *u8g, u8g_dev_t *dev, const uint8_t msg, void *arg) { - switch(msg) { + switch (msg) { case U8G_DEV_MSG_INIT: u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS); u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_64128n_HAL_init_seq); 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 5ad6a6a10972..4c34f8209ff4 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -21,7 +21,7 @@ */ /** - * u8g_dev_st7920_128x64_HAL.c + * Based on u8g_dev_st7920_128x64.c * * Universal 8bit Graphics Library * @@ -106,7 +106,7 @@ void clear_graphics_DRAM(u8g_t *u8g, u8g_dev_t *dev) { } uint8_t u8g_dev_st7920_128x64_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) { - switch(msg) { + switch (msg) { case U8G_DEV_MSG_INIT: u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS); u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7920_128x64_HAL_init_seq); @@ -149,7 +149,7 @@ uint8_t u8g_dev_st7920_128x64_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo } uint8_t u8g_dev_st7920_128x64_HAL_4x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) { - switch(msg) { + switch (msg) { case U8G_DEV_MSG_INIT: u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS); u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7920_128x64_HAL_init_seq); diff --git a/Marlin/src/lcd/dogm/u8g_dev_tft_320x240_upscale_from_128x64.cpp b/Marlin/src/lcd/dogm/u8g_dev_tft_320x240_upscale_from_128x64.cpp new file mode 100644 index 000000000000..8f295ab0fe98 --- /dev/null +++ b/Marlin/src/lcd/dogm/u8g_dev_tft_320x240_upscale_from_128x64.cpp @@ -0,0 +1,177 @@ +/** + * 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 . + * + */ + +/* + + u8g_dev_tft_320x240_upscale_from_128x64.cpp + + 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/MarlinConfig.h" + +#if HAS_GRAPHICAL_LCD + +#include "U8glib.h" +#include "HAL_LCD_com_defines.h" +#include "string.h" + +#define WIDTH 128 +#define HEIGHT 64 +#define PAGE_HEIGHT 8 + +#define X_MIN 32 +#define Y_MIN 56 +#define X_MAX (X_MIN + 2 * WIDTH - 1) +#define Y_MAX (Y_MIN + 2 * HEIGHT - 1) + +#define LCD_COLUMN 0x2A /* Colomn address register */ +#define LCD_ROW 0x2B /* Row address register */ +#define LCD_WRITE_RAM 0x2C + +static uint32_t lcd_id = 0; + +#define U8G_ESC_DATA(x) (uint8_t)(x >> 8), (uint8_t)(x & 0xFF) + +static const uint8_t page_first_sequence[] = { + U8G_ESC_ADR(0), LCD_COLUMN, U8G_ESC_ADR(1), U8G_ESC_DATA(X_MIN), U8G_ESC_DATA(X_MAX), + U8G_ESC_ADR(0), LCD_ROW, U8G_ESC_ADR(1), U8G_ESC_DATA(Y_MIN), U8G_ESC_DATA(Y_MAX), + U8G_ESC_ADR(0), LCD_WRITE_RAM, U8G_ESC_ADR(1), + U8G_ESC_END +}; + +static const uint8_t clear_screen_sequence[] = { + U8G_ESC_ADR(0), LCD_COLUMN, U8G_ESC_ADR(1), 0x00, 0x00, 0x01, 0x3F, + U8G_ESC_ADR(0), LCD_ROW, U8G_ESC_ADR(1), 0x00, 0x00, 0x00, 0xEF, + U8G_ESC_ADR(0), LCD_WRITE_RAM, U8G_ESC_ADR(1), + U8G_ESC_END +}; + +static const uint8_t st7789v_init_sequence[] = { // 0x8552 - ST7789V + U8G_ESC_ADR(0), + 0x10, + U8G_ESC_DLY(10), + 0x01, + U8G_ESC_DLY(100), U8G_ESC_DLY(100), + 0x11, + U8G_ESC_DLY(120), + 0x36, U8G_ESC_ADR(1), 0xA0, + U8G_ESC_ADR(0), 0x3A, U8G_ESC_ADR(1), 0x05, + U8G_ESC_ADR(0), LCD_COLUMN, U8G_ESC_ADR(1), 0x00, 0x00, 0x01, 0x3F, + U8G_ESC_ADR(0), LCD_ROW, U8G_ESC_ADR(1), 0x00, 0x00, 0x00, 0xEF, + U8G_ESC_ADR(0), 0xB2, U8G_ESC_ADR(1), 0x0C, 0x0C, 0x00, 0x33, 0x33, + U8G_ESC_ADR(0), 0xB7, U8G_ESC_ADR(1), 0x35, + U8G_ESC_ADR(0), 0xBB, U8G_ESC_ADR(1), 0x1F, + U8G_ESC_ADR(0), 0xC0, U8G_ESC_ADR(1), 0x2C, + U8G_ESC_ADR(0), 0xC2, U8G_ESC_ADR(1), 0x01, 0xC3, + U8G_ESC_ADR(0), 0xC4, U8G_ESC_ADR(1), 0x20, + U8G_ESC_ADR(0), 0xC6, U8G_ESC_ADR(1), 0x0F, + U8G_ESC_ADR(0), 0xD0, U8G_ESC_ADR(1), 0xA4, 0xA1, + U8G_ESC_ADR(0), 0xE0, U8G_ESC_ADR(1), 0xD0, 0x08, 0x11, 0x08, 0x0C, 0x15, 0x39, 0x33, 0x50, 0x36, 0x13, 0x14, 0x29, 0x2D, + U8G_ESC_ADR(0), 0xE1, U8G_ESC_ADR(1), 0xD0, 0x08, 0x10, 0x08, 0x06, 0x06, 0x39, 0x44, 0x51, 0x0B, 0x16, 0x14, 0x2F, 0x31, + U8G_ESC_ADR(0), 0x29, 0x11, 0x35, U8G_ESC_ADR(1), 0x00, + U8G_ESC_END +}; + +uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) { + u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem); + uint16_t buffer[256]; + uint32_t i, j, k; + + switch (msg) { + case U8G_DEV_MSG_INIT: + dev->com_fn(u8g, U8G_COM_MSG_INIT, U8G_SPI_CLK_CYCLE_NONE, &lcd_id); + if (lcd_id == 0x040404) return 0; // No connected display on FSMC + if (lcd_id == 0xFFFFFF) return 0; // No connected display on SPI + + memset(buffer, 0x00, sizeof(buffer)); + + if ((lcd_id & 0xFFFF) == 0x8552) // ST7789V + u8g_WriteEscSeqP(u8g, dev, st7789v_init_sequence); + + u8g_WriteEscSeqP(u8g, dev, clear_screen_sequence); + for (i = 0; i < 960; i++) + u8g_WriteSequence(u8g, dev, 160, (uint8_t *)buffer); + break; + + case U8G_DEV_MSG_STOP: + break; + + case U8G_DEV_MSG_PAGE_FIRST: + u8g_WriteEscSeqP(u8g, dev, page_first_sequence); + break; + + case U8G_DEV_MSG_PAGE_NEXT: + for (j = 0; j < 8; j++) { + k = 0; + for (i = 0; i < (uint32_t)pb->width; i++) { + const uint8_t b = *(((uint8_t *)pb->buf) + i); + const uint16_t c = TEST(b, j) ? 0x7FFF : 0x0000; + buffer[k++] = c; buffer[k++] = c; + } + for (k = 0; k < 2; k++) { + u8g_WriteSequence(u8g, dev, 128, (uint8_t*)buffer); + u8g_WriteSequence(u8g, dev, 128, (uint8_t*)&(buffer[64])); + u8g_WriteSequence(u8g, dev, 128, (uint8_t*)&(buffer[128])); + u8g_WriteSequence(u8g, dev, 128, (uint8_t*)&(buffer[192])); + } + } + break; + + case U8G_DEV_MSG_SLEEP_ON: + case U8G_DEV_MSG_SLEEP_OFF: + return 1; + } + return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg); +} + +U8G_PB_DEV(u8g_dev_tft_320x240_upscale_from_128x64, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_tft_320x240_upscale_from_128x64_fn, U8G_COM_HAL_FSMC_FN); + +#endif // HAS_GRAPHICAL_LCD diff --git a/Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp b/Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp index 03372ece0589..4dd8759e7ae7 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017, 2018 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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" @@ -70,46 +66,51 @@ #define PAGE_HEIGHT 8 static const uint8_t u8g_dev_uc1701_mini12864_HAL_init_seq[] PROGMEM = { - U8G_ESC_CS(0), /* disable chip */ - U8G_ESC_ADR(0), /* instruction mode */ - U8G_ESC_RST(1), /* do reset low pulse with (1*16)+2 milliseconds */ - U8G_ESC_CS(1), /* enable chip */ - - 0x0E2, /* soft reset */ - 0x040, /* set display start line to 0 */ - 0x0A0, /* ADC set to reverse */ - 0x0C8, /* common output mode */ - 0x0A6, /* display normal, bit val 0: LCD pixel off. */ - 0x0A2, /* LCD bias 1/9 */ - 0x02F, /* all power control circuits on */ - 0x0F8, /* set booster ratio to */ - 0x000, /* 4x */ - 0x023, /* set V0 voltage resistor ratio to large */ - 0x081, /* set contrast */ - 0x027, /* contrast value */ - 0x0AC, /* indicator */ - 0x000, /* disable */ - 0x0AF, /* display on */ - - U8G_ESC_DLY(100), /* delay 100 ms */ - 0x0A5, /* display all points, ST7565 */ - U8G_ESC_DLY(100), /* delay 100 ms */ - U8G_ESC_DLY(100), /* delay 100 ms */ - 0x0A4, /* normal display */ - U8G_ESC_CS(0), /* disable chip */ - U8G_ESC_END /* end of sequence */ + U8G_ESC_CS(0), /* disable chip */ + U8G_ESC_ADR(0), /* instruction mode */ + U8G_ESC_RST(1), /* do reset low pulse with (1*16)+2 milliseconds */ + U8G_ESC_CS(1), /* enable chip */ + + 0x0E2, /* soft reset */ + 0x040, /* set display start line to 0 */ + 0x0A0, /* ADC set to reverse */ + 0x0C8, /* common output mode */ + 0x0A6, /* display normal, bit val 0: LCD pixel off. */ + 0x0A2, /* LCD bias 1/9 */ + 0x02F, /* all power control circuits on */ + 0x0F8, /* set booster ratio to */ + 0x000, /* 4x */ + 0x023, /* set V0 voltage resistor ratio to large */ + 0x081, /* set contrast */ + 0x027, /* contrast value */ + 0x0AC, /* indicator */ + 0x000, /* disable */ + 0x0AF, /* display on */ + + U8G_ESC_CS(0), /* disable chip */ + U8G_ESC_DLY(100), /* delay 100 ms */ + U8G_ESC_CS(1), /* enable chip */ + + 0x0A5, /* display all points, ST7565 */ + U8G_ESC_CS(0), /* disable chip */ + U8G_ESC_DLY(100), /* delay 100 ms */ + U8G_ESC_DLY(100), /* delay 100 ms */ + U8G_ESC_CS(1), /* enable chip */ + 0x0A4, /* normal display */ + U8G_ESC_CS(0), /* disable chip */ + U8G_ESC_END /* end of sequence */ }; static const uint8_t u8g_dev_uc1701_mini12864_HAL_data_start[] PROGMEM = { - U8G_ESC_ADR(0), /* instruction mode */ - U8G_ESC_CS(1), /* enable chip */ - 0x010, /* set upper 4 bit of the col adr to 0 */ - 0x000, /* set lower 4 bit of the col adr to 4 */ - U8G_ESC_END /* end of sequence */ + U8G_ESC_ADR(0), /* instruction mode */ + U8G_ESC_CS(1), /* enable chip */ + 0x010, /* set upper 4 bit of the col adr to 0 */ + 0x000, /* set lower 4 bit of the col adr to 4 */ + U8G_ESC_END /* end of sequence */ }; uint8_t u8g_dev_uc1701_mini12864_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) { - switch(msg) { + switch (msg) { case U8G_DEV_MSG_INIT: u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS); u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_init_seq); @@ -138,7 +139,7 @@ uint8_t u8g_dev_uc1701_mini12864_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, } uint8_t u8g_dev_uc1701_mini12864_HAL_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) { - switch(msg) { + switch (msg) { case U8G_DEV_MSG_INIT: u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS); u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_init_seq); diff --git a/Marlin/src/lcd/dogm/u8g_fontutf8.cpp b/Marlin/src/lcd/dogm/u8g_fontutf8.cpp index 890cd4217cbc..115919954fee 100644 --- a/Marlin/src/lcd/dogm/u8g_fontutf8.cpp +++ b/Marlin/src/lcd/dogm/u8g_fontutf8.cpp @@ -97,7 +97,7 @@ static void fontgroup_drawwchar(font_group_t *group, const font_t *fnt_default, * @param utf8_msg : the UTF-8 string * @param cb_read_byte : how to read the utf8_msg, from RAM or ROM (call read_byte_ram or pgm_read_byte) * @param userdata : User's data - * @param cb_draw_ram : the callback function of userdata to draw a !RAM! string (actural it is to draw a one byte string in RAM) + * @param cb_draw_ram : the callback function of userdata to draw a !RAM! string (actually it is to draw a one byte string in RAM) * * @return N/A * diff --git a/Marlin/src/lcd/dogm/ultralcd_DOGM.cpp b/Marlin/src/lcd/dogm/ultralcd_DOGM.cpp index dee00a073c5c..1ab6b18cf26f 100644 --- a/Marlin/src/lcd/dogm/ultralcd_DOGM.cpp +++ b/Marlin/src/lcd/dogm/ultralcd_DOGM.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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" @@ -59,6 +62,10 @@ #include "../../feature/bedlevel/ubl/ubl.h" #endif +/** + * Include all needed font files + * (See http://marlinfw.org/docs/development/fonts.html) + */ #include "fontdata/fontdata_ISO10646_1.h" #if ENABLED(USE_SMALL_INFOFONT) #include "fontdata/fontdata_6x9_marlin.h" @@ -134,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); } @@ -144,31 +154,58 @@ void MarlinUI::set_font(const MarlinFont font_nr) { lcd_custom_bootscreen(); #endif - constexpr uint8_t offy = - #if ENABLED(START_BMPHIGH) - (LCD_PIXEL_HEIGHT - (START_BMPHEIGHT)) / 2 - #else - MENU_FONT_HEIGHT - #endif - ; + // Screen dimensions. + //const uint8_t width = u8g.getWidth(), height = u8g.getHeight(); + constexpr uint8_t width = LCD_PIXEL_WIDTH, height = LCD_PIXEL_HEIGHT; - const uint8_t width = u8g.getWidth(), height = u8g.getHeight(), - offx = (width - (START_BMPWIDTH)) / 2; + // Determine text space needed + #ifndef STRING_SPLASH_LINE2 + constexpr uint8_t text_total_height = MENU_FONT_HEIGHT, + text_width_1 = (sizeof(STRING_SPLASH_LINE1) - 1) * (MENU_FONT_WIDTH), + text_width_2 = 0; + #else + constexpr uint8_t text_total_height = (MENU_FONT_HEIGHT) * 2, + text_width_1 = (sizeof(STRING_SPLASH_LINE1) - 1) * (MENU_FONT_WIDTH), + text_width_2 = (sizeof(STRING_SPLASH_LINE2) - 1) * (MENU_FONT_WIDTH); + #endif + constexpr uint8_t text_max_width = MAX(text_width_1, text_width_2), + rspace = width - (START_BMPWIDTH); + + int8_t offx, offy, txt_base, txt_offx_1, txt_offx_2; + + // Can the text fit to the right of the bitmap? + if (text_max_width < rspace) { + constexpr int8_t inter = (width - text_max_width - (START_BMPWIDTH)) / 3; // Evenly distribute horizontal space + offx = inter; // First the boot logo... + offy = (height - (START_BMPHEIGHT)) / 2; // ...V-aligned in the full height + txt_offx_1 = txt_offx_2 = inter + (START_BMPWIDTH) + inter; // Text right of the bitmap + txt_base = (height + MENU_FONT_ASCENT + text_total_height - (MENU_FONT_HEIGHT)) / 2; // Text vertical center + } + else { + constexpr int8_t inter = (height - text_total_height - (START_BMPHEIGHT)) / 3; // Evenly distribute vertical space + offy = inter; // V-align boot logo proportionally + offx = rspace / 2; // Center the boot logo in the whole space + txt_offx_1 = (width - text_width_1) / 2; // Text 1 centered + txt_offx_2 = (width - text_width_2) / 2; // Text 2 centered + txt_base = offy + START_BMPHEIGHT + offy + text_total_height - (MENU_FONT_DESCENT); // Even spacing looks best + } + NOLESS(offx, 0); + NOLESS(offy, 0); u8g.firstPage(); do { u8g.drawBitmapP(offx, offy, (START_BMPWIDTH + 7) / 8, START_BMPHEIGHT, start_bmp); - ui.set_font(FONT_MENU); + set_font(FONT_MENU); #ifndef STRING_SPLASH_LINE2 - const uint8_t txt1X = width - (sizeof(STRING_SPLASH_LINE1) - 1) * (MENU_FONT_WIDTH); - u8g.drawStr(txt1X, (height + MENU_FONT_HEIGHT) / 2, STRING_SPLASH_LINE1); + u8g.drawStr(txt_offx_1, txt_base, STRING_SPLASH_LINE1); #else - const uint8_t txt1X = (width - (sizeof(STRING_SPLASH_LINE1) - 1) * (MENU_FONT_WIDTH)) / 2, - txt2X = (width - (sizeof(STRING_SPLASH_LINE2) - 1) * (MENU_FONT_WIDTH)) / 2; - u8g.drawStr(txt1X, height - (MENU_FONT_HEIGHT) * 3 / 2, STRING_SPLASH_LINE1); - u8g.drawStr(txt2X, height - (MENU_FONT_HEIGHT) * 1 / 2, STRING_SPLASH_LINE2); + u8g.drawStr(txt_offx_1, txt_base - (MENU_FONT_HEIGHT), STRING_SPLASH_LINE1); + u8g.drawStr(txt_offx_2, txt_base, STRING_SPLASH_LINE2); #endif } while (u8g.nextPage()); + #ifndef BOOTSCREEN_TIMEOUT + #define BOOTSCREEN_TIMEOUT 2500 + #endif safe_delay(BOOTSCREEN_TIMEOUT); } @@ -185,7 +222,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 @@ -254,11 +291,11 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop lcd_put_wchar('E'); lcd_put_wchar((char)('1' + extruder)); lcd_put_wchar(' '); - lcd_put_u8str(itostr3(thermalManager.degHotend(extruder))); + lcd_put_u8str(i16tostr3(thermalManager.degHotend(extruder))); lcd_put_wchar('/'); - if (get_blink() || !thermalManager.is_heater_idle(extruder)) - lcd_put_u8str(itostr3(thermalManager.degTargetHotend(extruder))); + if (get_blink() || !thermalManager.hotend_idle[extruder].timed_out) + lcd_put_u8str(i16tostr3(thermalManager.degTargetHotend(extruder))); } #endif // ADVANCED_PAUSE_FEATURE @@ -376,7 +413,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop if (value != NULL) { lcd_put_wchar(':'); if (extra_row) { - // Assume the value is numeric (with no descender) + // Assume that value is numeric (with no descender) baseline += EDIT_FONT_ASCENT + 2; onpage = PAGE_CONTAINS(baseline - (EDIT_FONT_ASCENT - 1), baseline); } @@ -388,6 +425,27 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop } } + inline void draw_boxed_string(const uint8_t x, const uint8_t y, PGM_P const pstr, const bool inv) { + const uint8_t len = utf8_strlen_P(pstr), bw = len * (MENU_FONT_WIDTH), + bx = x * (MENU_FONT_WIDTH), by = (y + 1) * (MENU_FONT_HEIGHT); + if (inv) { + u8g.setColorIndex(1); + u8g.drawBox(bx - 1, by - (MENU_FONT_ASCENT) + 1, bw + 2, MENU_FONT_HEIGHT - 1); + u8g.setColorIndex(0); + } + lcd_moveto(bx, by); + lcd_put_u8str_P(pstr); + if (inv) u8g.setColorIndex(1); + } + + void draw_select_screen(PGM_P const yes, PGM_P const no, const bool yesno, PGM_P const pref, const char * const string, PGM_P const suff) { + SETCURSOR(0, 0); lcd_put_u8str_P(pref); + if (string) wrap_string(1, string); + if (suff) lcd_put_u8str_P(suff); + draw_boxed_string(1, LCD_HEIGHT - 1, no, !yesno); + draw_boxed_string(LCD_WIDTH - (utf8_strlen_P(yes) + 1), LCD_HEIGHT - 1, yes, yesno); + } + #if ENABLED(SDSUPPORT) void draw_sd_menu_item(const bool sel, const uint8_t row, PGM_P const pstr, CardReader &theCard, const bool isDir) { @@ -493,25 +551,25 @@ 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, - B00001111,B11111110,B00000000, - B00011110,B00001111,B00000000, - B00111000,B00000111,B00000000, - B00111000,B00000011,B10000000, - B01110000,B00000011,B10000000, - B01110000,B00001111,B11100000, - B01110000,B00000111,B11000000, - B01110000,B00000011,B10000000, - B01110000,B00000001,B00000000, - B01110000,B00000000,B00000000, - B00111000,B00000000,B00000000, - B00111000,B00000111,B00000000, - B00011110,B00001111,B00000000, - B00001111,B11111110,B00000000, - B00000011,B11111000,B00000000 + B00000001,B11111100,B00000000, + B00000111,B11111111,B00000000, + B00001111,B00000111,B10000000, + B00001110,B00000001,B11000000, + B00000000,B00000001,B11000000, + B00000000,B00000000,B11100000, + B00001000,B00000000,B11100000, + B00011100,B00000000,B11100000, + B00111110,B00000000,B11100000, + B01111111,B00000000,B11100000, + B00011100,B00000000,B11100000, + B00001110,B00000000,B11100000, + B00001110,B00000001,B11000000, + B00000111,B10000011,B11000000, + B00000011,B11111111,B10000000, + B00000000,B11111110,B00000000 }; const unsigned char ccw_bmp[] PROGMEM = { @@ -611,10 +669,10 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop // Draw cw/ccw indicator and up/down arrows. if (PAGE_CONTAINS(47, 62)) { - u8g.drawBitmapP(left + 0, 47, 3, 16, rot_down); - u8g.drawBitmapP(right + 0, 47, 3, 16, rot_up); - u8g.drawBitmapP(right + 20, 48 - dir, 2, 13, up_arrow_bmp); - u8g.drawBitmapP(left + 20, 49 - dir, 2, 13, down_arrow_bmp); + u8g.drawBitmapP(right + 0, 48 - dir, 2, 13, up_arrow_bmp); + u8g.drawBitmapP(left + 0, 49 - dir, 2, 13, down_arrow_bmp); + u8g.drawBitmapP(left + 13, 47, 3, 16, rot_down); + u8g.drawBitmapP(right + 13, 47, 3, 16, rot_up); } } diff --git a/Marlin/src/lcd/dogm/ultralcd_DOGM.h b/Marlin/src/lcd/dogm/ultralcd_DOGM.h index 42c4fa742d5a..8ce25d0e77c7 100644 --- a/Marlin/src/lcd/dogm/ultralcd_DOGM.h +++ b/Marlin/src/lcd/dogm/ultralcd_DOGM.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -107,16 +107,24 @@ // Generic support for SSD1309 OLED I2C LCDs #define U8G_CLASS U8GLIB_SSD1309_128X64 #define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) -#elif ENABLED(MINIPANEL) +#elif EITHER(MINIPANEL, FYSETC_MINI_12864) // The MINIPanel display //#define U8G_CLASS U8GLIB_MINI12864 //#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 8 stripes - #define U8G_CLASS U8GLIB_MINI12864_2X - #define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 4 stripes + #define U8G_CLASS U8GLIB_MINI12864_2X_HAL + #if BOTH(FYSETC_MINI_12864, FORCE_SOFT_SPI) + #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // 4 stripes SW-SPI + #else + #define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 4 stripes HW-SPI + #endif #elif ENABLED(U8GLIB_SH1106_EINSTART) // Connected via motherboard header #define U8G_CLASS U8GLIB_SH1106_128X64 #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, LCD_PINS_DC, LCD_PINS_RS +#elif ENABLED(MKS_ROBIN_TFT) + // Unspecified 320x240 TFT pre-initialized by built-in bootloader + #define U8G_CLASS U8GLIB_TFT_320X240_UPSCALE_FROM_128X64 + #define U8G_PARAM FSMC_CS_PIN, FSMC_RS_PIN #else // for regular DOGM128 display with HW-SPI //#define U8G_CLASS U8GLIB_DOGM128 diff --git a/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp b/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp index c3d1942a59db..969cef10bb13 100644 --- a/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp +++ b/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -71,23 +71,23 @@ uint8_t u8g_dev_rrd_st7920_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo OUT_WRITE(ST7920_CLK_PIN, HIGH); ST7920_CS(); - u8g_Delay(120); //initial delay for boot up + u8g_Delay(120); // Initial delay for boot up ST7920_SET_CMD(); - ST7920_WRITE_BYTE(0x20); //non-extended mode - ST7920_WRITE_BYTE(0x08); //display off, cursor+blink off - ST7920_WRITE_BYTE(0x01); //clear DDRAM ram - u8g_Delay(15); //delay for DDRAM clear - ST7920_WRITE_BYTE(0x24); //extended mode - ST7920_WRITE_BYTE(0x26); //extended mode + GDRAM active - for (y = 0; y < (LCD_PIXEL_HEIGHT) / 2; y++) { //clear GDRAM - ST7920_WRITE_BYTE(0x80 | y); //set y - ST7920_WRITE_BYTE(0x80); //set x = 0 + ST7920_WRITE_BYTE(0x20); // Non-extended mode + ST7920_WRITE_BYTE(0x08); // Display off, cursor+blink off + ST7920_WRITE_BYTE(0x01); // Clear DDRAM ram + u8g_Delay(15); // Delay for DDRAM clear + ST7920_WRITE_BYTE(0x24); // Extended mode + ST7920_WRITE_BYTE(0x26); // Extended mode + GDRAM active + for (y = 0; y < (LCD_PIXEL_HEIGHT) / 2; y++) { // Clear GDRAM + ST7920_WRITE_BYTE(0x80 | y); // Set y + ST7920_WRITE_BYTE(0x80); // Set x = 0 ST7920_SET_DAT(); - for (i = 0; i < 2 * (LCD_PIXEL_WIDTH) / 8; i++) //2x width clears both segments + for (i = 0; i < 2 * (LCD_PIXEL_WIDTH) / 8; i++) // 2x width clears both segments ST7920_WRITE_BYTE(0); ST7920_SET_CMD(); } - ST7920_WRITE_BYTE(0x0C); //display on, cursor+blink off + ST7920_WRITE_BYTE(0x0C); // Display on, cursor+blink off ST7920_NCS(); } break; @@ -104,15 +104,15 @@ uint8_t u8g_dev_rrd_st7920_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo for (i = 0; i < PAGE_HEIGHT; i ++) { ST7920_SET_CMD(); if (y < 32) { - ST7920_WRITE_BYTE(0x80 | y); //y - ST7920_WRITE_BYTE(0x80); //x=0 + ST7920_WRITE_BYTE(0x80 | y); // y + ST7920_WRITE_BYTE(0x80); // x = 0 } else { - ST7920_WRITE_BYTE(0x80 | (y - 32)); //y - ST7920_WRITE_BYTE(0x80 | 8); //x=64 + ST7920_WRITE_BYTE(0x80 | (y - 32)); // y + ST7920_WRITE_BYTE(0x80 | 8); // x = 64 } ST7920_SET_DAT(); - ST7920_WRITE_BYTES(ptr, (LCD_PIXEL_WIDTH) / 8); //ptr is incremented inside of macro + ST7920_WRITE_BYTES(ptr, (LCD_PIXEL_WIDTH) / 8); // ptr incremented inside of macro! y++; } ST7920_NCS(); @@ -134,4 +134,13 @@ u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi = {u8g_dev_rrd_st7920_128x64_fn, &u8g #pragma GCC reset_options +#if ENABLED(LIGHTWEIGHT_UI) + #include "../../HAL/shared/HAL_ST7920.h" + void ST7920_cs() { ST7920_CS(); } + void ST7920_ncs() { ST7920_NCS(); } + void ST7920_set_cmd() { ST7920_SET_CMD(); } + void ST7920_set_dat() { ST7920_SET_DAT(); } + void ST7920_write_byte(const uint8_t val) { ST7920_WRITE_BYTE(val); } +#endif + #endif // U8GLIB_ST7920 && !U8G_HAL_LINKS && !__SAM3X8E__ diff --git a/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.h b/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.h index 4e601b617926..b795ac169a93 100644 --- a/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.h +++ b/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/lcd/extensible_ui/lib/example.cpp b/Marlin/src/lcd/extensible_ui/lib/example.cpp index 51040cde04c5..2a11d5c3c44d 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 a9dabaa0acbd..aa71743e129e 100644 --- a/Marlin/src/lcd/extensible_ui/ui_api.cpp +++ b/Marlin/src/lcd/extensible_ui/ui_api.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -51,39 +51,56 @@ #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 +#if ENABLED(EMERGENCY_PARSER) + #include "../../feature/emergency_parser.h" +#endif + #if ENABLED(SDSUPPORT) #include "../../sd/cardreader.h" - #include "../../feature/emergency_parser.h" #define IFSD(A,B) (A) #else #define IFSD(A,B) (B) #endif -#if ENABLED(PRINTCOUNTER) - #include "../../core/utility.h" - #include "../../module/printcounter.h" +#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 ENABLED(FILAMENT_RUNOUT_SENSOR) +#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); } @@ -180,7 +197,13 @@ namespace ExtUI { return thermalManager.degTargetHotend(extruder - E0); } - float getFan_percent(const fan_t fan) { return ((float(fan_speed[fan - FAN0]) + 1) * 100) / 256; } + float getTargetFan_percent(const fan_t fan) { + return thermalManager.fanPercent(thermalManager.fan_speed[fan - FAN0]); + } + + float getActualFan_percent(const fan_t fan) { + return thermalManager.fanPercent((thermalManager.fan_speed[fan - FAN0] * uint16_t(thermalManager.fan_speed_scaler[fan - FAN0])) >> 7); + } float getAxisPosition_mm(const axis_t axis) { return flags.manual_motion ? destination[axis] : current_position[axis]; @@ -200,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; } @@ -284,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 @@ -322,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]; } @@ -370,7 +513,7 @@ namespace ExtUI { planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(extruder - E0)] = value; } - #if ENABLED(FILAMENT_RUNOUT_SENSOR) + #if HAS_FILAMENT_SENSOR bool getFilamentRunoutEnabled() { return runout.enabled; } void setFilamentRunoutEnabled(const bool value) { runout.enabled = value; } @@ -404,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 @@ -439,49 +584,86 @@ namespace ExtUI { void setRetractAcceleration_mm_s2(const float acc) { planner.settings.retract_acceleration = acc; } void setTravelAcceleration_mm_s2(const float acc) { planner.settings.travel_acceleration = acc; } - #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - float getZOffset_mm() { - #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET) - if (active_extruder != 0) - return hotend_offset[Z_AXIS][active_extruder]; - else - #endif - return zprobe_zoffset; + #if ENABLED(BABYSTEPPING) + bool babystepAxis_steps(const int16_t steps, const axis_t axis) { + switch (axis) { + #if ENABLED(BABYSTEP_XY) + case X: babystep.add_steps(X_AXIS, steps); break; + case Y: babystep.add_steps(Y_AXIS, steps); break; + #endif + case Z: babystep.add_steps(Z_AXIS, steps); break; + default: return false; + }; + return true; } - void setZOffset_mm(const float value) { - const float diff = (value - getZOffset_mm()) / planner.steps_to_mm[Z_AXIS]; - addZOffset_steps(diff > 0 ? ceil(diff) : floor(diff)); - } + /** + * This function adjusts an axis during a print. + * + * When linked_nozzles is false, each nozzle in a multi-nozzle + * printer can be babystepped independently of the others. This + * lets the user to fine tune the Z-offset and Nozzle Offsets + * while observing the first layer of a print, regardless of + * what nozzle is printing. + */ + void smartAdjustAxis_steps(const int16_t steps, const axis_t axis, bool linked_nozzles) { + const float mm = steps * planner.steps_to_mm[axis]; + + if (!babystepAxis_steps(steps, axis)) return; - void addZOffset_steps(int16_t babystep_increment) { - #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET) - const bool do_probe = (active_extruder == 0); + #if ENABLED(BABYSTEP_ZPROBE_OFFSET) + // Make it so babystepping in Z adjusts the Z probe offset. + if (axis == Z + #if EXTRUDERS > 1 + && (linked_nozzles || active_extruder == 0) + #endif + ) zprobe_zoffset += mm; + #endif + + #if EXTRUDERS > 1 + /** + * When linked_nozzles is false, as an axis is babystepped + * adjust the hotend offsets so that the other nozzles are + * unaffected by the babystepping of the active nozzle. + */ + if (!linked_nozzles) { + HOTEND_LOOP() + if (e != active_extruder) + hotend_offset[axis][e] += mm; + + normalizeNozzleOffset(X); + normalizeNozzleOffset(Y); + normalizeNozzleOffset(Z); + } #else - constexpr bool do_probe = true; + UNUSED(linked_nozzles); #endif - const float diff = planner.steps_to_mm[Z_AXIS] * babystep_increment, - new_probe_offset = zprobe_zoffset + diff, - new_offs = - #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET) - do_probe ? new_probe_offset : hotend_offset[Z_AXIS][active_extruder] - diff - #else - new_probe_offset - #endif - ; - if (WITHIN(new_offs, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) { - - thermalManager.babystep_axis(Z_AXIS, babystep_increment); - - if (do_probe) zprobe_zoffset = new_offs; - #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET) - else hotend_offset[Z_AXIS][active_extruder] = new_offs; - #endif + } + + /** + * Converts a mm displacement to a number of whole number of + * steps that is at least mm long. + */ + int16_t mmToWholeSteps(const float mm, const axis_t axis) { + const float steps = mm / planner.steps_to_mm[axis]; + return steps > 0 ? ceil(steps) : floor(steps); + } + #endif + + #if HAS_BED_PROBE + float getZOffset_mm() { + return zprobe_zoffset; + } + + void setZOffset_mm(const float value) { + if (WITHIN(value, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) { + zprobe_zoffset = value; } } - #endif // ENABLED(BABYSTEP_ZPROBE_OFFSET) + #endif // HAS_BED_PROBE + + #if HAS_HOTEND_OFFSET - #if HOTENDS > 1 float getNozzleOffset_mm(const axis_t axis, const extruder_t extruder) { if (extruder - E0 >= HOTENDS) return 0; return hotend_offset[axis][extruder - E0]; @@ -491,15 +673,26 @@ namespace ExtUI { if (extruder - E0 >= HOTENDS) return; hotend_offset[axis][extruder - E0] = value; } - #endif + + /** + * The UI should call this if needs to guarantee the first + * nozzle offset is zero (such as when it doesn't allow the + * user to edit the offset the first nozzle). + */ + void normalizeNozzleOffset(const axis_t axis) { + const float offs = hotend_offset[axis][0]; + HOTEND_LOOP() hotend_offset[axis][e] -= offs; + } + + #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; } @@ -508,7 +701,7 @@ namespace ExtUI { #endif uint8_t getProgress_percent() { - return IFSD(card.percentDone(), 0); + return ui.get_progress(); } uint32_t getProgress_seconds_elapsed() { @@ -516,11 +709,32 @@ 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,itostr3left(print_job_timer.getStats().totalPrints)); return buffer; } - char* getFinishedPrints_str(char buffer[21]) { strcpy(buffer,itostr3left(print_job_timer.getStats().finishedPrints)); return buffer; } - char* getTotalPrintTime_str(char buffer[21]) { duration_t(print_job_timer.getStats().printTime).toString(buffer); return buffer; } - char* getLongestPrint_str(char buffer[21]) { duration_t(print_job_timer.getStats().printTime).toString(buffer); return buffer; } + char* 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; } + char* getTotalPrintTime_str(char buffer[21]) { duration_t(print_job_timer.getStats().printTime).toString(buffer); return buffer; } + char* getLongestPrint_str(char buffer[21]) { duration_t(print_job_timer.getStats().printTime).toString(buffer); return buffer; } char* getFilamentUsed_str(char buffer[21]) { printStatistics stats = print_job_timer.getStats(); sprintf_P(buffer, PSTR("%ld.%im"), long(stats.filamentUsed / 1000), int16_t(stats.filamentUsed / 100) % 10); @@ -544,27 +758,37 @@ namespace ExtUI { } void setTargetTemp_celsius(float value, const heater_t heater) { + constexpr int16_t heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP); + const int16_t e = heater - H0; #if HAS_HEATED_BED if (heater == BED) - thermalManager.setTargetBed(clamp(value,0,200)); + thermalManager.setTargetBed(clamp(value, 0, BED_MAXTEMP - 10)); else #endif - thermalManager.setTargetHotend(clamp(value,0,500), heater - H0); + thermalManager.setTargetHotend(clamp(value, 0, heater_maxtemp[e] - 15), e); } void setTargetTemp_celsius(float value, const extruder_t extruder) { - thermalManager.setTargetHotend(clamp(value,0,500), extruder - E0); + constexpr int16_t heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP); + const int16_t e = extruder - E0; + thermalManager.setTargetHotend(clamp(value, 0, heater_maxtemp[e] - 15), e); } - void setFan_percent(float value, const fan_t fan) { + void setTargetFan_percent(const float value, const fan_t fan) { if (fan < FAN_COUNT) - fan_speed[fan - FAN0] = clamp(round(value * 255 / 100), 0, 255); + thermalManager.set_fan_speed(fan - FAN0, map(clamp(value, 0, 100), 0, 100, 0, 255)); } void setFeedrate_percent(const float value) { 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); } @@ -574,7 +798,7 @@ namespace ExtUI { } bool isPrintingFromMedia() { - return IFSD(card.flag.cardOK && card.isFileOpen(), false); + return IFSD(card.isFileOpen(), false); } bool isPrinting() { @@ -582,7 +806,7 @@ namespace ExtUI { } bool isMediaInserted() { - return IFSD(IS_SD_INSERTED() && card.flag.cardOK, false); + return IFSD(IS_SD_INSERTED() && card.isDetected(), false); } void pausePrint() { @@ -623,7 +847,7 @@ namespace ExtUI { bool FileList::seek(const uint16_t pos, const bool skip_range_check) { #if ENABLED(SDSUPPORT) - if (!skip_range_check && pos > (count() - 1)) return false; + if (!skip_range_check && (pos + 1) > count()) return false; const uint16_t nr = #if ENABLED(SDCARD_RATHERRECENTFIRST) && DISABLED(SDCARD_SORT_ALPHA) count() - 1 - @@ -631,14 +855,14 @@ namespace ExtUI { pos; card.getfilename_sorted(nr); - return card.filename && card.filename[0] != '\0'; + return card.filename[0] != '\0'; #else return false; #endif } const char* FileList::filename() { - return IFSD(card.longFilename && card.longFilename[0] ? card.longFilename : card.filename, ""); + return IFSD(card.longFilename[0] ? card.longFilename : card.filename, ""); } const char* FileList::shortFilename() { @@ -688,6 +912,7 @@ void MarlinUI::init() { #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT) SET_INPUT_PULLUP(SD_DETECT_PIN); #endif + ExtUI::onStartup(); } @@ -699,13 +924,13 @@ void MarlinUI::update() { last_sd_status = sd_status; if (sd_status) { card.initsd(); - if (card.flag.cardOK) + if (card.isDetected()) ExtUI::onMediaInserted(); else ExtUI::onMediaError(); } else { - const bool ok = card.flag.cardOK; + const bool ok = card.isDetected(); card.release(); if (ok) ExtUI::onMediaRemoved(); } diff --git a/Marlin/src/lcd/extensible_ui/ui_api.h b/Marlin/src/lcd/extensible_ui/ui_api.h index 1a86680a1ff0..b5be58dcca1a 100644 --- a/Marlin/src/lcd/extensible_ui/ui_api.h +++ b/Marlin/src/lcd/extensible_ui/ui_api.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -68,11 +68,27 @@ 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); float getTargetTemp_celsius(const extruder_t); - float getFan_percent(const fan_t); + float getTargetFan_percent(const fan_t); + float getActualFan_percent(const fan_t); float getAxisPosition_mm(const axis_t); float getAxisPosition_mm(const extruder_t); float getAxisSteps_per_mm(const axis_t); @@ -90,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]); @@ -100,7 +131,7 @@ namespace ExtUI { void setTargetTemp_celsius(const float, const heater_t); void setTargetTemp_celsius(const float, const extruder_t); - void setFan_percent(const float, const fan_t); + void setTargetFan_percent(const float, const fan_t); void setAxisPosition_mm(const float, const axis_t); void setAxisPosition_mm(const float, const extruder_t); void setAxisSteps_per_mm(const float, const axis_t); @@ -116,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); @@ -135,16 +167,22 @@ namespace ExtUI { extruder_t getActiveTool(); void setActiveTool(const extruder_t, bool no_move); + #if ENABLED(BABYSTEPPING) + int16_t mmToWholeSteps(const float mm, const axis_t axis); + + bool babystepAxis_steps(const int16_t steps, const axis_t axis); + 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); #endif - #if ENABLED(BABYSTEP_ZPROBE_OFFSET) + #if HAS_BED_PROBE float getZOffset_mm(); void setZOffset_mm(const float); - void addZOffset_steps(const int16_t); #endif #if ENABLED(BACKLASH_GCODE) @@ -160,7 +198,7 @@ namespace ExtUI { #endif #endif - #if ENABLED(FILAMENT_RUNOUT_SENSOR) + #if HAS_FILAMENT_SENSOR bool getFilamentRunoutEnabled(); void setFilamentRunoutEnabled(const bool); @@ -232,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(); + 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/fontutils.cpp b/Marlin/src/lcd/fontutils.cpp index 5685e6e4c32a..4e714d080456 100644 --- a/Marlin/src/lcd/fontutils.cpp +++ b/Marlin/src/lcd/fontutils.cpp @@ -10,8 +10,8 @@ #include "../inc/MarlinConfig.h" #if ENABLED(ULTRA_LCD) -#include "ultralcd.h" -#include "../Marlin.h" + #include "ultralcd.h" + #include "../Marlin.h" #endif #include "fontutils.h" diff --git a/Marlin/src/lcd/language/language_an.h b/Marlin/src/lcd/language/language_an.h index 849f30f9b9ae..e2932c47ea8a 100644 --- a/Marlin/src/lcd/language/language_an.h +++ b/Marlin/src/lcd/language/language_an.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -43,7 +43,6 @@ #define MSG_AUTO_HOME_X _UxGT("Orichen X") #define MSG_AUTO_HOME_Y _UxGT("Orichen Y") #define MSG_AUTO_HOME_Z _UxGT("Orichen Z") -#define MSG_TMC_Z_CALIBRATION _UxGT("Calibrar Z") #define MSG_LEVEL_BED_HOMING _UxGT("Orichen XYZ") #define MSG_LEVEL_BED_WAITING _UxGT("Encetar (pretar)") #define MSG_LEVEL_BED_NEXT_POINT _UxGT("Vinient punto") diff --git a/Marlin/src/lcd/language/language_bg.h b/Marlin/src/lcd/language/language_bg.h index 3409e770d526..74b550862cfb 100644 --- a/Marlin/src/lcd/language/language_bg.h +++ b/Marlin/src/lcd/language/language_bg.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -38,7 +38,6 @@ #define MSG_AUTOSTART _UxGT("Автостарт") #define MSG_DISABLE_STEPPERS _UxGT("Изкл. двигатели") #define MSG_AUTO_HOME _UxGT("Паркиране") -#define MSG_TMC_Z_CALIBRATION _UxGT("Калибровка Z") #define MSG_SET_HOME_OFFSETS _UxGT("Задай Начало") #define MSG_SET_ORIGIN _UxGT("Изходна точка") #define MSG_PREHEAT_1 _UxGT("Подгряване " PREHEAT_1_LABEL) diff --git a/Marlin/src/lcd/language/language_ca.h b/Marlin/src/lcd/language/language_ca.h index c871bdee0a96..4bb5817160c9 100644 --- a/Marlin/src/lcd/language/language_ca.h +++ b/Marlin/src/lcd/language/language_ca.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -44,7 +44,6 @@ #define MSG_AUTO_HOME_X _UxGT("X a origen") #define MSG_AUTO_HOME_Y _UxGT("Y a origen") #define MSG_AUTO_HOME_Z _UxGT("Z a origen") -#define MSG_TMC_Z_CALIBRATION _UxGT("Calibra Z") #define MSG_LEVEL_BED_HOMING _UxGT("Origen XYZ") #define MSG_LEVEL_BED_WAITING _UxGT("Premeu per iniciar") #define MSG_LEVEL_BED_NEXT_POINT _UxGT("Següent punt") diff --git a/Marlin/src/lcd/language/language_cz.h b/Marlin/src/lcd/language/language_cz.h index e2a9256b8128..d2a9e0811b03 100644 --- a/Marlin/src/lcd/language/language_cz.h +++ b/Marlin/src/lcd/language/language_cz.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -35,24 +35,33 @@ */ #define DISPLAY_CHARSET_ISO10646_CZ +#define THIS_LANGUAGES_SPECIAL_SYMBOLS _UxGT("áÁčČďĎéÉěĚíÍňŇóÓřŘšŠťŤúÚůŮýÝžŽ³") #define CHARSIZE 2 #define WELCOME_MSG MACHINE_NAME _UxGT(" připraven.") +#define MSG_YES _UxGT("ANO") +#define MSG_NO _UxGT("NE") #define MSG_BACK _UxGT("Zpět") #define MSG_SD_INSERTED _UxGT("Karta vložena") #define MSG_SD_REMOVED _UxGT("Karta vyjmuta") #define MSG_LCD_ENDSTOPS _UxGT("Endstopy") // max 8 znaku #define MSG_LCD_SOFT_ENDSTOPS _UxGT("Soft Endstopy") #define MSG_MAIN _UxGT("Hlavní nabídka") +#define MSG_ADVANCED_SETTINGS _UxGT("Další nastavení") +#define MSG_CONFIGURATION _UxGT("Konfigurace") #define MSG_AUTOSTART _UxGT("Autostart") #define MSG_DISABLE_STEPPERS _UxGT("Uvolnit motory") #define MSG_DEBUG_MENU _UxGT("Nabídka ladění") -#define MSG_PROGRESS_BAR_TEST _UxGT("Test uk. průběhu") +#if LCD_WIDTH >= 20 + #define MSG_PROGRESS_BAR_TEST _UxGT("Test ukaz. průběhu") +#else + #define MSG_PROGRESS_BAR_TEST _UxGT("Test uk. průběhu") +#endif #define MSG_AUTO_HOME _UxGT("Domovská pozice") #define MSG_AUTO_HOME_X _UxGT("Domů osa X") #define MSG_AUTO_HOME_Y _UxGT("Domů osa Y") #define MSG_AUTO_HOME_Z _UxGT("Domů osa Z") -#define MSG_TMC_Z_CALIBRATION _UxGT("Kalibrovat Z") +#define MSG_AUTO_Z_ALIGN _UxGT("Auto srovnání Z") #define MSG_LEVEL_BED_HOMING _UxGT("Měření podložky") #define MSG_LEVEL_BED_WAITING _UxGT("Kliknutím spusťte") #define MSG_LEVEL_BED_NEXT_POINT _UxGT("Další bod") @@ -73,7 +82,13 @@ #define MSG_PREHEAT_2_END MSG_PREHEAT_2 _UxGT(" hotend") #define MSG_PREHEAT_2_BEDONLY MSG_PREHEAT_2 _UxGT(" podlož") #define MSG_PREHEAT_2_SETTINGS MSG_PREHEAT_2 _UxGT(" nast") +#define MSG_PREHEAT_CUSTOM _UxGT("Zahřát vlastní") #define MSG_COOLDOWN _UxGT("Zchladit") +#define MSG_LASER_MENU _UxGT("Ovládání laseru") +#define MSG_LASER_OFF _UxGT("Vypnout laser") +#define MSG_LASER_ON _UxGT("Zapnout laser") +#define MSG_LASER_POWER _UxGT("Výkon laseru") +#define MSG_SPINDLE_REVERSE _UxGT("Vřeteno opačně") #define MSG_SWITCH_PS_ON _UxGT("Zapnout napájení") #define MSG_SWITCH_PS_OFF _UxGT("Vypnout napájení") #define MSG_EXTRUDE _UxGT("Vytlačit (extr.)") @@ -85,10 +100,23 @@ #define MSG_NEXT_CORNER _UxGT("Další roh") #define MSG_EDITING_STOPPED _UxGT("Konec úprav sítě") +#define MSG_MESH_X _UxGT("Index X") +#define MSG_MESH_Y _UxGT("Index Y") +#define MSG_MESH_EDIT_Z _UxGT("Hodnota Z") +#define MSG_USER_MENU _UxGT("Vlastní příkazy") #define MSG_UBL_DOING_G29 _UxGT("Provádím G29") #define MSG_UBL_UNHOMED _UxGT("Přejeďte domů") #define MSG_UBL_TOOLS _UxGT("UBL nástroje") #define MSG_UBL_LEVEL_BED _UxGT("Unified Bed Leveling") +#define MSG_IDEX_MENU _UxGT("Režim IDEX") +#define MSG_OFFSETS_MENU _UxGT("Ofsety nástrojů") +#define MSG_IDEX_MODE_AUTOPARK _UxGT("Auto-Park") +#define MSG_IDEX_MODE_DUPLICATE _UxGT("Duplikace") +#define MSG_IDEX_MODE_MIRRORED_COPY _UxGT("Zrcadlení") +#define MSG_IDEX_MODE_FULL_CTRL _UxGT("Plná kontrola") +#define MSG_X_OFFSET _UxGT("2. tryska X") +#define MSG_Y_OFFSET _UxGT("2. tryska Y") +#define MSG_Z_OFFSET _UxGT("2. tryska Z") #define MSG_UBL_MANUAL_MESH _UxGT("Manuální síť bodů") #define MSG_UBL_BC_INSERT _UxGT("Vložte kartu, změřte") #define MSG_UBL_BC_INSERT2 _UxGT("Změřte") @@ -106,8 +134,8 @@ #define MSG_UBL_DONE_EDITING_MESH _UxGT("Konec úprav sítě") #define MSG_UBL_BUILD_CUSTOM_MESH _UxGT("Vlastní síť") #define MSG_UBL_BUILD_MESH_MENU _UxGT("Vytvořit síť") -#define MSG_UBL_BUILD_MESH_M1 _UxGT("Síť bodu " PREHEAT_1_LABEL) -#define MSG_UBL_BUILD_MESH_M2 _UxGT("Síť bodu " PREHEAT_2_LABEL) +#define MSG_UBL_BUILD_MESH_M1 _UxGT("Síť bodů " PREHEAT_1_LABEL) +#define MSG_UBL_BUILD_MESH_M2 _UxGT("Síť bodů " PREHEAT_2_LABEL) #define MSG_UBL_BUILD_COLD_MESH _UxGT("Studená síť bodů") #define MSG_UBL_MESH_HEIGHT_ADJUST _UxGT("Upravit výšku sítě") #define MSG_UBL_MESH_HEIGHT_AMOUNT _UxGT("Výška") @@ -117,8 +145,8 @@ #define MSG_UBL_VALIDATE_CUSTOM_MESH _UxGT("Kontrola vlast. sítě") #define MSG_UBL_CONTINUE_MESH _UxGT("Pokračovat v síťi") #define MSG_UBL_MESH_LEVELING _UxGT("Síťové rovnání") -#define MSG_UBL_3POINT_MESH_LEVELING _UxGT("3-bodove rovnání") -#define MSG_UBL_GRID_MESH_LEVELING _UxGT("Mrizkove rovnání") +#define MSG_UBL_3POINT_MESH_LEVELING _UxGT("3-bodové rovnání") +#define MSG_UBL_GRID_MESH_LEVELING _UxGT("Mřížkové rovnání") #define MSG_UBL_MESH_LEVEL _UxGT("Srovnat podložku") #define MSG_UBL_SIDE_POINTS _UxGT("Postranní body") #define MSG_UBL_MAP_TYPE _UxGT("Typ sítě bodu") @@ -143,12 +171,12 @@ #define MSG_MESH_LOADED _UxGT("Síť %i načtena") #define MSG_MESH_SAVED _UxGT("Síť %i uložena") #define MSG_NO_STORAGE _UxGT("Nedostatek místa") -#define MSG_UBL_SAVE_ERROR _UxGT("Err: Uložit UBL") -#define MSG_UBL_RESTORE_ERROR _UxGT("Err: Obnovit UBL") +#define MSG_UBL_SAVE_ERROR _UxGT("Ch.: Uložit UBL") +#define MSG_UBL_RESTORE_ERROR _UxGT("Ch.: Obnovit UBL") #define MSG_UBL_Z_OFFSET_STOPPED _UxGT("Konec Z-Offsetu") #define MSG_UBL_STEP_BY_STEP_MENU _UxGT("UBL Postupně") -#define MSG_LED_CONTROL _UxGT("LED Nastavení") +#define MSG_LED_CONTROL _UxGT("Nastavení LED") #define MSG_LEDS _UxGT("Světla") #define MSG_LED_PRESETS _UxGT("Světla Předvolby") #define MSG_SET_LEDS_RED _UxGT("Červená") @@ -166,14 +194,14 @@ #define MSG_INTENSITY_B _UxGT("Modrá intenzita") #define MSG_INTENSITY_W _UxGT("Bílá intenzita") #define MSG_LED_BRIGHTNESS _UxGT("Jas") -#define MSG_USER_MENU _UxGT("Vlastní příkazy") -#define MSG_MOVING _UxGT("Posouvani...") +#define MSG_MOVING _UxGT("Posouvání...") #define MSG_FREE_XY _UxGT("Uvolnit XY") #define MSG_MOVE_X _UxGT("Posunout X") #define MSG_MOVE_Y _UxGT("Posunout Y") #define MSG_MOVE_Z _UxGT("Posunout Z") #define MSG_MOVE_E _UxGT("Extrudér") +#define MSG_HOTEND_TOO_COLD _UxGT("Hotend je studený") #define MSG_MOVE_01MM _UxGT("Posunout o 0,1mm") #define MSG_MOVE_1MM _UxGT("Posunout o 1mm") #define MSG_MOVE_10MM _UxGT("Posunout o 10mm") @@ -181,6 +209,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("Rychlost vent.") #define MSG_EXTRA_FAN_SPEED _UxGT("Rychlost ex. vent.") #define MSG_FLOW _UxGT("Průtok") @@ -208,6 +237,7 @@ #define MSG_VC_JERK _UxGT("Vz-jerk") #endif #define MSG_VE_JERK _UxGT("Ve-jerk") +#define MSG_JUNCTION_DEVIATION _UxGT("Odchylka spoje") #define MSG_VELOCITY _UxGT("Rychlost") #define MSG_VMAX _UxGT("Vmax ") #define MSG_VMIN _UxGT("Vmin") @@ -246,14 +276,19 @@ #define MSG_LOAD_EEPROM _UxGT("Načíst nastavení") #define MSG_RESTORE_FAILSAFE _UxGT("Obnovit výchozí") #define MSG_INIT_EEPROM _UxGT("Inic. EEPROM") +#define MSG_SD_UPDATE _UxGT("Aktualizace z SD") +#define MSG_RESET_PRINTER _UxGT("Reset tiskárny") #define MSG_REFRESH _UxGT("Obnovit") #define MSG_WATCH _UxGT("Info obrazovka") #define MSG_PREPARE _UxGT("Připrava tisku") #define MSG_TUNE _UxGT("Doladění tisku") +#define MSG_START_PRINT _UxGT("Spustit tisk") +#define MSG_BUTTON_PRINT _UxGT("Tisk") +#define MSG_BUTTON_CANCEL _UxGT("Zrušit") #define MSG_PAUSE_PRINT _UxGT("Pozastavit tisk") #define MSG_RESUME_PRINT _UxGT("Obnovit tisk") #define MSG_STOP_PRINT _UxGT("Zastavit tisk") -#define MSG_OUTAGE_RECOVERY _UxGT("Obnova vypadku") +#define MSG_OUTAGE_RECOVERY _UxGT("Obnova výpadku") #define MSG_CARD_MENU _UxGT("Tisknout z SD") #define MSG_NO_CARD _UxGT("Žádná SD karta") #define MSG_DWELL _UxGT("Uspáno...") @@ -273,6 +308,12 @@ #define MSG_CONTROL_RETRACT_RECOVERF _UxGT("UnRet V") #define MSG_CONTROL_RETRACT_RECOVER_SWAPF _UxGT("S UnRet V") #define MSG_AUTORETRACT _UxGT("AutoRetr.") +#define MSG_FILAMENT_SWAP_LENGTH _UxGT("Délka retrakce") +#define MSG_TOOL_CHANGE _UxGT("Výměna nástroje") +#define MSG_TOOL_CHANGE_ZLIFT _UxGT("Zdvih Z") +#define MSG_SINGLENOZZLE_PRIME_SPD _UxGT("Rychlost primár.") +#define MSG_SINGLENOZZLE_RETRACT_SPD _UxGT("Rychlost retrak.") +#define MSG_NOZZLE_STANDBY _UxGT("Tryska standby") #define MSG_FILAMENTCHANGE _UxGT("Vyměnit filament") #define MSG_FILAMENTLOAD _UxGT("Zavést filament") #define MSG_FILAMENTUNLOAD _UxGT("Vysunout filament") @@ -283,26 +324,34 @@ #define MSG_ZPROBE_OUT _UxGT("Sonda Z mimo podl") #define MSG_SKEW_FACTOR _UxGT("Faktor zkosení") #define MSG_BLTOUCH _UxGT("BLTouch") -#define MSG_BLTOUCH_SELFTEST _UxGT("BLTouch Self-Test") -#define MSG_BLTOUCH_RESET _UxGT("BLTouch Reset") -#define MSG_BLTOUCH_DEPLOY _UxGT("BLTouch Vysunout") -#define MSG_BLTOUCH_STOW _UxGT("BLTouch Zasunout") +#define MSG_BLTOUCH_SELFTEST _UxGT("BLTouch self-test") +#define MSG_BLTOUCH_RESET _UxGT("BLTouch reset") +#define MSG_BLTOUCH_DEPLOY _UxGT("BLTouch vysunout") +#define MSG_BLTOUCH_SW_MODE _UxGT("SW výsun BLTouch") +#define MSG_BLTOUCH_5V_MODE _UxGT("BLTouch 5V režim") +#define MSG_BLTOUCH_OD_MODE _UxGT("BLTouch OD režim") +#define MSG_BLTOUCH_STOW _UxGT("BLTouch zasunout") +#define MSG_MANUAL_DEPLOY _UxGT("Vysunout Z-sondu") +#define MSG_MANUAL_STOW _UxGT("Zasunout Z-sondu") #define MSG_HOME _UxGT("Domů") // Used as MSG_HOME " " MSG_X MSG_Y MSG_Z " " MSG_FIRST #define MSG_FIRST _UxGT("první") #define MSG_ZPROBE_ZOFFSET _UxGT("Z ofset") #define MSG_BABYSTEP_X _UxGT("Babystep X") #define MSG_BABYSTEP_Y _UxGT("Babystep Y") #define MSG_BABYSTEP_Z _UxGT("Babystep Z") +#define MSG_BABYSTEP_TOTAL _UxGT("Celkem") #define MSG_ENDSTOP_ABORT _UxGT("Endstop abort") #define MSG_HEATING_FAILED_LCD _UxGT("Chyba zahřívání") -#define MSG_HEATING_FAILED_LCD_BED _UxGT("Chyba zahř. podl.") +#define MSG_HEATING_FAILED_LCD_BED _UxGT("Chyba zahř.podl.") #define MSG_ERR_REDUNDANT_TEMP _UxGT("REDUND. TEPLOTA") -#define MSG_THERMAL_RUNAWAY _UxGT("TEPLOTNÍ SKOK") -#define MSG_THERMAL_RUNAWAY_BED _UxGT("PODL. TEPL. SKOK") +#define MSG_THERMAL_RUNAWAY _UxGT("TEPLOTNÍ ÚNIK") +#define MSG_THERMAL_RUNAWAY_BED _UxGT("TEPL. ÚNIK PODL.") #define MSG_ERR_MAXTEMP _UxGT("VYSOKÁ TEPLOTA") #define MSG_ERR_MINTEMP _UxGT("NÍZKA TEPLOTA") #define MSG_ERR_MAXTEMP_BED _UxGT("VYS. TEPL. PODL.") #define MSG_ERR_MINTEMP_BED _UxGT("NÍZ. TEPL. PODL.") +#define MSG_ERR_MAXTEMP_CHAMBER _UxGT("Err: MAXTEMP KOMORA") +#define MSG_ERR_MINTEMP_CHAMBER _UxGT("Err: MINTEMP KOMORA") #define MSG_ERR_Z_HOMING MSG_HOME _UxGT(" ") MSG_X MSG_Y _UxGT(" ") MSG_FIRST #define MSG_HALTED _UxGT("TISK. ZASTAVENA") #define MSG_PLEASE_RESET _UxGT("Proveďte reset") @@ -310,9 +359,17 @@ #define MSG_SHORT_HOUR _UxGT("h") #define MSG_SHORT_MINUTE _UxGT("m") #define MSG_HEATING _UxGT("Zahřívání...") -#define MSG_COOLING _UxGT("Chlazení") -#define MSG_BED_HEATING _UxGT("Zahřívání podl...") -#define MSG_BED_COOLING _UxGT("Chlazení podl...") +#define MSG_COOLING _UxGT("Chlazení...") +#if LCD_WIDTH >= 20 + #define MSG_BED_HEATING _UxGT("Zahřívání podložky") +#else + #define MSG_BED_HEATING _UxGT("Zahřívání podl.") +#endif +#if LCD_WIDTH >= 20 + #define MSG_BED_COOLING _UxGT("Chlazení podložky") +#else + #define MSG_BED_COOLING _UxGT("Chlazení podl.") +#endif #define MSG_DELTA_CALIBRATE _UxGT("Delta Kalibrace") #define MSG_DELTA_CALIBRATE_X _UxGT("Kalibrovat X") #define MSG_DELTA_CALIBRATE_Y _UxGT("Kalibrovat Y") @@ -368,40 +425,129 @@ #define MSG_FILAMENT_CHANGE_OPTION_PURGE _UxGT("Vytlačit víc") #define MSG_FILAMENT_CHANGE_OPTION_RESUME _UxGT("Obnovit tisk") #define MSG_FILAMENT_CHANGE_NOZZLE _UxGT(" Tryska: ") +#define MSG_RUNOUT_SENSOR _UxGT("Senzor filamentu") #define MSG_ERR_HOMING_FAILED _UxGT("Parkování selhalo") #define MSG_ERR_PROBING_FAILED _UxGT("Kalibrace selhala") #define MSG_M600_TOO_COLD _UxGT("M600: Moc studený") +#define MSG_MMU2_FILAMENT_CHANGE_HEADER _UxGT("VÝMĚNA FILAMENTU") +#define MSG_MMU2_CHOOSE_FILAMENT_HEADER _UxGT("VYBERTE FILAMENT") +#define MSG_MMU2_MENU _UxGT("MMU") +#define MSG_MMU2_WRONG_FIRMWARE _UxGT("Aktual. MMU firmware!") +#define MSG_MMU2_NOT_RESPONDING _UxGT("MMU potř. pozornost.") +#define MSG_MMU2_RESUME _UxGT("Obnovit tisk") +#define MSG_MMU2_RESUMING _UxGT("Obnovování...") +#define MSG_MMU2_LOAD_FILAMENT _UxGT("Zavést filament") +#define MSG_MMU2_LOAD_ALL _UxGT("Zavést všechny") +#define MSG_MMU2_LOAD_TO_NOZZLE _UxGT("Zavést do trysky") +#define MSG_MMU2_EJECT_FILAMENT _UxGT("Vysunout filament") +#define MSG_MMU2_EJECT_FILAMENT0 _UxGT("Vysun. filament 1") +#define MSG_MMU2_EJECT_FILAMENT1 _UxGT("Vysun. filament 2") +#define MSG_MMU2_EJECT_FILAMENT2 _UxGT("Vysun. filament 3") +#define MSG_MMU2_EJECT_FILAMENT3 _UxGT("Vysun. filament 4") +#define MSG_MMU2_EJECT_FILAMENT4 _UxGT("Vysun. filament 5") +#define MSG_MMU2_UNLOAD_FILAMENT _UxGT("Vytáhnout filament") +#define MSG_MMU2_LOADING_FILAMENT _UxGT("Zavádění fil. %i...") +#define MSG_MMU2_EJECTING_FILAMENT _UxGT("Vytahování fil. ...") +#define MSG_MMU2_UNLOADING_FILAMENT _UxGT("Vysouvání fil....") +#define MSG_MMU2_ALL _UxGT("Všechny") +#define MSG_MMU2_FILAMENT0 _UxGT("Filament 1") +#define MSG_MMU2_FILAMENT1 _UxGT("Filament 2") +#define MSG_MMU2_FILAMENT2 _UxGT("Filament 3") +#define MSG_MMU2_FILAMENT3 _UxGT("Filament 4") +#define MSG_MMU2_FILAMENT4 _UxGT("Filament 5") +#define MSG_MMU2_RESET _UxGT("Resetovat MMU") +#define MSG_MMU2_RESETTING _UxGT("Resetování MMU...") +#define MSG_MMU2_EJECT_RECOVER _UxGT("Vytáhněte, klikněte") + +#define MSG_MIX _UxGT("Mix") +#define MSG_MIX_COMPONENT _UxGT("Komponenta") +#define MSG_MIXER _UxGT("Mixér") +#define MSG_GRADIENT _UxGT("Přechod") +#define MSG_FULL_GRADIENT _UxGT("Celý přechod") +#define MSG_TOGGLE_MIX _UxGT("Přepnout mix") +#define MSG_CYCLE_MIX _UxGT("Střídat mix") +#define MSG_GRADIENT_MIX _UxGT("Přechod mix") +#define MSG_REVERSE_GRADIENT _UxGT("Opačný přechod") +#if LCD_WIDTH >= 20 + #define MSG_ACTIVE_VTOOL _UxGT("Aktivní V-nástroj") + #define MSG_START_VTOOL _UxGT("Spustit V-nástroj") + #define MSG_END_VTOOL _UxGT("Ukončit V-nástroj") + #define MSG_GRADIENT_ALIAS _UxGT("Alias V-nástroje") + #define MSG_RESET_VTOOLS _UxGT("Resetovat V-nástroj") + #define MSG_COMMIT_VTOOL _UxGT("Uložit V-nástroj mix") + #define MSG_VTOOLS_RESET _UxGT("V-nástroj resetovat") +#else + #define MSG_ACTIVE_VTOOL _UxGT("Aktivní V-nástr.") + #define MSG_START_VTOOL _UxGT("Spustit V-nástr.") + #define MSG_END_VTOOL _UxGT("Ukončit V-nástr.") + #define MSG_GRADIENT_ALIAS _UxGT("Alias V-nástr.") + #define MSG_RESET_VTOOLS _UxGT("Reset. V-nástr.") + #define MSG_COMMIT_VTOOL _UxGT("Uložit V-nás. mix") + #define MSG_VTOOLS_RESET _UxGT("V-nástr. reset.") +#endif +#define MSG_START_Z _UxGT("Počáteční Z") +#define MSG_END_Z _UxGT(" Koncové Z") +#define MSG_BRICKOUT _UxGT("Brickout") +#define MSG_INVADERS _UxGT("Invaders") +#define MSG_SNAKE _UxGT("Sn4k3") +#define MSG_MAZE _UxGT("Bludiště") + #if LCD_HEIGHT >= 4 // Up to 3 lines allowed - #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Čekejte prosím") - #define MSG_FILAMENT_CHANGE_INIT_2 _UxGT("na zahájení") - #define MSG_FILAMENT_CHANGE_INIT_3 _UxGT("výměny filamentu") - #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Čekejte prosím") - #define MSG_FILAMENT_CHANGE_UNLOAD_2 _UxGT("na vysunuti") - #define MSG_FILAMENT_CHANGE_UNLOAD_3 _UxGT("filamentu") - #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Vložte filament") - #define MSG_FILAMENT_CHANGE_INSERT_2 _UxGT("a stiskněte") - #define MSG_FILAMENT_CHANGE_INSERT_3 _UxGT("tlačítko...") - #define MSG_FILAMENT_CHANGE_HEAT_1 _UxGT("Klikněte pro") - #define MSG_FILAMENT_CHANGE_HEAT_2 _UxGT("nahřátí trysky") - #define MSG_FILAMENT_CHANGE_HEATING_1 _UxGT("Čekejte prosím") - #define MSG_FILAMENT_CHANGE_HEATING_2 _UxGT("na nahřátí tr.") - #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Čekejte prosím") - #define MSG_FILAMENT_CHANGE_LOAD_2 _UxGT("na zavedení") - #define MSG_FILAMENT_CHANGE_LOAD_3 _UxGT("filamentu") - #define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Vyčkejte na") - #define MSG_FILAMENT_CHANGE_PURGE_2 _UxGT("vytlačení") - #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Čekejte prosím") - #define MSG_FILAMENT_CHANGE_RESUME_2 _UxGT("na pokračování") - #define MSG_FILAMENT_CHANGE_RESUME_3 _UxGT("tisku") + #define MSG_ADVANCED_PAUSE_WAITING_1 _UxGT("Stikněte tlačítko") + #define MSG_ADVANCED_PAUSE_WAITING_2 _UxGT("pro obnovení tisku") + #define MSG_PAUSE_PRINT_INIT_1 _UxGT("Parkování...") + #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Čekejte prosím") + #define MSG_FILAMENT_CHANGE_INIT_2 _UxGT("na zahájení") + #define MSG_FILAMENT_CHANGE_INIT_3 _UxGT("výměny filamentu") + #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Vložte filament") + #define MSG_FILAMENT_CHANGE_INSERT_2 _UxGT("a stiskněte") + #define MSG_FILAMENT_CHANGE_INSERT_3 _UxGT("tlačítko...") + #define MSG_FILAMENT_CHANGE_HEAT_1 _UxGT("Klikněte pro") + #define MSG_FILAMENT_CHANGE_HEAT_2 _UxGT("nahřátí trysky") + #define MSG_FILAMENT_CHANGE_HEATING_1 _UxGT("Čekejte prosím") + #define MSG_FILAMENT_CHANGE_HEATING_2 _UxGT("na nahřátí tr.") + #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Čekejte prosím") + #define MSG_FILAMENT_CHANGE_UNLOAD_2 _UxGT("na vysunuti") + #define MSG_FILAMENT_CHANGE_UNLOAD_3 _UxGT("filamentu") + #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Čekejte prosím") + #define MSG_FILAMENT_CHANGE_LOAD_2 _UxGT("na zavedení") + #define MSG_FILAMENT_CHANGE_LOAD_3 _UxGT("filamentu") + #define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Vyčkejte na") + #define MSG_FILAMENT_CHANGE_PURGE_2 _UxGT("vytlačení") + #define MSG_FILAMENT_CHANGE_CONT_PURGE_1 _UxGT("Klikněte pro") + #define MSG_FILAMENT_CHANGE_CONT_PURGE_2 _UxGT("ukončení") + #define MSG_FILAMENT_CHANGE_CONT_PURGE_3 _UxGT("vytlačování") + #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Čekejte prosím") + #define MSG_FILAMENT_CHANGE_RESUME_2 _UxGT("na pokračování") + #define MSG_FILAMENT_CHANGE_RESUME_3 _UxGT("tisku") #else // LCD_HEIGHT < 4 // Up to 2 lines allowed - #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Čekejte...") - #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Vysouvání...") - #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Vložte, klikněte") - #define MSG_FILAMENT_CHANGE_HEATING_1 _UxGT("Nahřívání...") - #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Zavádění...") - #define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Vytlačování...") - #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Pokračování...") + #define MSG_ADVANCED_PAUSE_WAITING_1 _UxGT("Stikněte tlač.") + #define MSG_ADVANCED_PAUSE_WAITING_2 _UxGT("pro obnovení") + #define MSG_PAUSE_PRINT_INIT_1 _UxGT("Parkování...") + #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Čekejte...") + #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Vložte, klikněte") + #define MSG_FILAMENT_CHANGE_HEAT_1 _UxGT("Klikněte pro") + #define MSG_FILAMENT_CHANGE_HEAT_2 _UxGT("nahřátí") + #define MSG_FILAMENT_CHANGE_HEATING_1 _UxGT("Nahřívání...") + #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Vysouvání...") + #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Zavádění...") + #define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Vytlačování...") + #define MSG_FILAMENT_CHANGE_CONT_PURGE_1 _UxGT("Klikněte pro") + #define MSG_FILAMENT_CHANGE_CONT_PURGE_2 _UxGT("ukončení") + #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Pokračování...") #endif // LCD_HEIGHT < 4 + +#define MSG_TMC_DRIVERS _UxGT("TMC budiče") +#define MSG_TMC_CURRENT _UxGT("Proud budičů") +#define MSG_TMC_HYBRID_THRS _UxGT("Hybridní práh") +#define MSG_TMC_HOMING_THRS _UxGT("Domů bez senzorů") +#define MSG_TMC_STEPPING_MODE _UxGT("Režim kroků") +#define MSG_TMC_STEALTH_ENABLED _UxGT("StealthChop povolen") +#define MSG_SERVICE_RESET _UxGT("Reset") +#define MSG_SERVICE_IN _UxGT(" za:") +#define MSG_BACKLASH _UxGT("Vůle") +#define MSG_BACKLASH_CORRECTION _UxGT("Korekce") +#define MSG_BACKLASH_SMOOTHING _UxGT("Vyhlazení") \ No newline at end of file diff --git a/Marlin/src/lcd/language/language_da.h b/Marlin/src/lcd/language/language_da.h index 2dcea9ee4b39..99888b3b7ea0 100644 --- a/Marlin/src/lcd/language/language_da.h +++ b/Marlin/src/lcd/language/language_da.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -43,7 +43,6 @@ #define MSG_AUTO_HOME_X _UxGT("Home X") #define MSG_AUTO_HOME_Y _UxGT("Home Y") #define MSG_AUTO_HOME_Z _UxGT("Home Z") -#define MSG_TMC_Z_CALIBRATION _UxGT("Kalibrer Z") #define MSG_LEVEL_BED_HOMING _UxGT("Homing XYZ") #define MSG_LEVEL_BED_WAITING _UxGT("Klik når du er klar") #define MSG_LEVEL_BED_NEXT_POINT _UxGT("Næste punkt") diff --git a/Marlin/src/lcd/language/language_de.h b/Marlin/src/lcd/language/language_de.h index f218efdd0cbb..9275b08643c9 100644 --- a/Marlin/src/lcd/language/language_de.h +++ b/Marlin/src/lcd/language/language_de.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -34,6 +34,8 @@ #define THIS_LANGUAGES_SPECIAL_SYMBOLS _UxGT("ÄäÖöÜüß²³") #define WELCOME_MSG MACHINE_NAME _UxGT(" bereit") +#define MSG_YES _UxGT("JA") +#define MSG_NO _UxGT("NEIN") #define MSG_BACK _UxGT("Zurück") #define MSG_SD_INSERTED _UxGT("SD-Karte erkannt") #define MSG_SD_REMOVED _UxGT("SD-Karte entfernt") @@ -45,13 +47,12 @@ #define MSG_AUTOSTART _UxGT("Autostart") #define MSG_DISABLE_STEPPERS _UxGT("Motoren deaktivieren") // M84 #define MSG_DEBUG_MENU _UxGT("Debug-Menü") -#define MSG_PROGRESS_BAR_TEST _UxGT("Fortschrittsb.-Test") +#define MSG_PROGRESS_BAR_TEST _UxGT("Statusbalken-Test") #define MSG_AUTO_HOME _UxGT("Home XYZ") // G28 #define MSG_AUTO_HOME_X _UxGT("Home X") #define MSG_AUTO_HOME_Y _UxGT("Home Y") #define MSG_AUTO_HOME_Z _UxGT("Home Z") #define MSG_AUTO_Z_ALIGN _UxGT("Z-Achsen ausgleichen") -#define MSG_TMC_Z_CALIBRATION _UxGT("Kalibriere Z") #define MSG_LEVEL_BED_HOMING _UxGT("Home XYZ") #define MSG_LEVEL_BED_WAITING _UxGT("Klick zum Starten") #define MSG_LEVEL_BED_NEXT_POINT _UxGT("Nächste Koordinate") @@ -74,6 +75,11 @@ #define MSG_PREHEAT_2_SETTINGS _UxGT("Vorw. " PREHEAT_2_LABEL " Einst.") #define MSG_PREHEAT_CUSTOM _UxGT("benutzerdef. Heizen") #define MSG_COOLDOWN _UxGT("Abkühlen") +#define MSG_LASER_MENU _UxGT("Laser") +#define MSG_LASER_OFF _UxGT("Laser aus") +#define MSG_LASER_ON _UxGT("Laser an") +#define MSG_LASER_POWER _UxGT("Laserleistung") +#define MSG_SPINDLE_REVERSE _UxGT("Spindelrichtung") #define MSG_SWITCH_PS_ON _UxGT("Netzteil ein") #define MSG_SWITCH_PS_OFF _UxGT("Netzteil aus") #define MSG_EXTRUDE _UxGT("Extrudieren") @@ -93,14 +99,14 @@ #define MSG_UBL_TOOLS _UxGT("UBL-Werkzeuge") #define MSG_UBL_LEVEL_BED _UxGT("Unified Bed Leveling") #define MSG_IDEX_MENU _UxGT("IDEX-Modus") +#define MSG_OFFSETS_MENU _UxGT("Werkzeugversätze") #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") -#define MSG_IDEX_Z_OFFSET _UxGT("2. Düse Z") -#define MSG_IDEX_SAVE_OFFSETS _UxGT("Versätze speichern") +#define MSG_X_OFFSET _UxGT("2. Düse X") +#define MSG_Y_OFFSET _UxGT("2. Düse Y") +#define MSG_Z_OFFSET _UxGT("2. Düse Z") #define MSG_UBL_MANUAL_MESH _UxGT("Netz manuell erst.") #define MSG_UBL_BC_INSERT _UxGT("Unterlegen & messen") #define MSG_UBL_BC_INSERT2 _UxGT("Messen") @@ -193,6 +199,7 @@ #define MSG_BED_Z _UxGT("Bett Z") #define MSG_NOZZLE _UxGT("Düse") #define MSG_BED _UxGT("Bett") +#define MSG_CHAMBER _UxGT("Gehäuse") #define MSG_FAN_SPEED _UxGT("Lüfter") #define MSG_EXTRA_FAN_SPEED _UxGT("Geschw. Extralüfter") #define MSG_FLOW _UxGT("Flussrate") @@ -265,6 +272,9 @@ #define MSG_WATCH _UxGT("Info") #define MSG_PREPARE _UxGT("Vorbereitung") #define MSG_TUNE _UxGT("Justierung") +#define MSG_START_PRINT _UxGT("Starte Druck") +#define MSG_BUTTON_PRINT _UxGT("Drucke") +#define MSG_BUTTON_CANCEL _UxGT("Abbrechen") #define MSG_PAUSE_PRINT _UxGT("SD-Druck pausieren") #define MSG_RESUME_PRINT _UxGT("SD-Druck fortsetzen") #define MSG_STOP_PRINT _UxGT("SD-Druck abbrechen") @@ -293,6 +303,7 @@ #define MSG_TOOL_CHANGE_ZLIFT _UxGT("Z anheben") #define MSG_SINGLENOZZLE_PRIME_SPD _UxGT("Prime-Geschwin.") #define MSG_SINGLENOZZLE_RETRACT_SPD _UxGT("Rückzug-Geschwin.") +#define MSG_NOZZLE_STANDBY _UxGT("Düsen-Standby") #define MSG_FILAMENTCHANGE _UxGT("Filament wechseln") #define MSG_FILAMENTLOAD _UxGT("Filament laden") #define MSG_FILAMENTUNLOAD _UxGT("Filament entladen") @@ -305,6 +316,9 @@ #define MSG_BLTOUCH_SELFTEST _UxGT("BLTouch Selbsttest") #define MSG_BLTOUCH_RESET _UxGT("BLTouch zurücks.") #define MSG_BLTOUCH_DEPLOY _UxGT("BLTouch ausfahren") +#define MSG_BLTOUCH_SW_MODE _UxGT("BLTouch SW-Modus") +#define MSG_BLTOUCH_5V_MODE _UxGT("BLTouch 5V-Modus") +#define MSG_BLTOUCH_STOW _UxGT("BLTouch einfahren") #define MSG_BLTOUCH_STOW _UxGT("BLTouch einfahren") #define MSG_MANUAL_DEPLOY _UxGT("Z-Sonde ausfahren") #define MSG_MANUAL_STOW _UxGT("Z-Sonde einfahren") @@ -314,16 +328,21 @@ #define MSG_BABYSTEP_X _UxGT("Babystep X") #define MSG_BABYSTEP_Y _UxGT("Babystep Y") #define MSG_BABYSTEP_Z _UxGT("Babystep Z") +#define MSG_BABYSTEP_TOTAL _UxGT("Total") #define MSG_ENDSTOP_ABORT _UxGT("Endstopp Abbr.") #define MSG_HEATING_FAILED_LCD _UxGT("HEIZEN ERFOLGLOS") #define MSG_HEATING_FAILED_LCD_BED _UxGT("Bett heizen fehlge.") +#define MSG_HEATING_FAILED_LCD_CHAMBER _UxGT("Geh. heizen fehlge.") #define MSG_ERR_REDUNDANT_TEMP _UxGT("REDUND. TEMP-ABWEI.") #define MSG_THERMAL_RUNAWAY LCD_STR_THERMOMETER _UxGT(" NICHT ERREICHT") #define MSG_THERMAL_RUNAWAY_BED _UxGT("BETT") MSG_THERMAL_RUNAWAY +#define MSG_THERMAL_RUNAWAY_CHAMBER _UxGT("GEH.") MSG_THERMAL_RUNAWAY #define MSG_ERR_MAXTEMP LCD_STR_THERMOMETER _UxGT(" ÜBERSCHRITTEN") #define MSG_ERR_MINTEMP LCD_STR_THERMOMETER _UxGT(" UNTERSCHRITTEN") #define MSG_ERR_MAXTEMP_BED _UxGT("BETT ") LCD_STR_THERMOMETER _UxGT(" ÜBERSCHRITTEN") #define MSG_ERR_MINTEMP_BED _UxGT("BETT ") LCD_STR_THERMOMETER _UxGT(" UNTERSCHRITTEN") +#define MSG_ERR_MAXTEMP_CHAMBER _UxGT("Err: GEHÄUSE MAX TEM") +#define MSG_ERR_MINTEMP_CHAMBER _UxGT("Err: GEHÄUSE MIN TEM") #define MSG_ERR_Z_HOMING MSG_HOME _UxGT(" ") MSG_X MSG_Y _UxGT(" ") MSG_FIRST #define MSG_HALTED _UxGT("DRUCKER STOPP") #define MSG_PLEASE_RESET _UxGT("Bitte neustarten") @@ -379,7 +398,7 @@ #define MSG_INFO_MIN_TEMP _UxGT("Min Temp") #define MSG_INFO_MAX_TEMP _UxGT("Max Temp") #define MSG_INFO_PSU _UxGT("Netzteil") -#define MSG_DRIVE_STRENGTH _UxGT("Treiberstärke") +#define MSG_DRIVE_STRENGTH _UxGT("Motorleistung") #define MSG_DAC_PERCENT _UxGT("Treiber %") #define MSG_DAC_EEPROM_WRITE _UxGT("Werte speichern") #define MSG_FILAMENT_CHANGE_HEADER_PAUSE _UxGT("DRUCK PAUSIERT") @@ -389,17 +408,71 @@ #define MSG_FILAMENT_CHANGE_OPTION_PURGE _UxGT("Mehr entladen") #define MSG_FILAMENT_CHANGE_OPTION_RESUME _UxGT("Druck weiter") #define MSG_FILAMENT_CHANGE_NOZZLE _UxGT(" Düse: ") -#define MSG_RUNOUT_SENSOR_ENABLE _UxGT("Auslaufsensor") +#define MSG_RUNOUT_SENSOR _UxGT("Auslaufsensor") #define MSG_ERR_HOMING_FAILED _UxGT("Homing gescheitert") #define MSG_ERR_PROBING_FAILED _UxGT("Probing gescheitert") #define MSG_M600_TOO_COLD _UxGT("M600: zu kalt") +#define MSG_MMU2_FILAMENT_CHANGE_HEADER _UxGT("FILAMENT WECHSEL") +#define MSG_MMU2_CHOOSE_FILAMENT_HEADER _UxGT("FILAMENT WÄHLEN") +#define MSG_MMU2_MENU _UxGT("MMU") +#define MSG_MMU2_WRONG_FIRMWARE _UxGT("Update MMU Firmware!") +#define MSG_MMU2_NOT_RESPONDING _UxGT("MMU handeln erfor.") +#define MSG_MMU2_RESUME _UxGT("Druck fortsetzen") +#define MSG_MMU2_RESUMING _UxGT("Fortfahren...") +#define MSG_MMU2_LOAD_FILAMENT MSG_FILAMENTLOAD +#define MSG_MMU2_LOAD_ALL _UxGT("Lade alle") +#define MSG_MMU2_LOAD_TO_NOZZLE _UxGT("Düse laden") +#define MSG_MMU2_EJECT_FILAMENT _UxGT("Filament auswerfen") +#define MSG_MMU2_EJECT_FILAMENT0 _UxGT("Filament 1 auswerfen") +#define MSG_MMU2_EJECT_FILAMENT1 _UxGT("Filament 2 auswerfen") +#define MSG_MMU2_EJECT_FILAMENT2 _UxGT("Filament 3 auswerfen") +#define MSG_MMU2_EJECT_FILAMENT3 _UxGT("Filament 4 auswerfen") +#define MSG_MMU2_EJECT_FILAMENT4 _UxGT("Filament 5 auswerfen") +#define MSG_MMU2_UNLOAD_FILAMENT MSG_FILAMENTUNLOAD +#define MSG_MMU2_LOADING_FILAMENT _UxGT("Lade Fila. %i...") +#define MSG_MMU2_EJECTING_FILAMENT _UxGT("Fila. auswerfen...") +#define MSG_MMU2_UNLOADING_FILAMENT _UxGT("Fila. entladen...") +#define MSG_MMU2_ALL _UxGT("Alle") +#define MSG_MMU2_FILAMENT0 _UxGT("Filament 1") +#define MSG_MMU2_FILAMENT1 _UxGT("Filament 2") +#define MSG_MMU2_FILAMENT2 _UxGT("Filament 3") +#define MSG_MMU2_FILAMENT3 _UxGT("Filament 4") +#define MSG_MMU2_FILAMENT4 _UxGT("Filament 5") +#define MSG_MMU2_RESET _UxGT("setz MMU zurück") +#define MSG_MMU2_RESETTING _UxGT("MMU zurücksetzen...") +#define MSG_MMU2_EJECT_RECOVER _UxGT("Entfernen, klicken") + +#define MSG_MIX _UxGT("Mix") +#define MSG_MIX_COMPONENT _UxGT("Komponente") +#define MSG_MIXER _UxGT("Mixer") +#define MSG_GRADIENT _UxGT("Gradient") // equal Farbverlauf +#define MSG_FULL_GRADIENT _UxGT("Volle Gradient") +#define MSG_TOGGLE_MIX _UxGT("Mix umschalten") +#define MSG_CYCLE_MIX _UxGT("Zyklus Mix") +#define MSG_GRADIENT_MIX _UxGT("Gradient Mix") +#define MSG_REVERSE_GRADIENT _UxGT("Umgekehrte Gradient") +#define MSG_ACTIVE_VTOOL _UxGT("Aktives V-Tool") +#define MSG_START_VTOOL _UxGT("V-Tool Start") +#define MSG_END_VTOOL _UxGT("V-Tool Ende") +#define MSG_GRADIENT_ALIAS _UxGT("V-Tool Alias") +#define MSG_RESET_VTOOLS _UxGT("V-Tools Reseten") +#define MSG_COMMIT_VTOOL _UxGT("V-Tool Mix sichern") +#define MSG_VTOOLS_RESET _UxGT("V-Tools ist resetet") +#define MSG_START_Z _UxGT("Z Start") +#define MSG_END_Z _UxGT("Z End") +#define MSG_BRICKOUT _UxGT("Brickout") +#define MSG_INVADERS _UxGT("Invaders") +#define MSG_SNAKE _UxGT("Sn4k3") +#define MSG_MAZE _UxGT("Maze") + // // Die Filament-Change-Bildschirme können bis zu 3 Zeilen auf einem 4-Zeilen-Display anzeigen // ...oder 2 Zeilen auf einem 3-Zeilen-Display. #if LCD_HEIGHT >= 4 #define MSG_ADVANCED_PAUSE_WAITING_1 _UxGT("Knopf drücken um") #define MSG_ADVANCED_PAUSE_WAITING_2 _UxGT("Druck fortzusetzen") + #define MSG_PAUSE_PRINT_INIT_1 _UxGT("Parken...") #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Warte auf den") #define MSG_FILAMENT_CHANGE_INIT_2 _UxGT("Start des") #define MSG_FILAMENT_CHANGE_INIT_3 _UxGT("Filamentwechsels...") @@ -438,3 +511,15 @@ #define MSG_FILAMENT_CHANGE_CONT_PURGE_2 _UxGT("der Fila-Entladung") #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Fortsetzen...") #endif // LCD_HEIGHT < 4 + +#define MSG_TMC_DRIVERS _UxGT("TMC Treiber") // Max length 18 characters +#define MSG_TMC_CURRENT _UxGT("Treiber Strom") +#define MSG_TMC_HYBRID_THRS _UxGT("Hybrid threshold") +#define MSG_TMC_HOMING_THRS _UxGT("Sensorloses Homing") +#define MSG_TMC_STEPPING_MODE _UxGT("Schrittmodus") +#define MSG_TMC_STEALTH_ENABLED _UxGT("StealthChop einsch.") +#define MSG_SERVICE_RESET _UxGT("Reset") +#define MSG_SERVICE_IN _UxGT(" im:") +#define MSG_BACKLASH _UxGT("Spiel") +#define MSG_BACKLASH_CORRECTION _UxGT("Korrektur") +#define MSG_BACKLASH_SMOOTHING _UxGT("Glätten") diff --git a/Marlin/src/lcd/language/language_el-gr.h b/Marlin/src/lcd/language/language_el-gr.h index 85c2b8211431..205020d872db 100644 --- a/Marlin/src/lcd/language/language_el-gr.h +++ b/Marlin/src/lcd/language/language_el-gr.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -43,7 +43,6 @@ #define MSG_AUTO_HOME_X _UxGT("Αρχικό σημείο X") #define MSG_AUTO_HOME_Y _UxGT("Αρχικό σημείο Y") #define MSG_AUTO_HOME_Z _UxGT("Αρχικό σημείο Z") -#define MSG_TMC_Z_CALIBRATION _UxGT("Βαθμονόμηση Z") #define MSG_LEVEL_BED_HOMING _UxGT("Επαναφορά στο αρχικό σημείο ΧΥΖ") #define MSG_LEVEL_BED_WAITING _UxGT("Κάντε κλικ για να ξεκινήσετε") #define MSG_LEVEL_BED_NEXT_POINT _UxGT("Επόμενο σημείο") diff --git a/Marlin/src/lcd/language/language_el.h b/Marlin/src/lcd/language/language_el.h index 38ae18cbfaa2..ff3129957a58 100644 --- a/Marlin/src/lcd/language/language_el.h +++ b/Marlin/src/lcd/language/language_el.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -43,7 +43,6 @@ #define MSG_AUTO_HOME_X _UxGT("Αρχικό σημείο X") #define MSG_AUTO_HOME_Y _UxGT("Αρχικό σημείο Y") #define MSG_AUTO_HOME_Z _UxGT("Αρχικό σημείο Z") -#define MSG_TMC_Z_CALIBRATION _UxGT("Βαθμονόμηση Z") #define MSG_LEVEL_BED_HOMING _UxGT("Επαναφορά Επ. Εκτύπωσης") //SHORTEN #define MSG_LEVEL_BED_WAITING _UxGT("Επιπεδοποίηση επ. Εκτύπωσης περιμενει") //SHORTEN #define MSG_LEVEL_BED_NEXT_POINT _UxGT("Επόμενο σημείο") diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 111e74564099..d16cd44d478f 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -52,6 +52,12 @@ #ifndef WELCOME_MSG #define WELCOME_MSG MACHINE_NAME _UxGT(" Ready.") #endif +#ifndef MSG_YES + #define MSG_YES _UxGT("YES") +#endif +#ifndef MSG_NO + #define MSG_NO _UxGT("NO") +#endif #ifndef MSG_BACK #define MSG_BACK _UxGT("Back") #endif @@ -103,9 +109,6 @@ #ifndef MSG_AUTO_Z_ALIGN #define MSG_AUTO_Z_ALIGN _UxGT("Auto Z-Align") #endif -#ifndef MSG_TMC_Z_CALIBRATION - #define MSG_TMC_Z_CALIBRATION _UxGT("Calibrate Z") -#endif #ifndef MSG_LEVEL_BED_HOMING #define MSG_LEVEL_BED_HOMING _UxGT("Homing XYZ") #endif @@ -172,6 +175,21 @@ #ifndef MSG_COOLDOWN #define MSG_COOLDOWN _UxGT("Cooldown") #endif +#ifndef MSG_LASER_MENU + #define MSG_LASER_MENU _UxGT("Laser Control") +#endif +#ifndef MSG_LASER_OFF + #define MSG_LASER_OFF _UxGT("Laser Off") +#endif +#ifndef MSG_LASER_ON + #define MSG_LASER_ON _UxGT("Laser On") +#endif +#ifndef MSG_LASER_POWER + #define MSG_LASER_POWER _UxGT("Laser power") +#endif +#ifndef MSG_SPINDLE_REVERSE + #define MSG_SPINDLE_REVERSE _UxGT("Spindle Reverse") +#endif #ifndef MSG_SWITCH_PS_ON #define MSG_SWITCH_PS_ON _UxGT("Switch power on") #endif @@ -229,29 +247,29 @@ #ifndef MSG_IDEX_MENU #define MSG_IDEX_MENU _UxGT("IDEX Mode") #endif +#ifndef MSG_OFFSETS_MENU + #define MSG_OFFSETS_MENU _UxGT("Tool Offsets") +#endif #ifndef MSG_IDEX_MODE_AUTOPARK #define MSG_IDEX_MODE_AUTOPARK _UxGT("Auto-Park") #endif #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") #endif -#ifndef MSG_IDEX_X_OFFSET - #define MSG_IDEX_X_OFFSET _UxGT("2nd nozzle X") +#ifndef MSG_X_OFFSET + #define MSG_X_OFFSET _UxGT("2nd nozzle X") #endif -#ifndef MSG_IDEX_Y_OFFSET - #define MSG_IDEX_Y_OFFSET _UxGT("2nd nozzle Y") +#ifndef MSG_Y_OFFSET + #define MSG_Y_OFFSET _UxGT("2nd nozzle Y") #endif -#ifndef MSG_IDEX_Z_OFFSET - #define MSG_IDEX_Z_OFFSET _UxGT("2nd nozzle Z") -#endif -#ifndef MSG_IDEX_SAVE_OFFSETS - #define MSG_IDEX_SAVE_OFFSETS _UxGT("Save Offsets") +#ifndef MSG_Z_OFFSET + #define MSG_Z_OFFSET _UxGT("2nd nozzle Z") #endif #ifndef MSG_UBL_MANUAL_MESH #define MSG_UBL_MANUAL_MESH _UxGT("Manually Build Mesh") @@ -525,6 +543,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 @@ -729,6 +750,15 @@ #ifndef MSG_TUNE #define MSG_TUNE _UxGT("Tune") #endif +#ifndef MSG_START_PRINT + #define MSG_START_PRINT _UxGT("Start print") +#endif +#ifndef MSG_BUTTON_PRINT + #define MSG_BUTTON_PRINT _UxGT("Print") +#endif +#ifndef MSG_BUTTON_CANCEL + #define MSG_BUTTON_CANCEL _UxGT("Cancel") +#endif #ifndef MSG_PAUSE_PRINT #define MSG_PAUSE_PRINT _UxGT("Pause print") #endif @@ -813,6 +843,9 @@ #ifndef MSG_SINGLENOZZLE_RETRACT_SPD #define MSG_SINGLENOZZLE_RETRACT_SPD _UxGT("Retract Speed") #endif +#ifndef MSG_NOZZLE_STANDBY + #define MSG_NOZZLE_STANDBY _UxGT("Nozzle Standby") +#endif #ifndef MSG_FILAMENTCHANGE #define MSG_FILAMENTCHANGE _UxGT("Change filament") #endif @@ -849,6 +882,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 @@ -876,6 +918,9 @@ #ifndef MSG_BABYSTEP_Z #define MSG_BABYSTEP_Z _UxGT("Babystep Z") #endif +#ifndef MSG_BABYSTEP_TOTAL + #define MSG_BABYSTEP_TOTAL _UxGT("Total") +#endif #ifndef MSG_ENDSTOP_ABORT #define MSG_ENDSTOP_ABORT _UxGT("Endstop abort") #endif @@ -885,6 +930,9 @@ #ifndef MSG_HEATING_FAILED_LCD_BED #define MSG_HEATING_FAILED_LCD_BED _UxGT("Bed heating failed") #endif +#ifndef MSG_HEATING_FAILED_LCD_CHAMBER + #define MSG_HEATING_FAILED_LCD_CHAMBER _UxGT("Chamber heating fail") +#endif #ifndef MSG_ERR_REDUNDANT_TEMP #define MSG_ERR_REDUNDANT_TEMP _UxGT("Err: REDUNDANT TEMP") #endif @@ -894,6 +942,9 @@ #ifndef MSG_THERMAL_RUNAWAY_BED #define MSG_THERMAL_RUNAWAY_BED _UxGT("BED THERMAL RUNAWAY") #endif +#ifndef MSG_THERMAL_RUNAWAY_CHAMBER + #define MSG_THERMAL_RUNAWAY_CHAMBER _UxGT("CHAMBER T. RUNAWAY") +#endif #ifndef MSG_ERR_MAXTEMP #define MSG_ERR_MAXTEMP _UxGT("Err: MAXTEMP") #endif @@ -906,6 +957,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 @@ -1089,8 +1146,8 @@ #ifndef MSG_FILAMENT_CHANGE_NOZZLE #define MSG_FILAMENT_CHANGE_NOZZLE _UxGT(" Nozzle: ") #endif -#ifndef MSG_RUNOUT_SENSOR_ENABLE - #define MSG_RUNOUT_SENSOR_ENABLE _UxGT("Runout Sensor") +#ifndef MSG_RUNOUT_SENSOR + #define MSG_RUNOUT_SENSOR _UxGT("Runout Sensor") #endif #ifndef MSG_ERR_HOMING_FAILED #define MSG_ERR_HOMING_FAILED _UxGT("Homing failed") @@ -1102,6 +1159,161 @@ #define MSG_M600_TOO_COLD _UxGT("M600: Too cold") #endif +#ifndef MSG_MMU2_FILAMENT_CHANGE_HEADER + #define MSG_MMU2_FILAMENT_CHANGE_HEADER _UxGT("FILAMENT CHANGE") +#endif +#ifndef MSG_MMU2_CHOOSE_FILAMENT_HEADER + #define MSG_MMU2_CHOOSE_FILAMENT_HEADER _UxGT("CHOOSE FILAMENT") +#endif +#ifndef MSG_MMU2_MENU + #define MSG_MMU2_MENU _UxGT("MMU") +#endif +#ifndef MSG_MMU2_WRONG_FIRMWARE + #define MSG_MMU2_WRONG_FIRMWARE _UxGT("Update MMU firmware!") +#endif +#ifndef MSG_MMU2_NOT_RESPONDING + #define MSG_MMU2_NOT_RESPONDING _UxGT("MMU needs attention.") +#endif +#ifndef MSG_MMU2_RESUME + #define MSG_MMU2_RESUME _UxGT("Resume print") +#endif +#ifndef MSG_MMU2_RESUMING + #define MSG_MMU2_RESUMING _UxGT("Resuming...") +#endif +#ifndef MSG_MMU2_LOAD_FILAMENT + #define MSG_MMU2_LOAD_FILAMENT _UxGT("Load filament") +#endif +#ifndef MSG_MMU2_LOAD_ALL + #define MSG_MMU2_LOAD_ALL _UxGT("Load all") +#endif +#ifndef MSG_MMU2_LOAD_TO_NOZZLE + #define MSG_MMU2_LOAD_TO_NOZZLE _UxGT("Load to nozzle") +#endif +#ifndef MSG_MMU2_EJECT_FILAMENT + #define MSG_MMU2_EJECT_FILAMENT _UxGT("Eject filament") +#endif +#ifndef MSG_MMU2_EJECT_FILAMENT0 + #define MSG_MMU2_EJECT_FILAMENT0 _UxGT("Eject filament 1") +#endif +#ifndef MSG_MMU2_EJECT_FILAMENT1 + #define MSG_MMU2_EJECT_FILAMENT1 _UxGT("Eject filament 2") +#endif +#ifndef MSG_MMU2_EJECT_FILAMENT2 + #define MSG_MMU2_EJECT_FILAMENT2 _UxGT("Eject filament 3") +#endif +#ifndef MSG_MMU2_EJECT_FILAMENT3 + #define MSG_MMU2_EJECT_FILAMENT3 _UxGT("Eject filament 4") +#endif +#ifndef MSG_MMU2_EJECT_FILAMENT4 + #define MSG_MMU2_EJECT_FILAMENT4 _UxGT("Eject filament 5") +#endif +#ifndef MSG_MMU2_UNLOAD_FILAMENT + #define MSG_MMU2_UNLOAD_FILAMENT _UxGT("Unload filament") +#endif +#ifndef MSG_MMU2_LOADING_FILAMENT + #define MSG_MMU2_LOADING_FILAMENT _UxGT("Loading fil. %i...") +#endif +#ifndef MSG_MMU2_EJECTING_FILAMENT + #define MSG_MMU2_EJECTING_FILAMENT _UxGT("Ejecting fil. ...") +#endif +#ifndef MSG_MMU2_UNLOADING_FILAMENT + #define MSG_MMU2_UNLOADING_FILAMENT _UxGT("Unloading fil....") +#endif +#ifndef MSG_MMU2_ALL + #define MSG_MMU2_ALL _UxGT("All") +#endif +#ifndef MSG_MMU2_FILAMENT0 + #define MSG_MMU2_FILAMENT0 _UxGT("Filament 1") +#endif +#ifndef MSG_MMU2_FILAMENT1 + #define MSG_MMU2_FILAMENT1 _UxGT("Filament 2") +#endif +#ifndef MSG_MMU2_FILAMENT2 + #define MSG_MMU2_FILAMENT2 _UxGT("Filament 3") +#endif +#ifndef MSG_MMU2_FILAMENT3 + #define MSG_MMU2_FILAMENT3 _UxGT("Filament 4") +#endif +#ifndef MSG_MMU2_FILAMENT4 + #define MSG_MMU2_FILAMENT4 _UxGT("Filament 5") +#endif +#ifndef MSG_MMU2_RESET + #define MSG_MMU2_RESET _UxGT("Reset MMU") +#endif +#ifndef MSG_MMU2_RESETTING + #define MSG_MMU2_RESETTING _UxGT("Resetting MMU...") +#endif +#ifndef MSG_MMU2_EJECT_RECOVER + #define MSG_MMU2_EJECT_RECOVER _UxGT("Remove, click") +#endif + +#ifndef MSG_MIX + #define MSG_MIX _UxGT("Mix") +#endif +#ifndef MSG_MIX_COMPONENT + #define MSG_MIX_COMPONENT _UxGT("Component") +#endif +#ifndef MSG_MIXER + #define MSG_MIXER _UxGT("Mixer") +#endif +#ifndef MSG_GRADIENT + #define MSG_GRADIENT _UxGT("Gradient") +#endif +#ifndef MSG_FULL_GRADIENT + #define MSG_FULL_GRADIENT _UxGT("Full gradient") +#endif +#ifndef MSG_TOGGLE_MIX + #define MSG_TOGGLE_MIX _UxGT("Toggle mix") +#endif +#ifndef MSG_CYCLE_MIX + #define MSG_CYCLE_MIX _UxGT("Cycle mix") +#endif +#ifndef MSG_GRADIENT_MIX + #define MSG_GRADIENT_MIX _UxGT("Gradient mix") +#endif +#ifndef MSG_REVERSE_GRADIENT + #define MSG_REVERSE_GRADIENT _UxGT("Reverse Gradient") +#endif +#ifndef MSG_ACTIVE_VTOOL + #define MSG_ACTIVE_VTOOL _UxGT("Active V-tool") +#endif +#ifndef MSG_START_VTOOL + #define MSG_START_VTOOL _UxGT("Start V-tool") +#endif +#ifndef MSG_END_VTOOL + #define MSG_END_VTOOL _UxGT(" End V-tool") +#endif +#ifndef MSG_GRADIENT_ALIAS + #define MSG_GRADIENT_ALIAS _UxGT("Alias V-tool") +#endif +#ifndef MSG_RESET_VTOOLS + #define MSG_RESET_VTOOLS _UxGT("Reset V-tools") +#endif +#ifndef MSG_COMMIT_VTOOL + #define MSG_COMMIT_VTOOL _UxGT("Commit V-tool Mix") +#endif +#ifndef MSG_VTOOLS_RESET + #define MSG_VTOOLS_RESET _UxGT("V-tools were reset") +#endif +#ifndef MSG_START_Z + #define MSG_START_Z _UxGT("Start Z") +#endif +#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 // ...or up to 2 lines on a 3-line display @@ -1111,6 +1323,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") @@ -1153,6 +1368,9 @@ #ifndef MSG_ADVANCED_PAUSE_WAITING_1 #define MSG_ADVANCED_PAUSE_WAITING_1 _UxGT("Click to continue") #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("Please wait...") #endif @@ -1181,3 +1399,39 @@ #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Resuming...") #endif #endif // LCD_HEIGHT < 4 + +#ifndef MSG_TMC_DRIVERS + #define MSG_TMC_DRIVERS _UxGT("TMC drivers") +#endif +#ifndef MSG_TMC_CURRENT + #define MSG_TMC_CURRENT _UxGT("Driver current") +#endif +#ifndef MSG_TMC_HYBRID_THRS + #define MSG_TMC_HYBRID_THRS _UxGT("Hybrid threshold") +#endif +#ifndef MSG_TMC_HOMING_THRS + #define MSG_TMC_HOMING_THRS _UxGT("Sensorless homing") +#endif +#ifndef MSG_TMC_STEPPING_MODE + #define MSG_TMC_STEPPING_MODE _UxGT("Stepping mode") +#endif +#ifndef MSG_TMC_STEALTH_ENABLED + #define MSG_TMC_STEALTH_ENABLED _UxGT("StealthChop enabled") +#endif + +#ifndef MSG_SERVICE_RESET + #define MSG_SERVICE_RESET _UxGT("Reset") +#endif +#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_es.h b/Marlin/src/lcd/language/language_es.h index f216db91bf82..9adc0e4f0e49 100644 --- a/Marlin/src/lcd/language/language_es.h +++ b/Marlin/src/lcd/language/language_es.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -46,7 +46,6 @@ #define MSG_AUTO_HOME_X _UxGT("Origen X") #define MSG_AUTO_HOME_Y _UxGT("Origen Y") #define MSG_AUTO_HOME_Z _UxGT("Origen Z") -#define MSG_TMC_Z_CALIBRATION _UxGT("Calibrar Z") #define MSG_LEVEL_BED_HOMING _UxGT("Origen XYZ") #define MSG_LEVEL_BED_WAITING _UxGT("Iniciar (Presione)") #define MSG_LEVEL_BED_NEXT_POINT _UxGT("Siguiente punto") @@ -233,28 +232,25 @@ #define MSG_FILAMENT_CHANGE_MINTEMP _UxGT("Temp Mínima es ") #define MSG_FILAMENT_CHANGE_NOZZLE _UxGT(" Boquilla: ") -#define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Esperando iniciar") +#define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Esperando para") -#define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Inserte filamento") +#define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Inserte el filamento") #define MSG_FILAMENT_CHANGE_INSERT_2 _UxGT("y presione el botón") #if LCD_HEIGHT >= 4 // Up to 3 lines allowed - #define MSG_FILAMENT_CHANGE_INIT_2 _UxGT("del filamento") - #define MSG_FILAMENT_CHANGE_INIT_3 _UxGT("cambiar") + #define MSG_FILAMENT_CHANGE_INIT_2 _UxGT("iniciar cambio") + #define MSG_FILAMENT_CHANGE_INIT_3 _UxGT("de filamento") #define MSG_FILAMENT_CHANGE_INSERT_3 _UxGT("para continuar...") #else // LCD_HEIGHT < 4 // Up to 2 lines allowed - #define MSG_FILAMENT_CHANGE_INIT_2 _UxGT("del fil. cambiar") - #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Inserte filamento") + #define MSG_FILAMENT_CHANGE_INIT_2 _UxGT("iniciar cambio fil.") #endif // LCD_HEIGHT < 4 -#define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Esperado por") -#define MSG_FILAMENT_CHANGE_UNLOAD_2 _UxGT("filamento expulsado") -#define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Esperado por") -#define MSG_FILAMENT_CHANGE_LOAD_2 _UxGT("Cargar filamento") -#define MSG_FILAMENT_CHANGE_EXTRUDE_1 _UxGT("Esperado por") -#define MSG_FILAMENT_CHANGE_EXTRUDE_2 _UxGT("Extruir filamento") +#define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Esperando para") +#define MSG_FILAMENT_CHANGE_UNLOAD_2 _UxGT("expulsar filamento") +#define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Esperado para") +#define MSG_FILAMENT_CHANGE_LOAD_2 _UxGT("cargar el filamento") #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Esperando imp.") #define MSG_FILAMENT_CHANGE_RESUME_2 _UxGT("para resumir") #define MSG_FILAMENT_CHANGE_HEAT_1 _UxGT("Oprima botón para") diff --git a/Marlin/src/lcd/language/language_eu.h b/Marlin/src/lcd/language/language_eu.h index a1771d91786e..f705f13fb93e 100644 --- a/Marlin/src/lcd/language/language_eu.h +++ b/Marlin/src/lcd/language/language_eu.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -46,7 +46,6 @@ #define MSG_AUTO_HOME_X _UxGT("X jatorrira") #define MSG_AUTO_HOME_Y _UxGT("Y jatorrira") #define MSG_AUTO_HOME_Z _UxGT("Z jatorrira") -#define MSG_TMC_Z_CALIBRATION _UxGT("Kalibratu Z") #define MSG_LEVEL_BED_HOMING _UxGT("XYZ hasieraratzen") #define MSG_LEVEL_BED_WAITING _UxGT("Klik egin hasteko") #define MSG_LEVEL_BED_NEXT_POINT _UxGT("Hurrengo Puntua") diff --git a/Marlin/src/lcd/language/language_fi.h b/Marlin/src/lcd/language/language_fi.h index cca996d13ccc..23b66c3bed65 100644 --- a/Marlin/src/lcd/language/language_fi.h +++ b/Marlin/src/lcd/language/language_fi.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -39,7 +39,6 @@ #define MSG_AUTOSTART _UxGT("Automaatti") #define MSG_DISABLE_STEPPERS _UxGT("Vapauta moottorit") #define MSG_AUTO_HOME _UxGT("Aja referenssiin") -#define MSG_TMC_Z_CALIBRATION _UxGT("Kalibroi Z") #define MSG_LEVEL_BED_HOMING _UxGT("Homing XYZ") #define MSG_LEVEL_BED_WAITING _UxGT("Click to Begin") #define MSG_LEVEL_BED_DONE _UxGT("Leveling Done!") diff --git a/Marlin/src/lcd/language/language_fr.h b/Marlin/src/lcd/language/language_fr.h index 386f7cedf41a..e45bb3277d0e 100644 --- a/Marlin/src/lcd/language/language_fr.h +++ b/Marlin/src/lcd/language/language_fr.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -33,20 +33,25 @@ #define CHARSIZE 2 #define WELCOME_MSG MACHINE_NAME _UxGT(" prête.") +#define MSG_YES _UxGT("Oui") +#define MSG_NO _UxGT("Non") #define MSG_BACK _UxGT("Retour") #define MSG_SD_INSERTED _UxGT("Carte insérée") #define MSG_SD_REMOVED _UxGT("Carte retirée") -#define MSG_LCD_ENDSTOPS _UxGT("Butées") // Max length 8 characters +#define MSG_LCD_ENDSTOPS _UxGT("Butées") +#define MSG_LCD_SOFT_ENDSTOPS _UxGT("Butées SW") #define MSG_MAIN _UxGT("Menu principal") -#define MSG_AUTOSTART _UxGT("Demarrage auto") +#define MSG_ADVANCED_SETTINGS _UxGT("Config. avancée") +#define MSG_CONFIGURATION _UxGT("Configuration") +#define MSG_AUTOSTART _UxGT("Exéc. auto#.gcode") #define MSG_DISABLE_STEPPERS _UxGT("Arrêter moteurs") #define MSG_DEBUG_MENU _UxGT("Menu debug") #define MSG_PROGRESS_BAR_TEST _UxGT("Test barre progress.") #define MSG_AUTO_HOME _UxGT("Origine auto.") -#define MSG_AUTO_HOME_X _UxGT("Origine X Auto.") -#define MSG_AUTO_HOME_Y _UxGT("Origine Y Auto.") -#define MSG_AUTO_HOME_Z _UxGT("Origine Z Auto.") -#define MSG_TMC_Z_CALIBRATION _UxGT("Calibrer Z") +#define MSG_AUTO_HOME_X _UxGT("Origine X auto.") +#define MSG_AUTO_HOME_Y _UxGT("Origine Y auto.") +#define MSG_AUTO_HOME_Z _UxGT("Origine Z auto.") +#define MSG_AUTO_Z_ALIGN _UxGT("Align. Z auto.") #define MSG_LEVEL_BED_HOMING _UxGT("Origine XYZ") #define MSG_LEVEL_BED_WAITING _UxGT("Clic pour commencer") #define MSG_LEVEL_BED_NEXT_POINT _UxGT("Point suivant") @@ -60,14 +65,20 @@ #define MSG_PREHEAT_1_ALL _UxGT("Préch. " PREHEAT_1_LABEL " Tout") #define MSG_PREHEAT_1_END MSG_PREHEAT_1 _UxGT(" buse") #define MSG_PREHEAT_1_BEDONLY _UxGT("Préch. " PREHEAT_1_LABEL " lit") -#define MSG_PREHEAT_1_SETTINGS _UxGT("Régl. prech. " PREHEAT_1_LABEL) +#define MSG_PREHEAT_1_SETTINGS _UxGT("Régl. préch. " PREHEAT_1_LABEL) #define MSG_PREHEAT_2 _UxGT("Préchauffage " PREHEAT_2_LABEL) #define MSG_PREHEAT_2_N _UxGT("Préchauff. " PREHEAT_2_LABEL " ") #define MSG_PREHEAT_2_ALL _UxGT("Préch. " PREHEAT_2_LABEL " Tout") #define MSG_PREHEAT_2_END MSG_PREHEAT_2 _UxGT(" buse") #define MSG_PREHEAT_2_BEDONLY _UxGT("Préch. " PREHEAT_2_LABEL " lit") -#define MSG_PREHEAT_2_SETTINGS _UxGT("Régl. prech. " PREHEAT_2_LABEL) +#define MSG_PREHEAT_2_SETTINGS _UxGT("Régl. préch. " PREHEAT_2_LABEL) +#define MSG_PREHEAT_CUSTOM _UxGT("Préchauff. perso.") #define MSG_COOLDOWN _UxGT("Refroidir") +#define MSG_LASER_MENU _UxGT("Contrôle Laser") +#define MSG_LASER_OFF _UxGT("Laser Off") +#define MSG_LASER_ON _UxGT("Laser On") +#define MSG_LASER_POWER _UxGT("Puissance") +#define MSG_SPINDLE_REVERSE _UxGT("Inverser broches") #define MSG_SWITCH_PS_ON _UxGT("Allumer alim.") #define MSG_SWITCH_PS_OFF _UxGT("Eteindre alim.") #define MSG_EXTRUDE _UxGT("Extrusion") @@ -78,12 +89,24 @@ #define MSG_LEVEL_CORNERS _UxGT("Niveau coins") #define MSG_NEXT_CORNER _UxGT("Coin suivant") #define MSG_EDITING_STOPPED _UxGT("Arrêt édit. maillage") -#define MSG_USER_MENU _UxGT("Commandes perso") +#define MSG_MESH_X _UxGT("Index X") +#define MSG_MESH_Y _UxGT("Index Y") +#define MSG_MESH_EDIT_Z _UxGT("Valeur Z") +#define MSG_USER_MENU _UxGT("Commandes perso.") #define MSG_UBL_DOING_G29 _UxGT("G29 en cours") #define MSG_UBL_UNHOMED _UxGT("Origine XYZ d'abord") #define MSG_UBL_TOOLS _UxGT("Outils UBL") #define MSG_UBL_LEVEL_BED _UxGT("Niveau lit unifié") +#define MSG_IDEX_MENU _UxGT("Mode IDEX") +#define MSG_IDEX_MODE_AUTOPARK _UxGT("Auto-Park") +#define MSG_IDEX_MODE_DUPLICATE _UxGT("Duplication") +#define MSG_IDEX_MODE_MIRRORED_COPY _UxGT("Copie miroir") +#define MSG_IDEX_MODE_FULL_CTRL _UxGT("Contrôle complet") +#define MSG_OFFSETS_MENU _UxGT("Offsets Outil") +#define MSG_X_OFFSET _UxGT("Buse 2 X") +#define MSG_Y_OFFSET _UxGT("Buse 2 Y") +#define MSG_Z_OFFSET _UxGT("Buse 2 Z") #define MSG_UBL_MANUAL_MESH _UxGT("Maillage manuel") #define MSG_UBL_BC_INSERT _UxGT("Poser câle & mesurer") #define MSG_UBL_BC_INSERT2 _UxGT("Mesure") @@ -168,6 +191,7 @@ #define MSG_MOVE_Y _UxGT("Dépl. Y") #define MSG_MOVE_Z _UxGT("Dépl. Z") #define MSG_MOVE_E _UxGT("Extrudeur") +#define MSG_HOTEND_TOO_COLD _UxGT("Buse trop froide") #define MSG_MOVE_01MM _UxGT("Dépl. 0.1mm") #define MSG_MOVE_1MM _UxGT("Dépl. 1mm") #define MSG_MOVE_10MM _UxGT("Dépl. 10mm") @@ -175,6 +199,7 @@ #define MSG_BED_Z _UxGT("Lit Z") #define MSG_NOZZLE _UxGT("Buse") #define MSG_BED _UxGT("Lit") +#define MSG_CHAMBER _UxGT("Caisson") #define MSG_FAN_SPEED _UxGT("Vitesse ventil.") #define MSG_EXTRA_FAN_SPEED _UxGT("Extra V ventil.") @@ -204,6 +229,7 @@ #endif #define MSG_VE_JERK _UxGT("Ve jerk") #define MSG_VELOCITY _UxGT("Vélocité") +#define MSG_JUNCTION_DEVIATION _UxGT("Déviat. jonct.") #define MSG_VMAX _UxGT("Vmax ") #define MSG_VMIN _UxGT("Vmin ") #define MSG_VTRAV_MIN _UxGT("V dépl. min") @@ -241,19 +267,26 @@ #define MSG_LOAD_EEPROM _UxGT("Lire config") #define MSG_RESTORE_FAILSAFE _UxGT("Restaurer défauts") #define MSG_INIT_EEPROM _UxGT("Initialiser EEPROM") +#define MSG_SD_UPDATE _UxGT("MàJ. SD") +#define MSG_RESET_PRINTER _UxGT("RàZ. imprimante") #define MSG_REFRESH _UxGT("Actualiser") #define MSG_WATCH _UxGT("Surveiller") #define MSG_PREPARE _UxGT("Préparer") #define MSG_TUNE _UxGT("Régler") +#define MSG_START_PRINT _UxGT("Démarrer Impr.") +#define MSG_BUTTON_PRINT _UxGT("Imprimer") +#define MSG_BUTTON_CANCEL _UxGT("Annuler") #define MSG_PAUSE_PRINT _UxGT("Interrompre impr.") #define MSG_RESUME_PRINT _UxGT("Reprendre impr.") #define MSG_STOP_PRINT _UxGT("Arrêter impr.") +#define MSG_OUTAGE_RECOVERY _UxGT("Récupér. coupure") #define MSG_CARD_MENU _UxGT("Impr. depuis SD") #define MSG_NO_CARD _UxGT("Pas de carte") #define MSG_DWELL _UxGT("Repos...") -#define MSG_USERWAIT _UxGT("Atten. de l'util.") +#define MSG_USERWAIT _UxGT("Attente utilis.") #define MSG_PRINT_PAUSED _UxGT("Impr. en pause") -#define MSG_PRINT_ABORTED _UxGT("Impr. Annulée") +#define MSG_PRINTING _UxGT("Impression") +#define MSG_PRINT_ABORTED _UxGT("Impr. annulée") #define MSG_NO_MOVE _UxGT("Moteurs bloqués.") #define MSG_KILLED _UxGT("MORT.") #define MSG_STOPPED _UxGT("STOPPÉ.") @@ -265,34 +298,50 @@ #define MSG_CONTROL_RETRACT_RECOVER_SWAP _UxGT("Ech. Rappel mm") #define MSG_CONTROL_RETRACT_RECOVERF _UxGT("Rappel V") #define MSG_CONTROL_RETRACT_RECOVER_SWAPF _UxGT("Ech. Rappel V") -#define MSG_AUTORETRACT _UxGT("Retrait. Auto.") +#define MSG_AUTORETRACT _UxGT("Retrait auto.") +#define MSG_TOOL_CHANGE _UxGT("Changement outil") +#define MSG_TOOL_CHANGE_ZLIFT _UxGT("Augmenter Z") +#define MSG_SINGLENOZZLE_PRIME_SPD _UxGT("Vitesse primaire") +#define MSG_SINGLENOZZLE_RETRACT_SPD _UxGT("Vitesse retrait") +#define MSG_NOZZLE_STANDBY _UxGT("Attente buse") +#define MSG_FILAMENT_SWAP_LENGTH _UxGT("Distance retrait") #define MSG_FILAMENTCHANGE _UxGT("Changer filament") #define MSG_FILAMENTLOAD _UxGT("Charger fil.") #define MSG_FILAMENTUNLOAD _UxGT("Décharger fil.") #define MSG_FILAMENTUNLOAD_ALL _UxGT("Décharger tout") #define MSG_INIT_SDCARD _UxGT("Init. la carte SD") #define MSG_CHANGE_SDCARD _UxGT("Changer de carte") -#define MSG_ZPROBE_OUT _UxGT("Z sonde hors lit") +#define MSG_ZPROBE_OUT _UxGT("Sonde Z hors lit") #define MSG_SKEW_FACTOR _UxGT("Facteur écart") #define MSG_BLTOUCH _UxGT("BLTouch") #define MSG_BLTOUCH_SELFTEST _UxGT("Autotest BLTouch") #define MSG_BLTOUCH_RESET _UxGT("RaZ BLTouch") #define MSG_BLTOUCH_DEPLOY _UxGT("Déployer BLTouch") +#define MSG_BLTOUCH_SW_MODE _UxGT("Mode BLTouch SW") +#define MSG_BLTOUCH_5V_MODE _UxGT("Mode BLTouch 5V") +#define MSG_BLTOUCH_OD_MODE _UxGT("Mode BLTouch OD") #define MSG_BLTOUCH_STOW _UxGT("Ranger BLTouch") +#define MSG_MANUAL_DEPLOY _UxGT("Déployer Sonde Z") +#define MSG_MANUAL_STOW _UxGT("Ranger Sonde Z") #define MSG_HOME _UxGT("Origine") // Used as MSG_HOME " " MSG_X MSG_Y MSG_Z " " MSG_FIRST #define MSG_FIRST _UxGT("Premier") #define MSG_ZPROBE_ZOFFSET _UxGT("Décalage Z") #define MSG_BABYSTEP_X _UxGT("Babystep X") #define MSG_BABYSTEP_Y _UxGT("Babystep Y") #define MSG_BABYSTEP_Z _UxGT("Babystep Z") +#define MSG_BABYSTEP_TOTAL _UxGT("Total") #define MSG_ENDSTOP_ABORT _UxGT("Butée abandon") #define MSG_HEATING_FAILED_LCD _UxGT("Erreur de chauffe") +#define MSG_HEATING_FAILED_LCD_BED _UxGT("Erreur de chauffe lit") #define MSG_ERR_REDUNDANT_TEMP _UxGT("Err: TEMP. REDONDANTE") #define MSG_THERMAL_RUNAWAY _UxGT("EMBALLEMENT THERM.") +#define MSG_THERMAL_RUNAWAY_BED _UxGT("ERREUR THERMIQUE LIT") #define MSG_ERR_MAXTEMP _UxGT("Err: TEMP. MAX") #define MSG_ERR_MINTEMP _UxGT("Err: TEMP. MIN") #define MSG_ERR_MAXTEMP_BED _UxGT("Err: TEMP. MAX LIT") #define MSG_ERR_MINTEMP_BED _UxGT("Err: TEMP. MIN LIT") +#define MSG_ERR_MAXTEMP_CHAMBER _UxGT("Err: MAXTEMP CAISSON") +#define MSG_ERR_MINTEMP_CHAMBER _UxGT("Err: MINTEMP CAISSON") #define MSG_ERR_Z_HOMING MSG_HOME _UxGT(" ") MSG_X MSG_Y _UxGT(" ") MSG_FIRST #define MSG_HALTED _UxGT("IMPR. STOPPÉE") @@ -302,7 +351,9 @@ #define MSG_SHORT_MINUTE _UxGT("m") // One character only #define MSG_HEATING _UxGT("En chauffe...") +#define MSG_COOLING _UxGT("Refroidissement") #define MSG_BED_HEATING _UxGT("Lit en chauffe...") +#define MSG_BED_COOLING _UxGT("Refroid. du lit...") #define MSG_DELTA_CALIBRATE _UxGT("Calibration Delta") #define MSG_DELTA_CALIBRATE_X _UxGT("Calibrer X") #define MSG_DELTA_CALIBRATE_Y _UxGT("Calibrer Y") @@ -311,6 +362,7 @@ #define MSG_DELTA_SETTINGS _UxGT("Réglages Delta") #define MSG_DELTA_AUTO_CALIBRATE _UxGT("Calibration Auto") #define MSG_DELTA_HEIGHT_CALIBRATE _UxGT("Hauteur Delta") +#define MSG_DELTA_Z_OFFSET_CALIBRATE _UxGT("Delta Z sonde") #define MSG_DELTA_DIAG_ROD _UxGT("Diagonale") #define MSG_DELTA_HEIGHT _UxGT("Hauteur") #define MSG_DELTA_RADIUS _UxGT("Rayon") @@ -324,9 +376,9 @@ #define MSG_MESH_LEVELING _UxGT("Niveau maillage") #define MSG_INFO_STATS_MENU _UxGT("Stats. imprimante") #define MSG_INFO_BOARD_MENU _UxGT("Infos carte") -#define MSG_INFO_THERMISTOR_MENU _UxGT("Thermistors") +#define MSG_INFO_THERMISTOR_MENU _UxGT("Thermistances") #define MSG_INFO_EXTRUDERS _UxGT("Extrudeurs") -#define MSG_INFO_BAUDRATE _UxGT("Baud") +#define MSG_INFO_BAUDRATE _UxGT("Bauds") #define MSG_INFO_PROTOCOL _UxGT("Protocole") #define MSG_CASE_LIGHT _UxGT("Lumière caisson") #define MSG_CASE_LIGHT_BRIGHTNESS _UxGT("Luminosité") @@ -359,35 +411,109 @@ #define MSG_FILAMENT_CHANGE_OPTION_PURGE _UxGT("Purger encore") #define MSG_FILAMENT_CHANGE_OPTION_RESUME _UxGT("Reprendre impr.") #define MSG_FILAMENT_CHANGE_NOZZLE _UxGT(" Buse: ") +#define MSG_RUNOUT_SENSOR _UxGT("Capteur Fil.") #define MSG_ERR_HOMING_FAILED _UxGT("Echec origine") #define MSG_ERR_PROBING_FAILED _UxGT("Echec sonde") #define MSG_M600_TOO_COLD _UxGT("M600: Trop froid") +#define MSG_MMU2_FILAMENT_CHANGE_HEADER _UxGT("CHANGER FILAMENT") +#define MSG_MMU2_CHOOSE_FILAMENT_HEADER _UxGT("CHOISIR FILAMENT") +#define MSG_MMU2_MENU _UxGT("MMU") +#define MSG_MMU2_WRONG_FIRMWARE _UxGT("Update MMU firmware!") +#define MSG_MMU2_NOT_RESPONDING _UxGT("MMU ne répond plus") +#define MSG_MMU2_RESUME _UxGT("Continuer impr.") +#define MSG_MMU2_RESUMING _UxGT("Reprise...") +#define MSG_MMU2_LOAD_FILAMENT _UxGT("Charger filament") +#define MSG_MMU2_LOAD_ALL _UxGT("Charger tous") +#define MSG_MMU2_LOAD_TO_NOZZLE _UxGT("Charger dans buse") +#define MSG_MMU2_EJECT_FILAMENT _UxGT("Ejecter filament") +#define MSG_MMU2_EJECT_FILAMENT0 _UxGT("Ejecter fil. 1") +#define MSG_MMU2_EJECT_FILAMENT1 _UxGT("Ejecter fil. 2") +#define MSG_MMU2_EJECT_FILAMENT2 _UxGT("Ejecter fil. 3") +#define MSG_MMU2_EJECT_FILAMENT3 _UxGT("Ejecter fil. 4") +#define MSG_MMU2_EJECT_FILAMENT4 _UxGT("Ejecter fil. 5") +#define MSG_MMU2_UNLOAD_FILAMENT _UxGT("Retrait filament") +#define MSG_MMU2_LOADING_FILAMENT _UxGT("Chargem. fil. %i...") +#define MSG_MMU2_EJECTING_FILAMENT _UxGT("Ejection fil...") +#define MSG_MMU2_UNLOADING_FILAMENT _UxGT("Retrait fil....") +#define MSG_MMU2_ALL _UxGT("Tous") +#define MSG_MMU2_FILAMENT0 _UxGT("Filament 1") +#define MSG_MMU2_FILAMENT1 _UxGT("Filament 2") +#define MSG_MMU2_FILAMENT2 _UxGT("Filament 3") +#define MSG_MMU2_FILAMENT3 _UxGT("Filament 4") +#define MSG_MMU2_FILAMENT4 _UxGT("Filament 5") +#define MSG_MMU2_RESET _UxGT("Réinit. MMU") +#define MSG_MMU2_RESETTING _UxGT("Réinit. MMU...") +#define MSG_MMU2_EJECT_RECOVER _UxGT("Retrait, click") + +#define MSG_MIX _UxGT("Mix") +#define MSG_MIX_COMPONENT _UxGT("Composante") +#define MSG_MIXER _UxGT("Mixeur") +#define MSG_GRADIENT _UxGT("Dégradé") +#define MSG_FULL_GRADIENT _UxGT("Dégradé complet") +#define MSG_TOGGLE_MIX _UxGT("Toggle mix") +#define MSG_CYCLE_MIX _UxGT("Cycle mix") +#define MSG_GRADIENT_MIX _UxGT("Mix dégradé") +#define MSG_REVERSE_GRADIENT _UxGT("Inverser dégradé") +#define MSG_ACTIVE_VTOOL _UxGT("Active V-tool") +#define MSG_START_VTOOL _UxGT("Début V-tool") +#define MSG_END_VTOOL _UxGT(" Fin V-tool") +#define MSG_GRADIENT_ALIAS _UxGT("Alias V-tool") +#define MSG_RESET_VTOOLS _UxGT("Réinit. V-tools") +#define MSG_COMMIT_VTOOL _UxGT("Valider Mix V-tool") +#define MSG_VTOOLS_RESET _UxGT("V-tools réinit. ok") +#define MSG_START_Z _UxGT("Début Z") +#define MSG_END_Z _UxGT(" Fin Z") +#define MSG_BRICKOUT _UxGT("Casse-briques") +#define MSG_INVADERS _UxGT("Invaders") +#define MSG_SNAKE _UxGT("Sn4k3") +#define MSG_MAZE _UxGT("Labyrinthe") #if LCD_HEIGHT >= 4 // Up to 3 lines allowed - #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Attente Démarrage") - #define MSG_FILAMENT_CHANGE_INIT_2 _UxGT("du filament") - #define MSG_FILAMENT_CHANGE_INIT_3 _UxGT("changer") - #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Attente de") - #define MSG_FILAMENT_CHANGE_UNLOAD_2 _UxGT("décharger filament") + #define MSG_ADVANCED_PAUSE_WAITING_1 _UxGT("Presser bouton") + #define MSG_ADVANCED_PAUSE_WAITING_2 _UxGT("pour reprendre") + #define MSG_PAUSE_PRINT_INIT_1 _UxGT("Parking...") + #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Attente filament") + #define MSG_FILAMENT_CHANGE_INIT_2 _UxGT("pour démarrer") #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Insérer filament") #define MSG_FILAMENT_CHANGE_INSERT_2 _UxGT("et app. bouton") #define MSG_FILAMENT_CHANGE_INSERT_3 _UxGT("pour continuer...") #define MSG_FILAMENT_CHANGE_HEAT_1 _UxGT("Presser le bouton...") - #define MSG_FILAMENT_CHANGE_HEAT_2 _UxGT("Pr chauffer la buse") + #define MSG_FILAMENT_CHANGE_HEAT_2 _UxGT("pr chauffer la buse") #define MSG_FILAMENT_CHANGE_HEATING_1 _UxGT("Buse en chauffe") - #define MSG_FILAMENT_CHANGE_HEATING_2 _UxGT("Patientez SVP...") - #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Attente de") - #define MSG_FILAMENT_CHANGE_LOAD_2 _UxGT("Chargement filament") + #define MSG_FILAMENT_CHANGE_HEATING_2 _UxGT("Patienter SVP...") + #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Attente") + #define MSG_FILAMENT_CHANGE_UNLOAD_2 _UxGT("retrait du filament") + #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Attente") + #define MSG_FILAMENT_CHANGE_LOAD_2 _UxGT("chargement filament") #define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Attente") - #define MSG_FILAMENT_CHANGE_PURGE_2 _UxGT("Purger filament") - #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Attente impression") - #define MSG_FILAMENT_CHANGE_RESUME_2 _UxGT("pour reprendre") + #define MSG_FILAMENT_CHANGE_PURGE_2 _UxGT("Purge filament") + #define MSG_FILAMENT_CHANGE_CONT_PURGE_1 _UxGT("Presser pour finir") + #define MSG_FILAMENT_CHANGE_CONT_PURGE_2 _UxGT("la purge du filament") + #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Attente reprise") + #define MSG_FILAMENT_CHANGE_RESUME_2 _UxGT("impression") #else // LCD_HEIGHT < 4 // Up to 2 lines allowed - #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Patientez...") - #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Ejection...") - #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Insérer et clic") + #define MSG_ADVANCED_PAUSE_WAITING_1 _UxGT("Presser pr continuer") + #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Patience...") + #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Insérer fil.") + #define MSG_FILAMENT_CHANGE_HEAT_1 _UxGT("Chauffer ?") + #define MSG_FILAMENT_CHANGE_HEATING_1 _UxGT("Chauffage...") + #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Ejecting...") #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Chargement...") + #define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Purge...") + #define MSG_FILAMENT_CHANGE_CONT_PURGE_1 _UxGT("Terminer ?") #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Reprise...") #endif // LCD_HEIGHT < 4 + +#define MSG_TMC_DRIVERS _UxGT("Drivers TMC") +#define MSG_TMC_CURRENT _UxGT("Courant driver") +#define MSG_TMC_HYBRID_THRS _UxGT("Seuil hybride") +#define MSG_TMC_HOMING_THRS _UxGT("Home sans capteur") +#define MSG_TMC_STEPPING_MODE _UxGT("Mode pas à pas") +#define MSG_TMC_STEALTH_ENABLED _UxGT("StealthChop activé") +#define MSG_SERVICE_RESET _UxGT("Réinit.") +#define MSG_SERVICE_IN _UxGT(" dans:") +#define MSG_BACKLASH _UxGT("Backlash") +#define MSG_BACKLASH_CORRECTION _UxGT("Correction") +#define MSG_BACKLASH_SMOOTHING _UxGT("Lissage") diff --git a/Marlin/src/lcd/language/language_gl.h b/Marlin/src/lcd/language/language_gl.h index 6809a2c70ca6..b7260802054f 100644 --- a/Marlin/src/lcd/language/language_gl.h +++ b/Marlin/src/lcd/language/language_gl.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -43,7 +43,6 @@ #define MSG_AUTO_HOME_X _UxGT("Ir orixe X") #define MSG_AUTO_HOME_Y _UxGT("Ir orixe Y") #define MSG_AUTO_HOME_Z _UxGT("Ir orixe Z") -#define MSG_TMC_Z_CALIBRATION _UxGT("Calibrar Z") #define MSG_LEVEL_BED_HOMING _UxGT("Ir orixes XYZ") #define MSG_LEVEL_BED_WAITING _UxGT("Prema pulsador") #define MSG_LEVEL_BED_NEXT_POINT _UxGT("Seguinte punto") diff --git a/Marlin/src/lcd/language/language_hr.h b/Marlin/src/lcd/language/language_hr.h index 50893a0c828e..0d5b34c87127 100644 --- a/Marlin/src/lcd/language/language_hr.h +++ b/Marlin/src/lcd/language/language_hr.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -43,7 +43,6 @@ #define MSG_AUTO_HOME_X _UxGT("Home-aj X") #define MSG_AUTO_HOME_Y _UxGT("Home-aj Y") #define MSG_AUTO_HOME_Z _UxGT("Home-aj Z") -#define MSG_TMC_Z_CALIBRATION _UxGT("Kalibriraj Z") #define MSG_LEVEL_BED_HOMING _UxGT("Home-aj XYZ") #define MSG_LEVEL_BED_WAITING _UxGT("Klikni za početak") #define MSG_LEVEL_BED_NEXT_POINT _UxGT("Sljedeća točka") diff --git a/Marlin/src/lcd/language/language_it.h b/Marlin/src/lcd/language/language_it.h index 06ec0f683515..36bfd70f1961 100644 --- a/Marlin/src/lcd/language/language_it.h +++ b/Marlin/src/lcd/language/language_it.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -32,6 +32,8 @@ #define DISPLAY_CHARSET_ISO10646_1 #define WELCOME_MSG MACHINE_NAME _UxGT(" pronto.") +#define MSG_YES _UxGT("SI") +#define MSG_NO _UxGT("NO") #define MSG_BACK _UxGT("Indietro") #define MSG_SD_INSERTED _UxGT("SD Card inserita") #define MSG_SD_REMOVED _UxGT("SD Card rimossa") @@ -49,7 +51,6 @@ #define MSG_AUTO_HOME_Y _UxGT("Home asse Y") #define MSG_AUTO_HOME_Z _UxGT("Home asse Z") #define MSG_AUTO_Z_ALIGN _UxGT("Allineam.automat. Z") -#define MSG_TMC_Z_CALIBRATION _UxGT("Calibra Z") #define MSG_LEVEL_BED_HOMING _UxGT("Home assi XYZ") #define MSG_LEVEL_BED_WAITING _UxGT("Premi per iniziare") #define MSG_LEVEL_BED_NEXT_POINT _UxGT("Punto successivo") @@ -72,6 +73,11 @@ #define MSG_PREHEAT_2_SETTINGS MSG_PREHEAT_2_N _UxGT("conf") #define MSG_PREHEAT_CUSTOM _UxGT("Prerisc.personal.") #define MSG_COOLDOWN _UxGT("Raffredda") +#define MSG_LASER_MENU _UxGT("Controllo laser") +#define MSG_LASER_OFF _UxGT("Laser Off") +#define MSG_LASER_ON _UxGT("Laser On") +#define MSG_LASER_POWER _UxGT("Potenza laser") +#define MSG_SPINDLE_REVERSE _UxGT("Inverti mandrino") #define MSG_SWITCH_PS_ON _UxGT("Accendi aliment.") #define MSG_SWITCH_PS_OFF _UxGT("Spegni aliment.") #define MSG_EXTRUDE _UxGT("Estrudi") @@ -91,14 +97,14 @@ #define MSG_UBL_TOOLS _UxGT("Strumenti UBL") #define MSG_UBL_LEVEL_BED _UxGT("Unified Bed Leveling") #define MSG_IDEX_MENU _UxGT("Modo IDEX") +#define MSG_OFFSETS_MENU _UxGT("Strumenti Offsets") #define MSG_IDEX_MODE_AUTOPARK _UxGT("Auto-Park") #define MSG_IDEX_MODE_DUPLICATE _UxGT("Duplicazione") -#define MSG_IDEX_MODE_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") -#define MSG_IDEX_Z_OFFSET _UxGT("2° ugello Z") -#define MSG_IDEX_SAVE_OFFSETS _UxGT("Memorizza Offsets") +#define MSG_X_OFFSET _UxGT("2° ugello X") +#define MSG_Y_OFFSET _UxGT("2° ugello Y") +#define MSG_Z_OFFSET _UxGT("2° ugello Z") #define MSG_UBL_MANUAL_MESH _UxGT("Mesh Manuale") #define MSG_UBL_BC_INSERT _UxGT("Metti spes. e misura") #define MSG_UBL_BC_INSERT2 _UxGT("Misura") @@ -191,6 +197,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") @@ -263,6 +270,9 @@ #define MSG_WATCH _UxGT("Schermata info") #define MSG_PREPARE _UxGT("Prepara") #define MSG_TUNE _UxGT("Regola") +#define MSG_START_PRINT _UxGT("Avvia stampa") +#define MSG_BUTTON_PRINT _UxGT("Stampa") +#define MSG_BUTTON_CANCEL _UxGT("Annulla") #define MSG_PAUSE_PRINT _UxGT("Pausa stampa") #define MSG_RESUME_PRINT _UxGT("Riprendi stampa") #define MSG_STOP_PRINT _UxGT("Arresta stampa") @@ -291,6 +301,7 @@ #define MSG_TOOL_CHANGE_ZLIFT _UxGT("Risalita Z") #define MSG_SINGLENOZZLE_PRIME_SPD _UxGT("Velocità innesco") #define MSG_SINGLENOZZLE_RETRACT_SPD _UxGT("Velocità retrazione") +#define MSG_NOZZLE_STANDBY _UxGT("Standby ugello") #define MSG_FILAMENTCHANGE _UxGT("Cambia filamento") #define MSG_FILAMENTLOAD _UxGT("Carica filamento") #define MSG_FILAMENTUNLOAD _UxGT("Rimuovi filamento") @@ -303,6 +314,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") @@ -312,6 +326,7 @@ #define MSG_BABYSTEP_X _UxGT("Babystep X") #define MSG_BABYSTEP_Y _UxGT("Babystep Y") #define MSG_BABYSTEP_Z _UxGT("Babystep Z") +#define MSG_BABYSTEP_TOTAL _UxGT("Totali") #define MSG_ENDSTOP_ABORT _UxGT("Finecorsa annullati") #define MSG_HEATING_FAILED_LCD _UxGT("Riscald. Fallito") #define MSG_HEATING_FAILED_LCD_BED _UxGT("Risc. piatto fallito") @@ -322,6 +337,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") @@ -385,11 +402,64 @@ #define MSG_FILAMENT_CHANGE_OPTION_PURGE _UxGT("Spurga di più") #define MSG_FILAMENT_CHANGE_OPTION_RESUME _UxGT("Riprendi stampa") #define MSG_FILAMENT_CHANGE_NOZZLE _UxGT(" Ugello: ") -#define MSG_RUNOUT_SENSOR_ENABLE _UxGT("Sens.filo terminato") +#define MSG_RUNOUT_SENSOR _UxGT("Sens.filo terminato") #define MSG_ERR_HOMING_FAILED _UxGT("Home fallito") #define MSG_ERR_PROBING_FAILED _UxGT("Sondaggio fallito") #define MSG_M600_TOO_COLD _UxGT("M600:Troppo freddo") +#define MSG_MMU2_FILAMENT_CHANGE_HEADER _UxGT("CAMBIO FILAMENTO") +#define MSG_MMU2_CHOOSE_FILAMENT_HEADER _UxGT("SCELTA FILAMENTO") +#define MSG_MMU2_MENU _UxGT("MMU") +#define MSG_MMU2_WRONG_FIRMWARE _UxGT("Agg.firmware MMU!") +#define MSG_MMU2_NOT_RESPONDING _UxGT("MMU needs attention.") +#define MSG_MMU2_RESUME _UxGT("Riprendi stampa") +#define MSG_MMU2_RESUMING _UxGT("Ripresa...") +#define MSG_MMU2_LOAD_FILAMENT _UxGT("Carica filamento") +#define MSG_MMU2_LOAD_ALL _UxGT("Carica tutto") +#define MSG_MMU2_LOAD_TO_NOZZLE _UxGT("Load to nozzle") +#define MSG_MMU2_EJECT_FILAMENT _UxGT("Espelli filamento") +#define MSG_MMU2_EJECT_FILAMENT0 _UxGT("Espelli filam.1") +#define MSG_MMU2_EJECT_FILAMENT1 _UxGT("Espelli filam.2") +#define MSG_MMU2_EJECT_FILAMENT2 _UxGT("Espelli filam.3") +#define MSG_MMU2_EJECT_FILAMENT3 _UxGT("Espelli filam.4") +#define MSG_MMU2_EJECT_FILAMENT4 _UxGT("Espelli filam.5") +#define MSG_MMU2_UNLOAD_FILAMENT _UxGT("Scarica filamento") +#define MSG_MMU2_LOADING_FILAMENT _UxGT("Caric.fil. %i...") +#define MSG_MMU2_EJECTING_FILAMENT _UxGT("Esplus.filam. ...") +#define MSG_MMU2_UNLOADING_FILAMENT _UxGT("Scaric.filam. ...") +#define MSG_MMU2_ALL _UxGT("Tutto") +#define MSG_MMU2_FILAMENT0 _UxGT("Filamento 1") +#define MSG_MMU2_FILAMENT1 _UxGT("Filamento 2") +#define MSG_MMU2_FILAMENT2 _UxGT("Filamento 3") +#define MSG_MMU2_FILAMENT3 _UxGT("Filamento 4") +#define MSG_MMU2_FILAMENT4 _UxGT("Filamento 5") +#define MSG_MMU2_RESET _UxGT("Azzera MMU") +#define MSG_MMU2_RESETTING _UxGT("Azzeramento MMU...") +#define MSG_MMU2_EJECT_RECOVER _UxGT("Rimuovi, click") + +#define MSG_MIX _UxGT("Miscela") +#define MSG_MIX_COMPONENT _UxGT("Componente") +#define MSG_MIXER _UxGT("Miscelatore") +#define MSG_GRADIENT _UxGT("Gradiente") +#define MSG_FULL_GRADIENT _UxGT("Gradiente pieno") +#define MSG_TOGGLE_MIX _UxGT("Alterna miscela") +#define MSG_CYCLE_MIX _UxGT("Ciclo miscela") +#define MSG_GRADIENT_MIX _UxGT("Miscela gradiente") +#define MSG_REVERSE_GRADIENT _UxGT("Inverti gradiente") +#define MSG_ACTIVE_VTOOL _UxGT("V-tool attivo") +#define MSG_START_VTOOL _UxGT("V-tool iniziale") +#define MSG_END_VTOOL _UxGT("V-tool finale") +#define MSG_GRADIENT_ALIAS _UxGT("V-tool alias") +#define MSG_RESET_VTOOLS _UxGT("Ripristina V-tools") +#define MSG_COMMIT_VTOOL _UxGT("Commit mix V-tool") +#define MSG_VTOOLS_RESET _UxGT("V-tools ripristin.") +#define MSG_START_Z _UxGT("Z inizio") +#define MSG_END_Z _UxGT("Z fine") +#define MSG_BRICKOUT _UxGT("Brickout") +#define MSG_INVADERS _UxGT("Invaders") +#define MSG_SNAKE _UxGT("Sn4k3") +#define MSG_MAZE _UxGT("Maze") + // // Le schermate di Cambio Filamento possono visualizzare fino a 3 linee su un display a 4 righe // ...o fino a 2 linee su un display a 3 righe. @@ -397,6 +467,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") @@ -434,3 +505,17 @@ #define MSG_FILAMENT_CHANGE_CONT_PURGE_1 _UxGT("Premi x terminare") #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Ripresa...") #endif // LCD_HEIGHT < 4 + +#define MSG_TMC_DRIVERS _UxGT("Drivers TMC") +#define MSG_TMC_CURRENT _UxGT("Driver in uso") +#define MSG_TMC_HYBRID_THRS _UxGT("Soglia modo ibrido") +#define MSG_TMC_HOMING_THRS _UxGT("Azzer. sensorless") +#define MSG_TMC_STEPPING_MODE _UxGT("Modo stepping") +#define MSG_TMC_STEALTH_ENABLED _UxGT("StealthChop abil.") + +#define MSG_SERVICE_RESET _UxGT("Resetta") +#define MSG_SERVICE_IN _UxGT(" tra:") + +#define MSG_BACKLASH _UxGT("Gioco") +#define MSG_BACKLASH_CORRECTION _UxGT("Correzione") +#define MSG_BACKLASH_SMOOTHING _UxGT("Smoothing") diff --git a/Marlin/src/lcd/language/language_jp-kana.h b/Marlin/src/lcd/language/language_jp-kana.h index b95285a85fde..7ff67a147c71 100644 --- a/Marlin/src/lcd/language/language_jp-kana.h +++ b/Marlin/src/lcd/language/language_jp-kana.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,7 +50,6 @@ #define MSG_AUTO_HOME_X _UxGT("Xジク ゲンテンフッキ") // "Home X" #define MSG_AUTO_HOME_Y _UxGT("Yジク ゲンテンフッキ") // "Home Y" #define MSG_AUTO_HOME_Z _UxGT("Zジク ゲンテンフッキ") // "Home Z" -#define MSG_TMC_Z_CALIBRATION _UxGT("Zジク コウセイ") #define MSG_LEVEL_BED_HOMING _UxGT("ゲンテンフッキチュウ") // "Homing XYZ" #define MSG_LEVEL_BED_WAITING _UxGT("レベリングカイシ") // "Click to Begin" #define MSG_LEVEL_BED_NEXT_POINT _UxGT("ツギノソクテイテンヘ") // "Next Point" diff --git a/Marlin/src/lcd/language/language_ko_KR.h b/Marlin/src/lcd/language/language_ko_KR.h index d6e9023b1585..275572717383 100644 --- a/Marlin/src/lcd/language/language_ko_KR.h +++ b/Marlin/src/lcd/language/language_ko_KR.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -48,7 +48,6 @@ #define MSG_AUTO_HOME_X _UxGT("X 홈으로") #define MSG_AUTO_HOME_Y _UxGT("Y 홈으로") #define MSG_AUTO_HOME_Z _UxGT("Z 홈으로") -#define MSG_TMC_Z_CALIBRATION _UxGT("Z 캘리브레이션") #define MSG_LEVEL_BED_HOMING _UxGT("XYZ 홈으로") #define MSG_LEVEL_BED_WAITING _UxGT("누르면 시작합니다") #define MSG_LEVEL_BED_NEXT_POINT _UxGT("다음 Point") @@ -89,12 +88,11 @@ #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") -#define MSG_IDEX_Z_OFFSET _UxGT("2nd nozzle Z") -#define MSG_IDEX_SAVE_OFFSETS _UxGT("Save Offsets") +#define MSG_X_OFFSET _UxGT("2nd nozzle X") +#define MSG_Y_OFFSET _UxGT("2nd nozzle Y") +#define MSG_Z_OFFSET _UxGT("2nd nozzle Z") #define MSG_UBL_MANUAL_MESH _UxGT("Manually Build Mesh") #define MSG_UBL_BC_INSERT _UxGT("Place shim & measure") #define MSG_UBL_BC_INSERT2 _UxGT("Measure") @@ -373,7 +371,7 @@ #define MSG_FILAMENT_CHANGE_OPTION_PURGE _UxGT("Purge more") #define MSG_FILAMENT_CHANGE_OPTION_RESUME _UxGT("Continue") #define MSG_FILAMENT_CHANGE_NOZZLE _UxGT(" Nozzle: ") -#define MSG_RUNOUT_SENSOR_ENABLE _UxGT("Runout Sensor") +#define MSG_RUNOUT_SENSOR _UxGT("Runout Sensor") #define MSG_ERR_HOMING_FAILED _UxGT("Homing failed") #define MSG_ERR_PROBING_FAILED _UxGT("Probing failed") #define MSG_M600_TOO_COLD _UxGT("M600: Too cold") diff --git a/Marlin/src/lcd/language/language_nl.h b/Marlin/src/lcd/language/language_nl.h index 1ab6d06836c3..d005689feaae 100644 --- a/Marlin/src/lcd/language/language_nl.h +++ b/Marlin/src/lcd/language/language_nl.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -46,7 +46,6 @@ #define MSG_AUTO_HOME_X _UxGT("Home X") #define MSG_AUTO_HOME_Y _UxGT("Home Y") #define MSG_AUTO_HOME_Z _UxGT("Home Z") -#define MSG_TMC_Z_CALIBRATION _UxGT("Kalibreer Z") #define MSG_LEVEL_BED_HOMING _UxGT("Homing XYZ") #define MSG_LEVEL_BED_WAITING _UxGT("Klik voor begin") #define MSG_LEVEL_BED_NEXT_POINT _UxGT("Volgende Plaats") diff --git a/Marlin/src/lcd/language/language_pl.h b/Marlin/src/lcd/language/language_pl.h index 63cf3cd33b27..723d49dabef2 100644 --- a/Marlin/src/lcd/language/language_pl.h +++ b/Marlin/src/lcd/language/language_pl.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -40,7 +40,6 @@ #define MSG_AUTO_HOME_X _UxGT("Zeruj X") #define MSG_AUTO_HOME_Y _UxGT("Zeruj Y") #define MSG_AUTO_HOME_Z _UxGT("Zeruj Z") -#define MSG_TMC_Z_CALIBRATION _UxGT("Kalibruj Z") #define MSG_LEVEL_BED _UxGT("Poziom. stołu") #define MSG_LEVEL_BED_HOMING _UxGT("Pozycja zerowa") #define MSG_LEVEL_BED_WAITING _UxGT("Kliknij by rozp.") diff --git a/Marlin/src/lcd/language/language_pt-br.h b/Marlin/src/lcd/language/language_pt-br.h index 4e3839b6633b..6baf1fdf0624 100644 --- a/Marlin/src/lcd/language/language_pt-br.h +++ b/Marlin/src/lcd/language/language_pt-br.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -54,7 +54,6 @@ #define MSG_AUTO_HOME_Y _UxGT("Ir na origem Y") #define MSG_AUTO_HOME_Z _UxGT("Ir na origem Z") #define MSG_AUTO_Z_ALIGN _UxGT("Auto alinhar Z") -#define MSG_TMC_Z_CALIBRATION _UxGT("Calibrar Z") #define MSG_LEVEL_BED_HOMING _UxGT("Indo para origem") #define MSG_LEVEL_BED_WAITING _UxGT("Clique para Iniciar") #define MSG_LEVEL_BED_NEXT_POINT _UxGT("Próximo Ponto") @@ -100,12 +99,11 @@ #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") -#define MSG_IDEX_Z_OFFSET _UxGT("2o bico Z") -#define MSG_IDEX_SAVE_OFFSETS _UxGT("Salvar Compensação") +#define MSG_X_OFFSET _UxGT("2o bico X") +#define MSG_Y_OFFSET _UxGT("2o bico Y") +#define MSG_Z_OFFSET _UxGT("2o bico Z") #define MSG_UBL_MANUAL_MESH _UxGT("Fazer malha manual") #define MSG_UBL_BC_INSERT _UxGT("Calçar e calibrar") @@ -397,7 +395,7 @@ #define MSG_FILAMENT_CHANGE_OPTION_PURGE _UxGT("Purgar mais") #define MSG_FILAMENT_CHANGE_OPTION_RESUME _UxGT("Continuar Impressão") #define MSG_FILAMENT_CHANGE_NOZZLE _UxGT(" Bocal: ") -#define MSG_RUNOUT_SENSOR_ENABLE _UxGT("Sensor filamento") +#define MSG_RUNOUT_SENSOR _UxGT("Sensor filamento") #define MSG_ERR_HOMING_FAILED _UxGT("Falha ao ir à origem") #define MSG_ERR_PROBING_FAILED _UxGT("Falha ao sondar") #define MSG_M600_TOO_COLD _UxGT("M600: Muito frio") diff --git a/Marlin/src/lcd/language/language_pt.h b/Marlin/src/lcd/language/language_pt.h index 954e6eb458b5..1df615ca88bb 100644 --- a/Marlin/src/lcd/language/language_pt.h +++ b/Marlin/src/lcd/language/language_pt.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -43,7 +43,6 @@ #define MSG_AUTO_HOME_X _UxGT("Ir para origem X") #define MSG_AUTO_HOME_Y _UxGT("Ir para origem Y") #define MSG_AUTO_HOME_Z _UxGT("Ir para origem Z") -#define MSG_TMC_Z_CALIBRATION _UxGT("Calibrar Z") #define MSG_LEVEL_BED_HOMING _UxGT("Indo para origem") #define MSG_LEVEL_BED_WAITING _UxGT("Click para iniciar") #define MSG_LEVEL_BED_NEXT_POINT _UxGT("Próximo ponto") diff --git a/Marlin/src/lcd/language/language_ru.h b/Marlin/src/lcd/language/language_ru.h index 9a3761b0cb3d..41a1c55bd9a9 100644 --- a/Marlin/src/lcd/language/language_ru.h +++ b/Marlin/src/lcd/language/language_ru.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -47,7 +47,6 @@ #define MSG_AUTO_HOME_X _UxGT("Парковка X") #define MSG_AUTO_HOME_Y _UxGT("Парковка Y") #define MSG_AUTO_HOME_Z _UxGT("Парковка Z") -#define MSG_TMC_Z_CALIBRATION _UxGT("Калибровать Z") #define MSG_LEVEL_BED_HOMING _UxGT("Нулевое положение") #define MSG_LEVEL_BED_WAITING _UxGT("Нажмите чтобы начать") #define MSG_LEVEL_BED_NEXT_POINT _UxGT("Следующая точка") diff --git a/Marlin/src/lcd/language/language_sk.h b/Marlin/src/lcd/language/language_sk.h index a30eec9bff7c..c069c780e916 100644 --- a/Marlin/src/lcd/language/language_sk.h +++ b/Marlin/src/lcd/language/language_sk.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -40,6 +40,8 @@ #define THIS_LANGUAGES_SPECIAL_SYMBOLS _UxGT("äÄáÁčČďĎéÉíÍĺĹľĽňŇóÓôÔŕŔšŠťŤúÚýÝžŽ³") #define WELCOME_MSG MACHINE_NAME _UxGT(" pripravená.") +#define MSG_YES _UxGT("ÁNO") +#define MSG_NO _UxGT("NIE") #define MSG_BACK _UxGT("Naspäť") #define MSG_SD_INSERTED _UxGT("Karta vložená") #define MSG_SD_REMOVED _UxGT("Karta vybraná") @@ -57,7 +59,6 @@ #define MSG_AUTO_HOME_Y _UxGT("Domov os Y") #define MSG_AUTO_HOME_Z _UxGT("Domov os Z") #define MSG_AUTO_Z_ALIGN _UxGT("Auto-zarovn. Z") -#define MSG_TMC_Z_CALIBRATION _UxGT("Kalibrovať Z") #define MSG_LEVEL_BED_HOMING _UxGT("Parkovanie XYZ") #define MSG_LEVEL_BED_WAITING _UxGT("Kliknutím spusťte") #define MSG_LEVEL_BED_NEXT_POINT _UxGT("Ďalší bod") @@ -80,6 +81,11 @@ #define MSG_PREHEAT_2_SETTINGS MSG_PREHEAT_2 _UxGT(" nast.") #define MSG_PREHEAT_CUSTOM _UxGT("Vlastné zahriatie") #define MSG_COOLDOWN _UxGT("Schladiť") +#define MSG_LASER_MENU _UxGT("Nastavenie lasera") +#define MSG_LASER_OFF _UxGT("Vypnúť laser") +#define MSG_LASER_ON _UxGT("Zapnúť laser") +#define MSG_LASER_POWER _UxGT("Výkon lasera") +#define MSG_SPINDLE_REVERSE _UxGT("Spät. chod vretena") #define MSG_SWITCH_PS_ON _UxGT("Zapnúť napájanie") #define MSG_SWITCH_PS_OFF _UxGT("Vypnúť napájanie") #define MSG_EXTRUDE _UxGT("Vytlačiť (extr.)") @@ -99,15 +105,15 @@ #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_OFFSETS_MENU _UxGT("Offset nástrojov") #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") -#define MSG_IDEX_Z_OFFSET _UxGT("2. tryska Z") -#define MSG_IDEX_SAVE_OFFSETS _UxGT("Uložiť offsety") +#define MSG_X_OFFSET _UxGT("2. tryska X") +#define MSG_Y_OFFSET _UxGT("2. tryska Y") +#define MSG_Z_OFFSET _UxGT("2. tryska Z") #define MSG_UBL_MANUAL_MESH _UxGT("Manuálna sieť bodov") #define MSG_UBL_BC_INSERT _UxGT("Položte a zmerajte") #define MSG_UBL_BC_INSERT2 _UxGT("Zmerajte") @@ -200,6 +206,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") @@ -272,6 +279,9 @@ #define MSG_WATCH _UxGT("Info. obrazovka") #define MSG_PREPARE _UxGT("Príprava tlače") #define MSG_TUNE _UxGT("Doladenie tlače") +#define MSG_START_PRINT _UxGT("Spustiť tlač") +#define MSG_BUTTON_PRINT _UxGT("Tlačiť") +#define MSG_BUTTON_CANCEL _UxGT("Zrušiť") #define MSG_PAUSE_PRINT _UxGT("Pozastaviť tlač") #define MSG_RESUME_PRINT _UxGT("Obnoviť tlač") #define MSG_STOP_PRINT _UxGT("Zastaviť tlač") @@ -300,6 +310,7 @@ #define MSG_TOOL_CHANGE_ZLIFT _UxGT("Zdvihnúť Z") #define MSG_SINGLENOZZLE_PRIME_SPD _UxGT("Primárna rýchl.") #define MSG_SINGLENOZZLE_RETRACT_SPD _UxGT("Rýchl. retrakcie") +#define MSG_NOZZLE_STANDBY _UxGT("Záložná tryska") #define MSG_FILAMENTCHANGE _UxGT("Vymeniť filament") #define MSG_FILAMENTLOAD _UxGT("Zaviesť filament") #define MSG_FILAMENTUNLOAD _UxGT("Vysunúť filament") @@ -313,6 +324,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") @@ -322,6 +336,7 @@ #define MSG_BABYSTEP_X _UxGT("Babystep X") #define MSG_BABYSTEP_Y _UxGT("Babystep Y") #define MSG_BABYSTEP_Z _UxGT("Babystep Z") +#define MSG_BABYSTEP_TOTAL _UxGT("Celkom") #define MSG_ENDSTOP_ABORT _UxGT("Zastavenie Endstop") #define MSG_HEATING_FAILED_LCD _UxGT("Chyba ohrevu") #define MSG_HEATING_FAILED_LCD_BED _UxGT("Chyba ohrevu podl.") @@ -332,6 +347,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") @@ -398,11 +415,64 @@ #define MSG_FILAMENT_CHANGE_OPTION_PURGE _UxGT("Vytlačiť viacej") #define MSG_FILAMENT_CHANGE_OPTION_RESUME _UxGT("Obnoviť tlač") #define MSG_FILAMENT_CHANGE_NOZZLE _UxGT(" Tryska: ") -#define MSG_RUNOUT_SENSOR_ENABLE _UxGT("Senzor filamentu") +#define MSG_RUNOUT_SENSOR _UxGT("Senzor filamentu") #define MSG_ERR_HOMING_FAILED _UxGT("Parkovanie zlyhalo") #define MSG_ERR_PROBING_FAILED _UxGT("Kalibrácia zlyhala") #define MSG_M600_TOO_COLD _UxGT("M600: Príliš studený") +#define MSG_MMU2_FILAMENT_CHANGE_HEADER _UxGT("VÝMENA FILAMENTU") +#define MSG_MMU2_CHOOSE_FILAMENT_HEADER _UxGT("VYBERTE FILAMENT") +#define MSG_MMU2_MENU _UxGT("MMU2") +#define MSG_MMU2_WRONG_FIRMWARE _UxGT("Aktualizujte FW MMU!") +#define MSG_MMU2_NOT_RESPONDING _UxGT("MMU potrebuje zásah.") +#define MSG_MMU2_RESUME _UxGT("Obnoviť tlač") +#define MSG_MMU2_RESUMING _UxGT("Obnovovanie...") +#define MSG_MMU2_LOAD_FILAMENT _UxGT("Zaviesť filament") +#define MSG_MMU2_LOAD_ALL _UxGT("Zaviesť všetky") +#define MSG_MMU2_LOAD_TO_NOZZLE _UxGT("Zaviesť po trysku") +#define MSG_MMU2_EJECT_FILAMENT _UxGT("Vysunúť filament") +#define MSG_MMU2_EJECT_FILAMENT0 _UxGT("Vysunúť filament 1") +#define MSG_MMU2_EJECT_FILAMENT1 _UxGT("Vysunúť filament 2") +#define MSG_MMU2_EJECT_FILAMENT2 _UxGT("Vysunúť filament 3") +#define MSG_MMU2_EJECT_FILAMENT3 _UxGT("Vysunúť filament 4") +#define MSG_MMU2_EJECT_FILAMENT4 _UxGT("Vysunúť filament 5") +#define MSG_MMU2_UNLOAD_FILAMENT _UxGT("Vyňať filament") +#define MSG_MMU2_LOADING_FILAMENT _UxGT("Zavádzanie fil. %i...") +#define MSG_MMU2_EJECTING_FILAMENT _UxGT("Vysúvanie fil. ...") +#define MSG_MMU2_UNLOADING_FILAMENT _UxGT("Vysúvanie fil. ...") +#define MSG_MMU2_ALL _UxGT("Všetky") +#define MSG_MMU2_FILAMENT0 _UxGT("Filament 1") +#define MSG_MMU2_FILAMENT1 _UxGT("Filament 2") +#define MSG_MMU2_FILAMENT2 _UxGT("Filament 3") +#define MSG_MMU2_FILAMENT3 _UxGT("Filament 4") +#define MSG_MMU2_FILAMENT4 _UxGT("Filament 5") +#define MSG_MMU2_RESET _UxGT("Reštartovať MMU") +#define MSG_MMU2_RESETTING _UxGT("Reštart MMU...") +#define MSG_MMU2_EJECT_RECOVER _UxGT("Odstráňte, kliknite") + +#define MSG_MIX _UxGT("Mix") +#define MSG_MIX_COMPONENT _UxGT("Zložka") +#define MSG_MIXER _UxGT("Mixér") +#define MSG_GRADIENT _UxGT("Gradient") +#define MSG_FULL_GRADIENT _UxGT("Plný gradient") +#define MSG_TOGGLE_MIX _UxGT("Prepnúť mix") +#define MSG_CYCLE_MIX _UxGT("Cyklický mix") +#define MSG_GRADIENT_MIX _UxGT("Gradientný mix") +#define MSG_REVERSE_GRADIENT _UxGT("Otočiť gradient") +#define MSG_ACTIVE_VTOOL _UxGT("Aktívny V-tool") +#define MSG_START_VTOOL _UxGT("Počiat. V-tool") +#define MSG_END_VTOOL _UxGT("Konečn. V-tool") +#define MSG_GRADIENT_ALIAS _UxGT("Alias V-tool") +#define MSG_RESET_VTOOLS _UxGT("Resetovať V-tools") +#define MSG_COMMIT_VTOOL _UxGT("Uložiť V-tool Mix") +#define MSG_VTOOLS_RESET _UxGT("V-tools resetované") +#define MSG_START_Z _UxGT("Počiat.Z") +#define MSG_END_Z _UxGT("Konečn.Z") +#define MSG_BRICKOUT _UxGT("Brickout") +#define MSG_INVADERS _UxGT("Nájazdníci") +#define MSG_SNAKE _UxGT("Had") +#define MSG_MAZE _UxGT("Bludisko") + // // Filament Change screens show up to 3 lines on a 4-line display // ...or up to 2 lines on a 3-line display @@ -410,6 +480,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") @@ -446,3 +517,15 @@ #define MSG_FILAMENT_CHANGE_CONT_PURGE_1 _UxGT("Klik. pre dokonč.") #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Pokračovanie...") #endif // LCD_HEIGHT < 4 +#define MSG_TMC_DRIVERS _UxGT("Ovládače TMC") +#define MSG_TMC_CURRENT _UxGT("Prúd ovládača") +#define MSG_TMC_HYBRID_THRS _UxGT("Hybridný prah") +#define MSG_TMC_HOMING_THRS _UxGT("Bezsenzor. domov") +#define MSG_TMC_STEPPING_MODE _UxGT("Režim krokovania") +#define MSG_TMC_STEALTH_ENABLED _UxGT("StealthChop zapnutý") + +#define MSG_SERVICE_RESET _UxGT("Vynulovať") +#define MSG_SERVICE_IN _UxGT(" za:") +#define MSG_BACKLASH _UxGT("Kompenz. vôle") +#define MSG_BACKLASH_CORRECTION _UxGT("Korekcia") +#define MSG_BACKLASH_SMOOTHING _UxGT("Vyhladzovanie") diff --git a/Marlin/src/lcd/language/language_test.h b/Marlin/src/lcd/language/language_test.h index 7b25e6f3fea8..2328747cb5ec 100644 --- a/Marlin/src/lcd/language/language_test.h +++ b/Marlin/src/lcd/language/language_test.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/lcd/language/language_tr.h b/Marlin/src/lcd/language/language_tr.h index 16e6da2dcdc3..f8569dd526a1 100644 --- a/Marlin/src/lcd/language/language_tr.h +++ b/Marlin/src/lcd/language/language_tr.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -55,7 +55,6 @@ #define MSG_AUTO_HOME_Y _UxGT("Y Sıfırla") #define MSG_AUTO_HOME_Z _UxGT("Z Sıfırla") #define MSG_AUTO_Z_ALIGN _UxGT("Oto. Z-Hizalama") -#define MSG_TMC_Z_CALIBRATION _UxGT("Z Ayarla") #define MSG_LEVEL_BED_HOMING _UxGT("XYZ Sıfırlanıyor") #define MSG_LEVEL_BED_WAITING _UxGT("Başlatmak için tıkla") #define MSG_LEVEL_BED_NEXT_POINT _UxGT("Sonraki Nokta") @@ -99,12 +98,11 @@ #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") -#define MSG_IDEX_Z_OFFSET _UxGT("2. nozul Z") -#define MSG_IDEX_SAVE_OFFSETS _UxGT("Ofsetleri Kaydet") +#define MSG_X_OFFSET _UxGT("2. nozul X") +#define MSG_Y_OFFSET _UxGT("2. nozul Y") +#define MSG_Z_OFFSET _UxGT("2. nozul Z") #define MSG_UBL_MANUAL_MESH _UxGT("Elle Mesh Oluştur") #define MSG_UBL_BC_INSERT _UxGT("Altlık & Ölçü Ver") #define MSG_UBL_BC_INSERT2 _UxGT("Ölçü") @@ -389,7 +387,7 @@ #define MSG_FILAMENT_CHANGE_OPTION_PURGE _UxGT("Daha Fazla Tasviye") #define MSG_FILAMENT_CHANGE_OPTION_RESUME _UxGT("Baskıyı sürdür") #define MSG_FILAMENT_CHANGE_NOZZLE _UxGT(" Nozul: ") -#define MSG_RUNOUT_SENSOR_ENABLE _UxGT("Runout Sensörü") +#define MSG_RUNOUT_SENSOR _UxGT("Runout Sensörü") #define MSG_ERR_HOMING_FAILED _UxGT("Sıfırlama Başarısız") #define MSG_ERR_PROBING_FAILED _UxGT("Probing Başarısız") #define MSG_M600_TOO_COLD _UxGT("M600: Çok Soğuk") diff --git a/Marlin/src/lcd/language/language_uk.h b/Marlin/src/lcd/language/language_uk.h index 38d7642420c8..a382a8e1b799 100644 --- a/Marlin/src/lcd/language/language_uk.h +++ b/Marlin/src/lcd/language/language_uk.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -43,7 +43,6 @@ #define MSG_AUTO_HOME_X _UxGT("Паркування X") #define MSG_AUTO_HOME_Y _UxGT("Паркування Y") #define MSG_AUTO_HOME_Z _UxGT("Паркування Z") -#define MSG_TMC_Z_CALIBRATION _UxGT("Калібрування Z") #define MSG_LEVEL_BED_HOMING _UxGT("Паркування XYZ") #define MSG_LEVEL_BED_WAITING _UxGT("Почати") #define MSG_LEVEL_BED_NEXT_POINT _UxGT("Слідуюча Точка") diff --git a/Marlin/src/lcd/language/language_zh_CN.h b/Marlin/src/lcd/language/language_zh_CN.h index 7eb9fa008f91..0a94e9d5b092 100644 --- a/Marlin/src/lcd/language/language_zh_CN.h +++ b/Marlin/src/lcd/language/language_zh_CN.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -45,7 +45,6 @@ #define MSG_AUTO_HOME_X _UxGT("回X原位") //"Home X" #define MSG_AUTO_HOME_Y _UxGT("回Y原位") //"Home Y" #define MSG_AUTO_HOME_Z _UxGT("回Z原位") //"Home Z" -#define MSG_TMC_Z_CALIBRATION _UxGT("⊿校准Z") #define MSG_LEVEL_BED_HOMING _UxGT("平台调平XYZ归原位") //"Homing XYZ" #define MSG_LEVEL_BED_WAITING _UxGT("单击开始热床调平") //"Click to Begin" #define MSG_LEVEL_BED_NEXT_POINT _UxGT("下个热床调平点") //"Next Point" @@ -257,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 d823ad4d6f0b..40a1448c1184 100644 --- a/Marlin/src/lcd/language/language_zh_TW.h +++ b/Marlin/src/lcd/language/language_zh_TW.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -45,7 +45,6 @@ #define MSG_AUTO_HOME_X _UxGT("回X原點") //"Home X" #define MSG_AUTO_HOME_Y _UxGT("回Y原點") //"Home Y" #define MSG_AUTO_HOME_Z _UxGT("回Z原點") //"Home Z" -#define MSG_TMC_Z_CALIBRATION _UxGT("⊿校準Z") #define MSG_LEVEL_BED_HOMING _UxGT("平台調平XYZ歸原點") //"Homing XYZ" #define MSG_LEVEL_BED_WAITING _UxGT("單擊開始熱床調平") //"Click to Begin" #define MSG_LEVEL_BED_NEXT_POINT _UxGT("下個熱床調平點") //"Next Point" @@ -257,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/malyanlcd.cpp b/Marlin/src/lcd/malyanlcd.cpp index 0df6a8937aeb..cb0e2a00cc20 100644 --- a/Marlin/src/lcd/malyanlcd.cpp +++ b/Marlin/src/lcd/malyanlcd.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -255,7 +255,7 @@ void process_lcd_p_command(const char* command) { quickstop_stepper(); print_job_timer.stop(); thermalManager.disable_all_heaters(); - zero_fan_speeds(); + thermalManager.zero_fan_speeds(); wait_for_heatup = false; write_to_lcd_P(PSTR("{SYS:STARTED}")); #endif @@ -330,7 +330,7 @@ void process_lcd_s_command(const char* command) { case 'L': { #if ENABLED(SDSUPPORT) - if (!card.flag.cardOK) card.initsd(); + if (!card.isDetected()) card.initsd(); // A more efficient way to do this would be to // implement a callback in the ls_SerialPrint code, but diff --git a/Marlin/src/lcd/menu/game/brickout.cpp b/Marlin/src/lcd/menu/game/brickout.cpp new file mode 100644 index 000000000000..4686072da72e --- /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 000000000000..e11c414a1395 --- /dev/null +++ b/Marlin/src/lcd/menu/game/game.cpp @@ -0,0 +1,68 @@ +/** + * 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_no_defer(); +} + +#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 000000000000..a4cfda56d687 --- /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 000000000000..b454d6c17ed7 --- /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 + int16_t ep = int16_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 000000000000..c84c50453767 --- /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 000000000000..d34f6f4b11d2 --- /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 8046a5d811fc..1a053ad85007 100644 --- a/Marlin/src/lcd/menu/menu.cpp +++ b/Marlin/src/lcd/menu/menu.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -28,6 +28,7 @@ #include "../ultralcd.h" #include "../../module/planner.h" #include "../../module/motion.h" +#include "../../module/printcounter.h" #include "../../gcode/queue.h" #include "../../sd/cardreader.h" #include "../../libs/buzzer.h" @@ -36,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 @@ -44,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 @@ -53,21 +54,23 @@ //////////////////////////////////////////// // 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; bool screen_changed; // Value Editing -PGM_P editLabel; -void *editValue; -int32_t minEditValue, maxEditValue; -screenFunc_t callbackFunc; -bool liveEdit; +PGM_P MenuItemBase::editLabel; +void* MenuItemBase::editValue; +int16_t MenuItemBase::minEditValue, MenuItemBase::maxEditValue; +screenFunc_t MenuItemBase::callbackFunc; +bool MenuItemBase::liveEdit; // Prevent recursion into screen handlers bool no_reentry = false; @@ -79,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(); @@ -115,7 +112,7 @@ void MenuItem_gcode::action(PGM_P pgcode) { enqueue_and_echo_commands_P(pgcode); * * The prerequisite is that in the header the type was already declared: * - * DECLARE_MENU_EDIT_TYPE(int16_t, int3, itostr3, 1) + * DECLARE_MENU_EDIT_TYPE(int16_t, int3, i16tostr3, 1) * * For example, DEFINE_MENU_EDIT_ITEM(int3) expands into these functions: * @@ -134,8 +131,8 @@ void MenuItem_gcode::action(PGM_P pgcode) { enqueue_and_echo_commands_P(pgcode); */ void MenuItemBase::edit(strfunc_t strfunc, loadfunc_t loadfunc) { ui.encoder_direction_normal(); - if ((int32_t)ui.encoderPosition < 0) ui.encoderPosition = 0; - if ((int32_t)ui.encoderPosition > maxEditValue) ui.encoderPosition = maxEditValue; + if (int16_t(ui.encoderPosition) < 0) ui.encoderPosition = 0; + if (int16_t(ui.encoderPosition) > maxEditValue) ui.encoderPosition = maxEditValue; if (ui.should_draw()) draw_edit_screen(editLabel, strfunc(ui.encoderPosition + minEditValue)); if (ui.lcd_clicked || (liveEdit && ui.should_draw())) { @@ -145,7 +142,7 @@ void MenuItemBase::edit(strfunc_t strfunc, loadfunc_t loadfunc) { } } -void MenuItemBase::init(PGM_P const el, void * const ev, const int32_t minv, const int32_t maxv, const uint32_t ep, const screenFunc_t cs, const screenFunc_t cb, const bool le) { +void MenuItemBase::init(PGM_P const el, void * const ev, const int16_t minv, const int16_t maxv, const uint16_t ep, const screenFunc_t cs, const screenFunc_t cb, const bool le) { ui.save_previous_screen(); ui.refresh(); editLabel = el; @@ -158,19 +155,22 @@ void MenuItemBase::init(PGM_P const el, void * const ev, const int32_t minv, con liveEdit = le; } -#define DEFINE_MENU_EDIT_ITEM(NAME) template class TMenuItem; - -DEFINE_MENU_EDIT_ITEM(int3); -DEFINE_MENU_EDIT_ITEM(int4); -DEFINE_MENU_EDIT_ITEM(int8); -DEFINE_MENU_EDIT_ITEM(float3); -DEFINE_MENU_EDIT_ITEM(float52); -DEFINE_MENU_EDIT_ITEM(float43); -DEFINE_MENU_EDIT_ITEM(float5); -DEFINE_MENU_EDIT_ITEM(float51); -DEFINE_MENU_EDIT_ITEM(float52sign); -DEFINE_MENU_EDIT_ITEM(float62); -DEFINE_MENU_EDIT_ITEM(long5); +#define DEFINE_MENU_EDIT_ITEM(NAME) template class TMenuItem + +DEFINE_MENU_EDIT_ITEM(int3); // 123, -12 right-justified +DEFINE_MENU_EDIT_ITEM(int4); // 1234, -123 right-justified +DEFINE_MENU_EDIT_ITEM(int8); // 123, -12 right-justified +DEFINE_MENU_EDIT_ITEM(uint8); // 123 right-justified +DEFINE_MENU_EDIT_ITEM(uint16_3); // 123, -12 right-justified +DEFINE_MENU_EDIT_ITEM(uint16_4); // 1234, -123 right-justified +DEFINE_MENU_EDIT_ITEM(float3); // 123 right-justified +DEFINE_MENU_EDIT_ITEM(float52); // 123.45 +DEFINE_MENU_EDIT_ITEM(float43); // 1.234 +DEFINE_MENU_EDIT_ITEM(float5); // 12345 right-justified +DEFINE_MENU_EDIT_ITEM(float51); // 1234.5 right-justified +DEFINE_MENU_EDIT_ITEM(float51sign); // +1234.5 +DEFINE_MENU_EDIT_ITEM(float52sign); // +123.45 +DEFINE_MENU_EDIT_ITEM(long5); // 12345 right-justified void MenuItem_bool::action_edit(PGM_P pstr, bool *ptr, screenFunc_t callback) { UNUSED(pstr); *ptr ^= true; ui.refresh(); @@ -186,12 +186,14 @@ void MenuItem_bool::action_edit(PGM_P pstr, bool *ptr, screenFunc_t callback) { void _lcd_set_z_fade_height() { set_z_fade_height(lcd_z_fade_height); } #endif -bool printer_busy() { return planner.movesplanned() || IS_SD_PRINTING(); } +bool printer_busy() { + return planner.movesplanned() || IS_SD_PRINTING() || print_job_timer.isRunning(); +} /** * 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 uint16_t encoder/*=0*/, const uint8_t top/*=0*/, const uint8_t items/*=0*/) { if (currentScreen != screen) { #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) @@ -199,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. @@ -208,7 +210,19 @@ void MarlinUI::goto_screen(screenFunc_t screen, const uint32_t encoder/*=0*/) { doubleclick_expire_ms = millis() + DOUBLECLICK_MAX_INTERVAL; } else if (screen == status_screen && currentScreen == menu_main && PENDING(millis(), doubleclick_expire_ms)) { - if (printer_busy()) { + + #if ENABLED(BABYSTEP_WITHOUT_HOMING) + constexpr bool can_babystep = true; + #else + const bool can_babystep = all_axes_known(); + #endif + #if ENABLED(BABYSTEP_ALWAYS_AVAILABLE) + constexpr bool should_babystep = true; + #else + const bool should_babystep = printer_busy(); + #endif + + if (should_babystep && can_babystep) { screen = #if ENABLED(BABYSTEP_ZPROBE_OFFSET) lcd_babystep_zoffset @@ -228,8 +242,10 @@ 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) { - ui.defer_status_screen(false); + defer_status_screen(false); #if ENABLED(AUTO_BED_LEVELING_UBL) ubl.lcd_map_control = false; #endif @@ -240,10 +256,11 @@ void MarlinUI::goto_screen(screenFunc_t screen, const uint32_t encoder/*=0*/) { // Re-initialize custom characters that may be re-used #if HAS_CHARACTER_LCD - #if ENABLED(AUTO_BED_LEVELING_UBL) - if (!ubl.lcd_map_control) - #endif - set_custom_characters(screen == status_screen ? CHARSET_INFO : CHARSET_MENU); + if (true + #if ENABLED(AUTO_BED_LEVELING_UBL) + && !ubl.lcd_map_control + #endif + ) set_custom_characters(screen == status_screen ? CHARSET_INFO : CHARSET_MENU); #endif refresh(LCDVIEW_CALL_REDRAW_NEXT); @@ -295,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); @@ -336,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 @@ -346,7 +364,7 @@ void MarlinUI::completion_feedback(const bool good/*=true*/) { #endif ui.encoder_direction_normal(); if (ui.encoderPosition) { - const int16_t babystep_increment = (int32_t)ui.encoderPosition * (BABYSTEP_MULTIPLICATOR); + const int16_t babystep_increment = int16_t(ui.encoderPosition) * (BABYSTEP_MULTIPLICATOR); ui.encoderPosition = 0; const float diff = planner.steps_to_mm[Z_AXIS] * babystep_increment, @@ -360,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) @@ -373,7 +391,7 @@ void MarlinUI::completion_feedback(const bool good/*=true*/) { if (ui.should_draw()) { #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET) if (!do_probe) - draw_edit_screen(PSTR(MSG_IDEX_Z_OFFSET), ftostr43sign(hotend_offset[Z_AXIS][active_extruder])); + draw_edit_screen(PSTR(MSG_Z_OFFSET), ftostr43sign(hotend_offset[Z_AXIS][active_extruder])); else #endif draw_edit_screen(PSTR(MSG_ZPROBE_ZOFFSET), ftostr43sign(zprobe_zoffset)); @@ -386,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; @@ -451,4 +436,12 @@ void _lcd_draw_homing() { void _lcd_toggle_bed_leveling() { set_bed_leveling_enabled(!planner.leveling_active); } #endif +void do_select_screen(PGM_P const yes, PGM_P const no, bool &yesno, PGM_P const pref, const char * const string, PGM_P const suff) { + if (ui.encoderPosition) { + yesno = int16_t(ui.encoderPosition) > 0; + ui.encoderPosition = 0; + } + draw_select_screen(yes, no, yesno, pref, string, suff); +} + #endif // HAS_LCD_MENU diff --git a/Marlin/src/lcd/menu/menu.h b/Marlin/src/lcd/menu/menu.h index 7044bd22ca10..acc51a2ae04b 100644 --- a/Marlin/src/lcd/menu/menu.h +++ b/Marlin/src/lcd/menu/menu.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -24,6 +24,8 @@ #include "../ultralcd.h" #include "../../inc/MarlinConfig.h" +#include "limits.h" + extern int8_t encoderLine, encoderTopLine, screen_items; extern bool screen_changed; @@ -43,23 +45,32 @@ bool printer_busy(); static inline char* strfunc(const float value) { return STRFUNC((TYPE) value); } \ }; -DECLARE_MENU_EDIT_TYPE(int16_t, int3, itostr3, 1 ); -DECLARE_MENU_EDIT_TYPE(int16_t, int4, itostr4sign, 1 ); -DECLARE_MENU_EDIT_TYPE(uint8_t, int8, i8tostr3, 1 ); -DECLARE_MENU_EDIT_TYPE(float, float3, ftostr3, 1 ); -DECLARE_MENU_EDIT_TYPE(float, float52, ftostr52, 100 ); -DECLARE_MENU_EDIT_TYPE(float, float43, ftostr43sign, 1000 ); -DECLARE_MENU_EDIT_TYPE(float, float5, ftostr5rj, 0.01f ); -DECLARE_MENU_EDIT_TYPE(float, float51, ftostr51sign, 10 ); -DECLARE_MENU_EDIT_TYPE(float, float52sign, ftostr52sign, 100 ); -DECLARE_MENU_EDIT_TYPE(float, float62, ftostr62rj, 100 ); -DECLARE_MENU_EDIT_TYPE(uint32_t, long5, ftostr5rj, 0.01f ); +DECLARE_MENU_EDIT_TYPE(uint8_t, percent, ui8tostr4pct, 1 ); // 100% right-justified +DECLARE_MENU_EDIT_TYPE(int16_t, int3, i16tostr3, 1 ); // 123, -12 right-justified +DECLARE_MENU_EDIT_TYPE(int16_t, int4, i16tostr4sign, 1 ); // 1234, -123 right-justified +DECLARE_MENU_EDIT_TYPE(int8_t, int8, i8tostr3, 1 ); // 123, -12 right-justified +DECLARE_MENU_EDIT_TYPE(uint8_t, uint8, ui8tostr3, 1 ); // 123 right-justified +DECLARE_MENU_EDIT_TYPE(uint16_t, uint16_3, ui16tostr3, 1 ); // 123, -12 right-justified +DECLARE_MENU_EDIT_TYPE(uint16_t, uint16_4, ui16tostr4, 0.1 ); // 1234, -123 right-justified +DECLARE_MENU_EDIT_TYPE(float, float3, ftostr3, 1 ); // 123 right-justified +DECLARE_MENU_EDIT_TYPE(float, float52, ftostr52, 100 ); // 123.45 +DECLARE_MENU_EDIT_TYPE(float, float43, ftostr43sign, 1000 ); // 1.234 +DECLARE_MENU_EDIT_TYPE(float, float5, ftostr5rj, 0.01f ); // 12345 right-justified +DECLARE_MENU_EDIT_TYPE(float, float51, ftostr51rj, 10 ); // 1234.5 right-justified +DECLARE_MENU_EDIT_TYPE(float, float51sign, ftostr51sign, 10 ); // +1234.5 +DECLARE_MENU_EDIT_TYPE(float, float52sign, ftostr52sign, 100 ); // +123.45 +DECLARE_MENU_EDIT_TYPE(uint32_t, long5, ftostr5rj, 0.01f ); // 12345 right-justified //////////////////////////////////////////// ///////// Menu Item Draw Functions ///////// //////////////////////////////////////////// void draw_edit_screen(PGM_P const pstr, const char* const value=NULL); +void draw_select_screen(PGM_P const yes, PGM_P const no, const bool yesno, PGM_P const pref, const char * const string, PGM_P const suff); +void do_select_screen(PGM_P const yes, PGM_P const no, bool &yesno, PGM_P const pref, const char * const string=NULL, PGM_P const suff=NULL); +inline void do_select_screen_yn(bool &yesno, PGM_P const pref, const char * const string, PGM_P const suff) { + do_select_screen(PSTR(MSG_YES), PSTR(MSG_NO), yesno, pref, string, suff); +} void draw_menu_item(const bool sel, const uint8_t row, PGM_P const pstr, const char pre_char, const char post_char); void draw_menu_item_static(const uint8_t row, PGM_P const pstr, const bool center=true, const bool invert=false, const char *valstr=NULL); void _draw_menu_item_edit(const bool sel, const uint8_t row, PGM_P const pstr, const char* const data, const bool pgm); @@ -79,7 +90,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 @@ -99,17 +110,21 @@ 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(int3); -DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(int4); -DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(int8); -DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float3); -DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float52); -DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float43); -DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float5); -DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float51); -DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float52sign); -DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float62); -DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(long5); +DEFINE_DRAW_MENU_ITEM_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 +DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(uint8); // 123 right-justified +DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(uint16_3); // 123, -12 right-justified +DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(uint16_4); // 1234, -123 right-justified +DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float3); // 123 right-justified +DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float52); // 123.45 +DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float43); // 1.234 +DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float5); // 12345 right-justified +DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float51); // 1234.5 right-justified +DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float51sign); // +1234.5 +DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float52sign); // +123.45 +DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(long5); // 12345 right-justified #define draw_menu_item_edit_bool(sel, row, pstr, pstr2, data, ...) DRAW_BOOL_SETTING(sel, row, pstr, data) #define draw_menu_item_edit_accessor_bool(sel, row, pstr, pstr2, pget, pset) DRAW_BOOL_SETTING(sel, row, pstr, data) @@ -143,10 +158,16 @@ class MenuItem_function { //////////////////////////////////////////// class MenuItemBase { + private: + static PGM_P editLabel; + static void *editValue; + static int16_t minEditValue, maxEditValue; + static screenFunc_t callbackFunc; + static bool liveEdit; protected: - typedef char* (*strfunc_t)(const int32_t); - typedef void (*loadfunc_t)(void *, const int32_t); - static void init(PGM_P const el, void * const ev, const int32_t minv, const int32_t maxv, const uint32_t ep, const screenFunc_t cs, const screenFunc_t cb, const bool le); + typedef char* (*strfunc_t)(const int16_t); + typedef void (*loadfunc_t)(void *, const int16_t); + static void init(PGM_P const el, void * const ev, const int16_t minv, const int16_t maxv, const uint16_t ep, const screenFunc_t cs, const screenFunc_t cb, const bool le); static void edit(strfunc_t, loadfunc_t); }; @@ -154,30 +175,36 @@ template class TMenuItem : MenuItemBase { private: typedef typename NAME::type_t type_t; - inline static float unscale(const float value) { return value * (1.0f / NAME::scale); } - inline static float scale(const float value) { return value * NAME::scale; } - static void load(void *ptr, const int32_t value) { *((type_t*)ptr) = unscale(value); } - static char* to_string(const int32_t value) { return NAME::strfunc(unscale(value)); } + static inline float unscale(const float value) { return value * (1.0f / NAME::scale); } + static inline float scale(const float value) { return value * NAME::scale; } + static void load(void *ptr, const int16_t value) { *((type_t*)ptr) = unscale(value); } + static char* to_string(const int16_t value) { return NAME::strfunc(unscale(value)); } public: static void action_edit(PGM_P const pstr, type_t * const ptr, const type_t minValue, const type_t maxValue, const screenFunc_t callback=NULL, const bool live=false) { - const int32_t minv = scale(minValue); - init(pstr, ptr, minv, int32_t(scale(maxValue)) - minv, int32_t(scale(*ptr)) - minv, edit, callback, live); + // Make sure minv and maxv fit within int16_t + const int16_t minv = MAX(scale(minValue), INT16_MIN), + maxv = MIN(scale(maxValue), INT16_MAX); + init(pstr, ptr, minv, maxv - minv, scale(*ptr) - minv, edit, callback, live); } static void edit() { MenuItemBase::edit(to_string, load); } }; #define DECLARE_MENU_EDIT_ITEM(NAME) typedef TMenuItem MenuItem_##NAME; +DECLARE_MENU_EDIT_ITEM(percent); DECLARE_MENU_EDIT_ITEM(int3); DECLARE_MENU_EDIT_ITEM(int4); DECLARE_MENU_EDIT_ITEM(int8); +DECLARE_MENU_EDIT_ITEM(uint8); +DECLARE_MENU_EDIT_ITEM(uint16_3); +DECLARE_MENU_EDIT_ITEM(uint16_4); DECLARE_MENU_EDIT_ITEM(float3); DECLARE_MENU_EDIT_ITEM(float52); DECLARE_MENU_EDIT_ITEM(float43); DECLARE_MENU_EDIT_ITEM(float5); DECLARE_MENU_EDIT_ITEM(float51); +DECLARE_MENU_EDIT_ITEM(float51sign); DECLARE_MENU_EDIT_ITEM(float52sign); -DECLARE_MENU_EDIT_ITEM(float62); DECLARE_MENU_EDIT_ITEM(long5); class MenuItem_bool { @@ -287,18 +314,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__) @@ -331,21 +358,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 bebf749214a2..05396f85079b 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -37,15 +37,65 @@ #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) #include "../../module/temperature.h" #endif +void menu_tmc(); +void menu_backlash(); + +#if ENABLED(DAC_STEPPER_CURRENT) + + #include "../../feature/dac/stepper_dac.h" + + uint8_t driverPercent[XYZE]; + inline void dac_driver_getValues() { LOOP_XYZE(i) driverPercent[i] = dac_current_get_percent((AxisEnum)i); } + static void dac_driver_commit() { dac_current_set_percents(driverPercent); } + + void menu_dac() { + dac_driver_getValues(); + START_MENU(); + MENU_BACK(MSG_CONTROL); + #define EDIT_DAC_PERCENT(N) MENU_ITEM_EDIT_CALLBACK(uint8, MSG_##N " " MSG_DAC_PERCENT, &driverPercent[_AXIS(N)], 0, 100, dac_driver_commit) + EDIT_DAC_PERCENT(X); + EDIT_DAC_PERCENT(Y); + EDIT_DAC_PERCENT(Z); + EDIT_DAC_PERCENT(E); + MENU_ITEM(function, MSG_DAC_EEPROM_WRITE, dac_commit_eeprom); + END_MENU(); + } + +#endif + +#if HAS_MOTOR_CURRENT_PWM + + #include "../../module/stepper.h" + + void menu_pwm() { + START_MENU(); + MENU_BACK(MSG_CONTROL); + #define EDIT_CURRENT_PWM(LABEL,I) MENU_ITEM_EDIT_CALLBACK(long5, LABEL, &stepper.motor_current_setting[I], 100, 2000, stepper.refresh_motor_power) + #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) + EDIT_CURRENT_PWM(MSG_X MSG_Y, 0); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_Z) + EDIT_CURRENT_PWM(MSG_Z, 1); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_E) + EDIT_CURRENT_PWM(MSG_E, 2); + #endif + END_MENU(); + } + +#endif + #if HAS_M206_COMMAND // // Set the home offset based on the current_position @@ -215,7 +265,7 @@ #endif // PID_AUTOTUNE_MENU -#if ENABLED(PIDTEMP) +#if ENABLED(PID_EDIT_MENU) float raw_Ki, raw_Kd; // place-holders for Ki and Kd edits @@ -239,14 +289,21 @@ void copy_and_scalePID_i_E ## N() { copy_and_scalePID_i(N); } \ void copy_and_scalePID_d_E ## N() { copy_and_scalePID_d(N); } - #if ENABLED(PID_AUTOTUNE_MENU) - #define DEFINE_PIDTEMP_FUNCS(N) \ - _DEFINE_PIDTEMP_BASE_FUNCS(N); \ - void lcd_autotune_callback_E ## N() { _lcd_autotune(N); } typedef void _pid_##N##_void - #else - #define DEFINE_PIDTEMP_FUNCS(N) _DEFINE_PIDTEMP_BASE_FUNCS(N) typedef void _pid_##N##_void - #endif +#else + + #define _DEFINE_PIDTEMP_BASE_FUNCS(N) // + +#endif + +#if ENABLED(PID_AUTOTUNE_MENU) + #define DEFINE_PIDTEMP_FUNCS(N) \ + _DEFINE_PIDTEMP_BASE_FUNCS(N); \ + void lcd_autotune_callback_E ## N() { _lcd_autotune(N); } // +#else + #define DEFINE_PIDTEMP_FUNCS(N) _DEFINE_PIDTEMP_BASE_FUNCS(N); // +#endif +#if HOTENDS DEFINE_PIDTEMP_FUNCS(0); #if ENABLED(PID_PARAMS_PER_HOTEND) #if HOTENDS > 1 @@ -265,81 +322,90 @@ #endif // HOTENDS > 2 #endif // HOTENDS > 1 #endif // PID_PARAMS_PER_HOTEND +#endif // HOTENDS -#endif // PIDTEMP +#define SHOW_MENU_ADVANCED_TEMPERATURE ((ENABLED(AUTOTEMP) && HAS_TEMP_HOTEND) || EITHER(PID_AUTOTUNE_MENU, PID_EDIT_MENU)) // // Advanced Settings > Temperature // -void menu_advanced_temperature() { - START_MENU(); - MENU_BACK(MSG_ADVANCED_SETTINGS); - // - // Autotemp, Min, Max, Fact - // - #if ENABLED(AUTOTEMP) && HAS_TEMP_HOTEND - MENU_ITEM_EDIT(bool, MSG_AUTOTEMP, &planner.autotemp_enabled); - MENU_ITEM_EDIT(float3, MSG_MIN, &planner.autotemp_min, 0, float(HEATER_0_MAXTEMP) - 15); - MENU_ITEM_EDIT(float3, MSG_MAX, &planner.autotemp_max, 0, float(HEATER_0_MAXTEMP) - 15); - MENU_ITEM_EDIT(float52, MSG_FACTOR, &planner.autotemp_factor, 0, 1); - #endif +#if SHOW_MENU_ADVANCED_TEMPERATURE - // - // PID-P, PID-I, PID-D, PID-C, PID Autotune - // PID-P E1, PID-I E1, PID-D E1, PID-C E1, PID Autotune E1 - // PID-P E2, PID-I E2, PID-D E2, PID-C E2, PID Autotune E2 - // PID-P E3, PID-I E3, PID-D E3, PID-C E3, PID Autotune E3 - // PID-P E4, PID-I E4, PID-D E4, PID-C E4, PID Autotune E4 - // PID-P E5, PID-I E5, PID-D E5, PID-C E5, PID Autotune E5 - // - #if ENABLED(PIDTEMP) + void menu_advanced_temperature() { + START_MENU(); + MENU_BACK(MSG_ADVANCED_SETTINGS); + // + // Autotemp, Min, Max, Fact + // + #if ENABLED(AUTOTEMP) && HAS_TEMP_HOTEND + MENU_ITEM_EDIT(bool, MSG_AUTOTEMP, &planner.autotemp_enabled); + MENU_ITEM_EDIT(float3, MSG_MIN, &planner.autotemp_min, 0, float(HEATER_0_MAXTEMP) - 15); + MENU_ITEM_EDIT(float3, MSG_MAX, &planner.autotemp_max, 0, float(HEATER_0_MAXTEMP) - 15); + MENU_ITEM_EDIT(float52, MSG_FACTOR, &planner.autotemp_factor, 0, 10); + #endif + + // + // PID-P, PID-I, PID-D, PID-C, PID Autotune + // PID-P E1, PID-I E1, PID-D E1, PID-C E1, PID Autotune E1 + // PID-P E2, PID-I E2, PID-D E2, PID-C E2, PID Autotune E2 + // PID-P E3, PID-I E3, PID-D E3, PID-C E3, PID Autotune E3 + // PID-P E4, PID-I E4, PID-D E4, PID-C E4, PID Autotune E4 + // PID-P E5, PID-I E5, PID-D E5, PID-C E5, PID Autotune E5 + // + #if ENABLED(PID_EDIT_MENU) + + #define _PID_BASE_MENU_ITEMS(ELABEL, eindex) \ + raw_Ki = unscalePID_i(PID_PARAM(Ki, eindex)); \ + raw_Kd = unscalePID_d(PID_PARAM(Kd, eindex)); \ + MENU_ITEM_EDIT(float52sign, MSG_PID_P ELABEL, &PID_PARAM(Kp, eindex), 1, 9990); \ + MENU_ITEM_EDIT_CALLBACK(float52sign, MSG_PID_I ELABEL, &raw_Ki, 0.01f, 9990, copy_and_scalePID_i_E ## eindex); \ + MENU_ITEM_EDIT_CALLBACK(float52sign, MSG_PID_D ELABEL, &raw_Kd, 1, 9990, copy_and_scalePID_d_E ## eindex) + + #if ENABLED(PID_EXTRUSION_SCALING) + #define _PID_EDIT_MENU_ITEMS(ELABEL, eindex) \ + _PID_BASE_MENU_ITEMS(ELABEL, eindex); \ + MENU_ITEM_EDIT(float3, MSG_PID_C ELABEL, &PID_PARAM(Kc, eindex), 1, 9990) + #else + #define _PID_EDIT_MENU_ITEMS(ELABEL, eindex) _PID_BASE_MENU_ITEMS(ELABEL, eindex) + #endif - #define _PID_BASE_MENU_ITEMS(ELABEL, eindex) \ - raw_Ki = unscalePID_i(PID_PARAM(Ki, eindex)); \ - raw_Kd = unscalePID_d(PID_PARAM(Kd, eindex)); \ - MENU_ITEM_EDIT(float52sign, MSG_PID_P ELABEL, &PID_PARAM(Kp, eindex), 1, 9990); \ - MENU_ITEM_EDIT_CALLBACK(float52sign, MSG_PID_I ELABEL, &raw_Ki, 0.01f, 9990, copy_and_scalePID_i_E ## eindex); \ - MENU_ITEM_EDIT_CALLBACK(float52sign, MSG_PID_D ELABEL, &raw_Kd, 1, 9990, copy_and_scalePID_d_E ## eindex) - - #if ENABLED(PID_EXTRUSION_SCALING) - #define _PID_MENU_ITEMS(ELABEL, eindex) \ - _PID_BASE_MENU_ITEMS(ELABEL, eindex); \ - MENU_ITEM_EDIT(float3, MSG_PID_C ELABEL, &PID_PARAM(Kc, eindex), 1, 9990) #else - #define _PID_MENU_ITEMS(ELABEL, eindex) _PID_BASE_MENU_ITEMS(ELABEL, eindex) + + #define _PID_EDIT_MENU_ITEMS(ELABEL, eindex) NOOP + #endif #if ENABLED(PID_AUTOTUNE_MENU) - #define PID_MENU_ITEMS(ELABEL, eindex) \ - _PID_MENU_ITEMS(ELABEL, eindex); \ + #define PID_EDIT_MENU_ITEMS(ELABEL, eindex) \ + _PID_EDIT_MENU_ITEMS(ELABEL, eindex); \ MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_PID_AUTOTUNE ELABEL, &autotune_temp[eindex], 150, heater_maxtemp[eindex] - 15, lcd_autotune_callback_E ## eindex) #else - #define PID_MENU_ITEMS(ELABEL, eindex) _PID_MENU_ITEMS(ELABEL, eindex) + #define PID_EDIT_MENU_ITEMS(ELABEL, eindex) _PID_EDIT_MENU_ITEMS(ELABEL, eindex) #endif #if ENABLED(PID_PARAMS_PER_HOTEND) && HOTENDS > 1 - PID_MENU_ITEMS(" " MSG_E1, 0); - PID_MENU_ITEMS(" " MSG_E2, 1); + PID_EDIT_MENU_ITEMS(" " MSG_E1, 0); + PID_EDIT_MENU_ITEMS(" " MSG_E2, 1); #if HOTENDS > 2 - PID_MENU_ITEMS(" " MSG_E3, 2); + PID_EDIT_MENU_ITEMS(" " MSG_E3, 2); #if HOTENDS > 3 - PID_MENU_ITEMS(" " MSG_E4, 3); + PID_EDIT_MENU_ITEMS(" " MSG_E4, 3); #if HOTENDS > 4 - PID_MENU_ITEMS(" " MSG_E5, 4); + PID_EDIT_MENU_ITEMS(" " MSG_E5, 4); #if HOTENDS > 5 - PID_MENU_ITEMS(" " MSG_E6, 5); + PID_EDIT_MENU_ITEMS(" " MSG_E6, 5); #endif // HOTENDS > 5 #endif // HOTENDS > 4 #endif // HOTENDS > 3 #endif // HOTENDS > 2 #else // !PID_PARAMS_PER_HOTEND || HOTENDS == 1 - PID_MENU_ITEMS("", 0); + PID_EDIT_MENU_ITEMS("", 0); #endif // !PID_PARAMS_PER_HOTEND || HOTENDS == 1 - #endif // PIDTEMP + END_MENU(); + } - END_MENU(); -} +#endif // SHOW_MENU_ADVANCED_TEMPERATURE #if DISABLED(SLIM_LCD_MENUS) @@ -368,7 +434,7 @@ void menu_advanced_temperature() { if (e == active_extruder) _planner_refresh_positioning(); else - planner.steps_to_mm[E_AXIS + e] = 1.0f / planner.settings.axis_steps_per_mm[E_AXIS + e]; + planner.steps_to_mm[E_AXIS_N(e)] = 1.0f / planner.settings.axis_steps_per_mm[E_AXIS_N(e)]; } void _planner_refresh_e0_positioning() { _planner_refresh_e_positioning(0); } void _planner_refresh_e1_positioning() { _planner_refresh_e_positioning(1); } @@ -414,7 +480,7 @@ void menu_advanced_temperature() { #endif // E_STEPPERS > 4 #endif // E_STEPPERS > 3 #endif // E_STEPPERS > 2 - #else + #elif E_STEPPERS MENU_MULTIPLIER_ITEM_EDIT(float3, MSG_VMAX MSG_E, &planner.settings.max_feedrate_mm_s[E_AXIS], 1, 999); #endif @@ -464,7 +530,7 @@ void menu_advanced_temperature() { #endif // E_STEPPERS > 4 #endif // E_STEPPERS > 3 #endif // E_STEPPERS > 2 - #else + #elif E_STEPPERS MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E, &planner.settings.max_acceleration_mm_per_s2[E_AXIS], 100, 99000, _reset_acceleration_rates); #endif @@ -505,14 +571,14 @@ void menu_advanced_temperature() { START_MENU(); MENU_BACK(MSG_ADVANCED_SETTINGS); - #define EDIT_QSTEPS(Q) MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_##Q##STEPS, &planner.settings.axis_steps_per_mm[_AXIS(Q)], 5, 9999, _planner_refresh_positioning) + #define EDIT_QSTEPS(Q) MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float51, MSG_##Q##STEPS, &planner.settings.axis_steps_per_mm[_AXIS(Q)], 5, 9999, _planner_refresh_positioning) EDIT_QSTEPS(A); EDIT_QSTEPS(B); EDIT_QSTEPS(C); #if ENABLED(DISTINCT_E_FACTORS) - #define EDIT_ESTEPS(N,E) MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_E##N##STEPS, &planner.settings.axis_steps_per_mm[E_AXIS_N(E)], 5, 9999, _planner_refresh_e##E##_positioning) - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_ESTEPS, &planner.settings.axis_steps_per_mm[E_AXIS_N(active_extruder)], 5, 9999, _planner_refresh_positioning); + #define EDIT_ESTEPS(N,E) MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float51, MSG_E##N##STEPS, &planner.settings.axis_steps_per_mm[E_AXIS_N(E)], 5, 9999, _planner_refresh_e##E##_positioning) + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float51, MSG_ESTEPS, &planner.settings.axis_steps_per_mm[E_AXIS_N(active_extruder)], 5, 9999, _planner_refresh_positioning); EDIT_ESTEPS(1,0); EDIT_ESTEPS(2,1); #if E_STEPPERS > 2 @@ -527,8 +593,8 @@ void menu_advanced_temperature() { #endif // E_STEPPERS > 4 #endif // E_STEPPERS > 3 #endif // E_STEPPERS > 2 - #else - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_ESTEPS, &planner.settings.axis_steps_per_mm[E_AXIS], 5, 9999, _planner_refresh_positioning); + #elif E_STEPPERS + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float51, MSG_ESTEPS, &planner.settings.axis_steps_per_mm[E_AXIS], 5, 9999, _planner_refresh_positioning); #endif END_MENU(); @@ -558,12 +624,6 @@ void menu_advanced_settings() { START_MENU(); MENU_BACK(MSG_CONFIGURATION); - #if ENABLED(BABYSTEP_ZPROBE_OFFSET) - MENU_ITEM(submenu, MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset); - #elif HAS_BED_PROBE - MENU_ITEM_EDIT(float52, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX); - #endif - #if DISABLED(SLIM_LCD_MENUS) #if HAS_M206_COMMAND @@ -586,10 +646,26 @@ void menu_advanced_settings() { // M92 - Steps Per mm MENU_ITEM(submenu, MSG_STEPS_PER_MM, menu_advanced_steps_per_mm); } - #endif // !SLIM_LCD_MENUS - MENU_ITEM(submenu, MSG_TEMPERATURE, menu_advanced_temperature); + #if 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 + #if HAS_MOTOR_CURRENT_PWM + MENU_ITEM(submenu, MSG_DRIVE_STRENGTH, menu_pwm); + #endif + + #if HAS_TRINAMIC + MENU_ITEM(submenu, MSG_TMC_DRIVERS, menu_tmc); + #endif + + #if SHOW_MENU_ADVANCED_TEMPERATURE + MENU_ITEM(submenu, MSG_TEMPERATURE, menu_advanced_temperature); + #endif #if DISABLED(NO_VOLUMETRICS) || ENABLED(ADVANCED_PAUSE_FEATURE) MENU_ITEM(submenu, MSG_FILAMENT, menu_advanced_filament); @@ -625,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 000000000000..1b183e10632a --- /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 037d6be03ac0..b36d8dd3b1b7 100644 --- a/Marlin/src/lcd/menu/menu_bed_corners.cpp +++ b/Marlin/src/lcd/menu/menu_bed_corners.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -32,12 +32,37 @@ #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() { - line_to_z(4.0); +static inline void _lcd_goto_next_corner() { + line_to_z(LEVEL_CORNERS_Z_HOP); switch (bed_corner) { case 0: current_position[X_AXIS] = X_MIN_BED + LEVEL_CORNERS_INSET; @@ -60,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 @@ -68,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) @@ -76,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; @@ -91,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 40c51b572684..e8107aa58a5a 100644 --- a/Marlin/src/lcd/menu/menu_bed_leveling.cpp +++ b/Marlin/src/lcd/menu/menu_bed_leveling.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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" @@ -120,7 +120,7 @@ // Encoder knob or keypad buttons adjust the Z position // if (ui.encoderPosition) { - const float z = current_position[Z_AXIS] + float((int32_t)ui.encoderPosition) * (MESH_EDIT_Z_STEP); + const float z = current_position[Z_AXIS] + float(int16_t(ui.encoderPosition)) * (MESH_EDIT_Z_STEP); line_to_z(constrain(z, -(LCD_PROBE_Z_RANGE) * 0.5f, (LCD_PROBE_Z_RANGE) * 0.5f)); ui.refresh(LCDVIEW_CALL_REDRAW_NEXT); ui.encoderPosition = 0; @@ -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")); @@ -210,8 +210,8 @@ static uint8_t xind, yind; // =0 START_MENU(); MENU_BACK(MSG_BED_LEVELING); - MENU_ITEM_EDIT(int8, MSG_MESH_X, &xind, 0, GRID_MAX_POINTS_X - 1); - MENU_ITEM_EDIT(int8, MSG_MESH_Y, &yind, 0, GRID_MAX_POINTS_Y - 1); + MENU_ITEM_EDIT(uint8, MSG_MESH_X, &xind, 0, GRID_MAX_POINTS_X - 1); + MENU_ITEM_EDIT(uint8, MSG_MESH_Y, &yind, 0, GRID_MAX_POINTS_Y - 1); MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_MESH_EDIT_Z, &Z_VALUES(xind, yind), -(LCD_PROBE_Z_RANGE) * 0.5, (LCD_PROBE_Z_RANGE) * 0.5, refresh_planner); END_MENU(); } @@ -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 3e67a8367241..3dab29333425 100644 --- a/Marlin/src/lcd/menu/menu_configuration.cpp +++ b/Marlin/src/lcd/menu/menu_configuration.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -32,7 +32,7 @@ #include "../../module/configuration_store.h" -#if ENABLED(FILAMENT_RUNOUT_SENSOR) +#if HAS_FILAMENT_SENSOR #include "../../feature/runout.h" #endif @@ -40,6 +40,13 @@ #include "../../feature/power_loss_recovery.h" #endif +#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) void menu_advanced_settings(); @@ -101,7 +108,7 @@ static void lcd_factory_settings() { void menu_tool_change() { START_MENU(); MENU_BACK(MSG_MAIN); - #if ENABLED(TOOLCHANGE_PARK) + #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) MENU_ITEM_EDIT(float3, MSG_FILAMENT_SWAP_LENGTH, &toolchange_settings.swap_length, 0, 200); MENU_MULTIPLIER_ITEM_EDIT(int4, MSG_SINGLENOZZLE_RETRACT_SPD, &toolchange_settings.retract_speed, 10, 5400); MENU_MULTIPLIER_ITEM_EDIT(int4, MSG_SINGLENOZZLE_PRIME_SPD, &toolchange_settings.prime_speed, 10, 5400); @@ -112,19 +119,37 @@ static void lcd_factory_settings() { #endif -#if ENABLED(DUAL_X_CARRIAGE) - +#if HAS_HOTEND_OFFSET #include "../../module/motion.h" #include "../../gcode/queue.h" - void _recalc_IDEX_settings() { - if (active_extruder) { // For the 2nd extruder re-home so the next tool-change gets the new offsets. + void _recalc_offsets() { + if (active_extruder && all_axes_known()) { // For the 2nd extruder re-home so the next tool-change gets the new offsets. enqueue_and_echo_commands_P(PSTR("G28")); // In future, we can babystep the 2nd extruder (if active), making homing unnecessary. active_extruder = 0; } } - void menu_IDEX() { + void menu_tool_offsets() { + START_MENU(); + MENU_BACK(MSG_MAIN); + #if ENABLED(DUAL_X_CARRIAGE) + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float52, MSG_X_OFFSET, &hotend_offset[X_AXIS][1], MIN(X2_HOME_POS, X2_MAX_POS) - 25.0, MAX(X2_HOME_POS, X2_MAX_POS) + 25.0, _recalc_offsets); + #else + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float52, MSG_X_OFFSET, &hotend_offset[X_AXIS][1], -10.0, 10.0, _recalc_offsets); + #endif + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float52, MSG_Y_OFFSET, &hotend_offset[Y_AXIS][1], -10.0, 10.0, _recalc_offsets); + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float52, MSG_Z_OFFSET, &hotend_offset[Z_AXIS][1], Z_PROBE_LOW_POINT, 10.0, _recalc_offsets); + #if ENABLED(EEPROM_SETTINGS) + MENU_ITEM(function, MSG_STORE_EEPROM, lcd_store_settings); + #endif + END_MENU(); + } +#endif + +#if ENABLED(DUAL_X_CARRIAGE) + + void menu_idex() { START_MENU(); MENU_BACK(MSG_MAIN); @@ -134,15 +159,11 @@ 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); - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float52, MSG_IDEX_Z_OFFSET , &hotend_offset[Z_AXIS][1], -10.0, 10.0, _recalc_IDEX_settings); - MENU_ITEM(gcode, MSG_IDEX_SAVE_OFFSETS, PSTR("M500")); END_MENU(); } @@ -153,10 +174,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(); } @@ -169,7 +195,7 @@ static void lcd_factory_settings() { void menu_case_light() { START_MENU(); MENU_BACK(MSG_MAIN); - MENU_ITEM_EDIT_CALLBACK(int8, MSG_CASE_LIGHT_BRIGHTNESS, &case_light_brightness, 0, 255, update_case_light, true); + MENU_ITEM_EDIT_CALLBACK(uint8, MSG_CASE_LIGHT_BRIGHTNESS, &case_light_brightness, 0, 255, update_case_light, true); MENU_ITEM_EDIT_CALLBACK(bool, MSG_CASE_LIGHT, (bool*)&case_light_on, update_case_light); END_MENU(); } @@ -192,9 +218,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 @@ -205,51 +231,6 @@ static void lcd_factory_settings() { #endif -#if ENABLED(DAC_STEPPER_CURRENT) - - #include "../../feature/dac/stepper_dac.h" - - uint8_t driverPercent[XYZE]; - inline void dac_driver_getValues() { LOOP_XYZE(i) driverPercent[i] = dac_current_get_percent((AxisEnum)i); } - static void dac_driver_commit() { dac_current_set_percents(driverPercent); } - - void menu_dac() { - dac_driver_getValues(); - START_MENU(); - MENU_BACK(MSG_CONTROL); - #define EDIT_DAC_PERCENT(N) MENU_ITEM_EDIT_CALLBACK(int8, MSG_##N " " MSG_DAC_PERCENT, &driverPercent[_AXIS(N)], 0, 100, dac_driver_commit) - EDIT_DAC_PERCENT(X); - EDIT_DAC_PERCENT(Y); - EDIT_DAC_PERCENT(Z); - EDIT_DAC_PERCENT(E); - MENU_ITEM(function, MSG_DAC_EEPROM_WRITE, dac_commit_eeprom); - END_MENU(); - } - -#endif - -#if HAS_MOTOR_CURRENT_PWM - - #include "../../module/stepper.h" - - void menu_pwm() { - START_MENU(); - MENU_BACK(MSG_CONTROL); - #define EDIT_CURRENT_PWM(LABEL,I) MENU_ITEM_EDIT_CALLBACK(long5, LABEL, &stepper.motor_current_setting[I], 100, 2000, stepper.refresh_motor_power) - #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) - EDIT_CURRENT_PWM(MSG_X MSG_Y, 0); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_Z) - EDIT_CURRENT_PWM(MSG_Z, 1); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_E) - EDIT_CURRENT_PWM(MSG_E, 2); - #endif - END_MENU(); - } - -#endif - #if DISABLED(SLIM_LCD_MENUS) void _menu_configuration_preheat_settings(const uint8_t material) { @@ -274,12 +255,12 @@ static void lcd_factory_settings() { #endif START_MENU(); MENU_BACK(MSG_CONFIGURATION); - MENU_ITEM_EDIT(int8, MSG_FAN_SPEED, &ui.preheat_fan_speed[material], 0, 255); + MENU_ITEM_EDIT(uint8, MSG_FAN_SPEED, &ui.preheat_fan_speed[material], 0, 255); #if HAS_TEMP_HOTEND MENU_ITEM_EDIT(int3, MSG_NOZZLE, &ui.preheat_hotend_temp[material], MINTEMP_ALL, MAXTEMP_ALL - 15); #endif #if HAS_HEATED_BED - MENU_ITEM_EDIT(int3, MSG_BED, &ui.preheat_bed_temp[material], BED_MINTEMP, BED_MAXTEMP - 15); + 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); @@ -305,17 +286,27 @@ void menu_configuration() { MENU_ITEM(submenu, MSG_ADVANCED_SETTINGS, menu_advanced_settings); + #if ENABLED(BABYSTEP_ZPROBE_OFFSET) + MENU_ITEM(submenu, MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset); + #elif HAS_BED_PROBE + MENU_ITEM_EDIT(float52, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX); + #endif + const bool busy = printer_busy(); if (!busy) { // // 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 + #if HAS_HOTEND_OFFSET + MENU_ITEM(submenu, MSG_OFFSETS_MENU, menu_tool_offsets); + #endif + #if ENABLED(DUAL_X_CARRIAGE) - MENU_ITEM(submenu, MSG_IDEX_MENU, menu_IDEX); + MENU_ITEM(submenu, MSG_IDEX_MENU, menu_idex); #endif #if ENABLED(BLTOUCH) @@ -334,7 +325,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); @@ -346,15 +337,9 @@ void menu_configuration() { #if ENABLED(FWRETRACT) MENU_ITEM(submenu, MSG_RETRACT, menu_config_retract); #endif - #if ENABLED(DAC_STEPPER_CURRENT) - MENU_ITEM(submenu, MSG_DRIVE_STRENGTH, menu_dac); - #endif - #if HAS_MOTOR_CURRENT_PWM - MENU_ITEM(submenu, MSG_DRIVE_STRENGTH, menu_pwm); - #endif - #if ENABLED(FILAMENT_RUNOUT_SENSOR) - MENU_ITEM_EDIT_CALLBACK(bool, MSG_RUNOUT_SENSOR_ENABLE, &runout.enabled, runout.reset); + #if HAS_FILAMENT_SENSOR + MENU_ITEM_EDIT_CALLBACK(bool, MSG_RUNOUT_SENSOR, &runout.enabled, runout.reset); #endif #if ENABLED(POWER_LOSS_RECOVERY) diff --git a/Marlin/src/lcd/menu/menu_custom.cpp b/Marlin/src/lcd/menu/menu_custom.cpp index 6b16bbc79287..9d6cd9e8a197 100644 --- a/Marlin/src/lcd/menu/menu_custom.cpp +++ b/Marlin/src/lcd/menu/menu_custom.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/lcd/menu/menu_delta_calibrate.cpp b/Marlin/src/lcd/menu/menu_delta_calibrate.cpp index f83057b658f5..6931f327261b 100644 --- a/Marlin/src/lcd/menu/menu_delta_calibrate.cpp +++ b/Marlin/src/lcd/menu/menu_delta_calibrate.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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,8 +50,11 @@ 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")); + #endif while (wait_for_user) idle(); KEEPALIVE_STATE(IN_HANDLER); ui.goto_previous_screen_no_defer(); @@ -111,8 +114,6 @@ void menu_delta_calibrate() { #if ENABLED(DELTA_AUTO_CALIBRATION) MENU_ITEM(gcode, MSG_DELTA_AUTO_CALIBRATE, PSTR("G33")); - MENU_ITEM(gcode, MSG_DELTA_HEIGHT_CALIBRATE, PSTR("G33 S P1")); - MENU_ITEM(gcode, MSG_DELTA_Z_OFFSET_CALIBRATE, PSTR("G33 P-1")); #if ENABLED(EEPROM_SETTINGS) MENU_ITEM(function, MSG_STORE_EEPROM, lcd_store_settings); MENU_ITEM(function, MSG_LOAD_EEPROM, lcd_load_settings); diff --git a/Marlin/src/lcd/menu/menu_filament.cpp b/Marlin/src/lcd/menu/menu_filament.cpp index b5938d0a98ee..2e84a25d5417 100644 --- a/Marlin/src/lcd/menu/menu_filament.cpp +++ b/Marlin/src/lcd/menu/menu_filament.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -31,20 +31,23 @@ #include "menu.h" #include "../../module/temperature.h" #include "../../feature/pause.h" +#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"); } @@ -57,22 +60,22 @@ static void _change_filament_temp(const uint16_t temperature) { thermalManager.setTargetHotend(temperature, _change_filament_temp_extruder); lcd_enqueue_command(cmd); } -inline void _lcd_change_filament_temp_1_func() { _change_filament_temp(PREHEAT_1_TEMP_HOTEND); } -inline void _lcd_change_filament_temp_2_func() { _change_filament_temp(PREHEAT_2_TEMP_HOTEND); } -inline void _lcd_change_filament_temp_custom_cb() { _change_filament_temp(thermalManager.target_temperature[_change_filament_temp_extruder]); } +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.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(); @@ -99,35 +102,37 @@ 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(); } -void menu_temp_e0_filament_change() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_PAUSE_PRINT, 0); } -void menu_temp_e0_filament_load() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_LOAD_FILAMENT, 0); } -void menu_temp_e0_filament_unload() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, 0); } -#if E_STEPPERS > 1 - void menu_temp_e1_filament_change() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_PAUSE_PRINT, 1); } - void menu_temp_e1_filament_load() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_LOAD_FILAMENT, 1); } - void menu_temp_e1_filament_unload() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, 1); } - #if ENABLED(FILAMENT_UNLOAD_ALL_EXTRUDERS) - void menu_unload_filament_all_temp() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, -1); } - #endif - #if E_STEPPERS > 2 - void menu_temp_e2_filament_change() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_PAUSE_PRINT, 2); } - void menu_temp_e2_filament_load() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_LOAD_FILAMENT, 2); } - void menu_temp_e2_filament_unload() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, 2); } - #if E_STEPPERS > 3 - void menu_temp_e3_filament_change() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_PAUSE_PRINT, 3); } - void menu_temp_e3_filament_load() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_LOAD_FILAMENT, 3); } - void menu_temp_e3_filament_unload() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, 3); } - #if E_STEPPERS > 4 - void menu_temp_e4_filament_change() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_PAUSE_PRINT, 4); } - void menu_temp_e4_filament_load() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_LOAD_FILAMENT, 4); } - void menu_temp_e4_filament_unload() { _menu_temp_filament_op(ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT, 4); } - #endif // E_STEPPERS > 4 - #endif // E_STEPPERS > 3 - #endif // E_STEPPERS > 2 -#endif // E_STEPPERS > 1 +#if E_STEPPERS + 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(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(PAUSE_MODE_UNLOAD_FILAMENT, -1); } + #endif + #if E_STEPPERS > 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(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(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 + #endif // E_STEPPERS > 1 +#endif // E_STEPPERS /** * @@ -306,14 +311,13 @@ void menu_temp_e0_filament_unload() { _menu_temp_filament_op(ADVANCED_PAUSE_MOD } #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; } @@ -336,21 +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_RESUME, lcd_advanced_pause_resume_print); - 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_pause_resume_print); END_MENU(); } @@ -358,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); @@ -369,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 @@ -380,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 @@ -391,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 @@ -402,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 @@ -413,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 @@ -424,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 @@ -435,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 @@ -446,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 @@ -457,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 @@ -479,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 000000000000..9e0af2c7f0fd --- /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 3bd7054cdc7c..eb58b3a56be7 100644 --- a/Marlin/src/lcd/menu/menu_info.cpp +++ b/Marlin/src/lcd/menu/menu_info.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -38,7 +38,6 @@ // #include "../../feature/bedlevel/bedlevel.h" // #endif - #if ENABLED(PRINTCOUNTER) #include "../../module/printcounter.h" @@ -53,24 +52,44 @@ printStatistics stats = print_job_timer.getStats(); START_SCREEN(); // 12345678901234567890 - STATIC_ITEM(MSG_INFO_PRINT_COUNT ": ", false, false, itostr3left(stats.totalPrints)); // Print Count: 999 - STATIC_ITEM(MSG_INFO_COMPLETED_PRINTS": ", false, false, itostr3left(stats.finishedPrints)); // Completed : 666 + STATIC_ITEM(MSG_INFO_PRINT_COUNT ": ", false, false, i16tostr3left(stats.totalPrints)); // Print Count: 999 + STATIC_ITEM(MSG_INFO_COMPLETED_PRINTS": ", false, false, i16tostr3left(stats.finishedPrints)); // Completed : 666 duration_t elapsed = stats.printTime; elapsed.toString(buffer); - STATIC_ITEM(MSG_INFO_PRINT_TIME ": ", false, false); // Total print Time: - STATIC_ITEM("", false, false, buffer); // 99y 364d 23h 59m 59s + STATIC_ITEM(MSG_INFO_PRINT_TIME ":", false, false); // Total print Time: + STATIC_ITEM("> ", false, false, buffer); // > 99y 364d 23h 59m 59s elapsed = stats.longestPrint; elapsed.toString(buffer); - STATIC_ITEM(MSG_INFO_PRINT_LONGEST ": ", false, false); // Longest job time: - STATIC_ITEM("", false, false, buffer); // 99y 364d 23h 59m 59s + STATIC_ITEM(MSG_INFO_PRINT_LONGEST ":", false, false); // Longest job time: + STATIC_ITEM("> ", false, false, buffer); // > 99y 364d 23h 59m 59s sprintf_P(buffer, PSTR("%ld.%im"), long(stats.filamentUsed / 1000), int16_t(stats.filamentUsed / 100) % 10); - STATIC_ITEM(MSG_INFO_PRINT_FILAMENT ": ", false, false); // Extruded total: - STATIC_ITEM("", false, false, buffer); // 125m + STATIC_ITEM(MSG_INFO_PRINT_FILAMENT ":", false, false); // Extruded total: + STATIC_ITEM("> ", false, false, buffer); // > 125m + + #if SERVICE_INTERVAL_1 > 0 + elapsed = stats.nextService1; + elapsed.toString(buffer); + STATIC_ITEM(SERVICE_NAME_1 MSG_SERVICE_IN, false, false); // Service X in: + STATIC_ITEM("> ", false, false, buffer); // > 7d 12h 11m 10s + #endif + #if SERVICE_INTERVAL_2 > 0 + elapsed = stats.nextService2; + elapsed.toString(buffer); + STATIC_ITEM(SERVICE_NAME_2 MSG_SERVICE_IN, false, false); + STATIC_ITEM("> ", false, false, buffer); + #endif + #if SERVICE_INTERVAL_3 > 0 + elapsed = stats.nextService3; + elapsed.toString(buffer); + STATIC_ITEM(SERVICE_NAME_3 MSG_SERVICE_IN, false, false); + STATIC_ITEM("> ", false, false, buffer); + #endif + END_SCREEN(); } @@ -124,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 18063b224a56..6d584948c456 100644 --- a/Marlin/src/lcd/menu/menu_job_recovery.cpp +++ b/Marlin/src/lcd/menu/menu_job_recovery.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 d85fe338fbf9..ef693ccc4169 100644 --- a/Marlin/src/lcd/menu/menu_led.cpp +++ b/Marlin/src/lcd/menu/menu_led.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -55,13 +55,13 @@ void menu_led_custom() { START_MENU(); MENU_BACK(MSG_LED_CONTROL); - MENU_ITEM_EDIT_CALLBACK(int8, MSG_INTENSITY_R, &leds.color.r, 0, 255, leds.update, true); - MENU_ITEM_EDIT_CALLBACK(int8, MSG_INTENSITY_G, &leds.color.g, 0, 255, leds.update, true); - MENU_ITEM_EDIT_CALLBACK(int8, MSG_INTENSITY_B, &leds.color.b, 0, 255, leds.update, true); - #if ENABLED(RGBW_LED) || ENABLED(NEOPIXEL_LED) - MENU_ITEM_EDIT_CALLBACK(int8, MSG_INTENSITY_W, &leds.color.w, 0, 255, leds.update, true); + 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 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(int8, MSG_LED_BRIGHTNESS, &leds.color.i, 0, 255, leds.update, true); + MENU_ITEM_EDIT_CALLBACK(uint8, MSG_LED_BRIGHTNESS, &leds.color.i, 0, 255, leds.update, true); #endif #endif END_MENU(); diff --git a/Marlin/src/lcd/menu/menu_main.cpp b/Marlin/src/lcd/menu/menu_main.cpp index b08125f41d68..52178b873c80 100644 --- a/Marlin/src/lcd/menu/menu_main.cpp +++ b/Marlin/src/lcd/menu/menu_main.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -30,47 +30,88 @@ #include "menu.h" #include "../../module/temperature.h" +#include "../../gcode/queue.h" +#include "../../module/printcounter.h" +#include "../../module/stepper.h" +#include "../../sd/cardreader.h" -#if ENABLED(SDSUPPORT) +#if ENABLED(POWER_LOSS_RECOVERY) + #include "../../feature/power_loss_recovery.h" +#endif - #include "../../sd/cardreader.h" - #include "../../gcode/queue.h" - #include "../../module/printcounter.h" +#if ENABLED(HOST_ACTION_COMMANDS) + #include "../../feature/host_actions.h" +#endif - #if ENABLED(POWER_LOSS_RECOVERY) - #include "../../feature/power_loss_recovery.h" - #endif +#if HAS_GAMES + #include "game/game.h" +#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 MACHINE_CAN_PAUSE - void lcd_sdcard_pause() { + void lcd_pause_job() { #if ENABLED(POWER_LOSS_RECOVERY) if (recovery.enabled) recovery.save(true, false); #endif - card.pauseSDPrint(); - print_job_timer.pause(); + + #if ENABLED(HOST_PROMPT_SUPPORT) + host_prompt_open(PROMPT_PAUSE_RESUME, PSTR("UI Pause"), PSTR("Resume")); + #endif + #if ENABLED(PARK_HEAD_ON_PAUSE) - enqueue_and_echo_commands_P(PSTR("M125")); + 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 - ui.reset_status(); + planner.synchronize(); } - void lcd_sdcard_resume() { - #if ENABLED(PARK_HEAD_ON_PAUSE) - enqueue_and_echo_commands_P(PSTR("M24")); - #else - card.startFileprint(); - print_job_timer.start(); + 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 - ui.reset_status(); } - void lcd_sdcard_stop() { - wait_for_heatup = wait_for_user = false; - card.flag.abort_sd_printing = true; +#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(); } -#endif // SDSUPPORT + 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" +#endif void menu_tune(); void menu_motion(); @@ -82,42 +123,89 @@ void menu_change_filament(); void menu_info(); void menu_led(); +#if ENABLED(MIXING_EXTRUDER) + void menu_mixer(); +#endif + +#if HAS_SERVICE_INTERVALS && ENABLED(PRINTCOUNTER) + #if SERVICE_INTERVAL_1 > 0 + void menu_service1(); + #endif + #if SERVICE_INTERVAL_2 > 0 + void menu_service2(); + #endif + #if SERVICE_INTERVAL_3 > 0 + void menu_service3(); + #endif +#endif + void menu_main() { START_MENU(); MENU_BACK(MSG_WATCH); - #if ENABLED(SDSUPPORT) - if (card.flag.cardOK) { - if (card.isFileOpen()) { - if (IS_SD_PRINTING()) - MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause); - else - MENU_ITEM(function, MSG_RESUME_PRINT, lcd_sdcard_resume); - MENU_ITEM(function, MSG_STOP_PRINT, lcd_sdcard_stop); + const bool busy = IS_SD_PRINTING() || print_job_timer.isRunning() + #if ENABLED(SDSUPPORT) + , card_detected = card.isDetected() + , card_open = card_detected && card.isFileOpen() + #endif + ; + + if (busy) { + #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); + } + else { + #if !HAS_ENCODER_WHEEL && ENABLED(SDSUPPORT) + // + // Autostart + // + #if ENABLED(MENU_ADDAUTOSTART) + if (!busy) MENU_ITEM(function, MSG_AUTOSTART, card.beginautostart); + #endif + + if (card_detected) { + if (!card_open) { + MENU_ITEM(submenu, MSG_CARD_MENU, menu_sdcard); + #if !PIN_EXISTS(SD_DETECT) + MENU_ITEM(gcode, MSG_CHANGE_SDCARD, PSTR("M21")); // SD-card changed by user + #endif + } } else { - MENU_ITEM(submenu, MSG_CARD_MENU, menu_sdcard); #if !PIN_EXISTS(SD_DETECT) - MENU_ITEM(gcode, MSG_CHANGE_SDCARD, PSTR("M21")); // SD-card changed by user + MENU_ITEM(gcode, MSG_INIT_SDCARD, PSTR("M21")); // Manually init SD-card #endif + MENU_ITEM(function, MSG_NO_CARD, NULL); } - } - else { - MENU_ITEM(submenu, MSG_NO_CARD, menu_sdcard); - #if !PIN_EXISTS(SD_DETECT) - MENU_ITEM(gcode, MSG_INIT_SDCARD, PSTR("M21")); // Manually initialize the SD-card via user interface - #endif - } - #endif // SDSUPPORT + #endif // !HAS_ENCODER_WHEEL && SDSUPPORT + + #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 - const bool busy = printer_busy(); - if (busy) - MENU_ITEM(submenu, MSG_TUNE, menu_tune); - else { MENU_ITEM(submenu, MSG_MOTION, menu_motion); - MENU_ITEM(submenu, MSG_TEMPERATURE, menu_temperature); } + MENU_ITEM(submenu, MSG_TEMPERATURE, menu_temperature); + + #if ENABLED(MIXING_EXTRUDER) + MENU_ITEM(submenu, MSG_MIXER, menu_mixer); + #endif + + #if ENABLED(MMU2_MENUS) + if (!busy) MENU_ITEM(submenu, MSG_MMU2_MENU, menu_mmu2); + #endif + MENU_ITEM(submenu, MSG_CONFIGURATION, menu_configuration); #if ENABLED(CUSTOM_USER_MENUS) @@ -153,12 +241,56 @@ void menu_main() { MENU_ITEM(gcode, MSG_SWITCH_PS_ON, PSTR("M80")); #endif - // - // Autostart - // - #if ENABLED(SDSUPPORT) && ENABLED(MENU_ADDAUTOSTART) - if (!busy) - MENU_ITEM(function, MSG_AUTOSTART, card.beginautostart); + #if HAS_ENCODER_WHEEL && ENABLED(SDSUPPORT) + // + // Autostart + // + #if ENABLED(MENU_ADDAUTOSTART) + if (!busy) MENU_ITEM(function, MSG_AUTOSTART, card.beginautostart); + #endif + + if (card_detected) { + if (!card_open) { + MENU_ITEM(submenu, MSG_CARD_MENU, menu_sdcard); + #if !PIN_EXISTS(SD_DETECT) + MENU_ITEM(gcode, MSG_CHANGE_SDCARD, PSTR("M21")); // SD-card changed by user + #endif + } + } + else { + #if !PIN_EXISTS(SD_DETECT) + MENU_ITEM(gcode, MSG_INIT_SDCARD, PSTR("M21")); // Manually init SD-card + #endif + MENU_ITEM(function, MSG_NO_CARD, NULL); + } + #endif // HAS_ENCODER_WHEEL && SDSUPPORT + + #if HAS_SERVICE_INTERVALS && ENABLED(PRINTCOUNTER) + #if SERVICE_INTERVAL_1 > 0 + MENU_ITEM(submenu, SERVICE_NAME_1, menu_service1); + #endif + #if SERVICE_INTERVAL_2 > 0 + MENU_ITEM(submenu, SERVICE_NAME_2, menu_service2); + #endif + #if SERVICE_INTERVAL_3 > 0 + MENU_ITEM(submenu, SERVICE_NAME_3, menu_service3); + #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 new file mode 100644 index 000000000000..8e5b6f4d0fb1 --- /dev/null +++ b/Marlin/src/lcd/menu/menu_mixer.cpp @@ -0,0 +1,314 @@ +/** + * 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 . + * + */ + +// +// Mixer Menu +// + +#include "../../inc/MarlinConfigPre.h" + +#if HAS_LCD_MENU && ENABLED(MIXING_EXTRUDER) + +#include "menu.h" +#include "../../feature/mixing.h" + +#include "../dogm/ultralcd_DOGM.h" +#include "../ultralcd.h" +#include "../lcdprint.h" + +#define CHANNEL_MIX_EDITING !DUAL_MIXING_EXTRUDER + +#if ENABLED(GRADIENT_MIX) + + void lcd_mixer_gradient_z_start_edit() { + ui.defer_status_screen(); + ui.encoder_direction_normal(); + ENCODER_RATE_MULTIPLY(true); + if (ui.encoderPosition != 0) { + mixer.gradient.start_z += float(int16_t(ui.encoderPosition)) * 0.1; + ui.encoderPosition = 0; + NOLESS(mixer.gradient.start_z, 0); + NOMORE(mixer.gradient.start_z, Z_MAX_POS); + } + if (ui.should_draw()) { + char tmp[21]; + sprintf_P(tmp, PSTR(MSG_START_Z ": %4d.%d mm"), int(mixer.gradient.start_z), int(mixer.gradient.start_z * 10) % 10); + SETCURSOR(2, (LCD_HEIGHT - 1) / 2); + LCDPRINT(tmp); + } + + if (ui.lcd_clicked) { + if (mixer.gradient.start_z > mixer.gradient.end_z) + mixer.gradient.end_z = mixer.gradient.start_z; + mixer.refresh_gradient(); + ui.goto_previous_screen(); + } + } + + void lcd_mixer_gradient_z_end_edit() { + ui.defer_status_screen(); + ui.encoder_direction_normal(); + ENCODER_RATE_MULTIPLY(true); + if (ui.encoderPosition != 0) { + mixer.gradient.end_z += float(int16_t(ui.encoderPosition)) * 0.1; + ui.encoderPosition = 0; + NOLESS(mixer.gradient.end_z, 0); + NOMORE(mixer.gradient.end_z, Z_MAX_POS); + } + + if (ui.should_draw()) { + char tmp[21]; + sprintf_P(tmp, PSTR(MSG_END_Z ": %4d.%d mm"), int(mixer.gradient.end_z), int(mixer.gradient.end_z * 10) % 10); + SETCURSOR(2, (LCD_HEIGHT - 1) / 2); + LCDPRINT(tmp); + } + + if (ui.lcd_clicked) { + if (mixer.gradient.end_z < mixer.gradient.start_z) + mixer.gradient.start_z = mixer.gradient.end_z; + mixer.refresh_gradient(); + ui.goto_previous_screen(); + } + } + + void lcd_mixer_edit_gradient_menu() { + START_MENU(); + MENU_BACK(MSG_MIXER); + + MENU_ITEM_EDIT_CALLBACK(int8, MSG_START_VTOOL, &mixer.gradient.start_vtool, 0, MIXING_VIRTUAL_TOOLS - 1, mixer.refresh_gradient); + MENU_ITEM_EDIT_CALLBACK(int8, MSG_END_VTOOL, &mixer.gradient.end_vtool, 0, MIXING_VIRTUAL_TOOLS - 1, mixer.refresh_gradient); + + #if ENABLED(GRADIENT_VTOOL) + MENU_ITEM_EDIT_CALLBACK(int8, MSG_GRADIENT_ALIAS, &mixer.gradient.vtool_index, 0, MIXING_VIRTUAL_TOOLS - 1, mixer.refresh_gradient); + #endif + + char tmp[10]; + + MENU_ITEM(submenu, MSG_START_Z ":", lcd_mixer_gradient_z_start_edit); + MENU_ITEM_ADDON_START(9); + sprintf_P(tmp, PSTR("%4d.%d mm"), int(mixer.gradient.start_z), int(mixer.gradient.start_z * 10) % 10); + LCDPRINT(tmp); + MENU_ITEM_ADDON_END(); + + MENU_ITEM(submenu, MSG_END_Z ":", lcd_mixer_gradient_z_end_edit); + MENU_ITEM_ADDON_START(9); + sprintf_P(tmp, PSTR("%4d.%d mm"), int(mixer.gradient.end_z), int(mixer.gradient.end_z * 10) % 10); + LCDPRINT(tmp); + MENU_ITEM_ADDON_END(); + + END_MENU(); + } + +#endif // GRADIENT_MIX + +static uint8_t v_index; + +#if DUAL_MIXING_EXTRUDER + void _lcd_draw_mix(const uint8_t y) { + char tmp[21]; + sprintf_P(tmp, PSTR(MSG_MIX ": %3d%% %3d%%"), int(mixer.mix[0]), int(mixer.mix[1])); + SETCURSOR(2, y); + LCDPRINT(tmp); + } +#endif + +void _lcd_mixer_select_vtool() { + mixer.T(v_index); + #if DUAL_MIXING_EXTRUDER + _lcd_draw_mix(LCD_HEIGHT - 1); + #endif +} + +#if CHANNEL_MIX_EDITING + + void _lcd_mixer_cycle_mix() { + uint16_t bits = 0; + MIXER_STEPPER_LOOP(i) if (mixer.collector[i]) SBI(bits, i); + bits = (bits + 1) & (_BV(MIXING_STEPPERS) - 1); + if (!bits) ++bits; + MIXER_STEPPER_LOOP(i) mixer.collector[i] = TEST(bits, i) ? 10.0f : 0.0f; + ui.refresh(); + } + + void _lcd_mixer_commit_vtool() { + mixer.normalize(); + ui.goto_previous_screen(); + } + +#endif + +void lcd_mixer_mix_edit() { + + #if CHANNEL_MIX_EDITING + + #define EDIT_COLOR(N) MENU_MULTIPLIER_ITEM_EDIT(float52, MSG_MIX_COMPONENT " " STRINGIFY(N), &mixer.collector[N-1], 0, 10); + + START_MENU(); + MENU_BACK(MSG_MIXER); + EDIT_COLOR(1); + EDIT_COLOR(2); + #if MIXING_STEPPERS > 2 + EDIT_COLOR(3); + #if MIXING_STEPPERS > 3 + EDIT_COLOR(4); + #if MIXING_STEPPERS > 4 + EDIT_COLOR(5); + #if MIXING_STEPPERS > 5 + EDIT_COLOR(6); + #endif + #endif + #endif + #endif + MENU_ITEM(function, MSG_CYCLE_MIX, _lcd_mixer_cycle_mix); + MENU_ITEM(function, MSG_COMMIT_VTOOL, _lcd_mixer_commit_vtool); + END_MENU(); + + #elif DUAL_MIXING_EXTRUDER + + if (ui.encoderPosition != 0) { + mixer.mix[0] += int16_t(ui.encoderPosition); + ui.encoderPosition = 0; + if (mixer.mix[0] < 0) mixer.mix[0] += 101; + if (mixer.mix[0] > 100) mixer.mix[0] -= 101; + mixer.mix[1] = 100 - mixer.mix[0]; + } + _lcd_draw_mix((LCD_HEIGHT - 1) / 2); + + if (ui.lcd_clicked) { + mixer.update_vtool_from_mix(); + ui.goto_previous_screen(); + } + + #else + + START_MENU(); + MENU_BACK(MSG_MIXER); + END_MENU(); + + #endif +} + +#if DUAL_MIXING_EXTRUDER + + // + // Toggle Dual-Mix + // + inline void _lcd_mixer_toggle_mix() { + mixer.mix[0] = mixer.mix[0] == 100 ? 0 : 100; + mixer.mix[1] = 100 - mixer.mix[0]; + mixer.update_vtool_from_mix(); + ui.refresh(LCDVIEW_CALL_REDRAW_NEXT); + } + +#endif + +#if CHANNEL_MIX_EDITING + + // + // Prepare and Edit Mix + // + inline void _lcd_goto_mix_edit() { + mixer.refresh_collector(10, v_index); + ui.goto_screen(lcd_mixer_mix_edit); + lcd_mixer_mix_edit(); + } + +#endif + +#if ENABLED(GRADIENT_MIX) + // + // Reverse Gradient + // + inline void _lcd_mixer_reverse_gradient() { + const uint8_t sv = mixer.gradient.start_vtool; + mixer.gradient.start_vtool = mixer.gradient.end_vtool; + mixer.gradient.end_vtool = sv; + mixer.refresh_gradient(); + ui.refresh(LCDVIEW_CALL_REDRAW_NEXT); + } +#endif + +// +// Reset All V-Tools +// +inline void _lcd_reset_vtools() { + LCD_MESSAGEPGM(MSG_VTOOLS_RESET); + ui.return_to_status(); + mixer.reset_vtools(); +} + +void menu_mixer_vtools_reset_confirm() { + START_MENU(); + MENU_BACK(MSG_BACK); + MENU_ITEM(function, MSG_RESET_VTOOLS, _lcd_reset_vtools); + END_MENU(); +} + +void menu_mixer() { + START_MENU(); + MENU_BACK(MSG_MAIN); + + v_index = mixer.get_current_vtool(); + MENU_ITEM_EDIT_CALLBACK(uint8, MSG_ACTIVE_VTOOL, &v_index, 0, MIXING_VIRTUAL_TOOLS - 1, _lcd_mixer_select_vtool + #if DUAL_MIXING_EXTRUDER + , true + #endif + ); + + MENU_ITEM(submenu, MSG_MIX, + #if CHANNEL_MIX_EDITING + _lcd_goto_mix_edit + #elif DUAL_MIXING_EXTRUDER + lcd_mixer_mix_edit + #endif + ); + + #if DUAL_MIXING_EXTRUDER + { + char tmp[10]; + MENU_ITEM_ADDON_START(10); + mixer.update_mix_from_vtool(); + sprintf_P(tmp, PSTR("%3d;%3d%%"), int(mixer.mix[0]), int(mixer.mix[1])); + LCDPRINT(tmp); + MENU_ITEM_ADDON_END(); + MENU_ITEM(function, MSG_TOGGLE_MIX, _lcd_mixer_toggle_mix); + } + #endif + + MENU_ITEM(submenu, MSG_RESET_VTOOLS, menu_mixer_vtools_reset_confirm); + + #if ENABLED(GRADIENT_MIX) + { + char tmp[10]; + MENU_ITEM(submenu, MSG_GRADIENT, lcd_mixer_edit_gradient_menu); + MENU_ITEM_ADDON_START(10); + sprintf_P(tmp, PSTR("T%i->T%i"), mixer.gradient.start_vtool, mixer.gradient.end_vtool); + LCDPRINT(tmp); + MENU_ITEM_ADDON_END(); + MENU_ITEM(function, MSG_REVERSE_GRADIENT, _lcd_mixer_reverse_gradient); + } + #endif + + END_MENU(); +} + +#endif // HAS_LCD_MENU && MIXING_EXTRUDER diff --git a/Marlin/src/lcd/menu/menu_mmu2.cpp b/Marlin/src/lcd/menu/menu_mmu2.cpp new file mode 100644 index 000000000000..af2e296083c6 --- /dev/null +++ b/Marlin/src/lcd/menu/menu_mmu2.cpp @@ -0,0 +1,215 @@ +/** + * 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 HAS_LCD_MENU && ENABLED(MMU2_MENUS) + +#include "../../feature/prusa_MMU2/mmu2.h" +#include "menu_mmu2.h" +#include "menu.h" + +uint8_t currentTool; +bool mmuMenuWait; + +// +// Load Filament +// + +void _mmu2_load_filamentToNozzle(uint8_t index) { + ui.reset_status(); + ui.return_to_status(); + ui.status_printf_P(0, PSTR(MSG_MMU2_LOADING_FILAMENT), int(index + 1)); + if (mmu2.load_filament_to_nozzle(index)) ui.reset_status(); +} + +inline void action_mmu2_load_filament_to_nozzl_e(const uint8_t tool) { + _mmu2_load_filamentToNozzle(tool); + ui.return_to_status(); +} +inline void action_mmu2_load_filament_to_nozzle_0() { action_mmu2_load_filament_to_nozzl_e(0); } +inline void action_mmu2_load_filament_to_nozzle_1() { action_mmu2_load_filament_to_nozzl_e(1); } +inline void action_mmu2_load_filament_to_nozzle_2() { action_mmu2_load_filament_to_nozzl_e(2); } +inline void action_mmu2_load_filament_to_nozzle_3() { action_mmu2_load_filament_to_nozzl_e(3); } +inline void action_mmu2_load_filament_to_nozzle_4() { action_mmu2_load_filament_to_nozzl_e(4); } + +void _mmu2_load_filament(uint8_t index) { + ui.return_to_status(); + ui.status_printf_P(0, PSTR(MSG_MMU2_LOADING_FILAMENT), int(index + 1)); + mmu2.load_filament(index); + ui.reset_status(); +} +void action_mmu2_load_all() { + for (uint8_t i = 0; i < EXTRUDERS; i++) + _mmu2_load_filament(i); + ui.return_to_status(); +} +inline void action_mmu2_load_filament_0() { _mmu2_load_filament(0); } +inline void action_mmu2_load_filament_1() { _mmu2_load_filament(1); } +inline void action_mmu2_load_filament_2() { _mmu2_load_filament(2); } +inline void action_mmu2_load_filament_3() { _mmu2_load_filament(3); } +inline void action_mmu2_load_filament_4() { _mmu2_load_filament(4); } + +void menu_mmu2_load_filament() { + START_MENU(); + MENU_BACK(MSG_MMU2_MENU); + MENU_ITEM(function, MSG_MMU2_ALL, action_mmu2_load_all); + MENU_ITEM(function, MSG_MMU2_FILAMENT0, action_mmu2_load_filament_0); + MENU_ITEM(function, MSG_MMU2_FILAMENT1, action_mmu2_load_filament_1); + MENU_ITEM(function, MSG_MMU2_FILAMENT2, action_mmu2_load_filament_2); + MENU_ITEM(function, MSG_MMU2_FILAMENT3, action_mmu2_load_filament_3); + MENU_ITEM(function, MSG_MMU2_FILAMENT4, action_mmu2_load_filament_4); + END_MENU(); +} + +void menu_mmu2_load_to_nozzle() { + START_MENU(); + MENU_BACK(MSG_MMU2_MENU); + MENU_ITEM(function, MSG_MMU2_FILAMENT0, action_mmu2_load_filament_to_nozzle_0); + MENU_ITEM(function, MSG_MMU2_FILAMENT1, action_mmu2_load_filament_to_nozzle_1); + MENU_ITEM(function, MSG_MMU2_FILAMENT2, action_mmu2_load_filament_to_nozzle_2); + MENU_ITEM(function, MSG_MMU2_FILAMENT3, action_mmu2_load_filament_to_nozzle_3); + MENU_ITEM(function, MSG_MMU2_FILAMENT4, action_mmu2_load_filament_to_nozzle_4); + END_MENU(); +} + +// +// Eject Filament +// + +void _mmu2_eject_filament(uint8_t index) { + ui.reset_status(); + ui.return_to_status(); + ui.status_printf_P(0, PSTR(MSG_MMU2_EJECTING_FILAMENT), int(index + 1)); + if (mmu2.eject_filament(index, true)) ui.reset_status(); +} +inline void action_mmu2_eject_filament_0() { _mmu2_eject_filament(0); } +inline void action_mmu2_eject_filament_1() { _mmu2_eject_filament(1); } +inline void action_mmu2_eject_filament_2() { _mmu2_eject_filament(2); } +inline void action_mmu2_eject_filament_3() { _mmu2_eject_filament(3); } +inline void action_mmu2_eject_filament_4() { _mmu2_eject_filament(4); } + +void action_mmu2_unload_filament() { + ui.reset_status(); + ui.return_to_status(); + LCD_MESSAGEPGM(MSG_MMU2_UNLOADING_FILAMENT); + idle(); + if (mmu2.unload()) ui.reset_status(); +} + +void menu_mmu2_eject_filament() { + START_MENU(); + MENU_BACK(MSG_MMU2_MENU); + MENU_ITEM(function, MSG_MMU2_FILAMENT0, action_mmu2_eject_filament_0); + MENU_ITEM(function, MSG_MMU2_FILAMENT1, action_mmu2_eject_filament_1); + MENU_ITEM(function, MSG_MMU2_FILAMENT2, action_mmu2_eject_filament_2); + MENU_ITEM(function, MSG_MMU2_FILAMENT3, action_mmu2_eject_filament_3); + MENU_ITEM(function, MSG_MMU2_FILAMENT4, action_mmu2_eject_filament_4); + END_MENU(); +} + +// +// MMU2 Menu +// + +void action_mmu2_reset() { + mmu2.init(); + ui.reset_status(); +} + +void menu_mmu2() { + START_MENU(); + MENU_BACK(MSG_MAIN); + MENU_ITEM(submenu, MSG_MMU2_LOAD_FILAMENT, menu_mmu2_load_filament); + MENU_ITEM(submenu, MSG_MMU2_LOAD_TO_NOZZLE, menu_mmu2_load_to_nozzle); + MENU_ITEM(submenu, MSG_MMU2_EJECT_FILAMENT, menu_mmu2_eject_filament); + MENU_ITEM(function, MSG_MMU2_UNLOAD_FILAMENT, action_mmu2_unload_filament); + MENU_ITEM(function, MSG_MMU2_RESET, action_mmu2_reset); + END_MENU(); +} + +// +// T* Choose Filament +// + +inline void action_mmu2_choose(const uint8_t tool) { + currentTool = tool; + mmuMenuWait = false; +} +inline void action_mmu2_choose0() { action_mmu2_choose(0); } +inline void action_mmu2_choose1() { action_mmu2_choose(1); } +inline void action_mmu2_choose2() { action_mmu2_choose(2); } +inline void action_mmu2_choose3() { action_mmu2_choose(3); } +inline void action_mmu2_choose4() { action_mmu2_choose(4); } + +void menu_mmu2_choose_filament() { + START_MENU(); + #if LCD_HEIGHT > 2 + STATIC_ITEM(MSG_MMU2_CHOOSE_FILAMENT_HEADER, true, true); + #endif + MENU_ITEM(function, MSG_MMU2_FILAMENT0, action_mmu2_choose0); + MENU_ITEM(function, MSG_MMU2_FILAMENT1, action_mmu2_choose1); + MENU_ITEM(function, MSG_MMU2_FILAMENT2, action_mmu2_choose2); + MENU_ITEM(function, MSG_MMU2_FILAMENT3, action_mmu2_choose3); + MENU_ITEM(function, MSG_MMU2_FILAMENT4, action_mmu2_choose4); + END_MENU(); +} + +// +// MMU2 Filament Runout +// + +inline void action_mmu2_M600_load_current_filament() { mmu2.load_filament(currentTool); } +inline void action_mmu2_M600_load_current_filament_to_nozzle() { mmu2.load_filament_to_nozzle(currentTool); } +inline void action_mmu2_M600_unload_filament() { mmu2.unload(); } +inline void action_mmu2_M600_resume() { mmuMenuWait = false; } + +void menu_mmu2_pause() { + currentTool = mmu2.get_current_tool(); + START_MENU(); + #if LCD_HEIGHT > 2 + STATIC_ITEM(MSG_MMU2_FILAMENT_CHANGE_HEADER, true, true); + #endif + MENU_ITEM(function, MSG_MMU2_RESUME, action_mmu2_M600_resume); + MENU_ITEM(function, MSG_MMU2_UNLOAD_FILAMENT, action_mmu2_M600_unload_filament); + MENU_ITEM(function, MSG_MMU2_LOAD_FILAMENT, action_mmu2_M600_load_current_filament); + MENU_ITEM(function, MSG_MMU2_LOAD_TO_NOZZLE, action_mmu2_M600_load_current_filament_to_nozzle); + END_MENU(); +} + +void mmu2_M600() { + ui.defer_status_screen(); + ui.goto_screen(menu_mmu2_pause); + mmuMenuWait = true; + while (mmuMenuWait) idle(); +} + +uint8_t mmu2_choose_filament() { + ui.defer_status_screen(); + ui.goto_screen(menu_mmu2_choose_filament); + mmuMenuWait = true; + while (mmuMenuWait) idle(); + ui.return_to_status(); + return currentTool; +} + +#endif // HAS_LCD_MENU && ENABLED(PRUSA_MMU2_MENUS) diff --git a/Marlin/src/lcd/menu/menu_mmu2.h b/Marlin/src/lcd/menu/menu_mmu2.h new file mode 100644 index 000000000000..ee14e1191ca6 --- /dev/null +++ b/Marlin/src/lcd/menu/menu_mmu2.h @@ -0,0 +1,28 @@ +/** + * 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 + +void menu_mmu2(); +void mmu2_M600(); +uint8_t mmu2_choose_filament(); diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index e4c29ad18c6f..e6d7b8bc48c9 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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; } @@ -121,16 +121,16 @@ static void _lcd_move_xyz(PGM_P name, AxisEnum axis) { #endif // Get the new position - const float diff = float((int32_t)ui.encoderPosition) * move_menu_scale; + const float diff = float(int16_t(ui.encoderPosition)) * move_menu_scale; #if IS_KINEMATIC manual_move_offset += diff; - if ((int32_t)ui.encoderPosition < 0) + if (int16_t(ui.encoderPosition) < 0) NOLESS(manual_move_offset, min - current_position[axis]); else NOMORE(manual_move_offset, max - current_position[axis]); #else current_position[axis] += diff; - if ((int32_t)ui.encoderPosition < 0) + if (int16_t(ui.encoderPosition) < 0) NOLESS(current_position[axis], min); else NOMORE(current_position[axis], max); @@ -161,7 +161,7 @@ static void _lcd_move_e( ui.encoder_direction_normal(); if (ui.encoderPosition) { if (!ui.processing_manual_move) { - const float diff = float((int32_t)ui.encoderPosition) * move_menu_scale; + const float diff = float(int16_t(ui.encoderPosition)) * move_menu_scale; #if IS_KINEMATIC manual_move_offset += diff; #else @@ -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); } @@ -248,12 +248,9 @@ void _menu_move_distance(const AxisEnum axis, const screenFunc_t func, const int START_MENU(); if (LCD_HEIGHT >= 4) { switch (axis) { - case X_AXIS: - STATIC_ITEM(MSG_MOVE_X, true, true); break; - case Y_AXIS: - STATIC_ITEM(MSG_MOVE_Y, true, true); break; - case Z_AXIS: - STATIC_ITEM(MSG_MOVE_Z, true, true); break; + case X_AXIS: STATIC_ITEM(MSG_MOVE_X, true, true); break; + case Y_AXIS: STATIC_ITEM(MSG_MOVE_Y, true, true); break; + case Z_AXIS: STATIC_ITEM(MSG_MOVE_Z, true, true); break; default: #if ENABLED(MANUAL_E_MOVES_RELATIVE) manual_move_e_origin = current_position[E_AXIS]; @@ -338,7 +335,7 @@ void menu_move() { else MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28")); - #if ENABLED(SWITCHING_EXTRUDER) || ENABLED(SWITCHING_NOZZLE) + #if ANY(SWITCHING_EXTRUDER, SWITCHING_NOZZLE, MAGNETIC_SWITCHING_TOOLHEAD) #if EXTRUDERS == 6 switch (active_extruder) { @@ -379,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); @@ -452,13 +449,6 @@ void menu_motion() { MENU_ITEM(gcode, MSG_AUTO_Z_ALIGN, PSTR("G34")); #endif - // - // TMC Z Calibration - // - #if ENABLED(TMC_Z_CALIBRATION) - MENU_ITEM(gcode, MSG_TMC_Z_CALIBRATION, PSTR("G28\nM915")); - #endif - // // Level Bed // @@ -475,7 +465,7 @@ void menu_motion() { #if DISABLED(PROBE_MANUALLY) MENU_ITEM(gcode, MSG_LEVEL_BED, PSTR("G28\nG29")); #endif - if (leveling_is_valid()) { + if (all_axes_homed() && leveling_is_valid()) { bool new_level_state = planner.leveling_active; MENU_ITEM_EDIT_CALLBACK(bool, MSG_BED_LEVELING, &new_level_state, _lcd_toggle_bed_leveling); } diff --git a/Marlin/src/lcd/menu/menu_sdcard.cpp b/Marlin/src/lcd/menu/menu_sdcard.cpp index f5fffb91e273..274643841f18 100644 --- a/Marlin/src/lcd/menu/menu_sdcard.cpp +++ b/Marlin/src/lcd/menu/menu_sdcard.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -33,8 +33,8 @@ #if !PIN_EXISTS(SD_DETECT) void lcd_sd_refresh() { - card.initsd(); encoderTopLine = 0; + card.initsd(); } #endif @@ -47,10 +47,11 @@ void lcd_sd_updir() { #if ENABLED(SD_REPRINT_LAST_SELECTED_FILE) - uint32_t last_sdfile_encoderPosition = 0xFFFF; + uint16_t sd_encoder_position = 0xFFFF; + int8_t sd_top_line, sd_items; void MarlinUI::reselect_last_file() { - if (last_sdfile_encoderPosition == 0xFFFF) return; + if (sd_encoder_position == 0xFFFF) return; //#if HAS_GRAPHICAL_LCD // // This is a hack to force a screen update. // ui.refresh(LCDVIEW_CALL_REDRAW_NEXT); @@ -61,10 +62,10 @@ void lcd_sd_updir() { // ui.drawing_screen = screen_changed = true; //#endif - goto_screen(menu_sdcard, last_sdfile_encoderPosition); - last_sdfile_encoderPosition = 0xFFFF; + goto_screen(menu_sdcard, sd_encoder_position, sd_top_line, sd_items); + sd_encoder_position = 0xFFFF; - defer_status_screen(true); + defer_status_screen(); //#if HAS_GRAPHICAL_LCD // update(); @@ -72,15 +73,44 @@ void lcd_sd_updir() { } #endif +inline void sdcard_start_selected_file() { + card.openAndPrintFile(card.filename); + ui.return_to_status(); + ui.reset_status(); +} + +#if ENABLED(SD_MENU_CONFIRM_START) + + bool do_print_file; + void menu_sd_confirm() { + if (ui.should_draw()) + do_select_screen(PSTR(MSG_BUTTON_PRINT), PSTR(MSG_BUTTON_CANCEL), do_print_file, PSTR(MSG_START_PRINT " "), card.longest_filename(), PSTR("?")); + + if (ui.use_click()) { + if (do_print_file) + sdcard_start_selected_file(); + else + ui.goto_previous_screen(); + } + } + +#endif + class MenuItem_sdfile { public: static void action(CardReader &theCard) { #if ENABLED(SD_REPRINT_LAST_SELECTED_FILE) - last_sdfile_encoderPosition = ui.encoderPosition; // Save which file was selected for later use + // Save menu state for the selected file + sd_encoder_position = ui.encoderPosition; + sd_top_line = encoderTopLine; + sd_items = screen_items; + #endif + #if ENABLED(SD_MENU_CONFIRM_START) + do_print_file = false; + MenuItem_submenu::action(menu_sd_confirm); + #else + sdcard_start_selected_file(); #endif - card.openAndPrintFile(theCard.filename); - ui.return_to_status(); - ui.reset_status(); } }; @@ -89,7 +119,7 @@ class MenuItem_sdfolder { static void action(CardReader &theCard) { card.chdir(theCard.filename); encoderTopLine = 0; - ui.encoderPosition = 2 * ENCODER_STEPS_PER_MENU_ITEM; + ui.encoderPosition = 2 * (ENCODER_STEPS_PER_MENU_ITEM); screen_changed = true; #if HAS_GRAPHICAL_LCD ui.drawing_screen = false; @@ -111,10 +141,10 @@ void menu_sdcard() { MENU_ITEM(function, LCD_STR_REFRESH MSG_REFRESH, lcd_sd_refresh); #endif } - else if (card.flag.cardOK) + else if (card.isDetected()) MENU_ITEM(function, LCD_STR_FOLDER "..", lcd_sd_updir); - for (uint16_t i = 0; i < fileCnt; i++) { + if (ui.should_draw()) for (uint16_t i = 0; i < fileCnt; i++) { if (_menuLineNr == _thisItemNr) { const uint16_t nr = #if ENABLED(SDCARD_RATHERRECENTFIRST) && DISABLED(SDCARD_SORT_ALPHA) diff --git a/Marlin/src/lcd/menu/menu_service.cpp b/Marlin/src/lcd/menu/menu_service.cpp new file mode 100644 index 000000000000..05d43f5fd03a --- /dev/null +++ b/Marlin/src/lcd/menu/menu_service.cpp @@ -0,0 +1,82 @@ +/** + * 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 . + * + */ + +// +// Service Menus +// + +#include "../../inc/MarlinConfigPre.h" + +#if HAS_LCD_MENU && HAS_SERVICE_INTERVALS && ENABLED(PRINTCOUNTER) + +#include "menu.h" +#include "../../module/printcounter.h" + +inline void _lcd_reset_service(const int index) { + print_job_timer.resetServiceInterval(index); + BUZZ(200, 404); + ui.reset_status(); + ui.return_to_status(); +} + +#if SERVICE_INTERVAL_1 > 0 + void menu_action_reset_service1() { _lcd_reset_service(1); } +#endif + +#if SERVICE_INTERVAL_2 > 0 + void menu_action_reset_service2() { _lcd_reset_service(2); } +#endif + +#if SERVICE_INTERVAL_3 > 0 + void menu_action_reset_service3() { _lcd_reset_service(3); } +#endif + +inline void _menu_service(const int index) { + START_MENU(); + MENU_BACK(MSG_MAIN); + switch (index) { + #if SERVICE_INTERVAL_1 > 0 + case 1: MENU_ITEM(function, MSG_SERVICE_RESET, menu_action_reset_service1); break; + #endif + #if SERVICE_INTERVAL_2 > 0 + case 2: MENU_ITEM(function, MSG_SERVICE_RESET, menu_action_reset_service2); break; + #endif + #if SERVICE_INTERVAL_3 > 0 + case 3: MENU_ITEM(function, MSG_SERVICE_RESET, menu_action_reset_service3); break; + #endif + } + END_MENU(); +} + +#if SERVICE_INTERVAL_1 > 0 + void menu_service1() { _menu_service(1); } +#endif + +#if SERVICE_INTERVAL_2 > 0 + void menu_service2() { _menu_service(2); } +#endif + +#if SERVICE_INTERVAL_3 > 0 + void menu_service3() { _menu_service(3); } +#endif + +#endif // HAS_LCD_MENU && HAS_SERVICE_INTERVALS && PRINTCOUNTER diff --git a/Marlin/src/lcd/menu/menu_temperature.cpp b/Marlin/src/lcd/menu/menu_temperature.cpp index 2883fe752e57..012c0d574e96 100644 --- a/Marlin/src/lcd/menu/menu_temperature.cpp +++ b/Marlin/src/lcd/menu/menu_temperature.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -31,10 +31,14 @@ #include "menu.h" #include "../../module/temperature.h" -#if FAN_COUNT > 1 +#if FAN_COUNT > 1 || ENABLED(SINGLENOZZLE) #include "../../module/motion.h" #endif +#if ENABLED(SINGLENOZZLE) + #include "../../module/tool_change.h" +#endif + // Initialized by settings.load() int16_t MarlinUI::preheat_hotend_temp[2], MarlinUI::preheat_bed_temp[2]; uint8_t MarlinUI::preheat_fan_speed[2]; @@ -44,7 +48,7 @@ uint8_t MarlinUI::preheat_fan_speed[2]; // void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb, const uint8_t fan) { - if (temph > 0) thermalManager.setTargetHotend(MIN(heater_maxtemp[endnum], temph), endnum); + if (temph > 0) thermalManager.setTargetHotend(MIN(heater_maxtemp[endnum] - 15, temph), endnum); #if HAS_HEATED_BED if (tempb >= 0) thermalManager.setTargetBed(tempb); #else @@ -52,9 +56,9 @@ void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb #endif #if FAN_COUNT > 0 #if FAN_COUNT > 1 - fan_speed[active_extruder < FAN_COUNT ? active_extruder : 0] = fan; + thermalManager.set_fan_speed(active_extruder < FAN_COUNT ? active_extruder : 0, fan); #else - fan_speed[0] = fan; + thermalManager.set_fan_speed(0, fan); #endif #else UNUSED(fan); @@ -292,13 +296,54 @@ void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb } void lcd_cooldown() { - zero_fan_speeds(); + thermalManager.zero_fan_speeds(); thermalManager.disable_all_heaters(); ui.return_to_status(); } #endif // HAS_TEMP_HOTEND || HAS_HEATED_BED +#if ENABLED(SPINDLE_LASER_ENABLE) + + extern uint8_t spindle_laser_power; + bool spindle_laser_enabled(); + void set_spindle_laser_enabled(const bool enabled); + #if ENABLED(SPINDLE_LASER_PWM) + void update_spindle_laser_power(); + #endif + + inline void _lcd_spindle_laser_off() { set_spindle_laser_enabled(false); } + inline void _lcd_spindle_laser_on(const bool is_M4) { + #if SPINDLE_DIR_CHANGE + set_spindle_direction(is_M4); + #endif + set_spindle_laser_enabled(true); + } + inline void _lcd_spindle_laser_on() { _lcd_spindle_laser_on(false); } + #if SPINDLE_DIR_CHANGE + inline void _lcd_spindle_on_reverse() { _lcd_spindle_laser_on(true); } + #endif + + void menu_spindle_laser() { + START_MENU(); + MENU_BACK(MSG_MAIN); + if (spindle_laser_enabled()) { + #if ENABLED(SPINDLE_LASER_PWM) + MENU_ITEM_EDIT_CALLBACK(int3, MSG_LASER_POWER, &spindle_laser_power, SPEED_POWER_MIN, SPEED_POWER_MAX, update_spindle_laser_power); + #endif + MENU_ITEM(function, MSG_LASER_OFF, _lcd_spindle_laser_off); + } + else { + MENU_ITEM(function, MSG_LASER_ON, _lcd_spindle_laser_on); + #if SPINDLE_DIR_CHANGE + MENU_ITEM(function, MSG_SPINDLE_REVERSE, _lcd_spindle_on_reverse); + #endif + } + END_MENU(); + } + +#endif // SPINDLE_LASER_ENABLE + void menu_temperature() { START_MENU(); MENU_BACK(MSG_MAIN); @@ -308,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 @@ -327,11 +372,22 @@ void menu_temperature() { #endif // HOTENDS > 2 #endif // HOTENDS > 1 + #if ENABLED(SINGLENOZZLE) + MENU_MULTIPLIER_ITEM_EDIT(uint16_3, MSG_NOZZLE_STANDBY, &singlenozzle_temp[active_extruder ? 0 : 1], 0, HEATER_0_MAXTEMP - 15); + #endif + // // 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 // @@ -339,21 +395,21 @@ void menu_temperature() { // #if FAN_COUNT > 0 #if HAS_FAN0 - MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_FAN_SPEED FAN_SPEED_1_SUFFIX, &fan_speed[0], 0, 255); + 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(int8, MSG_EXTRA_FAN_SPEED FAN_SPEED_1_SUFFIX, &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 - MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_FAN_SPEED " 2", &fan_speed[1], 0, 255); + #if HAS_FAN1 || (ENABLED(SINGLENOZZLE) && EXTRUDERS > 1) + 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(int8, MSG_EXTRA_FAN_SPEED " 2", &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 - MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_FAN_SPEED " 3", &fan_speed[2], 0, 255); + #if HAS_FAN2 || (ENABLED(SINGLENOZZLE) && EXTRUDERS > 2) + 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(int8, MSG_EXTRA_FAN_SPEED " 3", &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 @@ -364,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 @@ -383,6 +439,10 @@ void menu_temperature() { #endif // HAS_TEMP_HOTEND + #if ENABLED(SPINDLE_LASER_ENABLE) + MENU_ITEM(submenu, MSG_LASER_MENU, menu_spindle_laser); + #endif + END_MENU(); } diff --git a/Marlin/src/lcd/menu/menu_tmc.cpp b/Marlin/src/lcd/menu/menu_tmc.cpp new file mode 100644 index 000000000000..3d446495997a --- /dev/null +++ b/Marlin/src/lcd/menu/menu_tmc.cpp @@ -0,0 +1,352 @@ +/** + * 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 . + * + */ + +// +// TMC Menu +// + +#include "../../inc/MarlinConfigPre.h" + +#if HAS_TRINAMIC && HAS_LCD_MENU + +#include "menu.h" +#include "../../module/stepper_indirection.h" +#include "../../feature/tmc_util.h" + +#define TMC_EDIT_STORED_I_RMS(ST) MENU_ITEM_EDIT_CALLBACK(uint16_4, MSG_##ST, &stepper##ST.val_mA, 100, 3000, refresh_stepper_current_##ST) + +#if AXIS_IS_TMC(X) + void refresh_stepper_current_X() { stepperX.refresh_stepper_current(); } +#endif +#if AXIS_IS_TMC(Y) + void refresh_stepper_current_Y() { stepperY.refresh_stepper_current(); } +#endif +#if AXIS_IS_TMC(Z) + void refresh_stepper_current_Z() { stepperZ.refresh_stepper_current(); } +#endif +#if AXIS_IS_TMC(X2) + void refresh_stepper_current_X2() { stepperX2.refresh_stepper_current(); } +#endif +#if AXIS_IS_TMC(Y2) + void refresh_stepper_current_Y2() { stepperY2.refresh_stepper_current(); } +#endif +#if AXIS_IS_TMC(Z2) + void refresh_stepper_current_Z2() { stepperZ2.refresh_stepper_current(); } +#endif +#if AXIS_IS_TMC(Z3) + void refresh_stepper_current_Z3() { stepperZ3.refresh_stepper_current(); } +#endif +#if AXIS_IS_TMC(E0) + void refresh_stepper_current_E0() { stepperE0.refresh_stepper_current(); } +#endif +#if AXIS_IS_TMC(E1) + void refresh_stepper_current_E1() { stepperE1.refresh_stepper_current(); } +#endif +#if AXIS_IS_TMC(E2) + void refresh_stepper_current_E2() { stepperE2.refresh_stepper_current(); } +#endif +#if AXIS_IS_TMC(E3) + void refresh_stepper_current_E3() { stepperE3.refresh_stepper_current(); } +#endif +#if AXIS_IS_TMC(E4) + void refresh_stepper_current_E4() { stepperE4.refresh_stepper_current(); } +#endif +#if AXIS_IS_TMC(E5) + void refresh_stepper_current_E5() { stepperE5.refresh_stepper_current(); } +#endif + +void menu_tmc_current() { + START_MENU(); + MENU_BACK(MSG_TMC_DRIVERS); + #if AXIS_IS_TMC(X) + TMC_EDIT_STORED_I_RMS(X); + #endif + #if AXIS_IS_TMC(Y) + TMC_EDIT_STORED_I_RMS(Y); + #endif + #if AXIS_IS_TMC(Z) + TMC_EDIT_STORED_I_RMS(Z); + #endif + #if AXIS_IS_TMC(X2) + TMC_EDIT_STORED_I_RMS(X2); + #endif + #if AXIS_IS_TMC(Y2) + TMC_EDIT_STORED_I_RMS(Y2); + #endif + #if AXIS_IS_TMC(Z2) + TMC_EDIT_STORED_I_RMS(Z2); + #endif + #if AXIS_IS_TMC(Z3) + TMC_EDIT_STORED_I_RMS(Z3); + #endif + #if AXIS_IS_TMC(E0) + TMC_EDIT_STORED_I_RMS(E0); + #endif + #if AXIS_IS_TMC(E1) + TMC_EDIT_STORED_I_RMS(E1); + #endif + #if AXIS_IS_TMC(E2) + TMC_EDIT_STORED_I_RMS(E2); + #endif + #if AXIS_IS_TMC(E3) + TMC_EDIT_STORED_I_RMS(E3); + #endif + #if AXIS_IS_TMC(E4) + TMC_EDIT_STORED_I_RMS(E4); + #endif + #if AXIS_IS_TMC(E5) + TMC_EDIT_STORED_I_RMS(E5); + #endif + END_MENU(); +} + +#if ENABLED(HYBRID_THRESHOLD) + + #define TMC_EDIT_STORED_HYBRID_THRS(ST) MENU_ITEM_EDIT_CALLBACK(uint8, MSG_##ST, &stepper##ST.stored.hybrid_thrs, 0, 255, refresh_hybrid_thrs_##ST); + + #if AXIS_HAS_STEALTHCHOP(X) + void refresh_hybrid_thrs_X() { stepperX.refresh_hybrid_thrs(planner.settings.axis_steps_per_mm[X_AXIS]); } + #endif + #if AXIS_HAS_STEALTHCHOP(Y) + void refresh_hybrid_thrs_Y() { stepperY.refresh_hybrid_thrs(planner.settings.axis_steps_per_mm[Y_AXIS]); } + #endif + #if AXIS_HAS_STEALTHCHOP(Z) + void refresh_hybrid_thrs_Z() { stepperZ.refresh_hybrid_thrs(planner.settings.axis_steps_per_mm[Z_AXIS]); } + #endif + #if AXIS_HAS_STEALTHCHOP(X2) + void refresh_hybrid_thrs_X2() { stepperX2.refresh_hybrid_thrs(planner.settings.axis_steps_per_mm[X_AXIS]); } + #endif + #if AXIS_HAS_STEALTHCHOP(Y2) + void refresh_hybrid_thrs_Y2() { stepperY2.refresh_hybrid_thrs(planner.settings.axis_steps_per_mm[Y_AXIS]); } + #endif + #if AXIS_HAS_STEALTHCHOP(Z2) + void refresh_hybrid_thrs_Z2() { stepperZ2.refresh_hybrid_thrs(planner.settings.axis_steps_per_mm[Z_AXIS]); } + #endif + #if AXIS_HAS_STEALTHCHOP(Z3) + void refresh_hybrid_thrs_Z3() { stepperZ3.refresh_hybrid_thrs(planner.settings.axis_steps_per_mm[Z_AXIS]); } + #endif + #if AXIS_HAS_STEALTHCHOP(E0) + void refresh_hybrid_thrs_E0() { stepperE0.refresh_hybrid_thrs(planner.settings.axis_steps_per_mm[E_AXIS]); } + #endif + #if AXIS_HAS_STEALTHCHOP(E1) + void refresh_hybrid_thrs_E1() { stepperE1.refresh_hybrid_thrs(planner.settings.axis_steps_per_mm[E_AXIS_N(1)]); } + #endif + #if AXIS_HAS_STEALTHCHOP(E2) + void refresh_hybrid_thrs_E2() { stepperE2.refresh_hybrid_thrs(planner.settings.axis_steps_per_mm[E_AXIS_N(2)]); } + #endif + #if AXIS_HAS_STEALTHCHOP(E3) + void refresh_hybrid_thrs_E3() { stepperE3.refresh_hybrid_thrs(planner.settings.axis_steps_per_mm[E_AXIS_N(3)]); } + #endif + #if AXIS_HAS_STEALTHCHOP(E4) + void refresh_hybrid_thrs_E4() { stepperE4.refresh_hybrid_thrs(planner.settings.axis_steps_per_mm[E_AXIS_N(4)]); } + #endif + #if AXIS_HAS_STEALTHCHOP(E5) + void refresh_hybrid_thrs_E5() { stepperE5.refresh_hybrid_thrs(planner.settings.axis_steps_per_mm[E_AXIS_N(5)]); } + #endif + + void menu_tmc_hybrid_thrs() { + START_MENU(); + MENU_BACK(MSG_TMC_DRIVERS); + #if AXIS_HAS_STEALTHCHOP(X) + TMC_EDIT_STORED_HYBRID_THRS(X); + #endif + #if AXIS_HAS_STEALTHCHOP(Y) + TMC_EDIT_STORED_HYBRID_THRS(Y); + #endif + #if AXIS_HAS_STEALTHCHOP(Z) + TMC_EDIT_STORED_HYBRID_THRS(Z); + #endif + #if AXIS_HAS_STEALTHCHOP(X2) + TMC_EDIT_STORED_HYBRID_THRS(X2); + #endif + #if AXIS_HAS_STEALTHCHOP(Y2) + TMC_EDIT_STORED_HYBRID_THRS(Y2); + #endif + #if AXIS_HAS_STEALTHCHOP(Z2) + TMC_EDIT_STORED_HYBRID_THRS(Z2); + #endif + #if AXIS_HAS_STEALTHCHOP(Z3) + TMC_EDIT_STORED_HYBRID_THRS(Z3); + #endif + #if AXIS_HAS_STEALTHCHOP(E0) + TMC_EDIT_STORED_HYBRID_THRS(E0); + #endif + #if AXIS_HAS_STEALTHCHOP(E1) + TMC_EDIT_STORED_HYBRID_THRS(E1); + #endif + #if AXIS_HAS_STEALTHCHOP(E2) + TMC_EDIT_STORED_HYBRID_THRS(E2); + #endif + #if AXIS_HAS_STEALTHCHOP(E3) + TMC_EDIT_STORED_HYBRID_THRS(E3); + #endif + #if AXIS_HAS_STEALTHCHOP(E4) + TMC_EDIT_STORED_HYBRID_THRS(E4); + #endif + #if AXIS_HAS_STEALTHCHOP(E5) + TMC_EDIT_STORED_HYBRID_THRS(E5); + #endif + END_MENU(); + } + +#endif + +#if ENABLED(SENSORLESS_HOMING) + + #define TMC_EDIT_STORED_SGT(ST) MENU_ITEM_EDIT_CALLBACK(int8, MSG_##ST, &stepper##ST.stored.homing_thrs, -64, 63, refresh_homing_thrs_##ST); + + #if X_SENSORLESS + void refresh_homing_thrs_X() { stepperX.refresh_homing_thrs(); } + #endif + #if Y_SENSORLESS + void refresh_homing_thrs_Y() { stepperY.refresh_homing_thrs(); } + #endif + #if Z_SENSORLESS + void refresh_homing_thrs_Z() { stepperZ.refresh_homing_thrs(); } + #endif + + void menu_tmc_homing_thrs() { + START_MENU(); + MENU_BACK(MSG_TMC_DRIVERS); + #if X_SENSORLESS + TMC_EDIT_STORED_SGT(X); + #endif + #if Y_SENSORLESS + TMC_EDIT_STORED_SGT(Y); + #endif + #if Z_SENSORLESS + TMC_EDIT_STORED_SGT(Z); + #endif + END_MENU(); + } + +#endif + +#if HAS_STEALTHCHOP + + #define TMC_EDIT_STEP_MODE(ST) MENU_ITEM_EDIT_CALLBACK(bool, MSG_##ST, &stepper##ST.stored.stealthChop_enabled, refresh_stepping_mode_##ST) + + #if AXIS_HAS_STEALTHCHOP(X) + void refresh_stepping_mode_X() { stepperX.refresh_stepping_mode(); } + #endif + #if AXIS_HAS_STEALTHCHOP(Y) + void refresh_stepping_mode_Y() { stepperY.refresh_stepping_mode(); } + #endif + #if AXIS_HAS_STEALTHCHOP(Z) + void refresh_stepping_mode_Z() { stepperZ.refresh_stepping_mode(); } + #endif + #if AXIS_HAS_STEALTHCHOP(X2) + void refresh_stepping_mode_X2() { stepperX2.refresh_stepping_mode(); } + #endif + #if AXIS_HAS_STEALTHCHOP(Y2) + void refresh_stepping_mode_Y2() { stepperY2.refresh_stepping_mode(); } + #endif + #if AXIS_HAS_STEALTHCHOP(Z2) + void refresh_stepping_mode_Z2() { stepperZ2.refresh_stepping_mode(); } + #endif + #if AXIS_HAS_STEALTHCHOP(Z3) + void refresh_stepping_mode_Z3() { stepperZ3.refresh_stepping_mode(); } + #endif + #if AXIS_HAS_STEALTHCHOP(E0) + void refresh_stepping_mode_E0() { stepperE0.refresh_stepping_mode(); } + #endif + #if AXIS_HAS_STEALTHCHOP(E1) + void refresh_stepping_mode_E1() { stepperE1.refresh_stepping_mode(); } + #endif + #if AXIS_HAS_STEALTHCHOP(E2) + void refresh_stepping_mode_E2() { stepperE2.refresh_stepping_mode(); } + #endif + #if AXIS_HAS_STEALTHCHOP(E3) + void refresh_stepping_mode_E3() { stepperE3.refresh_stepping_mode(); } + #endif + #if AXIS_HAS_STEALTHCHOP(E4) + void refresh_stepping_mode_E4() { stepperE4.refresh_stepping_mode(); } + #endif + #if AXIS_HAS_STEALTHCHOP(E5) + void refresh_stepping_mode_E5() { stepperE5.refresh_stepping_mode(); } + #endif + + void menu_tmc_step_mode() { + START_MENU(); + STATIC_ITEM(MSG_TMC_STEALTH_ENABLED); + MENU_BACK(MSG_TMC_DRIVERS); + #if AXIS_HAS_STEALTHCHOP(X) + TMC_EDIT_STEP_MODE(X); + #endif + #if AXIS_HAS_STEALTHCHOP(Y) + TMC_EDIT_STEP_MODE(Y); + #endif + #if AXIS_HAS_STEALTHCHOP(Z) + TMC_EDIT_STEP_MODE(Z); + #endif + #if AXIS_HAS_STEALTHCHOP(X2) + TMC_EDIT_STEP_MODE(X2); + #endif + #if AXIS_HAS_STEALTHCHOP(Y2) + TMC_EDIT_STEP_MODE(Y2); + #endif + #if AXIS_HAS_STEALTHCHOP(Z2) + TMC_EDIT_STEP_MODE(Z2); + #endif + #if AXIS_HAS_STEALTHCHOP(Z3) + TMC_EDIT_STEP_MODE(Z3); + #endif + #if AXIS_HAS_STEALTHCHOP(E0) + TMC_EDIT_STEP_MODE(E0); + #endif + #if AXIS_HAS_STEALTHCHOP(E1) + TMC_EDIT_STEP_MODE(E1); + #endif + #if AXIS_HAS_STEALTHCHOP(E2) + TMC_EDIT_STEP_MODE(E2); + #endif + #if AXIS_HAS_STEALTHCHOP(E3) + TMC_EDIT_STEP_MODE(E3); + #endif + #if AXIS_HAS_STEALTHCHOP(E4) + TMC_EDIT_STEP_MODE(E4); + #endif + #if AXIS_HAS_STEALTHCHOP(E5) + TMC_EDIT_STEP_MODE(E5); + #endif + END_MENU(); + } + +#endif + +void menu_tmc() { + START_MENU(); + MENU_BACK(MSG_CONTROL); + MENU_ITEM(submenu, MSG_TMC_CURRENT, menu_tmc_current); + #if ENABLED(HYBRID_THRESHOLD) + MENU_ITEM(submenu, MSG_TMC_HYBRID_THRS, menu_tmc_hybrid_thrs); + #endif + #if ENABLED(SENSORLESS_HOMING) + MENU_ITEM(submenu, MSG_TMC_HOMING_THRS, menu_tmc_homing_thrs); + #endif + #if HAS_STEALTHCHOP + MENU_ITEM(submenu, MSG_TMC_STEPPING_MODE, menu_tmc_step_mode); + #endif + END_MENU(); +} + +#endif // HAS_TRINAMIC diff --git a/Marlin/src/lcd/menu/menu_tune.cpp b/Marlin/src/lcd/menu/menu_tune.cpp index b3e41fa5d0a3..1044b7076b34 100644 --- a/Marlin/src/lcd/menu/menu_tune.cpp +++ b/Marlin/src/lcd/menu/menu_tune.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -38,53 +38,87 @@ #include "../../feature/bedlevel/bedlevel.h" #endif +#if ENABLED(SINGLENOZZLE) + #include "../../module/tool_change.h" +#endif + // Refresh the E factor after changing flow -void _lcd_refresh_e_factor_0() { planner.refresh_e_factor(0); } -#if EXTRUDERS > 1 - void _lcd_refresh_e_factor() { planner.refresh_e_factor(active_extruder); } - void _lcd_refresh_e_factor_1() { planner.refresh_e_factor(1); } - #if EXTRUDERS > 2 - void _lcd_refresh_e_factor_2() { planner.refresh_e_factor(2); } - #if EXTRUDERS > 3 - void _lcd_refresh_e_factor_3() { planner.refresh_e_factor(3); } - #if EXTRUDERS > 4 - void _lcd_refresh_e_factor_4() { planner.refresh_e_factor(4); } - #if EXTRUDERS > 5 - void _lcd_refresh_e_factor_5() { planner.refresh_e_factor(5); } - #endif // EXTRUDERS > 5 - #endif // EXTRUDERS > 4 - #endif // EXTRUDERS > 3 - #endif // EXTRUDERS > 2 -#endif // EXTRUDERS > 1 +#if EXTRUDERS + void _lcd_refresh_e_factor_0() { planner.refresh_e_factor(0); } + #if EXTRUDERS > 1 + void _lcd_refresh_e_factor() { planner.refresh_e_factor(active_extruder); } + void _lcd_refresh_e_factor_1() { planner.refresh_e_factor(1); } + #if EXTRUDERS > 2 + void _lcd_refresh_e_factor_2() { planner.refresh_e_factor(2); } + #if EXTRUDERS > 3 + void _lcd_refresh_e_factor_3() { planner.refresh_e_factor(3); } + #if EXTRUDERS > 4 + void _lcd_refresh_e_factor_4() { planner.refresh_e_factor(4); } + #if EXTRUDERS > 5 + void _lcd_refresh_e_factor_5() { planner.refresh_e_factor(5); } + #endif // EXTRUDERS > 5 + #endif // EXTRUDERS > 4 + #endif // EXTRUDERS > 3 + #endif // EXTRUDERS > 2 + #endif // EXTRUDERS > 1 +#endif // EXTRUDERS #if ENABLED(BABYSTEPPING) - long babysteps_done = 0; + #include "../../feature/babystep.h" + #include "../lcdprint.h" + #if HAS_GRAPHICAL_LCD + #include "../dogm/ultralcd_DOGM.h" + #endif - void _lcd_babystep(const AxisEnum axis, PGM_P msg) { + void _lcd_babystep(const AxisEnum axis, PGM_P const msg) { if (ui.use_click()) return ui.goto_previous_screen_no_defer(); ui.encoder_direction_normal(); if (ui.encoderPosition) { - const int16_t babystep_increment = (int32_t)ui.encoderPosition * (BABYSTEP_MULTIPLICATOR); + const int16_t steps = int16_t(ui.encoderPosition) * (BABYSTEP_MULTIPLICATOR); ui.encoderPosition = 0; ui.refresh(LCDVIEW_REDRAW_NOW); - thermalManager.babystep_axis(axis, babystep_increment); - babysteps_done += babystep_increment; + babystep.add_steps(axis, steps); + } + if (ui.should_draw()) { + 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 } - if (ui.should_draw()) - draw_edit_screen(msg, ftostr43sign(planner.steps_to_mm[axis] * babysteps_done)); + } + + 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 @@ -101,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 @@ -110,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 @@ -129,11 +163,15 @@ void menu_tune() { #endif // HOTENDS > 2 #endif // HOTENDS > 1 + #if ENABLED(SINGLENOZZLE) + MENU_MULTIPLIER_ITEM_EDIT(uint16_3, MSG_NOZZLE_STANDBY, &singlenozzle_temp[active_extruder ? 0 : 1], 0, HEATER_0_MAXTEMP - 15); + #endif + // // 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 // @@ -141,21 +179,21 @@ void menu_tune() { // #if FAN_COUNT > 0 #if HAS_FAN0 - MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_FAN_SPEED FAN_SPEED_1_SUFFIX, &fan_speed[0], 0, 255); + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(uint8, 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(int8, MSG_EXTRA_FAN_SPEED FAN_SPEED_1_SUFFIX, &new_fan_speed[0], 3, 255); + MENU_MULTIPLIER_ITEM_EDIT(uint8, MSG_EXTRA_FAN_SPEED FAN_SPEED_1_SUFFIX, &thermalManager.new_fan_speed[0], 3, 255); #endif #endif - #if HAS_FAN1 - MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_FAN_SPEED " 2", &fan_speed[1], 0, 255); + #if 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); #if ENABLED(EXTRA_FAN_SPEED) - MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_EXTRA_FAN_SPEED " 2", &new_fan_speed[1], 3, 255); + MENU_MULTIPLIER_ITEM_EDIT(uint8, MSG_EXTRA_FAN_SPEED " 2", &thermalManager.new_fan_speed[1], 3, 255); #endif #endif - #if HAS_FAN2 - MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_FAN_SPEED " 3", &fan_speed[2], 0, 255); + #if 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); #if ENABLED(EXTRA_FAN_SPEED) - MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_EXTRA_FAN_SPEED " 3", &new_fan_speed[2], 3, 255); + MENU_MULTIPLIER_ITEM_EDIT(uint8, MSG_EXTRA_FAN_SPEED " 3", &thermalManager.new_fan_speed[2], 3, 255); #endif #endif #endif // FAN_COUNT > 0 @@ -166,7 +204,7 @@ void menu_tune() { // #if EXTRUDERS == 1 MENU_ITEM_EDIT_CALLBACK(int3, MSG_FLOW, &planner.flow_percentage[0], 10, 999, _lcd_refresh_e_factor_0); - #else // EXTRUDERS > 1 + #elif EXTRUDERS MENU_ITEM_EDIT_CALLBACK(int3, MSG_FLOW, &planner.flow_percentage[active_extruder], 10, 999, _lcd_refresh_e_factor); #define EDIT_FLOW(N) MENU_ITEM_EDIT_CALLBACK(int3, MSG_FLOW MSG_LCD_N##N, &planner.flow_percentage[N], 10, 999, _lcd_refresh_e_factor_##N) EDIT_FLOW(0); @@ -183,7 +221,7 @@ void menu_tune() { #endif // EXTRUDERS > 4 #endif // EXTRUDERS > 3 #endif // EXTRUDERS > 2 - #endif // EXTRUDERS > 1 + #endif // EXTRUDERS // // Babystep X: diff --git a/Marlin/src/lcd/menu/menu_ubl.cpp b/Marlin/src/lcd/menu/menu_ubl.cpp index 146c9268f1b2..8b182b89b938 100644 --- a/Marlin/src/lcd/menu/menu_ubl.cpp +++ b/Marlin/src/lcd/menu/menu_ubl.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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(); @@ -296,7 +296,7 @@ void _menu_ubl_fillin() { void _lcd_ubl_invalidate() { ubl.invalidate(); - SERIAL_PROTOCOLLNPGM("Mesh invalidated."); + SERIAL_ECHOLNPGM("Mesh invalidated."); } /** @@ -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(); } /** @@ -459,24 +471,35 @@ void _lcd_ubl_output_map_lcd() { ui.encoder_direction_normal(); if (ui.encoderPosition) { - step_scaler += (int32_t)ui.encoderPosition; + step_scaler += int16_t(ui.encoderPosition); x_plot += step_scaler / (ENCODER_STEPS_PER_MENU_ITEM); - 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 + + 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; - // 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; + // 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; - // 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); + #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); @@ -589,8 +615,10 @@ void _lcd_ubl_step_by_step() { void _lcd_ubl_level_bed() { START_MENU(); MENU_BACK(MSG_MOTION); - MENU_ITEM(gcode, MSG_UBL_ACTIVATE_MESH, PSTR("G29 A")); - MENU_ITEM(gcode, MSG_UBL_DEACTIVATE_MESH, PSTR("G29 D")); + if (planner.leveling_active) + MENU_ITEM(gcode, MSG_UBL_DEACTIVATE_MESH, PSTR("G29 D")); + else + MENU_ITEM(gcode, MSG_UBL_ACTIVATE_MESH, PSTR("G29 A")); MENU_ITEM(submenu, MSG_UBL_STEP_BY_STEP_MENU, _lcd_ubl_step_by_step); MENU_ITEM(function, MSG_UBL_MESH_EDIT, _lcd_ubl_output_map_lcd_cmd); MENU_ITEM(submenu, MSG_UBL_STORAGE_MESH_MENU, _lcd_ubl_storage_mesh); diff --git a/Marlin/src/lcd/thermistornames.h b/Marlin/src/lcd/thermistornames.h index 02f2bfe0a9f1..ea7998e33f80 100644 --- a/Marlin/src/lcd/thermistornames.h +++ b/Marlin/src/lcd/thermistornames.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -98,8 +98,12 @@ #define THERMISTOR_NAME "Einstart S" // High Temperature thermistors +#elif THERMISTOR_ID == 61 + #define THERMISTOR_NAME "Formbot 350°C" #elif THERMISTOR_ID == 66 #define THERMISTOR_NAME "Dyze 4.7M" +#elif THERMISTOR_ID == 67 + #define THERMISTOR_NAME "SliceEng 450°C" // Dummies for dev testing #elif THERMISTOR_ID == 998 diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index 640dc74ae715..cf1f8f98ea76 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -23,12 +23,10 @@ #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; - #if ENABLED(SDSUPPORT) - #include "../sd/cardreader.h" - #endif + #include "../sd/cardreader.h" #if ENABLED(EXTENSIBLE_UI) #define START_OF_UTF8_CHAR(C) (((C) & 0xC0u) != 0x80u) #endif @@ -54,6 +52,10 @@ char MarlinUI::status_message[MAX_MESSAGE_LENGTH + 1]; #endif +#if ENABLED(LCD_SET_PROGRESS_MANUALLY) + uint8_t MarlinUI::progress_bar_percent; // = 0 +#endif + #if HAS_SPI_LCD #if HAS_GRAPHICAL_LCD @@ -83,6 +85,10 @@ #include "../libs/buzzer.h" #endif +#if HAS_TRINAMIC + #include "../feature/tmc_util.h" +#endif + #if HAS_ENCODER_ACTION volatile uint8_t MarlinUI::buttons; #if HAS_SLOW_BUTTONS @@ -100,14 +106,10 @@ 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 -#if ENABLED(LCD_SET_PROGRESS_MANUALLY) - uint8_t MarlinUI::progress_bar_percent; // = 0 -#endif - millis_t next_button_update_ms; #if HAS_GRAPHICAL_LCD @@ -116,7 +118,7 @@ millis_t next_button_update_ms; // Encoder Handling #if HAS_ENCODER_ACTION - uint32_t MarlinUI::encoderPosition; + uint16_t MarlinUI::encoderPosition; volatile int8_t encoderDiff; // Updated in update_buttons, added to encoderPosition every LCD update #endif @@ -179,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 @@ -190,7 +192,25 @@ millis_t next_button_update_ms; #endif -#endif + void wrap_string(uint8_t y, const char * const string) { + uint8_t x = LCD_WIDTH; + if (string) { + uint8_t *p = (uint8_t*)string; + for (;;) { + if (x >= LCD_WIDTH) { + x = 0; + SETCURSOR(0, y++); + } + wchar_t ch; + p = get_utf8_value_cb(p, read_byte_ram, &ch); + if (!ch) break; + lcd_put_wchar(ch); + x++; + } + } + } + +#endif // HAS_LCD_MENU void MarlinUI::init() { @@ -258,10 +278,8 @@ void MarlinUI::init() { encoderDiff = 0; #endif - #if ENABLED(MARLIN_DEV_MODE) - // Start timer 5 at full speed - SET_CS(5, PRESCALER_1); - SET_COM(5, A, NORMAL); + #if HAS_TRINAMIC && HAS_LCD_MENU + init_tmc_section(); #endif } @@ -397,20 +415,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 @@ -427,7 +431,8 @@ void MarlinUI::status_screen() { // #if DISABLED(PROGRESS_MSG_ONCE) || (PROGRESS_MSG_EXPIRE > 0) - millis_t ms = millis(); + #define GOT_MS + const millis_t ms = millis(); #endif // If the message will blink rather than expire... @@ -462,7 +467,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); @@ -472,31 +477,40 @@ void MarlinUI::status_screen() { #endif // HAS_LCD_MENU - #if ENABLED(ULTIPANEL_FEEDMULTIPLY) && HAS_ENCODER_ACTION + #if ENABLED(ULTIPANEL_FEEDMULTIPLY) + + const int16_t old_frm = feedrate_percentage; + int16_t new_frm = old_frm + int16_t(encoderPosition); - const int16_t new_frm = feedrate_percentage + (int32_t)encoderPosition; // Dead zone at 100% feedrate - if ((feedrate_percentage < 100 && new_frm > 100) || (feedrate_percentage > 100 && new_frm < 100)) { - feedrate_percentage = 100; - encoderPosition = 0; + if (old_frm == 100) { + if (int16_t(encoderPosition) > ENCODER_FEEDRATE_DEADZONE) + new_frm -= ENCODER_FEEDRATE_DEADZONE; + else if (int16_t(encoderPosition) < -(ENCODER_FEEDRATE_DEADZONE)) + new_frm += ENCODER_FEEDRATE_DEADZONE; + else + new_frm = old_frm; } - else if (feedrate_percentage == 100) { - if ((int32_t)encoderPosition > ENCODER_FEEDRATE_DEADZONE) { - feedrate_percentage += (int32_t)encoderPosition - (ENCODER_FEEDRATE_DEADZONE); - encoderPosition = 0; - } - else if ((int32_t)encoderPosition < -(ENCODER_FEEDRATE_DEADZONE)) { - feedrate_percentage += (int32_t)encoderPosition + ENCODER_FEEDRATE_DEADZONE; - encoderPosition = 0; - } - } - else { + else if ((old_frm < 100 && new_frm > 100) || (old_frm > 100 && new_frm < 100)) + new_frm = 100; + + new_frm = constrain(new_frm, 10, 999); + + if (old_frm != new_frm) { feedrate_percentage = new_frm; encoderPosition = 0; + #if ENABLED(BEEP_ON_FEEDRATE_CHANGE) + static millis_t next_beep; + #ifndef GOT_MS + const millis_t ms = millis(); + #endif + if (ELAPSED(ms, next_beep)) { + BUZZ(FEEDRATE_CHANGE_BEEP_DURATION, FEEDRATE_CHANGE_BEEP_FREQUENCY); + next_beep = ms + 500UL; + } + #endif } - feedrate_percentage = constrain(feedrate_percentage, 10, 999); - #endif // ULTIPANEL_FEEDMULTIPLY draw_status_screen(); @@ -642,7 +656,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 @@ -654,6 +668,7 @@ void MarlinUI::update() { static uint16_t max_display_update_time = 0; static millis_t next_lcd_update_ms; + millis_t ms = millis(); #if HAS_LCD_MENU @@ -707,16 +722,20 @@ void MarlinUI::update() { } else { card.release(); - if (old_sd_status != 2) set_status_P(PSTR(MSG_SD_REMOVED)); + if (old_sd_status != 2) { + set_status_P(PSTR(MSG_SD_REMOVED)); + if (!on_status_screen()) return_to_status(); + } } refresh(); init_lcd(); // May revive the LCD if static electricity killed it + ms = millis(); + next_lcd_update_ms = ms + LCD_UPDATE_INTERVAL; // delay LCD update until after SD activity completes } #endif // SDSUPPORT && SD_DETECT_PIN - const millis_t ms = millis(); if (ELAPSED(ms, next_lcd_update_ms) #if HAS_GRAPHICAL_LCD || drawing_screen @@ -810,10 +829,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 @@ -917,16 +939,46 @@ void MarlinUI::update() { uint8_t ADCKeyNo; } _stADCKeypadTable_; + #ifndef ADC_BUTTONS_VALUE_SCALE + #define ADC_BUTTONS_VALUE_SCALE 1.0 // for the power voltage equal to the reference voltage + #endif + #ifndef ADC_BUTTONS_R_PULLUP + #define ADC_BUTTONS_R_PULLUP 4.7 // common pull-up resistor in the voltage divider + #endif + #ifndef ADC_BUTTONS_LEFT_R_PULLDOWN + #define ADC_BUTTONS_LEFT_R_PULLDOWN 0.47 // pull-down resistor for LEFT button voltage divider + #endif + #ifndef ADC_BUTTONS_RIGHT_R_PULLDOWN + #define ADC_BUTTONS_RIGHT_R_PULLDOWN 4.7 // pull-down resistor for RIGHT button voltage divider + #endif + #ifndef ADC_BUTTONS_UP_R_PULLDOWN + #define ADC_BUTTONS_UP_R_PULLDOWN 1.0 // pull-down resistor for UP button voltage divider + #endif + #ifndef ADC_BUTTONS_DOWN_R_PULLDOWN + #define ADC_BUTTONS_DOWN_R_PULLDOWN 10.0 // pull-down resistor for DOWN button voltage divider + #endif + #ifndef ADC_BUTTONS_MIDDLE_R_PULLDOWN + #define ADC_BUTTONS_MIDDLE_R_PULLDOWN 2.2 // pull-down resistor for MIDDLE button voltage divider + #endif + + // Calculate the ADC value for the voltage divider with specified pull-down resistor value + #define ADC_BUTTON_VALUE(r) (int(4096.0 * (ADC_BUTTONS_VALUE_SCALE) * r / (r + ADC_BUTTONS_R_PULLUP))) + static const _stADCKeypadTable_ stADCKeyTable[] PROGMEM = { // VALUE_MIN, VALUE_MAX, KEY { 4000, 4096, 1 + BLEN_KEYPAD_F1 }, // F1 { 4000, 4096, 1 + BLEN_KEYPAD_F2 }, // F2 { 4000, 4096, 1 + BLEN_KEYPAD_F3 }, // F3 - { 300, 500, 1 + BLEN_KEYPAD_LEFT }, // LEFT - { 1900, 2200, 1 + BLEN_KEYPAD_RIGHT }, // RIGHT - { 570, 870, 1 + BLEN_KEYPAD_UP }, // UP - { 2670, 2870, 1 + BLEN_KEYPAD_DOWN }, // DOWN - { 1150, 1450, 1 + BLEN_KEYPAD_MIDDLE }, // ENTER + { ADC_BUTTON_VALUE(ADC_BUTTONS_LEFT_R_PULLDOWN) - 100, + ADC_BUTTON_VALUE(ADC_BUTTONS_LEFT_R_PULLDOWN) + 100, 1 + BLEN_KEYPAD_LEFT }, // LEFT ( 272 ... 472) + { ADC_BUTTON_VALUE(ADC_BUTTONS_RIGHT_R_PULLDOWN) - 100, + ADC_BUTTON_VALUE(ADC_BUTTONS_RIGHT_R_PULLDOWN) + 100, 1 + BLEN_KEYPAD_RIGHT }, // RIGHT (1948 ... 2148) + { ADC_BUTTON_VALUE(ADC_BUTTONS_UP_R_PULLDOWN) - 100, + ADC_BUTTON_VALUE(ADC_BUTTONS_UP_R_PULLDOWN) + 100, 1 + BLEN_KEYPAD_UP }, // UP ( 618 ... 818) + { ADC_BUTTON_VALUE(ADC_BUTTONS_DOWN_R_PULLDOWN) - 100, + ADC_BUTTON_VALUE(ADC_BUTTONS_DOWN_R_PULLDOWN) + 100, 1 + BLEN_KEYPAD_DOWN }, // DOWN (2686 ... 2886) + { ADC_BUTTON_VALUE(ADC_BUTTONS_MIDDLE_R_PULLDOWN) - 100, + ADC_BUTTON_VALUE(ADC_BUTTONS_MIDDLE_R_PULLDOWN) + 100, 1 + BLEN_KEYPAD_MIDDLE }, // ENTER (1205 ... 1405) }; uint8_t get_ADC_keyValue(void) { @@ -943,7 +995,8 @@ void MarlinUI::update() { } return 0; } -#endif + +#endif // HAS_ADC_BUTTONS #if HAS_ENCODER_ACTION @@ -978,7 +1031,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; @@ -1004,7 +1057,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; @@ -1043,15 +1096,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 @@ -1132,7 +1185,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); @@ -1145,11 +1213,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 @@ -1184,7 +1252,7 @@ void MarlinUI::update() { strncpy(status_message, message, maxLen); status_message[maxLen] = '\0'; - finishstatus(persist); + finish_status(persist); } #include @@ -1196,7 +1264,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) { @@ -1223,7 +1291,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) { @@ -1242,8 +1310,17 @@ void MarlinUI::update() { static const char paused[] PROGMEM = MSG_PRINT_PAUSED; static const char printing[] PROGMEM = MSG_PRINTING; static const char welcome[] PROGMEM = WELCOME_MSG; + #if SERVICE_INTERVAL_1 > 0 + static const char service1[] PROGMEM = { "> " SERVICE_NAME_1 "!" }; + #endif + #if SERVICE_INTERVAL_2 > 0 + static const char service2[] PROGMEM = { "> " SERVICE_NAME_2 "!" }; + #endif + #if SERVICE_INTERVAL_3 > 0 + static const char service3[] PROGMEM = { "> " SERVICE_NAME_3 "!" }; + #endif PGM_P msg; - if (print_job_timer.isPaused()) + if (!IS_SD_PRINTING() && print_job_timer.isPaused()) msg = paused; #if ENABLED(SDSUPPORT) else if (IS_SD_PRINTING()) @@ -1251,10 +1328,35 @@ void MarlinUI::update() { #endif else if (print_job_timer.isRunning()) msg = printing; + + #if SERVICE_INTERVAL_1 > 0 + else if (print_job_timer.needsService(1)) msg = service1; + #endif + #if SERVICE_INTERVAL_2 > 0 + else if (print_job_timer.needsService(2)) msg = service2; + #endif + #if SERVICE_INTERVAL_3 > 0 + else if (print_job_timer.needsService(3)) msg = service3; + #endif + else msg = welcome; set_status_P(msg, -1); } -#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 + +#endif // HAS_SPI_LCD || EXTENSIBLE_UI diff --git a/Marlin/src/lcd/ultralcd.h b/Marlin/src/lcd/ultralcd.h index 54eb239b9df9..be694ddfe4bb 100644 --- a/Marlin/src/lcd/ultralcd.h +++ b/Marlin/src/lcd/ultralcd.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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" @@ -50,18 +56,24 @@ uint8_t get_ADC_keyValue(); #endif - #if HAS_GRAPHICAL_LCD - #define SETCURSOR(col, row) lcd_moveto(col * (MENU_FONT_WIDTH), (row + 1) * (MENU_FONT_HEIGHT)) - #define SETCURSOR_RJ(len, row) lcd_moveto(LCD_PIXEL_WIDTH - len * (MENU_FONT_WIDTH), (row + 1) * (MENU_FONT_HEIGHT)) - #else - #define SETCURSOR(col, row) lcd_moveto(col, row) - #define SETCURSOR_RJ(len, row) lcd_moveto(LCD_WIDTH - len, row) - #endif - #define LCD_UPDATE_INTERVAL 100 #if HAS_LCD_MENU + #if HAS_GRAPHICAL_LCD + #define SETCURSOR(col, row) lcd_moveto(col * (MENU_FONT_WIDTH), (row + 1) * (MENU_FONT_HEIGHT)) + #define SETCURSOR_RJ(len, row) lcd_moveto(LCD_PIXEL_WIDTH - (len) * (MENU_FONT_WIDTH), (row + 1) * (MENU_FONT_HEIGHT)) + #define LCDPRINT(p) u8g.print(p) + #define LCDWRITE(c) u8g.print(c) + #else + #define SETCURSOR(col, row) lcd_moveto(col, row) + #define SETCURSOR_RJ(len, row) lcd_moveto(LCD_WIDTH - (len), row) + #define LCDPRINT(p) lcd_put_u8str(p) + #define LCDWRITE(c) lcd_put_wchar(c) + #endif + + void wrap_string(uint8_t y, const char * const string); + #if ENABLED(SDSUPPORT) #include "../sd/cardreader.h" #endif @@ -74,8 +86,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 @@ -129,7 +141,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) @@ -173,7 +184,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 @@ -252,7 +264,7 @@ class MarlinUI { 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); @@ -267,10 +279,25 @@ class MarlinUI { 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; + static void set_progress(const uint8_t progress) { progress_bar_percent = MIN(progress, 100); } + #endif + static uint8_t get_progress(); + #else + static constexpr uint8_t get_progress() { return 0; } + #endif + #if HAS_SPI_LCD static bool detected(); @@ -307,28 +334,15 @@ class MarlinUI { #endif - #if ENABLED(STATUS_MESSAGE_SCROLLING) - static uint8_t status_scroll_offset; - #endif static uint8_t lcd_status_update_delay; - #if HAS_PRINT_PROGRESS - #if ENABLED(LCD_SET_PROGRESS_MANUALLY) - static uint8_t progress_bar_percent; - static void set_progress(const uint8_t progress) { progress_bar_percent = MIN(progress, 100); } - #endif - static uint8_t get_progress(); - #else - static constexpr uint8_t get_progress() { return 0; } - #endif - #if HAS_LCD_CONTRAST static int16_t contrast; static void set_contrast(const int16_t value); static inline void refresh_contrast() { set_contrast(contrast); } #endif - #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) + #if BOTH(FILAMENT_LCD_DISPLAY, SDSUPPORT) static millis_t next_filament_display; #endif @@ -407,7 +421,7 @@ class MarlinUI { 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 uint16_t encoder=0, const uint8_t top=0, const uint8_t items=0); static void save_previous_screen(); static void goto_previous_screen(); static void return_to_status(); @@ -418,7 +432,7 @@ class MarlinUI { 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 @@ -451,13 +465,13 @@ class MarlinUI { #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; } @@ -478,11 +492,11 @@ class MarlinUI { #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 - static uint32_t encoderPosition; + static uint16_t encoderPosition; #if ENABLED(REVERSE_ENCODER_DIRECTION) #define ENCODERBASE -1 @@ -510,7 +524,7 @@ class MarlinUI { 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/000_l6470_read_me.md b/Marlin/src/libs/L6470/000_l6470_read_me.md new file mode 100644 index 000000000000..712ced551b79 --- /dev/null +++ b/Marlin/src/libs/L6470/000_l6470_read_me.md @@ -0,0 +1,105 @@ +Arduino-6470 library revision 0.7.0 or above is required. + +This software can be used with any L647x chip and the powerSTEP01. L647x and powerSTEP01 devices can not be mixed within a system. A flag in the library must be set to enable use of a powerSTEP01. + +These devices use voltage PWMs to drive the stepper phases. Phase current is not directly controlled. Each microstep corresponds to a particular PWM duty cycle. The KVAL\_HOLD register scales the PWM duty cycle. + +This software assumes that all L6470 drivers are in one SPI daisy chain. + +``` + The hardware setup is: + + MOSI from controller tied to SDI on the first device + + SDO of the first device is tied to SDI of the next device + + SDO of the last device is tied to MISO of the controller + + all devices share the same SCK, SS\_PIN and RESET\_PIN + + Each L6470 passes the data it saw on its SDI to its neighbor on the **NEXT** SPI cycle (8 bit delay). + + Each L6470 acts on the **last** SPI data it saw when the SS\_PIN **goes high**. +``` + +The L6470 drivers operate in STEP\_CLOCK mode. In this mode the direction and enable are done via SPI commands and the phase currents are changed in response to step pulses (generated in the usual way). + +There are two different SPI routines used. + +- **uint8\_t** L6470\_Transfer(uint8\_t data, int \_SSPin, const uint8\_t chain\_position) is used to setup the chips and by the maintenance/status code. This code uses the Arduino-6470 library. + +- **void** L6470\_Transfer(uint8\_t L6470\_buf[], const uint8\_t length) is used by the set\_directions() routine to send the direction/enable commands. The library is NOT used by this code. + +**HARDWARE/SOFTWARE interaction** + +Powering up a stepper and setting the direction are done by the same command. Can't do one without the other. + +**All** directions are set **every time** a new block is popped off the queue by the stepper ISR. + +SPI transfers, when setting the directions, are minimized by using arrays and a SPI routine dedicated to this function. L6470 library calls are not used. For N L6470 drivers, this results in a N byte transfer. If library calls were used then N\*N bytes would be sent. + +**Power up (reset) sequence:** + +1. Stepper objects are created before the **setup()** entry point is reached. + +2. After the **setup()** entry point is reached and before the steppers are initialized, L6470\_init() is called to do the following + +3. If present, the hardware reset is pulsed. + +4. The L6470\_chain array is populated during **setup()**. This array is used to tell where in the SPI stream the commands/data for an stepper is positioned. + +5. The L6470 soft SPI pins are initialized. + +6. The L6470 chips are initialized during **setup()**. They can be re-initialized using the **L6470\_init\_to\_defaults()** function + +The steppers are **NOT** powered up during this sequence. + +**L6470\_chain** array + +This array is used by all routines that transmit SPI data. + +``` + Location 0 - number of drivers in chain + + Location 1 - axis index for first device in the chain (closest to MOSI) + + ... + + Location N - axis index for last device in the N device long chain (closest to MISO) +``` + +**Direction set and enable** + +The DIR\_WRITE macros for the L6470 drivers are written so that the standard X, Y, Z and extruder logic used by the set\_directions() routine is not altered. These macros write the correct forward/reverse command to the corresponding location in the array *L6470\_dir\_commands*. + +At the end of the set\_directions() routine, the array *L6470\_chain* is used to grab the corresponding direction/enable commands out of the array *L6470\_dir\_commands* and put them in the correct sequence in the array *L6470\_buf*. Array *L6470\_buf* is then passed to the **void** L6470\_Transfer function which actually sends the data to the devices. + +**Utilities and misc** + +The **absolute position** registers should accurately reflect Marlin’s stepper position counts. They are set to zero during initialization. G28 sets them to the Marlin counts for the corresponding axis after homing. NOTE – these registers are often the negative of the Marlin counts. This is because the Marlin counts reflect the logical direction while the registers reflect the stepper direction. The register contents are displayed via the M114 D command. + +The **L6470\_monitor** feature reads the status of each device every half second. It will report if there are any error conditions present or if communications has been lost/restored. The KVAL\_HOLD value is reduced every 2 – 2.5 seconds if the thermal warning or thermal shutdown conditions are present. + +**M122** displays the settings of most of the bits in the status register plus a couple of other items. + +**M906** can be used to set the KVAL\_HOLD register one driver at a time. If a setting is not included with the command then the contents of the registers that affect the phase current/voltage are displayed. + +**M916, M917 & M918** + +These utilities are used to tune the system. They can get you in the ballpark for acceptable jerk, acceleration, top speed and KVAL\_HOLD settings. In general they seem to provide an overly optimistic KVAL\_HOLD setting because of the lag between setting KVAL\_HOLD and the driver reaching final temperature. Enabling the **L6470\_monitor** feature during prints will provide the **final useful KVAL\_HOLD setting**. + +The amount of power needed to move the stepper without skipping steps increases as jerk, acceleration and top speed increase. The power dissipated by the driver increases as the power to the stepper increases. The net result is a balancing act between jerk, acceleration, top speed and power dissipated by the driver. + +**M916 -** Increases KVAL\_HOLD while moving one axis until get thermal warning. This routine is also useful for determining the approximate KVAL\_HOLD where the stepper stops losing steps. The sound will get noticeably quieter as it stops losing steps. + +**M917 -** Find minimum current thresholds. This is done by doing the following steps while moving an axis: + +1. Decrease OCD current until overcurrent error + +2. Increase OCD until overcurrent error goes away + +3. Decrease stall threshold until stall error + +4. Increase stall until stall error goes away + +**M918 -** Increase speed until error or max feedrate achieved. diff --git a/Marlin/src/libs/L6470/L6470_Marlin.cpp b/Marlin/src/libs/L6470/L6470_Marlin.cpp new file mode 100644 index 000000000000..9e1fd2ca695d --- /dev/null +++ b/Marlin/src/libs/L6470/L6470_Marlin.cpp @@ -0,0 +1,796 @@ +/** + * 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 . + * + */ + +/** + * The monitor_driver routines are a close copy of the TMC code + */ + +#include "../../inc/MarlinConfig.h" + +#if HAS_DRIVER(L6470) + +#include "L6470_Marlin.h" + +L6470_Marlin L6470; + +#include "../stepper_indirection.h" +#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" }; + +bool L6470_Marlin::index_to_dir[MAX_L6470] = { + INVERT_X_DIR , // 0 X + INVERT_Y_DIR , // 1 Y + INVERT_Z_DIR , // 2 Z + #if ENABLED(X_DUAL_STEPPER_DRIVERS) + INVERT_X_DIR ^ INVERT_X2_VS_X_DIR , // 3 X2 + #else + INVERT_X_DIR , // 3 X2 + #endif + #if ENABLED(Y_DUAL_STEPPER_DRIVERS) + INVERT_Y_DIR ^ INVERT_Y2_VS_Y_DIR , // 4 Y2 + #else + INVERT_Y_DIR , // 4 Y2 + #endif + INVERT_Z_DIR , // 5 Z2 + INVERT_Z_DIR , // 6 Z3 + INVERT_E0_DIR , // 7 E0 + INVERT_E1_DIR , // 8 E1 + INVERT_E2_DIR , // 9 E2 + INVERT_E3_DIR , //10 E3 + INVERT_E4_DIR , //11 E4 + INVERT_E5_DIR , //12 E5 +}; + +uint8_t L6470_Marlin::axis_xref[MAX_L6470] = { + AxisEnum(X_AXIS), // X + AxisEnum(Y_AXIS), // Y + AxisEnum(Z_AXIS), // Z + AxisEnum(X_AXIS), // X2 + AxisEnum(Y_AXIS), // Y2 + AxisEnum(Z_AXIS), // Z2 + AxisEnum(Z_AXIS), // Z3 + AxisEnum(E_AXIS), // E0 + AxisEnum(E_AXIS), // E1 + AxisEnum(E_AXIS), // E2 + AxisEnum(E_AXIS), // E3 + AxisEnum(E_AXIS), // E4 + AxisEnum(E_AXIS) // E5 +}; + +volatile bool L6470_Marlin::spi_abort = false; +bool L6470_Marlin::spi_active = false; + +void L6470_Marlin::populate_chain_array() { + + #define _L6470_INIT_SPI(Q) do{ stepper##Q.set_chain_info(Q, Q##_CHAIN_POS); }while(0) + + #if AXIS_DRIVER_TYPE_X(L6470) + _L6470_INIT_SPI(X); + #endif + #if AXIS_DRIVER_TYPE_X2(L6470) + _L6470_INIT_SPI(X2); + #endif + #if AXIS_DRIVER_TYPE_Y(L6470) + _L6470_INIT_SPI(Y); + #endif + #if AXIS_DRIVER_TYPE_Y2(L6470) + _L6470_INIT_SPI(Y2); + #endif + #if AXIS_DRIVER_TYPE_Z(L6470) + _L6470_INIT_SPI(Z); + #endif + #if AXIS_DRIVER_TYPE_Z2(L6470) + _L6470_INIT_SPI(Z2); + #endif + #if AXIS_DRIVER_TYPE_Z3(L6470) + _L6470_INIT_SPI(Z3); + #endif + #if AXIS_DRIVER_TYPE_E0(L6470) + _L6470_INIT_SPI(E0); + #endif + #if AXIS_DRIVER_TYPE_E1(L6470) + _L6470_INIT_SPI(E1); + #endif + #if AXIS_DRIVER_TYPE_E2(L6470) + _L6470_INIT_SPI(E2); + #endif + #if AXIS_DRIVER_TYPE_E3(L6470) + _L6470_INIT_SPI(E3); + #endif + #if AXIS_DRIVER_TYPE_E4(L6470) + _L6470_INIT_SPI(E4); + #endif + #if AXIS_DRIVER_TYPE_E5(L6470) + _L6470_INIT_SPI(E5); + #endif +} + +void L6470_Marlin::init() { // Set up SPI and then init chips + #if PIN_EXISTS(L6470_RESET_CHAIN) + OUT_WRITE(L6470_RESET_CHAIN_PIN, LOW); // hardware reset of drivers + delay(1); + OUT_WRITE(L6470_RESET_CHAIN_PIN, HIGH); + delay(1); // need about 650uS for the chip to fully start up + #endif + populate_chain_array(); // Set up array to control where in the SPI transfer sequence a particular stepper's data goes + L6470_spi_init(); // Set up L6470 soft SPI pins + init_to_defaults(); // init the chips +} + +uint16_t L6470_Marlin::get_status(const uint8_t axis) { + + #define GET_L6470_STATUS(Q) stepper##Q.getStatus() + + switch (axis) { + #if AXIS_DRIVER_TYPE_X(L6470) + case 0: return GET_L6470_STATUS(X); + #endif + #if AXIS_DRIVER_TYPE_Y(L6470) + case 1: return GET_L6470_STATUS(Y); + #endif + #if AXIS_DRIVER_TYPE_Z(L6470) + case 2: return GET_L6470_STATUS(Z); + #endif + #if AXIS_DRIVER_TYPE_X2(L6470) + case 3: return GET_L6470_STATUS(X2); + #endif + #if AXIS_DRIVER_TYPE_Y2(L6470) + case 4: return GET_L6470_STATUS(Y2); + #endif + #if AXIS_DRIVER_TYPE_Z2(L6470) + case 5: return GET_L6470_STATUS(Z2); + #endif + #if AXIS_DRIVER_TYPE_Z3(L6470) + case 6: return GET_L6470_STATUS(Z3); + #endif + #if AXIS_DRIVER_TYPE_E0(L6470) + case 7: return GET_L6470_STATUS(E0); + #endif + #if AXIS_DRIVER_TYPE_E1(L6470) + case 8: return GET_L6470_STATUS(E1); + #endif + #if AXIS_DRIVER_TYPE_E2(L6470) + case 9: return GET_L6470_STATUS(E2); + #endif + #if AXIS_DRIVER_TYPE_E3(L6470) + case 10: return GET_L6470_STATUS(E3); + #endif + #if AXIS_DRIVER_TYPE_E4(L6470) + case 11: return GET_L6470_STATUS(E4); + #endif + #if AXIS_DRIVER_TYPE_E5(L6470) + case 12: return GET_L6470_STATUS(E5); + #endif + } + + return 0; // Not needed but kills a compiler warning +} + +uint32_t L6470_Marlin::get_param(uint8_t axis, uint8_t param) { + + #define GET_L6470_PARAM(Q) L6470_GETPARAM(param,Q) + + switch (axis) { + #if AXIS_DRIVER_TYPE_X(L6470) + case 0: return GET_L6470_PARAM(X); + #endif + #if AXIS_DRIVER_TYPE_Y(L6470) + case 1: return GET_L6470_PARAM(Y); + #endif + #if AXIS_DRIVER_TYPE_Z(L6470) + case 2: return GET_L6470_PARAM(Z); + #endif + #if AXIS_DRIVER_TYPE_X2(L6470) + case 3: return GET_L6470_PARAM(X2); + #endif + #if AXIS_DRIVER_TYPE_Y2(L6470) + case 4: return GET_L6470_PARAM(Y2); + #endif + #if AXIS_DRIVER_TYPE_Z2(L6470) + case 5: return GET_L6470_PARAM(Z2); + #endif + #if AXIS_DRIVER_TYPE_Z3(L6470) + case 6: return GET_L6470_PARAM(Z3); + #endif + #if AXIS_DRIVER_TYPE_E0(L6470) + case 7: return GET_L6470_PARAM(E0); + #endif + #if AXIS_DRIVER_TYPE_E1(L6470) + case 8: return GET_L6470_PARAM(E1); + #endif + #if AXIS_DRIVER_TYPE_E2(L6470) + case 9: return GET_L6470_PARAM(E2); + #endif + #if AXIS_DRIVER_TYPE_E3(L6470) + case 10: return GET_L6470_PARAM(E3); + #endif + #if AXIS_DRIVER_TYPE_E4(L6470) + case 11: return GET_L6470_PARAM(E4); + #endif + #if AXIS_DRIVER_TYPE_E5(L6470) + case 12: return GET_L6470_PARAM(E5); + #endif + } + + return 0 ; // not needed but kills a compiler warning +} + +void L6470_Marlin::set_param(uint8_t axis, uint8_t param, uint32_t value) { + + #define SET_L6470_PARAM(Q) stepper##Q.SetParam(param, value) + + switch (axis) { + #if AXIS_DRIVER_TYPE_X(L6470) + case 0: SET_L6470_PARAM(X); + #endif + #if AXIS_DRIVER_TYPE_Y(L6470) + case 1: SET_L6470_PARAM(Y); + #endif + #if AXIS_DRIVER_TYPE_Z(L6470) + case 2: SET_L6470_PARAM(Z); + #endif + #if AXIS_DRIVER_TYPE_X2(L6470) + case 3: SET_L6470_PARAM(X2); + #endif + #if AXIS_DRIVER_TYPE_Y2(L6470) + case 4: SET_L6470_PARAM(Y2); + #endif + #if AXIS_DRIVER_TYPE_Z2(L6470) + case 5: SET_L6470_PARAM(Z2); + #endif + #if AXIS_DRIVER_TYPE_Z3(L6470) + case 6: SET_L6470_PARAM(Z3); + #endif + #if AXIS_DRIVER_TYPE_E0(L6470) + case 7: SET_L6470_PARAM(E0); + #endif + #if AXIS_DRIVER_TYPE_E1(L6470) + case 8: SET_L6470_PARAM(E1); + #endif + #if AXIS_DRIVER_TYPE_E2(L6470) + case 9: SET_L6470_PARAM(E2); + #endif + #if AXIS_DRIVER_TYPE_E3(L6470) + case 10: SET_L6470_PARAM(E3); + #endif + #if AXIS_DRIVER_TYPE_E4(L6470) + case 11: SET_L6470_PARAM(E4); + #endif + #if AXIS_DRIVER_TYPE_E5(L6470) + case 12: SET_L6470_PARAM(E5); + #endif + } +} + +inline void echo_min_max(const char a, const float &min, const float &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) { + DEBUG_ECHOPAIR("over_current_threshold used : ", oct); + serialprintPGM(stall ? PSTR(" (Stall") : PSTR(" (OCD")); + DEBUG_ECHOLNPGM(" threshold)"); +} +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, + bool over_current_flag, uint8_t &OCD_TH_val, uint8_t &STALL_TH_val, uint16_t &over_current_threshold +) { + // Return TRUE if the calling routine needs to abort/kill + + uint16_t displacement = 0; // " = 0" to eliminate compiler warning + uint8_t j; // general purpose counter + + if (!all_axes_homed()) { + DEBUG_ECHOLNPGM("ERROR - home all before running this command"); + //return true; + } + + LOOP_XYZE(i) if (uint16_t _displacement = parser.intval(axis_codes[i])) { + displacement = _displacement; + uint8_t axis_offset = parser.byteval('J'); + axis_mon[0][0] = axis_codes[i]; // axis ASCII value (target character) + if (axis_offset >= 2 || axis_mon[0][0] == 'E') // Single axis, E0, or E1 + axis_mon[0][1] = axis_offset + '0'; + else if (axis_offset == 0) { // one or more axes + uint8_t driver_count_local = 0; // can't use "driver_count" directly as a subscript because it's passed by reference + for (j = 0; j < MAX_L6470; j++) // see how many drivers on this axis + if (axis_mon[0][0] == index_to_axis[j][0]) { + axis_mon[driver_count_local][0] = axis_mon[0][0]; + axis_mon[driver_count_local][1] = index_to_axis[j][1]; + axis_mon[driver_count_local][2] = index_to_axis[j][2]; // append end of string + axis_index[driver_count_local] = j; // set axis index + driver_count_local++; + } + driver_count = driver_count_local; + } + break; // only take first axis found + } + + // + // Position calcs & checks + // + + const float center[] = { + LOGICAL_X_POSITION(current_position[X_AXIS]), + LOGICAL_Y_POSITION(current_position[Y_AXIS]), + LOGICAL_Z_POSITION(current_position[Z_AXIS]), + current_position[E_AXIS] + }; + + switch (axis_mon[0][0]) { + default: position_max = position_min = 0; break; + + case 'X': { + position_min = center[X_AXIS] - displacement; + position_max = center[X_AXIS] + displacement; + echo_min_max('X', position_min, position_max); + if (false + #ifdef X_MIN_POS + || position_min < (X_MIN_POS) + #endif + #ifdef X_MAX_POS + || position_max > (X_MAX_POS) + #endif + ) { + err_out_of_bounds(); + return true; + } + } break; + + case 'Y': { + position_min = center[Y_AXIS] - displacement; + position_max = center[Y_AXIS] + displacement; + echo_min_max('Y', position_min, position_max); + if (false + #ifdef Y_MIN_POS + || position_min < (Y_MIN_POS) + #endif + #ifdef Y_MAX_POS + || position_max > (Y_MAX_POS) + #endif + ) { + err_out_of_bounds(); + return true; + } + } break; + + case 'Z': { + position_min = center[E_AXIS] - displacement; + position_max = center[E_AXIS] + displacement; + echo_min_max('Z', position_min, position_max); + if (false + #ifdef Z_MIN_POS + || position_min < (Z_MIN_POS) + #endif + #ifdef Z_MAX_POS + || position_max > (Z_MAX_POS) + #endif + ) { + err_out_of_bounds(); + return true; + } + } break; + + case 'E': { + position_min = center[E_AXIS] - displacement; + position_max = center[E_AXIS] + displacement; + echo_min_max('E', position_min, position_max); + } break; + } + + // + // Work on the drivers + // + for (uint8_t k = 0; k < driver_count; k++) { + bool not_found = true; + for (j = 1; j <= L6470::chain[0]; j++) { + const char * const ind_axis = index_to_axis[L6470::chain[j]]; + if (ind_axis[0] == axis_mon[k][0] && ind_axis[1] == axis_mon[k][1]) { // See if a L6470 driver + not_found = false; + break; + } + } + if (not_found) { + driver_count = k; + axis_mon[k][0] = ' '; // mark this entry invalid + break; + } + } + + if (driver_count == 0) { + DEBUG_ECHOLNPGM("ERROR - not a L6470 axis"); + return true; + } + + 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 + + // + // kVAL_HOLD checks & settings + // + + kval_hold = parser.byteval('K'); + if (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); + DEBUG_ECHOLNPAIR("KVAL_HOLD = ", kval_hold); + } + + // + // Overcurrent checks & settings + // + + if (over_current_flag) { + + uint8_t OCD_TH_val_local = 0, // compiler thinks OCD_TH_val is unused if use it directly + STALL_TH_val_local = 0; // just in case ... + + over_current_threshold = parser.intval('I'); + + if (over_current_threshold) { + + OCD_TH_val_local = over_current_threshold/375; + LIMIT(OCD_TH_val_local, 0, 15); + STALL_TH_val_local = over_current_threshold/31.25; + LIMIT(STALL_TH_val_local, 0, 127); + uint16_t OCD_TH_actual = (OCD_TH_val_local + 1) * 375, + STALL_TH_actual = (STALL_TH_val_local + 1) * 31.25; + if (OCD_TH_actual < STALL_TH_actual) { + OCD_TH_val_local++; + OCD_TH_actual = (OCD_TH_val_local + 1) * 375; + } + + DEBUG_ECHOLNPAIR("over_current_threshold specified: ", over_current_threshold); + echo_oct_used(STALL_TH_actual, true); + echo_oct_used(OCD_TH_actual, false); + + #define SET_OVER_CURRENT(Q) do { stepper##Q.SetParam(L6470_STALL_TH, STALL_TH_val_local); stepper##Q.SetParam(L6470_OCD_TH, OCD_TH_val_local);} while (0) + + for (j = 0; j < driver_count; j++) { + set_param(axis_index[j], L6470_STALL_TH, STALL_TH_val_local); + set_param(axis_index[j], L6470_OCD_TH, OCD_TH_val_local); + } + } + else { + // only get & print the OVER_CURRENT values from one of the drivers + STALL_TH_val_local = get_param(axis_index[0], L6470_STALL_TH); + OCD_TH_val_local = get_param(axis_index[0], L6470_OCD_TH); + + echo_oct_used((STALL_TH_val_local + 1) * 31.25, true); + echo_oct_used((OCD_TH_val_local + 1) * 375, false); + } // over_current_threshold + + for (j = 0; j < driver_count; j++) { // set all drivers on axis the same + set_param(axis_index[j], L6470_STALL_TH, STALL_TH_val_local); + set_param(axis_index[j], L6470_OCD_TH, OCD_TH_val_local); + } + + OCD_TH_val = OCD_TH_val_local; // force compiler to update the main routine's copy + STALL_TH_val = STALL_TH_val_local; // force compiler to update the main routine's copy + } // end of overcurrent + + // + // Feedrate + // + + final_feedrate = parser.floatval('F'); + if (final_feedrate == 0) { + static constexpr float default_max_feedrate[] = DEFAULT_MAX_FEEDRATE; + const uint8_t num_feedrates = COUNT(default_max_feedrate); + for (j = 0; j < num_feedrates; j++) { + if (axis_codes[j] == axis_mon[0][0]) { + final_feedrate = default_max_feedrate[j]; + break; + } + } + if (j == 3 && num_feedrates > 4) { // have more than one extruder feedrate + uint8_t extruder_num = axis_mon[0][1] - '0'; + if (j <= num_feedrates - extruder_num) // have a feedrate specifically for this extruder + final_feedrate = default_max_feedrate[j + extruder_num]; + else + final_feedrate = default_max_feedrate[3]; // use E0 feedrate for this extruder + } + final_feedrate *= 60; // convert to mm/minute + } // end of feedrate + + return false; // FALSE indicates no user input problems +} + +#if ENABLED(L6470_CHITCHAT) + inline void echo_yes_no(const bool yes) { serialprintPGM(yes ? PSTR("YES") : PSTR("NO ")); } +#endif + +void L6470_Marlin::say_axis(const uint8_t axis, const bool label/*=true*/) { + if (label) SERIAL_ECHOPGM("AXIS:"); + SERIAL_CHAR(' '); + SERIAL_CHAR(index_to_axis[axis][0]); + SERIAL_CHAR(index_to_axis[axis][1]); + SERIAL_CHAR(' '); +} + +void L6470_Marlin::error_status_decode(const uint16_t status, const uint8_t axis) { // assumes status bits have been inverted + #if ENABLED(L6470_CHITCHAT) + char temp_buf[10]; + say_axis(axis); + sprintf_P(temp_buf, PSTR(" %4x "), status); + DEBUG_ECHO(temp_buf); + print_bin(status); + DEBUG_ECHOPGM(" THERMAL: "); + serialprintPGM((status & STATUS_TH_SD) ? PSTR("SHUTDOWN") : (status & STATUS_TH_WRN) ? PSTR("WARNING ") : PSTR("OK ")); + DEBUG_ECHOPGM(" OVERCURRENT: "); + echo_yes_no(status & STATUS_OCD); + DEBUG_ECHOPGM(" STALL: "); + echo_yes_no(status & (STATUS_STEP_LOSS_A | STATUS_STEP_LOSS_B)); + L6470_EOL(); + #else + UNUSED(status); UNUSED(axis); + #endif +} + +////////////////////////////////////////////////////////////////////////////////////////////////// +//// +//// MONITOR_L6470_DRIVER_STATUS routines +//// +////////////////////////////////////////////////////////////////////////////////////////////////// + +#if ENABLED(MONITOR_L6470_DRIVER_STATUS) + + struct L6470_driver_data { + uint8_t driver_index; + uint32_t driver_status; + bool is_otw; + uint8_t otw_counter; + bool is_ot; + bool is_hi_Z; + uint8_t com_counter; + }; + + L6470_driver_data driver_L6470_data[] = { + #if AXIS_DRIVER_TYPE_X(L6470) + { 0, 0, 0, 0, 0, 0, 0 }, + #endif + #if AXIS_DRIVER_TYPE_Y(L6470) + { 1, 0, 0, 0, 0, 0, 0 }, + #endif + #if AXIS_DRIVER_TYPE_Z(L6470) + { 2, 0, 0, 0, 0, 0, 0 }, + #endif + #if AXIS_DRIVER_TYPE_X2(L6470) + { 3, 0, 0, 0, 0, 0, 0 }, + #endif + #if AXIS_DRIVER_TYPE_Y2(L6470) + { 4, 0, 0, 0, 0, 0, 0 }, + #endif + #if AXIS_DRIVER_TYPE_Z2(L6470) + { 5, 0, 0, 0, 0, 0, 0 }, + #endif + #if AXIS_DRIVER_TYPE_Z3(L6470) + { 6, 0, 0, 0, 0, 0, 0 }, + #endif + #if AXIS_DRIVER_TYPE_E0(L6470) + { 7, 0, 0, 0, 0, 0, 0 }, + #endif + #if AXIS_DRIVER_TYPE_E1(L6470) + { 8, 0, 0, 0, 0, 0, 0 }, + #endif + #if AXIS_DRIVER_TYPE_E2(L6470) + { 9, 0, 0, 0, 0, 0, 0 }, + #endif + #if AXIS_DRIVER_TYPE_E3(L6470) + { 10, 0, 0, 0, 0, 0, 0 }, + #endif + #if AXIS_DRIVER_TYPE_E4(L6470) + { 11, 0, 0, 0, 0, 0, 0 }, + #endif + #if AXIS_DRIVER_TYPE_E5(L6470) + { 12, 0, 0, 0, 0, 0, 0 } + #endif + }; + + inline void append_stepper_err(char * &p, const uint8_t stepper_index, const char * const err=NULL) { + p += sprintf_P(p, PSTR("Stepper %c%c "), char(index_to_axis[stepper_index][0]), char(index_to_axis[stepper_index][1])); + if (err) p += sprintf_P(p, err); + } + + void L6470_monitor_update(uint8_t stepper_index, uint16_t status) { + if (spi_abort) return; // don't do anything if set_directions() has occurred + uint8_t kval_hold; + char temp_buf[120]; + char* p = &temp_buf[0]; + uint8_t j; + for (j = 0; j < L6470::chain[0]; j++) // find the table for this stepper + if (driver_L6470_data[j].driver_index == stepper_index) break; + + driver_L6470_data[j].driver_status = status; + uint16_t _status = ~status; // all error bits are active low + + if (status == 0 || status == 0xFFFF) { // com problem + 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")); + 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")); + DEBUG_ECHO(temp_buf); + } + } + } + else { + 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")); + DEBUG_ECHO(temp_buf); + init_to_defaults(); + } + else { + // no com problems - do the usual checks + if (_status & L6470_ERROR_MASK) { + append_stepper_err(p, stepper_index); + + if (status & STATUS_HIZ) { // the driver has shut down HiZ is active high + driver_L6470_data[j].is_hi_Z = true; + p += sprintf_P(p, PSTR("%cIS SHUT DOWN"), ' '); + // if (_status & STATUS_TH_SD) { // strange - TH_SD never seems to go active, must be implied by the HiZ and TH_WRN + if (_status & STATUS_TH_WRN) { // over current shutdown + p += sprintf_P(p, PSTR("%cdue to over temperature"), ' '); + driver_L6470_data[j].is_ot = true; + kval_hold = get_param(stepper_index, L6470_KVAL_HOLD) - 2 * KVAL_HOLD_STEP_DOWN; + set_param(stepper_index, L6470_KVAL_HOLD, kval_hold); // reduce KVAL_HOLD + p += sprintf_P(p, PSTR(" - KVAL_HOLD reduced by %d to %d"), 2 * KVAL_HOLD_STEP_DOWN, kval_hold); // let user know + } + else + driver_L6470_data[j].is_ot = false; + } + else { + driver_L6470_data[j].is_hi_Z = false; + + if (_status & STATUS_TH_WRN) { // have an over temperature warning + driver_L6470_data[j].is_otw = true; + driver_L6470_data[j].otw_counter++; + kval_hold = get_param(stepper_index, L6470_KVAL_HOLD); + if (driver_L6470_data[j].otw_counter > 4) { // otw present for 2 - 2.5 seconds, reduce KVAL_HOLD + kval_hold -= KVAL_HOLD_STEP_DOWN; + set_param(stepper_index, L6470_KVAL_HOLD, kval_hold); // reduce KVAL_HOLD + p += sprintf_P(p, PSTR(" - KVAL_HOLD reduced by %d to %d"), KVAL_HOLD_STEP_DOWN, kval_hold); // let user know + driver_L6470_data[j].otw_counter = 0; + driver_L6470_data[j].is_otw = true; + } + else if (driver_L6470_data[j].otw_counter) + p += sprintf_P(p, PSTR("%c- thermal warning"), ' '); // warn user + } + } + + #ifdef L6470_STOP_ON_ERROR + if (_status & (STATUS_UVLO | STATUS_TH_WRN | STATUS_TH_SD)) + kill(temp_buf); + #endif + + + #if ENABLED(L6470_CHITCHAT) + + if (_status & STATUS_OCD) + p += sprintf_P(p, PSTR("%c over current"), ' '); + + if (_status & (STATUS_STEP_LOSS_A | STATUS_STEP_LOSS_B)) + p += sprintf_P(p, PSTR("%c stall"), ' '); + + if (_status & STATUS_UVLO) + p += sprintf_P(p, PSTR("%c under voltage lock out"), ' '); + + p += sprintf_P(p, PSTR("%c\n"), ' '); + #endif + + DEBUG_ECHOLN(temp_buf); // print the error message + } + else { + driver_L6470_data[j].is_ot = false; + driver_L6470_data[j].otw_counter = 0; //clear out warning indicators + driver_L6470_data[j].is_otw = false; + + } // end usual checks + } // comms established but have errors + } // comms re-established + } // end L6470_monitor_update() + + #define MONITOR_L6470_DRIVE(Q) L6470_monitor_update(Q, stepper##Q.getStatus()) + + void L6470_Marlin::monitor_driver() { + static millis_t next_cOT = 0; + if (ELAPSED(millis(), next_cOT)) { + next_cOT = millis() + 500; + + spi_active = true; // let set_directions() know we're in the middle of a series of SPI transfers + + #if AXIS_DRIVER_TYPE_X(L6470) + MONITOR_L6470_DRIVE(X); + #endif + #if AXIS_DRIVER_TYPE_Y(L6470) + MONITOR_L6470_DRIVE(Y); + #endif + #if AXIS_DRIVER_TYPE_Z(L6470) + MONITOR_L6470_DRIVE(Z); + #endif + #if AXIS_DRIVER_TYPE_X2(L6470) + MONITOR_L6470_DRIVE(X2); + #endif + #if AXIS_DRIVER_TYPE_Y2(L6470) + MONITOR_L6470_DRIVE(Y2); + #endif + #if AXIS_DRIVER_TYPE_Z2(L6470) + MONITOR_L6470_DRIVE(Z2); + #endif + #if AXIS_DRIVER_TYPE_Z3(L6470) + MONITOR_L6470_DRIVE(Z3); + #endif + #if AXIS_DRIVER_TYPE_E0(L6470) + MONITOR_L6470_DRIVE(E0); + #endif + #if AXIS_DRIVER_TYPE_E1(L6470) + MONITOR_L6470_DRIVE(E1); + #endif + #if AXIS_DRIVER_TYPE_E2(L6470) + MONITOR_L6470_DRIVE(E2); + #endif + #if AXIS_DRIVER_TYPE_E3(L6470) + MONITOR_L6470_DRIVE(E3); + #endif + #if AXIS_DRIVER_TYPE_E4(L6470) + MONITOR_L6470_DRIVE(E4); + #endif + #if AXIS_DRIVER_TYPE_E5(L6470) + MONITOR_L6470_DRIVE(E5); + #endif + + #if ENABLED(L6470_DEBUG) + if (report_L6470_status) L6470_EOL(); + #endif + + spi_active = false; // done with all SPI transfers - clear handshake flags + spi_abort = false; + } + } + +#endif // MONITOR_L6470_DRIVER_STATUS + +#endif // HAS_DRIVER(L6470) diff --git a/Marlin/src/libs/L6470/L6470_Marlin.h b/Marlin/src/libs/L6470/L6470_Marlin.h new file mode 100644 index 000000000000..43ebd6ef08f1 --- /dev/null +++ b/Marlin/src/libs/L6470/L6470_Marlin.h @@ -0,0 +1,74 @@ +/** + * 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/MarlinConfig.h" + +#include + +#define L6470_GETPARAM(P,Q) stepper##Q.GetParam(P) + +#define MAX_L6470 (7 + MAX_EXTRUDERS) // Maximum number of axes in Marlin + +#define L6470_ERROR_MASK (STATUS_UVLO | STATUS_TH_WRN | STATUS_TH_SD | STATUS_OCD | STATUS_STEP_LOSS_A | STATUS_STEP_LOSS_B) +#define dSPIN_STEP_CLOCK_FWD dSPIN_STEP_CLOCK +#define dSPIN_STEP_CLOCK_REV dSPIN_STEP_CLOCK+1 +#define HAS_L6470_EXTRUDER ( AXIS_DRIVER_TYPE_E0(L6470) || AXIS_DRIVER_TYPE_E1(L6470) || AXIS_DRIVER_TYPE_E2(L6470) \ + || AXIS_DRIVER_TYPE_E3(L6470) || AXIS_DRIVER_TYPE_E4(L6470) || AXIS_DRIVER_TYPE_E5(L6470) ) + +class L6470_Marlin { +public: + static bool index_to_dir[MAX_L6470]; + static uint8_t axis_xref[MAX_L6470]; + static char index_to_axis[MAX_L6470][3]; + static uint8_t dir_commands[MAX_L6470]; + + // Flags to guarantee graceful switch if stepper interrupts L6470 SPI transfer + static volatile bool spi_abort; + static bool spi_active; + + L6470_Marlin() {} + + static uint16_t get_status(const uint8_t axis); + + static uint32_t get_param(uint8_t axis, uint8_t param); + + static void set_param(uint8_t axis, uint8_t param, uint32_t value); + + static bool 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, + bool over_current_flag, uint8_t &OCD_TH_val, uint8_t &STALL_TH_val, uint16_t &over_current_threshold); + + static void error_status_decode(const uint16_t status, const uint8_t axis); + + static void monitor_driver(); + + static void init(); + static void init_to_defaults(); + + static void say_axis(const uint8_t axis, const bool label=true); + +private: + void populate_chain_array(); +}; + +extern L6470_Marlin L6470; diff --git a/Marlin/src/libs/bresenham.h b/Marlin/src/libs/bresenham.h new file mode 100644 index 000000000000..0cd8850022f9 --- /dev/null +++ b/Marlin/src/libs/bresenham.h @@ -0,0 +1,132 @@ +/** + * 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 "../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/buzzer.cpp b/Marlin/src/libs/buzzer.cpp index 997c2264367a..fda35a130da8 100644 --- a/Marlin/src/libs/buzzer.cpp +++ b/Marlin/src/libs/buzzer.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/libs/buzzer.h b/Marlin/src/libs/buzzer.h index c0ed8d9fa2b3..7598ac79cca1 100644 --- a/Marlin/src/libs/buzzer.h +++ b/Marlin/src/libs/buzzer.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/libs/circularqueue.h b/Marlin/src/libs/circularqueue.h index 1cd051c2fae6..1aa73daa6a54 100644 --- a/Marlin/src/libs/circularqueue.h +++ b/Marlin/src/libs/circularqueue.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/libs/duration_t.h b/Marlin/src/libs/duration_t.h index 091bae0e57ab..b446f4b496b0 100644 --- a/Marlin/src/libs/duration_t.h +++ b/Marlin/src/libs/duration_t.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/libs/hex_print_routines.cpp b/Marlin/src/libs/hex_print_routines.cpp index ebf8bca7ecc9..a3f7492e1837 100644 --- a/Marlin/src/libs/hex_print_routines.cpp +++ b/Marlin/src/libs/hex_print_routines.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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) +#if ANY(AUTO_BED_LEVELING_UBL, M100_FREE_MEMORY_WATCHER, DEBUG_GCODE_PARSER, TMC_DEBUG) #include "hex_print_routines.h" @@ -78,4 +78,13 @@ void print_hex_word(const uint16_t w) { SERIAL_ECHO(hex_word(w)); } void print_hex_address(const void * const w) { SERIAL_ECHO(hex_address(w)); } + void print_hex_long(const uint32_t w, const char delimiter) { + SERIAL_ECHOPGM("0x"); + for (int B = 24; B >= 8; B -= 8){ + print_hex_byte(w >> B); + SERIAL_CHAR(delimiter); + } + print_hex_byte(w); + } + #endif // AUTO_BED_LEVELING_UBL || M100_FREE_MEMORY_WATCHER || DEBUG_GCODE_PARSER diff --git a/Marlin/src/libs/hex_print_routines.h b/Marlin/src/libs/hex_print_routines.h index 2033e5670bd4..b64378a9544c 100644 --- a/Marlin/src/libs/hex_print_routines.h +++ b/Marlin/src/libs/hex_print_routines.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -38,6 +38,7 @@ void print_hex_nybble(const uint8_t n); void print_hex_byte(const uint8_t b); void print_hex_word(const uint16_t w); void print_hex_address(const void * const w); +void print_hex_long(const uint32_t w, const char delimiter); #ifdef CPU_32_BIT typedef uint32_t ptr_int_t; diff --git a/Marlin/src/libs/least_squares_fit.cpp b/Marlin/src/libs/least_squares_fit.cpp index 6d7fc580d8a7..0f52db1938b0 100644 --- a/Marlin/src/libs/least_squares_fit.cpp +++ b/Marlin/src/libs/least_squares_fit.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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/least_squares_fit.h b/Marlin/src/libs/least_squares_fit.h index 02ed9cfbd93f..a6ed1dc9ff30 100644 --- a/Marlin/src/libs/least_squares_fit.h +++ b/Marlin/src/libs/least_squares_fit.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/libs/nozzle.cpp b/Marlin/src/libs/nozzle.cpp index fd845685d8e3..7038b2f2c324 100644 --- a/Marlin/src/libs/nozzle.cpp +++ b/Marlin/src/libs/nozzle.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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/libs/nozzle.h b/Marlin/src/libs/nozzle.h index 5e56618e3ff1..c0291c8f06c3 100644 --- a/Marlin/src/libs/nozzle.h +++ b/Marlin/src/libs/nozzle.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/libs/point_t.h b/Marlin/src/libs/point_t.h index 7a065cb33b89..5839763d866b 100644 --- a/Marlin/src/libs/point_t.h +++ b/Marlin/src/libs/point_t.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/libs/private_spi.h b/Marlin/src/libs/private_spi.h index 89c591a2a4a8..2fc585e3b864 100644 --- a/Marlin/src/libs/private_spi.h +++ b/Marlin/src/libs/private_spi.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -33,21 +33,22 @@ class SPIclass { FORCE_INLINE static uint8_t receive() { return softSPI.receive(); } }; - // Hardware SPI template<> class SPIclass { public: FORCE_INLINE static void init() { - OUT_WRITE(SCK_PIN, LOW); - OUT_WRITE(MOSI_PIN, HIGH); - SET_INPUT(MISO_PIN); - WRITE(MISO_PIN, HIGH); + OUT_WRITE(SCK_PIN, LOW); + OUT_WRITE(MOSI_PIN, HIGH); + SET_INPUT_PULLUP(MISO_PIN); } FORCE_INLINE static uint8_t receive() { - SPDR = 0; - for (;!TEST(SPSR, SPIF);); - return SPDR; + #if defined(__AVR__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__) + SPDR = 0; + for (;!TEST(SPSR, SPIF);); + return SPDR; + #else + return spiRec(); + #endif } - }; diff --git a/Marlin/src/libs/stopwatch.cpp b/Marlin/src/libs/stopwatch.cpp index 2817190aa6c0..c866404d8b33 100644 --- a/Marlin/src/libs/stopwatch.cpp +++ b/Marlin/src/libs/stopwatch.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -71,13 +71,13 @@ bool Stopwatch::start() { else return false; } -void Stopwatch::resume(const millis_t duration) { +void Stopwatch::resume(const millis_t with_time) { #if ENABLED(DEBUG_STOPWATCH) Stopwatch::debug(PSTR("resume")); #endif reset(); - if ((accumulator = duration)) state = RUNNING; + if ((accumulator = with_time)) state = RUNNING; } void Stopwatch::reset() { diff --git a/Marlin/src/libs/stopwatch.h b/Marlin/src/libs/stopwatch.h index c1e9ea74f891..ec9f5a5cbd01 100644 --- a/Marlin/src/libs/stopwatch.h +++ b/Marlin/src/libs/stopwatch.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -75,7 +75,7 @@ class Stopwatch { * @brief Resume the stopwatch * @details Resume a timer from a given duration */ - static void resume(const millis_t duration); + static void resume(const millis_t with_time); /** * @brief Reset the stopwatch diff --git a/Marlin/src/libs/vector_3.cpp b/Marlin/src/libs/vector_3.cpp index cb9f3272f1c1..a320085aae98 100644 --- a/Marlin/src/libs/vector_3.cpp +++ b/Marlin/src/libs/vector_3.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -84,13 +84,9 @@ void vector_3::apply_rotation(const matrix_3x3 &matrix) { void vector_3::debug(PGM_P const title) { serialprintPGM(title); - SERIAL_PROTOCOLPGM(" x: "); - SERIAL_PROTOCOL_F(x, 6); - SERIAL_PROTOCOLPGM(" y: "); - SERIAL_PROTOCOL_F(y, 6); - SERIAL_PROTOCOLPGM(" z: "); - SERIAL_PROTOCOL_F(z, 6); - SERIAL_EOL(); + SERIAL_ECHOPAIR_F(" x: ", x, 6); + SERIAL_ECHOPAIR_F(" y: ", y, 6); + SERIAL_ECHOLNPAIR_F(" z: ", z, 6); } void apply_rotation_xyz(const matrix_3x3 &matrix, float &x, float &y, float &z) { @@ -151,13 +147,13 @@ void matrix_3x3::debug(PGM_P const title) { uint8_t count = 0; for (uint8_t i = 0; i < 3; i++) { for (uint8_t j = 0; j < 3; j++) { - if (matrix[count] >= 0.0) SERIAL_PROTOCOLCHAR('+'); - SERIAL_PROTOCOL_F(matrix[count], 6); - SERIAL_PROTOCOLCHAR(' '); + if (matrix[count] >= 0.0) SERIAL_CHAR('+'); + SERIAL_ECHO_F(matrix[count], 6); + SERIAL_CHAR(' '); count++; } SERIAL_EOL(); } } -#endif // HAS_ABL +#endif // HAS_ABL_OR_UBL diff --git a/Marlin/src/libs/vector_3.h b/Marlin/src/libs/vector_3.h index b1f0f7977f8f..ddb4ea9fe8ca 100644 --- a/Marlin/src/libs/vector_3.h +++ b/Marlin/src/libs/vector_3.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/configuration_store.cpp b/Marlin/src/module/configuration_store.cpp index 2da6ea3eb25a..0552f555a5cf 100644 --- a/Marlin/src/module/configuration_store.cpp +++ b/Marlin/src/module/configuration_store.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -37,7 +37,7 @@ */ // Change EEPROM version if the structure changes -#define EEPROM_VERSION "V63" +#define EEPROM_VERSION "V64" #define EEPROM_OFFSET 100 // Check the integrity of data offsets. @@ -46,16 +46,6 @@ #include "configuration_store.h" -#if ADD_PORT_ARG - #define PORTARG_SOLO const int8_t port - #define PORTARG_AFTER ,const int8_t port - #define PORTVAR_SOLO port -#else - #define PORTARG_SOLO - #define PORTARG_AFTER - #define PORTVAR_SOLO -#endif - #include "endstops.h" #include "planner.h" #include "stepper.h" @@ -66,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 @@ -76,13 +66,16 @@ #if HAS_SERVOS #include "servo.h" +#endif + +#if HAS_SERVOS && HAS_SERVO_ANGLES + #define EEPROM_NUM_SERVOS NUM_SERVOS #else - #undef NUM_SERVOS - #define NUM_SERVOS NUM_SERVO_PLUGS + #define EEPROM_NUM_SERVOS NUM_SERVO_PLUGS #endif #if HAS_BED_PROBE - #include "../module/probe.h" + #include "probe.h" #endif #include "../feature/fwretract.h" @@ -93,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); @@ -109,6 +106,7 @@ typedef struct { uint16_t X, Y, Z, X2, Y2, Z2, Z3, E0, E1, E2, E3, E4, E5; } tmc_stepper_current_t; typedef struct { uint32_t X, Y, Z, X2, Y2, Z2, Z3, E0, E1, E2, E3, E4, E5; } tmc_hybrid_threshold_t; typedef struct { int16_t X, Y, Z; } tmc_sgt_t; +typedef struct { bool X, Y, Z, X2, Y2, Z2, Z3, E0, E1, E2, E3, E4, E5; } tmc_stealth_enabled_t; // Limit an index to an array size #define ALIM(I,ARR) MIN(I, COUNT(ARR) - 1) @@ -187,7 +185,7 @@ typedef struct SettingsDataStruct { // // SERVO_ANGLES // - uint16_t servo_angles[NUM_SERVOS][2]; // M281 P L U + uint16_t servo_angles[EEPROM_NUM_SERVOS][2]; // M281 P L U // // DELTA / [XYZ]_DUAL_ENDSTOPS @@ -200,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) @@ -253,6 +251,7 @@ typedef struct SettingsDataStruct { tmc_stepper_current_t tmc_stepper_current; // M906 X Y Z X2 Y2 Z2 Z3 E0 E1 E2 E3 E4 E5 tmc_hybrid_threshold_t tmc_hybrid_threshold; // M913 X Y Z X2 Y2 Z2 Z3 E0 E1 E2 E3 E4 E5 tmc_sgt_t tmc_sgt; // M914 X Y Z + tmc_stealth_enabled_t tmc_stealth_enabled; // M569 X Y Z X2 Y2 Z2 Z3 E0 E1 E2 E3 E4 E5 // // LIN_ADVANCE @@ -345,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 @@ -384,20 +383,40 @@ void MarlinSettings::postprocess() { #endif // SD_FIRMWARE_UPDATE +#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_START_P(port); SERIAL_ERRORLNPGM_P(port, 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 @@ -408,12 +427,9 @@ void MarlinSettings::postprocess() { bool MarlinSettings::eeprom_error, MarlinSettings::validating; - bool MarlinSettings::size_error(const uint16_t size PORTARG_AFTER) { + bool MarlinSettings::size_error(const uint16_t size) { if (size != datasize()) { - #if ENABLED(EEPROM_CHITCHAT) - SERIAL_ERROR_START_P(port); - SERIAL_ERRORLNPGM_P(port, "EEPROM datasize error."); - #endif + DEBUG_ERROR_MSG("EEPROM datasize error."); return true; } return false; @@ -422,7 +438,7 @@ void MarlinSettings::postprocess() { /** * M500 - Store Configuration */ - bool MarlinSettings::save(PORTARG_SOLO) { + bool MarlinSettings::save() { float dummy = 0; char ver[4] = "ERR"; @@ -453,12 +469,12 @@ 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 #else - const float planner_max_jerk[XYZE] = { float(DEFAULT_XJERK), float(DEFAULT_YJERK), float(DEFAULT_ZJERK), float(DEFAULT_EJERK) }; + const float planner_max_jerk[XYZE] = { float(DEFAULT_EJERK) }; EEPROM_WRITE(planner_max_jerk); #endif @@ -605,36 +621,11 @@ void MarlinSettings::postprocess() { // Servo Angles // { - #if !(HAS_SERVOS && ENABLED(EDITABLE_SERVO_ANGLES)) - - uint16_t servo_angles[NUM_SERVOS][2] = { { 0, 0 } }; - - #if ENABLED(SWITCHING_EXTRUDER) - - constexpr uint16_t sesa[][2] = SWITCHING_EXTRUDER_SERVO_ANGLES; - servo_angles[SWITCHING_EXTRUDER_SERVO_NR][0] = sesa[0][0]; - servo_angles[SWITCHING_EXTRUDER_SERVO_NR][1] = sesa[0][1]; - #if EXTRUDERS > 3 - servo_angles[SWITCHING_EXTRUDER_E23_SERVO_NR][0] = sesa[1][0]; - servo_angles[SWITCHING_EXTRUDER_E23_SERVO_NR][1] = sesa[1][1]; - #endif - - #elif ENABLED(SWITCHING_NOZZLE) - - constexpr uint16_t snsa[] = SWITCHING_NOZZLE_SERVO_ANGLES; - servo_angles[SWITCHING_NOZZLE_SERVO_NR][0] = snsa[0]; - servo_angles[SWITCHING_NOZZLE_SERVO_NR][1] = snsa[1]; - - #elif defined(Z_SERVO_ANGLES) && defined(Z_PROBE_SERVO_NR) - - constexpr uint16_t zsa[] = Z_SERVO_ANGLES; - servo_angles[Z_PROBE_SERVO_NR][0] = zsa[0]; - servo_angles[Z_PROBE_SERVO_NR][1] = zsa[1]; - - #endif - - #endif // !HAS_SERVOS || !EDITABLE_SERVO_ANGLES + _FIELD_TEST(servo_angles); + #if !HAS_SERVO_ANGLES + uint16_t servo_angles[EEPROM_NUM_SERVOS][2] = { { 0, 0 } }; + #endif EEPROM_WRITE(servo_angles); } @@ -654,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); @@ -691,7 +682,7 @@ void MarlinSettings::postprocess() { // LCD Preheat settings // { - _FIELD_TEST(lcd_preheat_hotend_temp); + _FIELD_TEST(ui_preheat_hotend_temp); #if HAS_LCD_MENU const int16_t (&ui_preheat_hotend_temp)[2] = ui.preheat_hotend_temp, @@ -739,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 } @@ -787,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; @@ -969,6 +960,70 @@ void MarlinSettings::postprocess() { EEPROM_WRITE(tmc_sgt); } + // + // TMC stepping mode + // + { + _FIELD_TEST(tmc_stealth_enabled); + + tmc_stealth_enabled_t tmc_stealth_enabled = { false, false, false, false, false, false, false, false, false, false, false, false, false }; + + #if HAS_STEALTHCHOP + #if AXIS_HAS_STEALTHCHOP(X) + tmc_stealth_enabled.X = stepperX.get_stealthChop_status(); + #endif + #if AXIS_HAS_STEALTHCHOP(Y) + tmc_stealth_enabled.Y = stepperY.get_stealthChop_status(); + #endif + #if AXIS_HAS_STEALTHCHOP(Z) + tmc_stealth_enabled.Z = stepperZ.get_stealthChop_status(); + #endif + #if AXIS_HAS_STEALTHCHOP(X2) + tmc_stealth_enabled.X2 = stepperX2.get_stealthChop_status(); + #endif + #if AXIS_HAS_STEALTHCHOP(Y2) + tmc_stealth_enabled.Y2 = stepperY2.get_stealthChop_status(); + #endif + #if AXIS_HAS_STEALTHCHOP(Z2) + tmc_stealth_enabled.Z2 = stepperZ2.get_stealthChop_status(); + #endif + #if AXIS_HAS_STEALTHCHOP(Z3) + tmc_stealth_enabled.Z3 = stepperZ3.get_stealthChop_status(); + #endif + #if MAX_EXTRUDERS + #if AXIS_HAS_STEALTHCHOP(E0) + tmc_stealth_enabled.E0 = stepperE0.get_stealthChop_status(); + #endif + #if MAX_EXTRUDERS > 1 + #if AXIS_HAS_STEALTHCHOP(E1) + tmc_stealth_enabled.E1 = stepperE1.get_stealthChop_status(); + #endif + #if MAX_EXTRUDERS > 2 + #if AXIS_HAS_STEALTHCHOP(E2) + tmc_stealth_enabled.E2 = stepperE2.get_stealthChop_status(); + #endif + #if MAX_EXTRUDERS > 3 + #if AXIS_HAS_STEALTHCHOP(E3) + tmc_stealth_enabled.E3 = stepperE3.get_stealthChop_status(); + #endif + #if MAX_EXTRUDERS > 4 + #if AXIS_HAS_STEALTHCHOP(E4) + tmc_stealth_enabled.E4 = stepperE4.get_stealthChop_status(); + #endif + #if MAX_EXTRUDERS > 5 + #if AXIS_HAS_STEALTHCHOP(E5) + tmc_stealth_enabled.E5 = stepperE5.get_stealthChop_status(); + #endif + #endif // MAX_EXTRUDERS > 5 + #endif // MAX_EXTRUDERS > 4 + #endif // MAX_EXTRUDERS > 3 + #endif // MAX_EXTRUDERS > 2 + #endif // MAX_EXTRUDERS > 1 + #endif // MAX_EXTRUDERS + #endif + EEPROM_WRITE(tmc_stealth_enabled); + } + // // Linear Advance // @@ -1050,12 +1105,8 @@ void MarlinSettings::postprocess() { EEPROM_WRITE(final_crc); // Report storage size - #if ENABLED(EEPROM_CHITCHAT) - SERIAL_ECHO_START_P(port); - SERIAL_ECHOPAIR_P(port, "Settings Stored (", eeprom_size); - SERIAL_ECHOPAIR_P(port, " bytes; crc ", (uint32_t)final_crc); - SERIAL_ECHOLNPGM_P(port, ")"); - #endif + DEBUG_ECHO_START(); + DEBUG_ECHOLNPAIR("Settings Stored (", eeprom_size, " bytes; crc ", (uint32_t)final_crc, ")"); eeprom_error |= size_error(eeprom_size); } @@ -1075,7 +1126,7 @@ void MarlinSettings::postprocess() { /** * M501 - Retrieve Configuration */ - bool MarlinSettings::_load(PORTARG_SOLO) { + bool MarlinSettings::_load() { uint16_t working_crc = 0; EEPROM_START(); @@ -1092,12 +1143,8 @@ void MarlinSettings::postprocess() { stored_ver[0] = '?'; stored_ver[1] = '\0'; } - #if ENABLED(EEPROM_CHITCHAT) - SERIAL_ECHO_START_P(port); - SERIAL_ECHOPGM_P(port, "EEPROM version mismatch "); - SERIAL_ECHOPAIR_P(port, "(EEPROM=", stored_ver); - SERIAL_ECHOLNPGM_P(port, " Marlin=" EEPROM_VERSION ")"); - #endif + DEBUG_ECHO_START(); + DEBUG_ECHOLNPAIR("EEPROM version mismatch (EEPROM=", stored_ver, " Marlin=" EEPROM_VERSION ")"); eeprom_error = true; } else { @@ -1141,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 @@ -1288,10 +1335,14 @@ void MarlinSettings::postprocess() { // SERVO_ANGLES // { - #if !(HAS_SERVOS && ENABLED(EDITABLE_SERVO_ANGLES)) - uint16_t servo_angles[NUM_SERVOS][2]; + _FIELD_TEST(servo_angles); + + #if ENABLED(EDITABLE_SERVO_ANGLES) + uint16_t (&servo_angles_arr)[EEPROM_NUM_SERVOS][2] = servo_angles; + #else + uint16_t servo_angles_arr[EEPROM_NUM_SERVOS][2]; #endif - EEPROM_READ(servo_angles); + EEPROM_READ(servo_angles_arr); } // @@ -1310,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); @@ -1399,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 } @@ -1442,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; @@ -1625,6 +1676,60 @@ void MarlinSettings::postprocess() { #endif } + // TMC stepping mode + { + _FIELD_TEST(tmc_stealth_enabled); + + tmc_stealth_enabled_t tmc_stealth_enabled; + EEPROM_READ(tmc_stealth_enabled); + + #if HAS_TRINAMIC + + #define SET_STEPPING_MODE(ST) stepper##ST.stored.stealthChop_enabled = tmc_stealth_enabled.ST; stepper##ST.refresh_stepping_mode(); + if (!validating) { + #if AXIS_HAS_STEALTHCHOP(X) + SET_STEPPING_MODE(X); + #endif + #if AXIS_HAS_STEALTHCHOP(Y) + SET_STEPPING_MODE(Y); + #endif + #if AXIS_HAS_STEALTHCHOP(Z) + SET_STEPPING_MODE(Z); + #endif + #if AXIS_HAS_STEALTHCHOP(X2) + SET_STEPPING_MODE(X2); + #endif + #if AXIS_HAS_STEALTHCHOP(Y2) + SET_STEPPING_MODE(Y2); + #endif + #if AXIS_HAS_STEALTHCHOP(Z2) + SET_STEPPING_MODE(Z2); + #endif + #if AXIS_HAS_STEALTHCHOP(Z3) + SET_STEPPING_MODE(Z3); + #endif + #if AXIS_HAS_STEALTHCHOP(E0) + SET_STEPPING_MODE(E0); + #endif + #if AXIS_HAS_STEALTHCHOP(E1) + SET_STEPPING_MODE(E1); + #endif + #if AXIS_HAS_STEALTHCHOP(E2) + SET_STEPPING_MODE(E2); + #endif + #if AXIS_HAS_STEALTHCHOP(E3) + SET_STEPPING_MODE(E3); + #endif + #if AXIS_HAS_STEALTHCHOP(E4) + SET_STEPPING_MODE(E4); + #endif + #if AXIS_HAS_STEALTHCHOP(E5) + SET_STEPPING_MODE(E5); + #endif + } + #endif + } + // // Linear Advance // @@ -1704,31 +1809,18 @@ void MarlinSettings::postprocess() { eeprom_error = size_error(eeprom_index - (EEPROM_OFFSET)); if (eeprom_error) { - #if ENABLED(EEPROM_CHITCHAT) - SERIAL_ECHO_START_P(port); - SERIAL_ECHOPAIR_P(port, "Index: ", int(eeprom_index - (EEPROM_OFFSET))); - SERIAL_ECHOLNPAIR_P(port, " Size: ", datasize()); - #endif + DEBUG_ECHO_START(); + DEBUG_ECHOLNPAIR("Index: ", int(eeprom_index - (EEPROM_OFFSET)), " Size: ", datasize()); } else if (working_crc != stored_crc) { eeprom_error = true; - #if ENABLED(EEPROM_CHITCHAT) - SERIAL_ERROR_START_P(port); - SERIAL_ERRORPGM_P(port, "EEPROM CRC mismatch - (stored) "); - SERIAL_ERROR_P(port, stored_crc); - SERIAL_ERRORPGM_P(port, " != "); - SERIAL_ERROR_P(port, working_crc); - SERIAL_ERRORLNPGM_P(port, " (calculated)!"); - #endif + DEBUG_ERROR_START(); + DEBUG_ECHOLNPAIR("EEPROM CRC mismatch - (stored) ", stored_crc, " != ", working_crc, " (calculated)!"); } else if (!validating) { - #if ENABLED(EEPROM_CHITCHAT) - SERIAL_ECHO_START_P(port); - SERIAL_ECHO_P(port, version); - SERIAL_ECHOPAIR_P(port, " stored settings retrieved (", eeprom_index - (EEPROM_OFFSET)); - SERIAL_ECHOPAIR_P(port, " bytes; crc ", (uint32_t)working_crc); - SERIAL_ECHOLNPGM_P(port, ")"); - #endif + 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(); @@ -1738,69 +1830,66 @@ void MarlinSettings::postprocess() { ubl.report_state(); if (!ubl.sanity_check()) { - SERIAL_EOL_P(port); + SERIAL_EOL(); #if ENABLED(EEPROM_CHITCHAT) ubl.echo_name(); - SERIAL_ECHOLNPGM_P(port, " initialized.\n"); + DEBUG_ECHOLNPGM(" initialized.\n"); #endif } else { eeprom_error = true; #if ENABLED(EEPROM_CHITCHAT) - SERIAL_PROTOCOLPGM_P(port, "?Can't enable "); + DEBUG_ECHOPGM("?Can't enable "); ubl.echo_name(); - SERIAL_PROTOCOLLNPGM_P(port, "."); + DEBUG_ECHOLNPGM("."); #endif ubl.reset(); } if (ubl.storage_slot >= 0) { load_mesh(ubl.storage_slot); - #if ENABLED(EEPROM_CHITCHAT) - SERIAL_ECHOPAIR_P(port, "Mesh ", ubl.storage_slot); - SERIAL_ECHOLNPGM_P(port, " loaded from storage."); - #endif + DEBUG_ECHOLNPAIR("Mesh ", ubl.storage_slot, " loaded from storage."); } else { ubl.reset(); - #if ENABLED(EEPROM_CHITCHAT) - SERIAL_ECHOLNPGM_P(port, "UBL System reset()"); - #endif + DEBUG_ECHOLNPGM("UBL System reset()"); } } #endif } #if ENABLED(EEPROM_CHITCHAT) && DISABLED(DISABLE_M503) - if (!validating) report(PORTVAR_SOLO); + if (!validating) report(); #endif EEPROM_FINISH(); return !eeprom_error; } - bool MarlinSettings::validate(PORTARG_SOLO) { + bool MarlinSettings::validate() { validating = true; - const bool success = _load(PORTVAR_SOLO); + const bool success = _load(); validating = false; return success; } - bool MarlinSettings::load(PORTARG_SOLO) { - if (validate(PORTVAR_SOLO)) return _load(PORTVAR_SOLO); + bool MarlinSettings::load() { + if (validate()) return _load(); reset(); return true; } #if ENABLED(AUTO_BED_LEVELING_UBL) - #if ENABLED(EEPROM_CHITCHAT) - void ubl_invalid_slot(const int s) { - SERIAL_PROTOCOLLNPGM("?Invalid slot."); - SERIAL_PROTOCOL(s); - SERIAL_PROTOCOLLNPGM(" mesh slots available."); - } - #endif + inline void ubl_invalid_slot(const int s) { + #if ENABLED(EEPROM_CHITCHAT) + DEBUG_ECHOLNPGM("?Invalid slot."); + DEBUG_ECHO(s); + DEBUG_ECHOLNPGM(" mesh slots available."); + #else + UNUSED(s); + #endif + } const uint16_t MarlinSettings::meshes_end = persistentStore.capacity() - 129; // 128 (+1 because of the change to capacity rather than last valid address) // is a placeholder for the size of the MAT; the MAT will always @@ -1824,32 +1913,22 @@ void MarlinSettings::postprocess() { #if ENABLED(AUTO_BED_LEVELING_UBL) const int16_t a = calc_num_meshes(); if (!WITHIN(slot, 0, a - 1)) { - #if ENABLED(EEPROM_CHITCHAT) - ubl_invalid_slot(a); - SERIAL_PROTOCOLPAIR("E2END=", persistentStore.capacity() - 1); - SERIAL_PROTOCOLPAIR(" meshes_end=", meshes_end); - SERIAL_PROTOCOLLNPAIR(" slot=", slot); - SERIAL_EOL(); - #endif + ubl_invalid_slot(a); + DEBUG_ECHOLNPAIR("E2END=", persistentStore.capacity() - 1, " meshes_end=", meshes_end, " slot=", slot); + DEBUG_EOL(); return; } int pos = mesh_slot_offset(slot); uint16_t crc = 0; + // Write crc to MAT along with other data, or just tack on to the beginning or end persistentStore.access_start(); const bool status = persistentStore.write_data(pos, (uint8_t *)&ubl.z_values, sizeof(ubl.z_values), &crc); persistentStore.access_finish(); - if (status) - SERIAL_PROTOCOLPGM("?Unable to save mesh data.\n"); - - // Write crc to MAT along with other data, or just tack on to the beginning or end - - #if ENABLED(EEPROM_CHITCHAT) - if (!status) - SERIAL_PROTOCOLLNPAIR("Mesh saved in slot ", slot); - #endif + if (status) SERIAL_ECHOLNPGM("?Unable to save mesh data."); + else DEBUG_ECHOLNPAIR("Mesh saved in slot ", slot); #else @@ -1865,9 +1944,7 @@ void MarlinSettings::postprocess() { const int16_t a = settings.calc_num_meshes(); if (!WITHIN(slot, 0, a - 1)) { - #if ENABLED(EEPROM_CHITCHAT) - ubl_invalid_slot(a); - #endif + ubl_invalid_slot(a); return; } @@ -1879,13 +1956,9 @@ void MarlinSettings::postprocess() { const uint16_t status = persistentStore.read_data(pos, dest, sizeof(ubl.z_values), &crc); persistentStore.access_finish(); - if (status) - SERIAL_PROTOCOLPGM("?Unable to load mesh data.\n"); + if (status) SERIAL_ECHOLNPGM("?Unable to load mesh data."); + else DEBUG_ECHOLNPAIR("Mesh loaded from slot ", slot); - #if ENABLED(EEPROM_CHITCHAT) - else - SERIAL_PROTOCOLLNPAIR("Mesh loaded from slot ", slot); - #endif EEPROM_FINISH(); #else @@ -1902,11 +1975,8 @@ void MarlinSettings::postprocess() { #else // !EEPROM_SETTINGS - bool MarlinSettings::save(PORTARG_SOLO) { - #if ENABLED(EEPROM_CHITCHAT) - SERIAL_ERROR_START_P(port); - SERIAL_ERRORLNPGM_P(port, "EEPROM disabled"); - #endif + bool MarlinSettings::save() { + DEBUG_ERROR_MSG("EEPROM disabled"); return false; } @@ -1915,7 +1985,7 @@ void MarlinSettings::postprocess() { /** * M502 - Reset Configuration */ -void MarlinSettings::reset(PORTARG_SOLO) { +void MarlinSettings::reset() { static const float tmp1[] PROGMEM = DEFAULT_AXIS_STEPS_PER_UNIT, tmp2[] PROGMEM = DEFAULT_MAX_FEEDRATE; static const uint32_t tmp3[] PROGMEM = DEFAULT_MAX_ACCELERATION; LOOP_XYZE_N(i) { @@ -1932,6 +2002,15 @@ void MarlinSettings::reset(PORTARG_SOLO) { planner.settings.min_travel_feedrate_mm_s = DEFAULT_MINTRAVELFEEDRATE; #if HAS_CLASSIC_JERK + #ifndef DEFAULT_XJERK + #define DEFAULT_XJERK 0 + #endif + #ifndef DEFAULT_YJERK + #define DEFAULT_YJERK 0 + #endif + #ifndef DEFAULT_ZJERK + #define DEFAULT_ZJERK 0 + #endif planner.max_jerk[X_AXIS] = DEFAULT_XJERK; planner.max_jerk[Y_AXIS] = DEFAULT_YJERK; planner.max_jerk[Z_AXIS] = DEFAULT_ZJERK; @@ -1951,15 +2030,7 @@ void MarlinSettings::reset(PORTARG_SOLO) { #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 @@ -1974,6 +2045,10 @@ void MarlinSettings::reset(PORTARG_SOLO) { toolchange_settings.z_raise = TOOLCHANGE_ZRAISE; #endif + #if ENABLED(MAGNETIC_PARKING_EXTRUDER) + mpe_settings_init(); + #endif + // // Global Leveling // @@ -1994,39 +2069,13 @@ void MarlinSettings::reset(PORTARG_SOLO) { // Servo Angles // - #if HAS_SERVOS && ENABLED(EDITABLE_SERVO_ANGLES) - - #if ENABLED(SWITCHING_EXTRUDER) - - #if EXTRUDERS > 3 - #define REQ_ANGLES 4 - #else - #define REQ_ANGLES 2 - #endif - constexpr uint16_t sesa[] = SWITCHING_EXTRUDER_SERVO_ANGLES; - static_assert(COUNT(sesa) == REQ_ANGLES, "SWITCHING_EXTRUDER_SERVO_ANGLES needs " STRINGIFY(REQ_ANGLES) " angles."); - servo_angles[SWITCHING_EXTRUDER_SERVO_NR][0] = sesa[0]; - servo_angles[SWITCHING_EXTRUDER_SERVO_NR][1] = sesa[1]; - #if EXTRUDERS > 3 - servo_angles[SWITCHING_EXTRUDER_E23_SERVO_NR][0] = sesa[2]; - servo_angles[SWITCHING_EXTRUDER_E23_SERVO_NR][1] = sesa[3]; - #endif - - #elif ENABLED(SWITCHING_NOZZLE) - - constexpr uint16_t snsa[2] = SWITCHING_NOZZLE_SERVO_ANGLES; - servo_angles[SWITCHING_NOZZLE_SERVO_NR][0] = snsa[0]; - servo_angles[SWITCHING_NOZZLE_SERVO_NR][1] = snsa[1]; - - #elif defined(Z_SERVO_ANGLES) && defined(Z_PROBE_SERVO_NR) - - constexpr uint16_t zsa[2] = Z_SERVO_ANGLES; - servo_angles[Z_PROBE_SERVO_NR][0] = zsa[0]; - servo_angles[Z_PROBE_SERVO_NR][1] = zsa[1]; - - #endif + #if ENABLED(EDITABLE_SERVO_ANGLES) + COPY(servo_angles, base_servo_angles); + #endif - #endif // HAS_SERVOS && EDITABLE_SERVO_ANGLES + // + // Endstop Adjustments + // #if ENABLED(DELTA) const float adj[ABC] = DELTA_ENDSTOP_ADJ, dta[ABC] = DELTA_TOWER_ANGLE_TRIM; @@ -2038,7 +2087,7 @@ void MarlinSettings::reset(PORTARG_SOLO) { 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 = ( @@ -2085,6 +2134,10 @@ void MarlinSettings::reset(PORTARG_SOLO) { #endif + // + // Preheat parameters + // + #if HAS_LCD_MENU ui.preheat_hotend_temp[0] = PREHEAT_1_TEMP_HOTEND; ui.preheat_hotend_temp[1] = PREHEAT_2_TEMP_HOTEND; @@ -2094,6 +2147,10 @@ void MarlinSettings::reset(PORTARG_SOLO) { ui.preheat_fan_speed[1] = PREHEAT_2_FAN_SPEED; #endif + // + // Hotend PID + // + #if ENABLED(PIDTEMP) HOTEND_LOOP() { PID_PARAM(Kp, e) = float(DEFAULT_Kp); @@ -2103,29 +2160,54 @@ void MarlinSettings::reset(PORTARG_SOLO) { PID_PARAM(Kc, e) = DEFAULT_Kc; #endif } - #if ENABLED(PID_EXTRUSION_SCALING) - thermalManager.lpq_len = 20; // default last-position-queue size - #endif - #endif // PIDTEMP + #endif + + // + // PID Extrusion Scaling + // + + #if ENABLED(PID_EXTRUSION_SCALING) + thermalManager.lpq_len = 20; // Default last-position-queue size + #endif + + // + // Heated Bed PID + // #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 + // + // LCD Contrast + // + #if HAS_LCD_CONTRAST ui.set_contrast(DEFAULT_LCD_CONTRAST); #endif + // + // Power-Loss Recovery + // + #if ENABLED(POWER_LOSS_RECOVERY) recovery.enable(true); #endif + // + // Firmware Retraction + // + #if ENABLED(FWRETRACT) fwretract.reset(); #endif + // + // Volumetric & Filament Size + // + #if DISABLED(NO_VOLUMETRICS) parser.volumetric_enabled = @@ -2150,16 +2232,41 @@ void MarlinSettings::reset(PORTARG_SOLO) { reset_stepper_drivers(); + // + // Linear Advance + // + #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 + // + // Motor Current PWM + // + #if HAS_MOTOR_CURRENT_PWM - uint32_t tmp_motor_current_setting[3] = PWM_MOTOR_CURRENT; + constexpr uint32_t tmp_motor_current_setting[3] = PWM_MOTOR_CURRENT; for (uint8_t q = 3; q--;) stepper.digipot_current(q, (stepper.motor_current_setting[q] = tmp_motor_current_setting[q])); #endif + // + // CNC Coordinate System + // + + #if ENABLED(CNC_COORDINATE_SYSTEMS) + (void)gcode.select_coordinate_system(-1); // Go back to machine space + #endif + + // + // Skew Correction + // + #if ENABLED(SKEW_CORRECTION_GCODE) planner.skew_factor.xy = XY_SKEW_FACTOR; #if ENABLED(SKEW_CORRECTION_FOR_Z) @@ -2168,6 +2275,10 @@ void MarlinSettings::reset(PORTARG_SOLO) { #endif #endif + // + // Advanced Pause filament load & unload lengths + // + #if ENABLED(ADVANCED_PAUSE_FEATURE) for (uint8_t e = 0; e < EXTRUDERS; e++) { fc_settings[e].unload_length = FILAMENT_CHANGE_UNLOAD_LENGTH; @@ -2177,92 +2288,90 @@ void MarlinSettings::reset(PORTARG_SOLO) { postprocess(); - #if ENABLED(EEPROM_CHITCHAT) - SERIAL_ECHO_START_P(port); - SERIAL_ECHOLNPGM_P(port, "Hardcoded Default Settings Loaded"); - #endif + DEBUG_ECHO_START(); + DEBUG_ECHOLNPGM("Hardcoded Default Settings Loaded"); } #if DISABLED(DISABLE_M503) - #define CONFIG_ECHO_START do{ if (!forReplay) SERIAL_ECHO_START_P(port); }while(0) + #define CONFIG_ECHO_START() do{ if (!forReplay) SERIAL_ECHO_START(); }while(0) + #define CONFIG_ECHO_MSG(STR) do{ CONFIG_ECHO_START(); SERIAL_ECHOLNPGM(STR); }while(0) + #define CONFIG_ECHO_HEADING(STR) do{ if (!forReplay) { CONFIG_ECHO_START(); SERIAL_ECHOLNPGM(STR); } }while(0) #if HAS_TRINAMIC - void say_M906(PORTARG_SOLO) { SERIAL_ECHOPGM_P(port, " 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"); + if (etc) { + SERIAL_CHAR(' '); + serialprintPGM(etc); + SERIAL_EOL(); + } + } + #endif #if ENABLED(HYBRID_THRESHOLD) - void say_M913(PORTARG_SOLO) { SERIAL_ECHOPGM_P(port, " M913"); } + inline void say_M913() { SERIAL_ECHOPGM(" M913"); } #endif #if USE_SENSORLESS - void say_M914(PORTARG_SOLO) { SERIAL_ECHOPGM_P(port, " M914"); } + inline void say_M914() { SERIAL_ECHOPGM(" M914"); } #endif #endif #if ENABLED(ADVANCED_PAUSE_FEATURE) - void say_M603(PORTARG_SOLO) { SERIAL_ECHOPGM_P(port, " M603 "); } + inline void say_M603(const bool forReplay) { CONFIG_ECHO_START(); SERIAL_ECHOPGM(" M603 "); } #endif - inline void say_units( - #if NUM_SERIAL > 1 - const int8_t port, - #endif - const bool colon - ) { - serialprintPGM_P(port, + inline void say_units(const bool colon) { + serialprintPGM( #if ENABLED(INCH_MODE_SUPPORT) parser.linear_unit_factor != 1.0 ? PSTR(" (in)") : #endif PSTR(" (mm)") ); - if (colon) SERIAL_ECHOLNPGM_P(port, ":"); + if (colon) SERIAL_ECHOLNPGM(":"); } - #if NUM_SERIAL > 1 - #define SAY_UNITS_P(PORT, COLON) say_units(PORT, COLON) - #else - #define SAY_UNITS_P(PORT, COLON) say_units(COLON) - #endif + + void report_M92(const bool echo=true, const int8_t e=-1); /** * M503 - Report current settings in RAM * * Unless specifically disabled, M503 is available even without EEPROM */ - void MarlinSettings::report(const bool forReplay - #if NUM_SERIAL > 1 - , const int8_t port/*=-1*/ - #endif - ) { + void MarlinSettings::report(const bool forReplay) { /** * Announce current units, in case inches are being displayed */ - CONFIG_ECHO_START; + CONFIG_ECHO_START(); #if ENABLED(INCH_MODE_SUPPORT) - SERIAL_ECHOPGM_P(port, " G2"); - SERIAL_CHAR_P(port, parser.linear_unit_factor == 1.0 ? '1' : '0'); - SERIAL_ECHOPGM_P(port, " ;"); - SAY_UNITS_P(port, false); + SERIAL_ECHOPGM(" G2"); + SERIAL_CHAR(parser.linear_unit_factor == 1.0 ? '1' : '0'); + SERIAL_ECHOPGM(" ;"); + say_units(false); #else - SERIAL_ECHOPGM_P(port, " G21 ; Units in mm"); - SAY_UNITS_P(port, false); + SERIAL_ECHOPGM(" G21 ; Units in mm"); + say_units(false); #endif - SERIAL_EOL_P(port); + SERIAL_EOL(); #if HAS_LCD_MENU // Temperature units - for Ultipanel temperature options - CONFIG_ECHO_START; + CONFIG_ECHO_START(); #if ENABLED(TEMPERATURE_UNITS_SUPPORT) - SERIAL_ECHOPGM_P(port, " M149 "); - SERIAL_CHAR_P(port, parser.temp_units_code()); - SERIAL_ECHOPGM_P(port, " ; Units in "); - serialprintPGM_P(port, parser.temp_units_name()); + SERIAL_ECHOPGM(" M149 "); + SERIAL_CHAR(parser.temp_units_code()); + SERIAL_ECHOPGM(" ; Units in "); + serialprintPGM(parser.temp_units_name()); #else - SERIAL_ECHOLNPGM_P(port, " M149 C ; Units in Celsius"); + SERIAL_ECHOLNPGM(" M149 C ; Units in Celsius"); #endif #endif - SERIAL_EOL_P(port); + SERIAL_EOL(); #if DISABLED(NO_VOLUMETRICS) @@ -2270,176 +2379,146 @@ void MarlinSettings::reset(PORTARG_SOLO) { * Volumetric extrusion M200 */ if (!forReplay) { - CONFIG_ECHO_START; - SERIAL_ECHOPGM_P(port, "Filament settings:"); + CONFIG_ECHO_START(); + SERIAL_ECHOPGM("Filament settings:"); if (parser.volumetric_enabled) - SERIAL_EOL_P(port); + SERIAL_EOL(); else - SERIAL_ECHOLNPGM_P(port, " Disabled"); + SERIAL_ECHOLNPGM(" Disabled"); } - CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M200 D", LINEAR_UNIT(planner.filament_size[0])); - SERIAL_EOL_P(port); + CONFIG_ECHO_START(); + SERIAL_ECHOLNPAIR(" M200 D", LINEAR_UNIT(planner.filament_size[0])); #if EXTRUDERS > 1 - CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M200 T1 D", LINEAR_UNIT(planner.filament_size[1])); - SERIAL_EOL_P(port); + CONFIG_ECHO_START(); + SERIAL_ECHOLNPAIR(" M200 T1 D", LINEAR_UNIT(planner.filament_size[1])); #if EXTRUDERS > 2 - CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M200 T2 D", LINEAR_UNIT(planner.filament_size[2])); - SERIAL_EOL_P(port); + CONFIG_ECHO_START(); + SERIAL_ECHOLNPAIR(" M200 T2 D", LINEAR_UNIT(planner.filament_size[2])); #if EXTRUDERS > 3 - CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M200 T3 D", LINEAR_UNIT(planner.filament_size[3])); - SERIAL_EOL_P(port); + CONFIG_ECHO_START(); + SERIAL_ECHOLNPAIR(" M200 T3 D", LINEAR_UNIT(planner.filament_size[3])); #if EXTRUDERS > 4 - CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M200 T4 D", LINEAR_UNIT(planner.filament_size[4])); - SERIAL_EOL_P(port); + CONFIG_ECHO_START(); + SERIAL_ECHOLNPAIR(" M200 T4 D", LINEAR_UNIT(planner.filament_size[4])); #if EXTRUDERS > 5 - CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M200 T5 D", LINEAR_UNIT(planner.filament_size[5])); - SERIAL_EOL_P(port); + CONFIG_ECHO_START(); + SERIAL_ECHOLNPAIR(" M200 T5 D", LINEAR_UNIT(planner.filament_size[5])); #endif // EXTRUDERS > 5 #endif // EXTRUDERS > 4 #endif // EXTRUDERS > 3 #endif // EXTRUDERS > 2 #endif // EXTRUDERS > 1 - if (!parser.volumetric_enabled) { - CONFIG_ECHO_START; - SERIAL_ECHOLNPGM_P(port, " M200 D0"); - } + if (!parser.volumetric_enabled) + CONFIG_ECHO_MSG(" M200 D0"); #endif // !NO_VOLUMETRICS - if (!forReplay) { - CONFIG_ECHO_START; - SERIAL_ECHOLNPGM_P(port, "Steps per unit:"); - } - CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M92 X", LINEAR_UNIT(planner.settings.axis_steps_per_mm[X_AXIS])); - SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(planner.settings.axis_steps_per_mm[Y_AXIS])); - SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(planner.settings.axis_steps_per_mm[Z_AXIS])); - #if DISABLED(DISTINCT_E_FACTORS) - SERIAL_ECHOPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.settings.axis_steps_per_mm[E_AXIS])); - #endif - SERIAL_EOL_P(port); - #if ENABLED(DISTINCT_E_FACTORS) - CONFIG_ECHO_START; - for (uint8_t i = 0; i < E_STEPPERS; i++) { - SERIAL_ECHOPAIR_P(port, " M92 T", (int)i); - SERIAL_ECHOLNPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.settings.axis_steps_per_mm[E_AXIS + i])); - } - #endif - - if (!forReplay) { - CONFIG_ECHO_START; - SERIAL_ECHOLNPGM_P(port, "Maximum feedrates (units/s):"); - } - CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M203 X", LINEAR_UNIT(planner.settings.max_feedrate_mm_s[X_AXIS])); - SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(planner.settings.max_feedrate_mm_s[Y_AXIS])); - SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(planner.settings.max_feedrate_mm_s[Z_AXIS])); - #if DISABLED(DISTINCT_E_FACTORS) - SERIAL_ECHOPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.settings.max_feedrate_mm_s[E_AXIS])); - #endif - SERIAL_EOL_P(port); + CONFIG_ECHO_HEADING("Steps per unit:"); + report_M92(!forReplay); + + CONFIG_ECHO_HEADING("Maximum feedrates (units/s):"); + CONFIG_ECHO_START(); + 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; + CONFIG_ECHO_START(); for (uint8_t i = 0; i < E_STEPPERS; i++) { - SERIAL_ECHOPAIR_P(port, " M203 T", (int)i); - SERIAL_ECHOLNPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.settings.max_feedrate_mm_s[E_AXIS + i])); + SERIAL_ECHOLNPAIR( + " M203 T", (int)i + , " E", VOLUMETRIC_UNIT(planner.settings.max_feedrate_mm_s[E_AXIS_N(i)]) + ); } #endif - if (!forReplay) { - CONFIG_ECHO_START; - SERIAL_ECHOLNPGM_P(port, "Maximum Acceleration (units/s2):"); - } - CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M201 X", LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[X_AXIS])); - SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[Y_AXIS])); - SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[Z_AXIS])); - #if DISABLED(DISTINCT_E_FACTORS) - SERIAL_ECHOPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.settings.max_acceleration_mm_per_s2[E_AXIS])); - #endif - SERIAL_EOL_P(port); + CONFIG_ECHO_HEADING("Maximum Acceleration (units/s2):"); + CONFIG_ECHO_START(); + 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_P(port, " M201 T", (int)i); - SERIAL_ECHOLNPAIR_P(port, " E", VOLUMETRIC_UNIT(planner.settings.max_acceleration_mm_per_s2[E_AXIS + i])); - } + CONFIG_ECHO_START(); + 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 - if (!forReplay) { - CONFIG_ECHO_START; - SERIAL_ECHOLNPGM_P(port, "Acceleration (units/s2): P R T"); - } - CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M204 P", LINEAR_UNIT(planner.settings.acceleration)); - SERIAL_ECHOPAIR_P(port, " R", LINEAR_UNIT(planner.settings.retract_acceleration)); - SERIAL_ECHOLNPAIR_P(port, " T", LINEAR_UNIT(planner.settings.travel_acceleration)); + CONFIG_ECHO_HEADING("Acceleration (units/s2): P R T"); + CONFIG_ECHO_START(); + 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; - SERIAL_ECHOPGM_P(port, "Advanced: B S T"); + CONFIG_ECHO_START(); + SERIAL_ECHOPGM("Advanced: B S T"); #if ENABLED(JUNCTION_DEVIATION) - SERIAL_ECHOPGM_P(port, " J"); + SERIAL_ECHOPGM(" J"); #endif #if HAS_CLASSIC_JERK - SERIAL_ECHOPGM_P(port, " X Y Z"); + SERIAL_ECHOPGM(" X Y Z"); #if DISABLED(JUNCTION_DEVIATION) || DISABLED(LIN_ADVANCE) - SERIAL_ECHOPGM_P(port, " E"); + SERIAL_ECHOPGM(" E"); #endif #endif - SERIAL_EOL_P(port); + SERIAL_EOL(); } - CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M205 B", LINEAR_UNIT(planner.settings.min_segment_time_us)); - SERIAL_ECHOPAIR_P(port, " S", LINEAR_UNIT(planner.settings.min_feedrate_mm_s)); - SERIAL_ECHOPAIR_P(port, " T", LINEAR_UNIT(planner.settings.min_travel_feedrate_mm_s)); - - #if ENABLED(JUNCTION_DEVIATION) - SERIAL_ECHOPAIR_P(port, " J", LINEAR_UNIT(planner.junction_deviation_mm)); - #endif - #if HAS_CLASSIC_JERK - SERIAL_ECHOPAIR_P(port, " X", LINEAR_UNIT(planner.max_jerk[X_AXIS])); - SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(planner.max_jerk[Y_AXIS])); - SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(planner.max_jerk[Z_AXIS])); - #if DISABLED(JUNCTION_DEVIATION) || DISABLED(LIN_ADVANCE) - SERIAL_ECHOPAIR_P(port, " E", LINEAR_UNIT(planner.max_jerk[E_AXIS])); + CONFIG_ECHO_START(); + 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_P(port); + #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 - if (!forReplay) { - CONFIG_ECHO_START; - SERIAL_ECHOLNPGM_P(port, "Home offset:"); - } - CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M206 X", LINEAR_UNIT(home_offset[X_AXIS])); - SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(home_offset[Y_AXIS])); - SERIAL_ECHOLNPAIR_P(port, " Z", LINEAR_UNIT(home_offset[Z_AXIS])); + CONFIG_ECHO_HEADING("Home offset:"); + CONFIG_ECHO_START(); + 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 - if (!forReplay) { - CONFIG_ECHO_START; - SERIAL_ECHOLNPGM_P(port, "Hotend offsets:"); - } - CONFIG_ECHO_START; + CONFIG_ECHO_HEADING("Hotend offsets:"); + CONFIG_ECHO_START(); for (uint8_t e = 1; e < HOTENDS; e++) { - SERIAL_ECHOPAIR_P(port, " M218 T", (int)e); - SERIAL_ECHOPAIR_P(port, " X", LINEAR_UNIT(hotend_offset[X_AXIS][e])); - SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(hotend_offset[Y_AXIS][e])); - SERIAL_ECHO_P(port, " Z"); - SERIAL_ECHO_F_P(port, LINEAR_UNIT(hotend_offset[Z_AXIS][e]), 3); - SERIAL_EOL_P(port); + 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 @@ -2450,46 +2529,38 @@ void MarlinSettings::reset(PORTARG_SOLO) { #if ENABLED(MESH_BED_LEVELING) - if (!forReplay) { - CONFIG_ECHO_START; - SERIAL_ECHOLNPGM_P(port, "Mesh Bed Leveling:"); - } + CONFIG_ECHO_HEADING("Mesh Bed Leveling:"); #elif ENABLED(AUTO_BED_LEVELING_UBL) if (!forReplay) { - CONFIG_ECHO_START; + CONFIG_ECHO_START(); ubl.echo_name(); - SERIAL_ECHOLNPGM_P(port, ":"); + SERIAL_ECHOLNPGM(":"); } - #elif HAS_ABL + #elif HAS_ABL_OR_UBL - if (!forReplay) { - CONFIG_ECHO_START; - SERIAL_ECHOLNPGM_P(port, "Auto Bed Leveling:"); - } + CONFIG_ECHO_HEADING("Auto Bed Leveling:"); #endif - CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M420 S", planner.leveling_active ? 1 : 0); - #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) - SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(planner.z_fade_height)); - #endif - SERIAL_EOL_P(port); + CONFIG_ECHO_START(); + 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) if (leveling_is_valid()) { 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_P(port, " G29 S3 X", (int)px + 1); - SERIAL_ECHOPAIR_P(port, " Y", (int)py + 1); - SERIAL_ECHOPGM_P(port, " Z"); - SERIAL_ECHO_F_P(port, LINEAR_UNIT(mbl.z_values[px][py]), 5); - SERIAL_EOL_P(port); + CONFIG_ECHO_START(); + SERIAL_ECHOPAIR(" G29 S3 X", (int)px + 1, " Y", (int)py + 1); + SERIAL_ECHOLNPAIR_F(" Z", LINEAR_UNIT(mbl.z_values[px][py]), 5); } } } @@ -2497,26 +2568,22 @@ void MarlinSettings::reset(PORTARG_SOLO) { #elif ENABLED(AUTO_BED_LEVELING_UBL) if (!forReplay) { - SERIAL_EOL_P(port); + SERIAL_EOL(); ubl.report_state(); - SERIAL_ECHOLNPAIR_P(port, "\nActive Mesh Slot: ", ubl.storage_slot); - SERIAL_ECHOPAIR_P(port, "EEPROM can hold ", calc_num_meshes()); - SERIAL_ECHOLNPGM_P(port, " meshes.\n"); + SERIAL_ECHOLNPAIR("\nActive Mesh Slot: ", ubl.storage_slot); + SERIAL_ECHOLNPAIR("EEPROM can hold ", calc_num_meshes(), " meshes.\n"); } -// ubl.report_current_mesh(PORTVAR_SOLO); // This is too verbose for large mesh's. A better (more terse) - // solution needs to be found. + //ubl.report_current_mesh(); // This is too verbose for large meshes. A better (more terse) + // solution needs to be found. #elif ENABLED(AUTO_BED_LEVELING_BILINEAR) if (leveling_is_valid()) { 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_P(port, " G29 W I", (int)px); - SERIAL_ECHOPAIR_P(port, " J", (int)py); - SERIAL_ECHOPGM_P(port, " Z"); - SERIAL_ECHO_F_P(port, LINEAR_UNIT(z_values[px][py]), 5); - SERIAL_EOL_P(port); + CONFIG_ECHO_START(); + SERIAL_ECHOPAIR(" G29 W I", (int)px, " J", (int)py); + SERIAL_ECHOLNPAIR_F(" Z", LINEAR_UNIT(z_values[px][py]), 5); } } } @@ -2525,12 +2592,9 @@ void MarlinSettings::reset(PORTARG_SOLO) { #endif // HAS_LEVELING - #if HAS_SERVOS && ENABLED(EDITABLE_SERVO_ANGLES) + #if ENABLED(EDITABLE_SERVO_ANGLES) - if (!forReplay) { - CONFIG_ECHO_START; - SERIAL_ECHOLNPGM_P(port, "Servo Angles:"); - } + CONFIG_ECHO_HEADING("Servo Angles:"); for (uint8_t i = 0; i < NUM_SERVOS; i++) { switch (i) { #if ENABLED(SWITCHING_EXTRUDER) @@ -2540,194 +2604,173 @@ void MarlinSettings::reset(PORTARG_SOLO) { #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_P(port, " M281 P", int(i)); - SERIAL_ECHOPAIR_P(port, " L", servo_angles[i][0]); - SERIAL_ECHOPAIR_P(port, " U", servo_angles[i][1]); - SERIAL_EOL_P(port); + CONFIG_ECHO_START(); + SERIAL_ECHOLNPAIR(" M281 P", int(i), " L", servo_angles[i][0], " U", servo_angles[i][1]); default: break; } } - #endif // HAS_SERVOS && EDITABLE_SERVO_ANGLES + #endif // EDITABLE_SERVO_ANGLES #if HAS_SCARA_OFFSET - if (!forReplay) { - CONFIG_ECHO_START; - SERIAL_ECHOLNPGM_P(port, "SCARA settings: S P T"); - } - CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M665 S", delta_segments_per_second); - SERIAL_ECHOPAIR_P(port, " P", scara_home_offset[A_AXIS]); - SERIAL_ECHOPAIR_P(port, " T", scara_home_offset[B_AXIS]); - SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(scara_home_offset[Z_AXIS])); - SERIAL_EOL_P(port); + CONFIG_ECHO_HEADING("SCARA settings: S P T"); + CONFIG_ECHO_START(); + 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) - if (!forReplay) { - CONFIG_ECHO_START; - SERIAL_ECHOLNPGM_P(port, "Endstop adjustment:"); - } - CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M666 X", LINEAR_UNIT(delta_endstop_adj[X_AXIS])); - SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(delta_endstop_adj[Y_AXIS])); - SERIAL_ECHOLNPAIR_P(port, " Z", LINEAR_UNIT(delta_endstop_adj[Z_AXIS])); - if (!forReplay) { - CONFIG_ECHO_START; - SERIAL_ECHOLNPGM_P(port, "Delta settings: L R H S B XYZ"); - } - CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M665 L", LINEAR_UNIT(delta_diagonal_rod)); - SERIAL_ECHOPAIR_P(port, " R", LINEAR_UNIT(delta_radius)); - SERIAL_ECHOPAIR_P(port, " H", LINEAR_UNIT(delta_height)); - SERIAL_ECHOPAIR_P(port, " S", delta_segments_per_second); - SERIAL_ECHOPAIR_P(port, " B", LINEAR_UNIT(delta_calibration_radius)); - SERIAL_ECHOPAIR_P(port, " X", LINEAR_UNIT(delta_tower_angle_trim[A_AXIS])); - SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(delta_tower_angle_trim[B_AXIS])); - SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(delta_tower_angle_trim[C_AXIS])); - SERIAL_EOL_P(port); - - #elif ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS) + CONFIG_ECHO_HEADING("Endstop adjustment:"); + CONFIG_ECHO_START(); + 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]) + ); - if (!forReplay) { - CONFIG_ECHO_START; - SERIAL_ECHOLNPGM_P(port, "Endstop adjustment:"); - } - CONFIG_ECHO_START; - SERIAL_ECHOPGM_P(port, " M666"); + CONFIG_ECHO_HEADING("Delta settings: L R H S B XYZ"); + CONFIG_ECHO_START(); + 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 EITHER(X_DUAL_ENDSTOPS, Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS + + CONFIG_ECHO_HEADING("Endstop adjustment:"); + CONFIG_ECHO_START(); + SERIAL_ECHOPGM(" M666"); #if ENABLED(X_DUAL_ENDSTOPS) - SERIAL_ECHOPAIR_P(port, " X", LINEAR_UNIT(endstops.x2_endstop_adj)); + SERIAL_ECHOPAIR(" X", LINEAR_UNIT(endstops.x2_endstop_adj)); #endif #if ENABLED(Y_DUAL_ENDSTOPS) - SERIAL_ECHOPAIR_P(port, " Y", LINEAR_UNIT(endstops.y2_endstop_adj)); + SERIAL_ECHOPAIR(" Y", LINEAR_UNIT(endstops.y2_endstop_adj)); #endif #if ENABLED(Z_TRIPLE_ENDSTOPS) - SERIAL_ECHOLNPAIR_P(port, "S1 Z", LINEAR_UNIT(endstops.z2_endstop_adj)); - CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M666 S2 Z", LINEAR_UNIT(endstops.z3_endstop_adj)); + SERIAL_ECHOLNPAIR("S1 Z", LINEAR_UNIT(endstops.z2_endstop_adj)); + CONFIG_ECHO_START(); + SERIAL_ECHOPAIR(" M666 S2 Z", LINEAR_UNIT(endstops.z3_endstop_adj)); #elif ENABLED(Z_DUAL_ENDSTOPS) - SERIAL_ECHOPAIR_P(port, " Z", LINEAR_UNIT(endstops.z2_endstop_adj)); + SERIAL_ECHOPAIR(" Z", LINEAR_UNIT(endstops.z2_endstop_adj)); #endif - SERIAL_EOL_P(port); + SERIAL_EOL(); #endif // [XYZ]_DUAL_ENDSTOPS #if HAS_LCD_MENU - if (!forReplay) { - CONFIG_ECHO_START; - SERIAL_ECHOLNPGM_P(port, "Material heatup parameters:"); - } + CONFIG_ECHO_HEADING("Material heatup parameters:"); for (uint8_t i = 0; i < COUNT(ui.preheat_hotend_temp); i++) { - CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M145 S", (int)i); - SERIAL_ECHOPAIR_P(port, " H", TEMP_UNIT(ui.preheat_hotend_temp[i])); - SERIAL_ECHOPAIR_P(port, " B", TEMP_UNIT(ui.preheat_bed_temp[i])); - SERIAL_ECHOLNPAIR_P(port, " F", int(ui.preheat_fan_speed[i])); + CONFIG_ECHO_START(); + 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 #if HAS_PID_HEATING - if (!forReplay) { - CONFIG_ECHO_START; - SERIAL_ECHOLNPGM_P(port, "PID settings:"); - } + CONFIG_ECHO_HEADING("PID settings:"); #if ENABLED(PIDTEMP) #if HOTENDS > 1 if (forReplay) { HOTEND_LOOP() { - CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M301 E", e); - SERIAL_ECHOPAIR_P(port, " P", PID_PARAM(Kp, e)); - SERIAL_ECHOPAIR_P(port, " I", unscalePID_i(PID_PARAM(Ki, e))); - SERIAL_ECHOPAIR_P(port, " D", unscalePID_d(PID_PARAM(Kd, e))); + CONFIG_ECHO_START(); + 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_P(port, " C", PID_PARAM(Kc, e)); - if (e == 0) SERIAL_ECHOPAIR_P(port, " L", thermalManager.lpq_len); + SERIAL_ECHOPAIR(" C", PID_PARAM(Kc, e)); + if (e == 0) SERIAL_ECHOPAIR(" L", thermalManager.lpq_len); #endif - SERIAL_EOL_P(port); + SERIAL_EOL(); } } else #endif // HOTENDS > 1 // !forReplay || HOTENDS == 1 { - CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M301 P", PID_PARAM(Kp, 0)); // for compatibility with hosts, only echo values for E0 - SERIAL_ECHOPAIR_P(port, " I", unscalePID_i(PID_PARAM(Ki, 0))); - SERIAL_ECHOPAIR_P(port, " D", unscalePID_d(PID_PARAM(Kd, 0))); - #if ENABLED(PID_EXTRUSION_SCALING) - SERIAL_ECHOPAIR_P(port, " C", PID_PARAM(Kc, 0)); - SERIAL_ECHOPAIR_P(port, " L", thermalManager.lpq_len); - #endif - SERIAL_EOL_P(port); + CONFIG_ECHO_START(); + 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_P(port, " M304 P", thermalManager.bed_pid.Kp); - SERIAL_ECHOPAIR_P(port, " I", unscalePID_i(thermalManager.bed_pid.Ki)); - SERIAL_ECHOPAIR_P(port, " D", unscalePID_d(thermalManager.bed_pid.Kd)); - SERIAL_EOL_P(port); + CONFIG_ECHO_START(); + 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 #if HAS_LCD_CONTRAST - if (!forReplay) { - CONFIG_ECHO_START; - SERIAL_ECHOLNPGM_P(port, "LCD Contrast:"); - } - CONFIG_ECHO_START; - SERIAL_ECHOLNPAIR_P(port, " M250 C", ui.contrast); + CONFIG_ECHO_HEADING("LCD Contrast:"); + CONFIG_ECHO_START(); + SERIAL_ECHOLNPAIR(" M250 C", ui.contrast); #endif #if ENABLED(POWER_LOSS_RECOVERY) - if (!forReplay) { - CONFIG_ECHO_START; - SERIAL_ECHOLNPGM_P(port, "Power-Loss Recovery:"); - } - CONFIG_ECHO_START; - SERIAL_ECHOLNPAIR_P(port, " M413 S", int(recovery.enabled)); + CONFIG_ECHO_HEADING("Power-Loss Recovery:"); + CONFIG_ECHO_START(); + SERIAL_ECHOLNPAIR(" M413 S", int(recovery.enabled)); #endif #if ENABLED(FWRETRACT) - if (!forReplay) { - CONFIG_ECHO_START; - SERIAL_ECHOLNPGM_P(port, "Retract: S F Z"); - } - CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M207 S", LINEAR_UNIT(fwretract.settings.retract_length)); - SERIAL_ECHOPAIR_P(port, " W", LINEAR_UNIT(fwretract.settings.swap_retract_length)); - SERIAL_ECHOPAIR_P(port, " F", MMS_TO_MMM(LINEAR_UNIT(fwretract.settings.retract_feedrate_mm_s))); - SERIAL_ECHOLNPAIR_P(port, " Z", LINEAR_UNIT(fwretract.settings.retract_zraise)); + CONFIG_ECHO_HEADING("Retract: S F Z"); + CONFIG_ECHO_START(); + 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) + ); - if (!forReplay) { - CONFIG_ECHO_START; - SERIAL_ECHOLNPGM_P(port, "Recover: S F"); - } - CONFIG_ECHO_START; - SERIAL_ECHOPAIR_P(port, " M208 S", LINEAR_UNIT(fwretract.settings.retract_recover_length)); - SERIAL_ECHOPAIR_P(port, " W", LINEAR_UNIT(fwretract.settings.swap_retract_recover_length)); - SERIAL_ECHOLNPAIR_P(port, " F", MMS_TO_MMM(LINEAR_UNIT(fwretract.settings.retract_recover_feedrate_mm_s))); + CONFIG_ECHO_HEADING("Recover: S F"); + CONFIG_ECHO_START(); + 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) - if (!forReplay) { - CONFIG_ECHO_START; - SERIAL_ECHOLNPGM_P(port, "Auto-Retract: S=0 to disable, 1 to interpret E-only moves as retract/recover"); - } - CONFIG_ECHO_START; - SERIAL_ECHOLNPAIR_P(port, " M209 S", fwretract.autoretract_enabled ? 1 : 0); + CONFIG_ECHO_HEADING("Auto-Retract: S=0 to disable, 1 to interpret E-only moves as retract/recover"); + CONFIG_ECHO_START(); + SERIAL_ECHOLNPAIR(" M209 S", fwretract.autoretract_enabled ? 1 : 0); #endif // FWRETRACT_AUTORETRACT @@ -2738,35 +2781,26 @@ void MarlinSettings::reset(PORTARG_SOLO) { */ #if HAS_BED_PROBE if (!forReplay) { - CONFIG_ECHO_START; - SERIAL_ECHOPGM_P(port, "Z-Probe Offset"); - SAY_UNITS_P(port, true); + CONFIG_ECHO_START(); + SERIAL_ECHOPGM("Z-Probe Offset"); + say_units(true); } - CONFIG_ECHO_START; - SERIAL_ECHOLNPAIR_P(port, " M851 Z", LINEAR_UNIT(zprobe_zoffset)); + CONFIG_ECHO_START(); + SERIAL_ECHOLNPAIR(" M851 Z", LINEAR_UNIT(zprobe_zoffset)); #endif /** * Bed Skew Correction */ #if ENABLED(SKEW_CORRECTION_GCODE) - if (!forReplay) { - CONFIG_ECHO_START; - SERIAL_ECHOLNPGM_P(port, "Skew Factor: "); - } - CONFIG_ECHO_START; + CONFIG_ECHO_HEADING("Skew Factor: "); + CONFIG_ECHO_START(); #if ENABLED(SKEW_CORRECTION_FOR_Z) - SERIAL_ECHOPGM_P(port, " M852 I"); - SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.skew_factor.xy), 6); - SERIAL_ECHOPGM_P(port, " J"); - SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.skew_factor.xz), 6); - SERIAL_ECHOPGM_P(port, " K"); - SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.skew_factor.yz), 6); - SERIAL_EOL_P(port); + SERIAL_ECHOPAIR_F(" M852 I", LINEAR_UNIT(planner.skew_factor.xy), 6); + SERIAL_ECHOPAIR_F(" J", LINEAR_UNIT(planner.skew_factor.xz), 6); + SERIAL_ECHOLNPAIR_F(" K", LINEAR_UNIT(planner.skew_factor.yz), 6); #else - SERIAL_ECHOPGM_P(port, " M852 S"); - SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.skew_factor.xy), 6); - SERIAL_EOL_P(port); + SERIAL_ECHOLNPAIR_F(" M852 S", LINEAR_UNIT(planner.skew_factor.xy), 6); #endif #endif @@ -2775,171 +2809,159 @@ void MarlinSettings::reset(PORTARG_SOLO) { /** * TMC stepper driver current */ - if (!forReplay) { - CONFIG_ECHO_START; - SERIAL_ECHOLNPGM_P(port, "Stepper driver current:"); - } - CONFIG_ECHO_START; - #if AXIS_IS_TMC(X) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Z) - say_M906(PORTVAR_SOLO); - #endif - #if AXIS_IS_TMC(X) - SERIAL_ECHOPAIR_P(port, " X", stepperX.getMilliamps()); - #endif - #if AXIS_IS_TMC(Y) - SERIAL_ECHOPAIR_P(port, " Y", stepperY.getMilliamps()); - #endif - #if AXIS_IS_TMC(Z) - SERIAL_ECHOPAIR_P(port, " Z", stepperZ.getMilliamps()); - #endif + CONFIG_ECHO_HEADING("Stepper driver current:"); + #if AXIS_IS_TMC(X) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Z) - SERIAL_EOL_P(port); + 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(PORTVAR_SOLO); - SERIAL_ECHOPGM_P(port, " I1"); - #endif - #if AXIS_IS_TMC(X2) - SERIAL_ECHOPAIR_P(port, " X", stepperX2.getMilliamps()); - #endif - #if AXIS_IS_TMC(Y2) - SERIAL_ECHOPAIR_P(port, " Y", stepperY2.getMilliamps()); - #endif - #if AXIS_IS_TMC(Z2) - SERIAL_ECHOPAIR_P(port, " Z", stepperZ2.getMilliamps()); - #endif - #if AXIS_IS_TMC(X2) || AXIS_IS_TMC(Y2) || AXIS_IS_TMC(Z2) - SERIAL_EOL_P(port); + say_M906(forReplay); + SERIAL_ECHOPGM(" I1"); + 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(PORTVAR_SOLO); - SERIAL_ECHOLNPAIR_P(port, " I2 Z", stepperZ3.getMilliamps()); + say_M906(forReplay); + SERIAL_ECHOLNPAIR(" I2 Z", stepperZ3.getMilliamps()); #endif #if AXIS_IS_TMC(E0) - say_M906(PORTVAR_SOLO); - SERIAL_ECHOLNPAIR_P(port, " T0 E", stepperE0.getMilliamps()); + say_M906(forReplay); + SERIAL_ECHOLNPAIR(" T0 E", stepperE0.getMilliamps()); #endif #if AXIS_IS_TMC(E1) - say_M906(PORTVAR_SOLO); - SERIAL_ECHOLNPAIR_P(port, " T1 E", stepperE1.getMilliamps()); + say_M906(forReplay); + SERIAL_ECHOLNPAIR(" T1 E", stepperE1.getMilliamps()); #endif #if AXIS_IS_TMC(E2) - say_M906(PORTVAR_SOLO); - SERIAL_ECHOLNPAIR_P(port, " T2 E", stepperE2.getMilliamps()); + say_M906(forReplay); + SERIAL_ECHOLNPAIR(" T2 E", stepperE2.getMilliamps()); #endif #if AXIS_IS_TMC(E3) - say_M906(PORTVAR_SOLO); - SERIAL_ECHOLNPAIR_P(port, " T3 E", stepperE3.getMilliamps()); + say_M906(forReplay); + SERIAL_ECHOLNPAIR(" T3 E", stepperE3.getMilliamps()); #endif #if AXIS_IS_TMC(E4) - say_M906(PORTVAR_SOLO); - SERIAL_ECHOLNPAIR_P(port, " T4 E", stepperE4.getMilliamps()); + say_M906(forReplay); + SERIAL_ECHOLNPAIR(" T4 E", stepperE4.getMilliamps()); #endif #if AXIS_IS_TMC(E5) - say_M906(PORTVAR_SOLO); - SERIAL_ECHOLNPAIR_P(port, " T5 E", stepperE5.getMilliamps()); + say_M906(forReplay); + SERIAL_ECHOLNPAIR(" T5 E", stepperE5.getMilliamps()); #endif - SERIAL_EOL_P(port); + SERIAL_EOL(); /** * TMC Hybrid Threshold */ #if ENABLED(HYBRID_THRESHOLD) - if (!forReplay) { - CONFIG_ECHO_START; - SERIAL_ECHOLNPGM_P(port, "Hybrid Threshold:"); - } - CONFIG_ECHO_START; + CONFIG_ECHO_HEADING("Hybrid Threshold:"); + CONFIG_ECHO_START(); #if AXIS_HAS_STEALTHCHOP(X) || AXIS_HAS_STEALTHCHOP(Y) || AXIS_HAS_STEALTHCHOP(Z) - say_M913(PORTVAR_SOLO); + say_M913(); #endif #if AXIS_HAS_STEALTHCHOP(X) - SERIAL_ECHOPAIR_P(port, " X", TMC_GET_PWMTHRS(X, X)); + SERIAL_ECHOPAIR(" X", TMC_GET_PWMTHRS(X, X)); #endif #if AXIS_HAS_STEALTHCHOP(Y) - SERIAL_ECHOPAIR_P(port, " Y", TMC_GET_PWMTHRS(Y, Y)); + SERIAL_ECHOPAIR(" Y", TMC_GET_PWMTHRS(Y, Y)); #endif #if AXIS_HAS_STEALTHCHOP(Z) - SERIAL_ECHOPAIR_P(port, " Z", TMC_GET_PWMTHRS(Z, Z)); + SERIAL_ECHOPAIR(" Z", TMC_GET_PWMTHRS(Z, Z)); #endif #if AXIS_HAS_STEALTHCHOP(X) || AXIS_HAS_STEALTHCHOP(Y) || AXIS_HAS_STEALTHCHOP(Z) - SERIAL_EOL_P(port); + SERIAL_EOL(); #endif #if AXIS_HAS_STEALTHCHOP(X2) || AXIS_HAS_STEALTHCHOP(Y2) || AXIS_HAS_STEALTHCHOP(Z2) - say_M913(PORTVAR_SOLO); - SERIAL_ECHOPGM_P(port, " I1"); + say_M913(); + SERIAL_ECHOPGM(" I1"); #endif #if AXIS_HAS_STEALTHCHOP(X2) - SERIAL_ECHOPAIR_P(port, " X", TMC_GET_PWMTHRS(X, X2)); + SERIAL_ECHOPAIR(" X", TMC_GET_PWMTHRS(X, X2)); #endif #if AXIS_HAS_STEALTHCHOP(Y2) - SERIAL_ECHOPAIR_P(port, " Y", TMC_GET_PWMTHRS(Y, Y2)); + SERIAL_ECHOPAIR(" Y", TMC_GET_PWMTHRS(Y, Y2)); #endif #if AXIS_HAS_STEALTHCHOP(Z2) - SERIAL_ECHOPAIR_P(port, " Z", TMC_GET_PWMTHRS(Z, Z2)); + SERIAL_ECHOPAIR(" Z", TMC_GET_PWMTHRS(Z, Z2)); #endif #if AXIS_HAS_STEALTHCHOP(X2) || AXIS_HAS_STEALTHCHOP(Y2) || AXIS_HAS_STEALTHCHOP(Z2) - SERIAL_EOL_P(port); + SERIAL_EOL(); #endif #if AXIS_HAS_STEALTHCHOP(Z3) - say_M913(PORTVAR_SOLO); - SERIAL_ECHOPGM_P(port, " I2"); - SERIAL_ECHOLNPAIR_P(port, " Z", TMC_GET_PWMTHRS(Z, Z3)); + say_M913(); + SERIAL_ECHOLNPAIR(" I2 Z", TMC_GET_PWMTHRS(Z, Z3)); #endif #if AXIS_HAS_STEALTHCHOP(E0) - say_M913(PORTVAR_SOLO); - SERIAL_ECHOLNPAIR_P(port, " T0 E", TMC_GET_PWMTHRS(E, E0)); + say_M913(); + SERIAL_ECHOLNPAIR(" T0 E", TMC_GET_PWMTHRS(E, E0)); #endif #if AXIS_HAS_STEALTHCHOP(E1) - say_M913(PORTVAR_SOLO); - SERIAL_ECHOLNPAIR_P(port, " T1 E", TMC_GET_PWMTHRS(E, E1)); + say_M913(); + SERIAL_ECHOLNPAIR(" T1 E", TMC_GET_PWMTHRS(E, E1)); #endif #if AXIS_HAS_STEALTHCHOP(E2) - say_M913(PORTVAR_SOLO); - SERIAL_ECHOLNPAIR_P(port, " T2 E", TMC_GET_PWMTHRS(E, E2)); + say_M913(); + SERIAL_ECHOLNPAIR(" T2 E", TMC_GET_PWMTHRS(E, E2)); #endif #if AXIS_HAS_STEALTHCHOP(E3) - say_M913(PORTVAR_SOLO); - SERIAL_ECHOLNPAIR_P(port, " T3 E", TMC_GET_PWMTHRS(E, E3)); + say_M913(); + SERIAL_ECHOLNPAIR(" T3 E", TMC_GET_PWMTHRS(E, E3)); #endif #if AXIS_HAS_STEALTHCHOP(E4) - say_M913(PORTVAR_SOLO); - SERIAL_ECHOLNPAIR_P(port, " T4 E", TMC_GET_PWMTHRS(E, E4)); + say_M913(); + SERIAL_ECHOLNPAIR(" T4 E", TMC_GET_PWMTHRS(E, E4)); #endif #if AXIS_HAS_STEALTHCHOP(E5) - say_M913(PORTVAR_SOLO); - SERIAL_ECHOLNPAIR_P(port, " T5 E", TMC_GET_PWMTHRS(E, E5)); + say_M913(); + SERIAL_ECHOLNPAIR(" T5 E", TMC_GET_PWMTHRS(E, E5)); #endif - SERIAL_EOL_P(port); + SERIAL_EOL(); #endif // HYBRID_THRESHOLD /** * TMC Sensorless homing thresholds */ #if USE_SENSORLESS - if (!forReplay) { - CONFIG_ECHO_START; - SERIAL_ECHOLNPGM_P(port, "TMC2130 StallGuard threshold:"); - } - CONFIG_ECHO_START; + CONFIG_ECHO_HEADING("TMC2130 StallGuard threshold:"); + CONFIG_ECHO_START(); #if X_SENSORLESS || Y_SENSORLESS || Z_SENSORLESS - say_M914(PORTVAR_SOLO); + say_M914(); #if X_SENSORLESS - SERIAL_ECHOPAIR_P(port, " X", stepperX.sgt()); + SERIAL_ECHOPAIR(" X", stepperX.sgt()); #endif #if Y_SENSORLESS - SERIAL_ECHOPAIR_P(port, " Y", stepperY.sgt()); + SERIAL_ECHOPAIR(" Y", stepperY.sgt()); #endif #if Z_SENSORLESS - SERIAL_ECHOPAIR_P(port, " Z", stepperZ.sgt()); + SERIAL_ECHOPAIR(" Z", stepperZ.sgt()); #endif - SERIAL_EOL_P(port); + SERIAL_EOL(); #endif #define HAS_X2_SENSORLESS (defined(X_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(X2)) @@ -2947,103 +2969,148 @@ void MarlinSettings::reset(PORTARG_SOLO) { #define HAS_Z2_SENSORLESS (defined(Z_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z2)) #define HAS_Z3_SENSORLESS (defined(Z_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z3)) #if HAS_X2_SENSORLESS || HAS_Y2_SENSORLESS || HAS_Z2_SENSORLESS - say_M914(PORTVAR_SOLO); - SERIAL_ECHOPGM_P(port, " I1"); + say_M914(); + SERIAL_ECHOPGM(" I1"); #if HAS_X2_SENSORLESS - SERIAL_ECHOPAIR_P(port, " X", stepperX2.sgt()); + SERIAL_ECHOPAIR(" X", stepperX2.sgt()); #endif #if HAS_Y2_SENSORLESS - SERIAL_ECHOPAIR_P(port, " Y", stepperY2.sgt()); + SERIAL_ECHOPAIR(" Y", stepperY2.sgt()); #endif #if HAS_Z2_SENSORLESS - SERIAL_ECHOPAIR_P(port, " Z", stepperZ2.sgt()); + SERIAL_ECHOPAIR(" Z", stepperZ2.sgt()); #endif - SERIAL_EOL_P(port); + SERIAL_EOL(); #endif #if HAS_Z3_SENSORLESS - say_M914(PORTVAR_SOLO); - SERIAL_ECHOPGM_P(port, " I2"); - SERIAL_ECHOLNPAIR_P(port, " Z", stepperZ3.sgt()); + say_M914(); + SERIAL_ECHOLNPAIR(" I2 Z", stepperZ3.sgt()); #endif #endif // USE_SENSORLESS + /** + * TMC stepping mode + */ + #if HAS_STEALTHCHOP + CONFIG_ECHO_HEADING("Driver stepping mode:"); + CONFIG_ECHO_START(); + #if AXIS_HAS_STEALTHCHOP(X) + const bool chop_x = stepperX.get_stealthChop_status(); + #else + constexpr bool chop_x = false; + #endif + #if AXIS_HAS_STEALTHCHOP(Y) + const bool chop_y = stepperY.get_stealthChop_status(); + #else + constexpr bool chop_y = false; + #endif + #if AXIS_HAS_STEALTHCHOP(Z) + const bool chop_z = stepperZ.get_stealthChop_status(); + #else + constexpr bool chop_z = false; + #endif + + if (chop_x || chop_y || chop_z) say_M569(); + if (chop_x) SERIAL_ECHOPGM(" X"); + if (chop_y) SERIAL_ECHOPGM(" Y"); + if (chop_z) SERIAL_ECHOPGM(" Z"); + if (chop_x || chop_y || chop_z) SERIAL_EOL(); + + #if AXIS_HAS_STEALTHCHOP(X2) + const bool chop_x2 = stepperX2.get_stealthChop_status(); + #else + constexpr bool chop_x2 = false; + #endif + #if AXIS_HAS_STEALTHCHOP(Y2) + const bool chop_y2 = stepperY2.get_stealthChop_status(); + #else + constexpr bool chop_y2 = false; + #endif + #if AXIS_HAS_STEALTHCHOP(Z2) + const bool chop_z2 = stepperZ2.get_stealthChop_status(); + #else + constexpr bool chop_z2 = false; + #endif + + if (chop_x2 || chop_y2 || chop_z2) say_M569(PSTR("I1")); + if (chop_x2) SERIAL_ECHOPGM(" X"); + if (chop_y2) SERIAL_ECHOPGM(" Y"); + if (chop_z2) SERIAL_ECHOPGM(" Z"); + if (chop_x2 || chop_y2 || chop_z2) SERIAL_EOL(); + + #if AXIS_HAS_STEALTHCHOP(Z3) + if (stepperZ3.get_stealthChop_status()) { say_M569(PSTR("I2 Z")); } + #endif + + #if AXIS_HAS_STEALTHCHOP(E0) + if (stepperE0.get_stealthChop_status()) { say_M569(PSTR("T0 E")); } + #endif + #if AXIS_HAS_STEALTHCHOP(E1) + if (stepperE1.get_stealthChop_status()) { say_M569(PSTR("T1 E")); } + #endif + #if AXIS_HAS_STEALTHCHOP(E2) + if (stepperE2.get_stealthChop_status()) { say_M569(PSTR("T2 E")); } + #endif + #if AXIS_HAS_STEALTHCHOP(E3) + if (stepperE3.get_stealthChop_status()) { say_M569(PSTR("T3 E")); } + #endif + #if AXIS_HAS_STEALTHCHOP(E4) + if (stepperE4.get_stealthChop_status()) { say_M569(PSTR("T4 E")); } + #endif + #if AXIS_HAS_STEALTHCHOP(E5) + if (stepperE5.get_stealthChop_status()) { say_M569(PSTR("T5 E")); } + #endif + + #endif // HAS_STEALTHCHOP + #endif // HAS_TRINAMIC /** * Linear Advance */ #if ENABLED(LIN_ADVANCE) - if (!forReplay) { - CONFIG_ECHO_START; - SERIAL_ECHOLNPGM_P(port, "Linear Advance:"); - } - - CONFIG_ECHO_START; + CONFIG_ECHO_HEADING("Linear Advance:"); + CONFIG_ECHO_START(); #if EXTRUDERS < 2 - SERIAL_ECHOLNPAIR_P(port, " M900 K", planner.extruder_advance_K[0]); + SERIAL_ECHOLNPAIR(" M900 K", planner.extruder_advance_K[0]); #else - LOOP_L_N(i, EXTRUDERS) { - SERIAL_ECHOPAIR_P(port, " M900 T", int(i)); - SERIAL_ECHOLNPAIR_P(port, " 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_START; - if (!forReplay) { - SERIAL_ECHOLNPGM_P(port, "Stepper motor currents:"); - CONFIG_ECHO_START; - } - SERIAL_ECHOPAIR_P(port, " M907 X", stepper.motor_current_setting[0]); - SERIAL_ECHOPAIR_P(port, " Z", stepper.motor_current_setting[1]); - SERIAL_ECHOPAIR_P(port, " E", stepper.motor_current_setting[2]); - SERIAL_EOL_P(port); + CONFIG_ECHO_HEADING("Stepper motor currents:"); + CONFIG_ECHO_START(); + SERIAL_ECHOLNPAIR( + " M907 X", stepper.motor_current_setting[0] + , " Z", stepper.motor_current_setting[1] + , " E", stepper.motor_current_setting[2] + ); #endif /** * Advanced Pause filament load & unload lengths */ #if ENABLED(ADVANCED_PAUSE_FEATURE) - if (!forReplay) { - CONFIG_ECHO_START; - SERIAL_ECHOLNPGM_P(port, "Filament load/unload lengths:"); - } - CONFIG_ECHO_START; + CONFIG_ECHO_HEADING("Filament load/unload lengths:"); #if EXTRUDERS == 1 - say_M603(PORTVAR_SOLO); - SERIAL_ECHOPAIR_P(port, "L", LINEAR_UNIT(fc_settings[0].load_length)); - SERIAL_ECHOLNPAIR_P(port, " 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(PORTVAR_SOLO); - SERIAL_ECHOPAIR_P(port, "T0 L", LINEAR_UNIT(fc_settings[0].load_length)); - SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(fc_settings[0].unload_length)); - CONFIG_ECHO_START; - say_M603(PORTVAR_SOLO); - SERIAL_ECHOPAIR_P(port, "T1 L", LINEAR_UNIT(fc_settings[1].load_length)); - SERIAL_ECHOLNPAIR_P(port, " 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(PORTVAR_SOLO); - SERIAL_ECHOPAIR_P(port, "T2 L", LINEAR_UNIT(fc_settings[2].load_length)); - SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(fc_settings[2].unload_length)); + _ECHO_603(2); #if EXTRUDERS > 3 - CONFIG_ECHO_START; - say_M603(PORTVAR_SOLO); - SERIAL_ECHOPAIR_P(port, "T3 L", LINEAR_UNIT(fc_settings[3].load_length)); - SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(fc_settings[3].unload_length)); + _ECHO_603(3); #if EXTRUDERS > 4 - CONFIG_ECHO_START; - say_M603(PORTVAR_SOLO); - SERIAL_ECHOPAIR_P(port, "T4 L", LINEAR_UNIT(fc_settings[4].load_length)); - SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(fc_settings[4].unload_length)); + _ECHO_603(4); #if EXTRUDERS > 5 - CONFIG_ECHO_START; - say_M603(PORTVAR_SOLO); - SERIAL_ECHOPAIR_P(port, "T5 L", LINEAR_UNIT(fc_settings[5].load_length)); - SERIAL_ECHOLNPAIR_P(port, " U", LINEAR_UNIT(fc_settings[5].unload_length)); + _ECHO_603(5); #endif // EXTRUDERS > 5 #endif // EXTRUDERS > 4 #endif // EXTRUDERS > 3 @@ -3052,11 +3119,8 @@ void MarlinSettings::reset(PORTARG_SOLO) { #endif // ADVANCED_PAUSE_FEATURE #if EXTRUDERS > 1 - CONFIG_ECHO_START; - if (!forReplay) { - SERIAL_ECHOLNPGM_P(port, "Tool-changing:"); - CONFIG_ECHO_START; - } + CONFIG_ECHO_HEADING("Tool-changing:"); + CONFIG_ECHO_START(); M217_report(true); #endif } diff --git a/Marlin/src/module/configuration_store.h b/Marlin/src/module/configuration_store.h index 88f36a492fb9..af2bff1e0a59 100644 --- a/Marlin/src/module/configuration_store.h +++ b/Marlin/src/module/configuration_store.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -27,24 +27,14 @@ #include "../HAL/shared/persistent_store_api.h" #endif -#define ADD_PORT_ARG ENABLED(EEPROM_CHITCHAT) && NUM_SERIAL > 1 - -#if ADD_PORT_ARG - #define PORTINIT_SOLO const int8_t port=-1 - #define PORTINIT_AFTER ,const int8_t port=-1 -#else - #define PORTINIT_SOLO - #define PORTINIT_AFTER -#endif - class MarlinSettings { public: MarlinSettings() { } static uint16_t datasize(); - static void reset(PORTINIT_SOLO); - static bool save(PORTINIT_SOLO); // Return 'true' if data was saved + static void reset(); + static bool save(); // Return 'true' if data was saved FORCE_INLINE static bool init_eeprom() { reset(); @@ -65,8 +55,8 @@ class MarlinSettings { #endif #if ENABLED(EEPROM_SETTINGS) - static bool load(PORTINIT_SOLO); // Return 'true' if data was loaded ok - static bool validate(PORTINIT_SOLO); // Return 'true' if EEPROM data is ok + static bool load(); // Return 'true' if data was loaded ok + static bool validate(); // Return 'true' if EEPROM data is ok #if ENABLED(AUTO_BED_LEVELING_UBL) // Eventually make these available if any leveling system // That can store is enabled @@ -86,11 +76,7 @@ class MarlinSettings { #endif #if DISABLED(DISABLE_M503) - static void report(const bool forReplay=false - #if NUM_SERIAL > 1 - , const int8_t port=-1 - #endif - ); + static void report(const bool forReplay=false); #else FORCE_INLINE static void report(const bool forReplay=false) { UNUSED(forReplay); } @@ -109,12 +95,9 @@ class MarlinSettings { // live at the very end of the eeprom #endif - static bool _load(PORTINIT_SOLO); - static bool size_error(const uint16_t size PORTINIT_AFTER); + static bool _load(); + static bool size_error(const uint16_t size); #endif }; extern MarlinSettings settings; - -#undef PORTINIT_SOLO -#undef PORTINIT_AFTER diff --git a/Marlin/src/module/delta.cpp b/Marlin/src/module/delta.cpp index 7d246aac404c..fbe474d85e3a 100644 --- a/Marlin/src/module/delta.cpp +++ b/Marlin/src/module/delta.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -37,10 +37,18 @@ #include "../lcd/ultralcd.h" #include "../Marlin.h" +#if HAS_BED_PROBE + #include "probe.h" +#endif + #if ENABLED(SENSORLESS_HOMING) #include "../feature/tmc_util.h" + #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 }, @@ -206,22 +214,12 @@ void forward_kinematics_DELTA(const float &z1, const float &z2, const float &z3) cartes[Z_AXIS] = z1 + ex[2] * Xnew + ey[2] * Ynew - ez[2] * Znew; } -#if ENABLED(SENSORLESS_HOMING) - inline void delta_sensorless_homing(const bool on=true) { - sensorless_homing_per_axis(A_AXIS, on); - sensorless_homing_per_axis(B_AXIS, on); - sensorless_homing_per_axis(C_AXIS, on); - } -#endif - /** * A delta can only safely home all axes at the same time * 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); @@ -229,17 +227,26 @@ void home_delta() { // Disable stealthChop if used. Enable diag1 pin on driver. #if ENABLED(SENSORLESS_HOMING) - delta_sensorless_homing(); + sensorless_t stealth_states { false, false, false, false, false, false, false }; + stealth_states.x = tmc_enable_stallguard(stepperX); + stealth_states.y = tmc_enable_stallguard(stepperY); + stealth_states.z = tmc_enable_stallguard(stepperZ); #endif // Move all carriages together linearly until an endstop is hit. - destination[Z_AXIS] = (delta_height + 10); + destination[Z_AXIS] = (delta_height + #if HAS_BED_PROBE + - zprobe_zoffset + #endif + + 10); buffer_line_to_destination(homing_feedrate(X_AXIS)); planner.synchronize(); // Re-enable stealthChop if used. Disable diag1 pin on driver. #if ENABLED(SENSORLESS_HOMING) - delta_sensorless_homing(false); + tmc_disable_stallguard(stepperX, stealth_states.x); + tmc_disable_stallguard(stepperY, stealth_states.y); + tmc_disable_stallguard(stepperZ, stealth_states.z); #endif endstops.validate_homing_move(); @@ -258,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/delta.h b/Marlin/src/module/delta.h index 52e2c59acc6e..292cb1162169 100644 --- a/Marlin/src/module/delta.h +++ b/Marlin/src/module/delta.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/endstops.cpp b/Marlin/src/module/endstops.cpp index 988bc21b17d0..e077045ef516 100644 --- a/Marlin/src/module/endstops.cpp +++ b/Marlin/src/module/endstops.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -29,15 +29,15 @@ #include "../Marlin.h" #include "../sd/cardreader.h" -#include "../module/temperature.h" +#include "temperature.h" #include "../lcd/ultralcd.h" #if ENABLED(ENDSTOP_INTERRUPTS_FEATURE) #include HAL_PATH(../HAL, endstop_interrupts.h) #endif -#if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) && ENABLED(SDSUPPORT) - #include "../module/printcounter.h" // for print_job_timer +#if BOTH(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED, SDSUPPORT) + #include "printcounter.h" // for print_job_timer #endif Endstops endstops; @@ -218,7 +218,17 @@ void Endstops::init() { #endif #endif - #if ENABLED(Z_MIN_PROBE_ENDSTOP) + #if HAS_CALIBRATION_PIN + #if ENABLED(CALIBRATION_PIN_PULLUP) + SET_INPUT_PULLUP(CALIBRATION_PIN); + #elif ENABLED(CALIBRATION_PIN_PULLDOWN) + SET_INPUT_PULLDOWN(CALIBRATION_PIN); + #else + SET_INPUT(CALIBRATION_PIN); + #endif + #endif + + #if USES_Z_MIN_PROBE_ENDSTOP #if ENABLED(ENDSTOPPULLUP_ZMIN_PROBE) SET_INPUT_PULLUP(Z_MIN_PROBE_PIN); #elif ENABLED(ENDSTOPPULLDOWN_ZMIN_PROBE) @@ -341,7 +351,7 @@ void Endstops::event_handler() { ENDSTOP_HIT_TEST_Y(); ENDSTOP_HIT_TEST_Z(); - #if ENABLED(Z_MIN_PROBE_ENDSTOP) + #if USES_Z_MIN_PROBE_ENDSTOP #define P_AXIS Z_AXIS if (TEST(hit_state, Z_MIN_PROBE)) _ENDSTOP_HIT_ECHO(P, 'P'); #endif @@ -351,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(); @@ -365,13 +375,13 @@ void Endstops::event_handler() { static void print_es_state(const bool is_hit, PGM_P const label=NULL) { if (label) serialprintPGM(label); - SERIAL_PROTOCOLPGM(": "); + SERIAL_ECHOPGM(": "); serialprintPGM(is_hit ? PSTR(MSG_ENDSTOP_HIT) : PSTR(MSG_ENDSTOP_OPEN)); SERIAL_EOL(); } void _O2 Endstops::M119() { - SERIAL_PROTOCOLLNPGM(MSG_M119_REPORT); + SERIAL_ECHOLNPGM(MSG_M119_REPORT); #define ES_REPORT(S) print_es_state(READ(S##_PIN) != S##_ENDSTOP_INVERTING, PSTR(MSG_##S)) #if HAS_X_MIN ES_REPORT(X_MIN); @@ -415,10 +425,10 @@ void _O2 Endstops::M119() { #if HAS_Z3_MAX ES_REPORT(Z3_MAX); #endif - #if ENABLED(Z_MIN_PROBE_ENDSTOP) + #if USES_Z_MIN_PROBE_ENDSTOP print_es_state(READ(Z_MIN_PROBE_PIN) != Z_MIN_PROBE_ENDSTOP_INVERTING, PSTR(MSG_Z_PROBE)); #endif - #if ENABLED(FILAMENT_RUNOUT_SENSOR) + #if HAS_FILAMENT_SENSOR #if NUM_RUNOUT_SENSORS == 1 print_es_state(READ(FIL_RUNOUT_PIN) != FIL_RUNOUT_INVERTING, PSTR(MSG_FILAMENT_RUNOUT_SENSOR)); #else @@ -441,9 +451,9 @@ void _O2 Endstops::M119() { #endif #endif } - SERIAL_PROTOCOLPGM(MSG_FILAMENT_RUNOUT_SENSOR); + 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 @@ -576,7 +586,7 @@ void Endstops::update() { #endif // When closing the gap check the enabled probe - #if ENABLED(Z_MIN_PROBE_ENDSTOP) + #if USES_Z_MIN_PROBE_ENDSTOP UPDATE_ENDSTOP_BIT(Z, MIN_PROBE); #endif @@ -596,7 +606,7 @@ void Endstops::update() { COPY_LIVE_STATE(Z_MAX, Z3_MAX); #endif #endif - #elif DISABLED(Z_MIN_PROBE_ENDSTOP) || Z_MAX_PIN != Z_MIN_PROBE_PIN + #elif !USES_Z_MIN_PROBE_ENDSTOP || Z_MAX_PIN != Z_MIN_PROBE_PIN // If this pin isn't the bed probe it's the Z endstop UPDATE_ENDSTOP_BIT(Z, MAX); #endif @@ -662,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 @@ -726,7 +739,7 @@ void Endstops::update() { #else #if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) if (z_probe_enabled) PROCESS_ENDSTOP(Z, MIN); - #elif ENABLED(Z_MIN_PROBE_ENDSTOP) + #elif USES_Z_MIN_PROBE_ENDSTOP if (!z_probe_enabled) PROCESS_ENDSTOP(Z, MIN); #else PROCESS_ENDSTOP(Z, MIN); @@ -735,7 +748,7 @@ void Endstops::update() { #endif // When closing the gap check the enabled probe - #if ENABLED(Z_MIN_PROBE_ENDSTOP) + #if USES_Z_MIN_PROBE_ENDSTOP if (z_probe_enabled) PROCESS_ENDSTOP(Z, MIN_PROBE); #endif } @@ -745,7 +758,7 @@ void Endstops::update() { PROCESS_TRIPLE_ENDSTOP(Z, Z2, Z3, MAX); #elif ENABLED(Z_DUAL_ENDSTOPS) PROCESS_DUAL_ENDSTOP(Z, Z2, MAX); - #elif DISABLED(Z_MIN_PROBE_ENDSTOP) || Z_MAX_PIN != Z_MIN_PROBE_PIN + #elif !USES_Z_MIN_PROBE_ENDSTOP || Z_MAX_PIN != Z_MIN_PROBE_PIN // If this pin is not hijacked for the bed probe // then it belongs to the Z endstop PROCESS_ENDSTOP(Z, MAX); @@ -775,101 +788,104 @@ void Endstops::update() { static uint8_t local_LED_status = 0; uint16_t live_state_local = 0; + #define ES_GET_STATE(S) if (READ(S##_PIN)) SBI(live_state_local, S) + #if HAS_X_MIN - if (READ(X_MIN_PIN)) SBI(live_state_local, X_MIN); + ES_GET_STATE(X_MIN); #endif #if HAS_X_MAX - if (READ(X_MAX_PIN)) SBI(live_state_local, X_MAX); + ES_GET_STATE(X_MAX); #endif #if HAS_Y_MIN - if (READ(Y_MIN_PIN)) SBI(live_state_local, Y_MIN); + ES_GET_STATE(Y_MIN); #endif #if HAS_Y_MAX - if (READ(Y_MAX_PIN)) SBI(live_state_local, Y_MAX); + ES_GET_STATE(Y_MAX); #endif #if HAS_Z_MIN - if (READ(Z_MIN_PIN)) SBI(live_state_local, Z_MIN); + ES_GET_STATE(Z_MIN); #endif #if HAS_Z_MAX - if (READ(Z_MAX_PIN)) SBI(live_state_local, Z_MAX); + ES_GET_STATE(Z_MAX); #endif #if HAS_Z_MIN_PROBE_PIN - if (READ(Z_MIN_PROBE_PIN)) SBI(live_state_local, Z_MIN_PROBE); + ES_GET_STATE(Z_MIN_PROBE); #endif #if HAS_X2_MIN - if (READ(X2_MIN_PIN)) SBI(live_state_local, X2_MIN); + ES_GET_STATE(X2_MIN); #endif #if HAS_X2_MAX - if (READ(X2_MAX_PIN)) SBI(live_state_local, X2_MAX); + ES_GET_STATE(X2_MAX); #endif #if HAS_Y2_MIN - if (READ(Y2_MIN_PIN)) SBI(live_state_local, Y2_MIN); + ES_GET_STATE(Y2_MIN); #endif #if HAS_Y2_MAX - if (READ(Y2_MAX_PIN)) SBI(live_state_local, Y2_MAX); + ES_GET_STATE(Y2_MAX); #endif #if HAS_Z2_MIN - if (READ(Z2_MIN_PIN)) SBI(live_state_local, Z2_MIN); + ES_GET_STATE(Z2_MIN); #endif #if HAS_Z2_MAX - if (READ(Z2_MAX_PIN)) SBI(live_state_local, Z2_MAX); + ES_GET_STATE(Z2_MAX); #endif #if HAS_Z3_MIN - if (READ(Z3_MIN_PIN)) SBI(live_state_local, Z3_MIN); + ES_GET_STATE(Z3_MIN); #endif #if HAS_Z3_MAX - if (READ(Z3_MAX_PIN)) SBI(live_state_local, Z3_MAX); + ES_GET_STATE(Z3_MAX); #endif uint16_t endstop_change = live_state_local ^ old_live_state_local; + #define ES_REPORT_CHANGE(S) if (TEST(endstop_change, S)) SERIAL_ECHOPAIR(" " STRINGIFY(S) ":", TEST(live_state_local, S)) if (endstop_change) { #if HAS_X_MIN - if (TEST(endstop_change, X_MIN)) SERIAL_PROTOCOLPAIR(" X_MIN:", TEST(live_state_local, X_MIN)); + ES_REPORT_CHANGE(X_MIN); #endif #if HAS_X_MAX - if (TEST(endstop_change, X_MAX)) SERIAL_PROTOCOLPAIR(" X_MAX:", TEST(live_state_local, X_MAX)); + ES_REPORT_CHANGE(X_MAX); #endif #if HAS_Y_MIN - if (TEST(endstop_change, Y_MIN)) SERIAL_PROTOCOLPAIR(" Y_MIN:", TEST(live_state_local, Y_MIN)); + ES_REPORT_CHANGE(Y_MIN); #endif #if HAS_Y_MAX - if (TEST(endstop_change, Y_MAX)) SERIAL_PROTOCOLPAIR(" Y_MAX:", TEST(live_state_local, Y_MAX)); + ES_REPORT_CHANGE(Y_MAX); #endif #if HAS_Z_MIN - if (TEST(endstop_change, Z_MIN)) SERIAL_PROTOCOLPAIR(" Z_MIN:", TEST(live_state_local, Z_MIN)); + ES_REPORT_CHANGE(Z_MIN); #endif #if HAS_Z_MAX - if (TEST(endstop_change, Z_MAX)) SERIAL_PROTOCOLPAIR(" Z_MAX:", TEST(live_state_local, Z_MAX)); + ES_REPORT_CHANGE(Z_MAX); #endif #if HAS_Z_MIN_PROBE_PIN - if (TEST(endstop_change, Z_MIN_PROBE)) SERIAL_PROTOCOLPAIR(" PROBE:", TEST(live_state_local, Z_MIN_PROBE)); + ES_REPORT_CHANGE(Z_MIN_PROBE); #endif #if HAS_X2_MIN - if (TEST(endstop_change, X2_MIN)) SERIAL_PROTOCOLPAIR(" X2_MIN:", TEST(live_state_local, X2_MIN)); + ES_REPORT_CHANGE(X2_MIN); #endif #if HAS_X2_MAX - if (TEST(endstop_change, X2_MAX)) SERIAL_PROTOCOLPAIR(" X2_MAX:", TEST(live_state_local, X2_MAX)); + ES_REPORT_CHANGE(X2_MAX); #endif #if HAS_Y2_MIN - if (TEST(endstop_change, Y2_MIN)) SERIAL_PROTOCOLPAIR(" Y2_MIN:", TEST(live_state_local, Y2_MIN)); + ES_REPORT_CHANGE(Y2_MIN); #endif #if HAS_Y2_MAX - if (TEST(endstop_change, Y2_MAX)) SERIAL_PROTOCOLPAIR(" Y2_MAX:", TEST(live_state_local, Y2_MAX)); + ES_REPORT_CHANGE(Y2_MAX); #endif #if HAS_Z2_MIN - if (TEST(endstop_change, Z2_MIN)) SERIAL_PROTOCOLPAIR(" Z2_MIN:", TEST(live_state_local, Z2_MIN)); + ES_REPORT_CHANGE(Z2_MIN); #endif #if HAS_Z2_MAX - if (TEST(endstop_change, Z2_MAX)) SERIAL_PROTOCOLPAIR(" Z2_MAX:", TEST(live_state_local, Z2_MAX)); + ES_REPORT_CHANGE(Z2_MAX); #endif #if HAS_Z3_MIN - if (TEST(endstop_change, Z3_MIN)) SERIAL_PROTOCOLPAIR(" Z3_MIN:", TEST(live_state_local, Z3_MIN)); + ES_REPORT_CHANGE(Z3_MIN); #endif #if HAS_Z3_MAX - if (TEST(endstop_change, Z3_MAX)) SERIAL_PROTOCOLPAIR(" Z3_MAX:", TEST(live_state_local, Z3_MAX)); + ES_REPORT_CHANGE(Z3_MAX); #endif - SERIAL_PROTOCOLPGM("\n\n"); + SERIAL_ECHOLNPGM("\n"); analogWrite(LED_PIN, local_LED_status); local_LED_status ^= 255; old_live_state_local = live_state_local; diff --git a/Marlin/src/module/endstops.h b/Marlin/src/module/endstops.h index 7892ea81da32..79be7df2994a 100644 --- a/Marlin/src/module/endstops.h +++ b/Marlin/src/module/endstops.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,7 +50,7 @@ class Endstops { public: - #if ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS + #if HAS_EXTRA_ENDSTOPS typedef uint16_t esbits_t; #if ENABLED(X_DUAL_ENDSTOPS) static float x2_endstop_adj; @@ -97,6 +97,8 @@ class Endstops { ); } + static inline bool global_enabled() { return enabled_globally; } + /** * Periodic call to poll endstops if required. Called from temperature ISR */ @@ -173,3 +175,17 @@ class Endstops { }; extern Endstops endstops; + +/** + * A class to save and change the endstop state, + * then restore it when it goes out of scope. + */ +class TemporaryGlobalEndstopsState { + bool saved; + + public: + TemporaryGlobalEndstopsState(const bool enable) : saved(endstops.global_enabled()) { + endstops.enable_globally(enable); + } + ~TemporaryGlobalEndstopsState() { endstops.enable_globally(saved); } +}; diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index dab6e816bf05..30f63ebed50b 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -47,7 +47,11 @@ #include "../feature/bedlevel/bedlevel.h" #endif -#if HAS_AXIS_UNHOMED_ERR && ENABLED(ULTRA_LCD) +#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,10 +96,10 @@ 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] = { 0 }; +float current_position[XYZE] = { X_HOME_POS, Y_HOME_POS, Z_HOME_POS }; /** * Cartesian Destination @@ -96,7 +107,7 @@ float current_position[XYZE] = { 0 }; * and expected by functions like 'prepare_move_to_destination'. * Set with 'get_destination_from_command' or 'set_destination_from_current'. */ -float destination[XYZE] = { 0 }; +float destination[XYZE]; // = { 0 } // The active extruder (tool). Set with T command. #if EXTRUDERS > 1 @@ -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 @@ -117,24 +139,36 @@ float feedrate_mm_s = MMM_TO_MMS(1500.0f); int16_t feedrate_percentage = 100; // Homing feedrate is const progmem - compare to constexpr in the header -const float homing_feedrate_mm_s[4] PROGMEM = { +const float homing_feedrate_mm_s[XYZ] PROGMEM = { #if ENABLED(DELTA) MMM_TO_MMS(HOMING_FEEDRATE_Z), MMM_TO_MMS(HOMING_FEEDRATE_Z), #else MMM_TO_MMS(HOMING_FEEDRATE_XY), MMM_TO_MMS(HOMING_FEEDRATE_XY), #endif - MMM_TO_MMS(HOMING_FEEDRATE_Z), 0 + MMM_TO_MMS(HOMING_FEEDRATE_Z) }; // Cartesian conversion result goes here: float cartes[XYZ]; #if IS_KINEMATIC + float delta[ABC]; -#endif -#if HAS_SCARA_OFFSET - float scara_home_offset[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 /** @@ -155,7 +189,7 @@ float cartes[XYZ]; float workspace_offset[XYZ] = { 0 }; #endif -#if OLDSCHOOL_ABL +#if HAS_ABL_NOT_UBL float xy_probe_feedrate_mm_s = MMM_TO_MMS(XY_PROBE_SPEED); #endif @@ -163,14 +197,10 @@ float cartes[XYZ]; * Output the current position to serial */ void report_current_position() { - SERIAL_PROTOCOLPGM("X:"); - SERIAL_PROTOCOL(LOGICAL_X_POSITION(current_position[X_AXIS])); - SERIAL_PROTOCOLPGM(" Y:"); - SERIAL_PROTOCOL(LOGICAL_Y_POSITION(current_position[Y_AXIS])); - SERIAL_PROTOCOLPGM(" Z:"); - SERIAL_PROTOCOL(LOGICAL_Z_POSITION(current_position[Z_AXIS])); - SERIAL_PROTOCOLPGM(" E:"); - SERIAL_PROTOCOL(current_position[E_AXIS]); + SERIAL_ECHOPAIR("X:", LOGICAL_X_POSITION(current_position[X_AXIS])); + SERIAL_ECHOPAIR(" Y:", LOGICAL_Y_POSITION(current_position[Y_AXIS])); + SERIAL_ECHOPAIR(" Z:", LOGICAL_Z_POSITION(current_position[Z_AXIS])); + SERIAL_ECHOPAIR(" E:", current_position[E_AXIS]); stepper.report_positions(); @@ -186,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]); } @@ -257,8 +285,8 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) { * Move the planner to the current position from wherever it last moved * (or from wherever it has been told it is located). */ -void line_to_current_position() { - planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], feedrate_mm_s, active_extruder); +void line_to_current_position(const float &fr_mm_s/*=feedrate_mm_s*/) { + planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], fr_mm_s, active_extruder); } /** @@ -274,10 +302,8 @@ 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 + void prepare_uninterpolated_move_to_destination(const float &fr_mm_s/*=0.0*/) { + 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 @@ -298,28 +324,23 @@ void buffer_line_to_destination(const float fr_mm_s) { #endif // IS_KINEMATIC /** - * Plan a move to (X, Y, Z) and set the current_position + * 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*/) { - const float old_feedrate_mm_s = feedrate_mm_s; + if (DEBUGGING(LEVELING)) DEBUG_XYZ(">>> do_blocking_move_to", rx, ry, rz); - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) print_xyz(PSTR(">>> do_blocking_move_to"), NULL, rx, ry, rz); - #endif - - const float z_feedrate = fr_mm_s ? fr_mm_s : homing_feedrate(Z_AXIS); + 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; #if ENABLED(DELTA) if (!position_is_reachable(rx, ry)) return; - feedrate_mm_s = fr_mm_s ? fr_mm_s : XY_PROBE_FEEDRATE_MM_S; + REMEMBER(fr, feedrate_mm_s, xy_feedrate); 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) { @@ -328,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 @@ -377,7 +388,7 @@ void do_blocking_move_to(const float rx, const float ry, const float rz, const f destination[X_AXIS] = rx; destination[Y_AXIS] = ry; - prepare_uninterpolated_move_to_destination(fr_mm_s ? fr_mm_s : XY_PROBE_FEEDRATE_MM_S); + prepare_uninterpolated_move_to_destination(xy_feedrate); // If Z needs to lower, do it after moving XY if (destination[Z_AXIS] > rz) { @@ -389,30 +400,23 @@ void do_blocking_move_to(const float rx, const float ry, const float rz, const f // If Z needs to raise, do it before moving XY if (current_position[Z_AXIS] < rz) { - feedrate_mm_s = z_feedrate; current_position[Z_AXIS] = rz; - line_to_current_position(); + line_to_current_position(z_feedrate); } - feedrate_mm_s = fr_mm_s ? fr_mm_s : XY_PROBE_FEEDRATE_MM_S; current_position[X_AXIS] = rx; current_position[Y_AXIS] = ry; - line_to_current_position(); + line_to_current_position(xy_feedrate); // If Z needs to lower, do it after moving XY if (current_position[Z_AXIS] > rz) { - feedrate_mm_s = z_feedrate; current_position[Z_AXIS] = rz; - line_to_current_position(); + line_to_current_position(z_feedrate); } #endif - feedrate_mm_s = old_feedrate_mm_s; - - #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(); } @@ -427,80 +431,27 @@ void do_blocking_move_to_xy(const float &rx, const float &ry, const float &fr_mm } // -// Prepare to do endstop or probe moves -// with custom feedrates. -// -// - Save current feedrates -// - Reset the rate multiplier +// Prepare to do endstop or probe moves with custom feedrates. +// - Save / restore current feedrate and multiplier // -void bracket_probe_move(const bool before) { - static float saved_feedrate_mm_s; - static int16_t saved_feedrate_percentage; - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("bracket_probe_move", current_position); - #endif - if (before) { - saved_feedrate_mm_s = feedrate_mm_s; - saved_feedrate_percentage = feedrate_percentage; - feedrate_percentage = 100; - } - else { - feedrate_mm_s = saved_feedrate_mm_s; - feedrate_percentage = saved_feedrate_percentage; - } +static float saved_feedrate_mm_s; +static int16_t saved_feedrate_percentage; +void setup_for_endstop_or_probe_move() { + saved_feedrate_mm_s = feedrate_mm_s; + saved_feedrate_percentage = feedrate_percentage; + feedrate_percentage = 100; +} +void clean_up_after_endstop_or_probe_move() { + feedrate_mm_s = saved_feedrate_mm_s; + feedrate_percentage = saved_feedrate_percentage; } - -void setup_for_endstop_or_probe_move() { bracket_probe_move(true); } -void clean_up_after_endstop_or_probe_move() { bracket_probe_move(false); } #if HAS_SOFTWARE_ENDSTOPS 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 @@ -511,7 +462,11 @@ void clean_up_after_endstop_or_probe_move() { bracket_probe_move(false); } * 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) @@ -520,30 +475,31 @@ void clean_up_after_endstop_or_probe_move() { bracket_probe_move(false); } // 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 + Z_PROBE_OFFSET_FROM_EXTRUDER + - zprobe_zoffset #endif : base_max_pos(axis)); @@ -551,31 +507,96 @@ void clean_up_after_endstop_or_probe_move() { bracket_probe_move(false); } 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 @@ -839,9 +860,12 @@ void clean_up_after_endstop_or_probe_move() { bracket_probe_move(false); } #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) @@ -904,19 +928,12 @@ void clean_up_after_endstop_or_probe_move() { bracket_probe_move(false); } 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]); @@ -930,15 +947,9 @@ void clean_up_after_endstop_or_probe_move() { bracket_probe_move(false); } 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; } } @@ -958,24 +969,22 @@ void clean_up_after_endstop_or_probe_move() { bracket_probe_move(false); } * 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]) { #if ENABLED(PREVENT_COLD_EXTRUSION) if (thermalManager.tooColdToExtrude(active_extruder)) { current_position[E_AXIS] = destination[E_AXIS]; // Behave as if the move really took place, but ignore E part - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP); + SERIAL_ECHO_MSG(MSG_ERR_COLD_EXTRUDE_STOP); } #endif // PREVENT_COLD_EXTRUSION #if ENABLED(PREVENT_LENGTHY_EXTRUDE) if (ABS(destination[E_AXIS] - current_position[E_AXIS]) * planner.e_factor[active_extruder] > (EXTRUDE_MAXLENGTH)) { current_position[E_AXIS] = destination[E_AXIS]; // Behave as if the move really took place, but ignore E part - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP); + SERIAL_ECHO_MSG(MSG_ERR_LONG_EXTRUDE_STOP); } #endif // PREVENT_LENGTHY_EXTRUDE } @@ -1005,40 +1014,36 @@ 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); +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); + + #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) - 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) */ -inline float get_homing_bump_feedrate(const AxisEnum axis) { +float get_homing_bump_feedrate(const AxisEnum axis) { #if HOMING_Z_WITH_PROBE if (axis == Z_AXIS) return MMM_TO_MMS(Z_PROBE_SPEED_SLOW); #endif @@ -1046,47 +1051,108 @@ inline float get_homing_bump_feedrate(const AxisEnum axis) { uint8_t hbd = pgm_read_byte(&homing_bump_divisor[axis]); if (hbd < 1) { hbd = 10; - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM("Warning: Homing Bump Divisor < 1"); + SERIAL_ECHO_MSG("Warning: Homing Bump Divisor < 1"); } return homing_feedrate(axis) / hbd; } #if ENABLED(SENSORLESS_HOMING) - /** * Set sensorless homing if the axis has it, accounting for Core Kinematics. */ - void sensorless_homing_per_axis(const AxisEnum axis, const bool enable/*=true*/) { + sensorless_t start_sensorless_homing_per_axis(const AxisEnum axis) { + sensorless_t stealth_states { false, false, false, false, false, false, false }; + switch (axis) { default: break; #if X_SENSORLESS case X_AXIS: - tmc_stallguard(stepperX, enable); + stealth_states.x = tmc_enable_stallguard(stepperX); + #if AXIS_HAS_STALLGUARD(X2) + stealth_states.x2 = tmc_enable_stallguard(stepperX2); + #endif #if CORE_IS_XY && Y_SENSORLESS - tmc_stallguard(stepperY, enable); + stealth_states.y = tmc_enable_stallguard(stepperY); #elif CORE_IS_XZ && Z_SENSORLESS - tmc_stallguard(stepperZ, enable); + stealth_states.z = tmc_enable_stallguard(stepperZ); #endif break; #endif #if Y_SENSORLESS case Y_AXIS: - tmc_stallguard(stepperY, enable); + stealth_states.y = tmc_enable_stallguard(stepperY); + #if AXIS_HAS_STALLGUARD(Y2) + stealth_states.y2 = tmc_enable_stallguard(stepperY2); + #endif #if CORE_IS_XY && X_SENSORLESS - tmc_stallguard(stepperX, enable); + stealth_states.x = tmc_enable_stallguard(stepperX); #elif CORE_IS_YZ && Z_SENSORLESS - tmc_stallguard(stepperZ, enable); + stealth_states.z = tmc_enable_stallguard(stepperZ); #endif break; #endif #if Z_SENSORLESS case Z_AXIS: - tmc_stallguard(stepperZ, enable); + stealth_states.z = tmc_enable_stallguard(stepperZ); + #if AXIS_HAS_STALLGUARD(Z2) + stealth_states.z2 = tmc_enable_stallguard(stepperZ2); + #endif + #if AXIS_HAS_STALLGUARD(Z3) + stealth_states.z3 = tmc_enable_stallguard(stepperZ3); + #endif + #if CORE_IS_XZ && X_SENSORLESS + stealth_states.x = tmc_enable_stallguard(stepperX); + #elif CORE_IS_YZ && Y_SENSORLESS + stealth_states.y = tmc_enable_stallguard(stepperY); + #endif + break; + #endif + } + return stealth_states; + } + + void end_sensorless_homing_per_axis(const AxisEnum axis, sensorless_t enable_stealth) { + switch (axis) { + default: break; + #if X_SENSORLESS + case X_AXIS: + tmc_disable_stallguard(stepperX, enable_stealth.x); + #if AXIS_HAS_STALLGUARD(X2) + tmc_disable_stallguard(stepperX2, enable_stealth.x2); + #endif + #if CORE_IS_XY && Y_SENSORLESS + tmc_disable_stallguard(stepperY, enable_stealth.y); + #elif CORE_IS_XZ && Z_SENSORLESS + tmc_disable_stallguard(stepperZ, enable_stealth.z); + #endif + break; + #endif + #if Y_SENSORLESS + case Y_AXIS: + tmc_disable_stallguard(stepperY, enable_stealth.y); + #if AXIS_HAS_STALLGUARD(Y2) + tmc_disable_stallguard(stepperY2, enable_stealth.y2); + #endif + #if CORE_IS_XY && X_SENSORLESS + tmc_disable_stallguard(stepperX, enable_stealth.x); + #elif CORE_IS_YZ && Z_SENSORLESS + tmc_disable_stallguard(stepperZ, enable_stealth.z); + #endif + break; + #endif + #if Z_SENSORLESS + case Z_AXIS: + tmc_disable_stallguard(stepperZ, enable_stealth.z); + #if AXIS_HAS_STALLGUARD(Z2) + tmc_disable_stallguard(stepperZ2, enable_stealth.z2); + #endif + #if AXIS_HAS_STALLGUARD(Z3) + tmc_disable_stallguard(stepperZ3, enable_stealth.z3); + #endif #if CORE_IS_XZ && X_SENSORLESS - tmc_stallguard(stepperX, enable); + tmc_disable_stallguard(stepperX, enable_stealth.x); #elif CORE_IS_YZ && Y_SENSORLESS - tmc_stallguard(stepperY, enable); + tmc_disable_stallguard(stepperY, enable_stealth.y); #endif break; #endif @@ -1100,20 +1166,14 @@ inline 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 @@ -1133,6 +1193,10 @@ void do_homing_move(const AxisEnum axis, const float distance, const float fr_mm home_dir(axis); const bool is_home_dir = (axis_home_dir > 0) == (distance > 0); + #if ENABLED(SENSORLESS_HOMING) + sensorless_t stealth_states; + #endif + if (is_home_dir) { #if HOMING_Z_WITH_PROBE && QUIET_PROBING @@ -1141,7 +1205,7 @@ void do_homing_move(const AxisEnum axis, const float distance, const float fr_mm // Disable stealthChop if used. Enable diag1 pin on driver. #if ENABLED(SENSORLESS_HOMING) - sensorless_homing_per_axis(axis); + stealth_states = start_sensorless_homing_per_axis(axis); #endif } @@ -1182,17 +1246,11 @@ void do_homing_move(const AxisEnum axis, const float distance, const float fr_mm // Re-enable stealthChop if used. Disable diag1 pin on driver. #if ENABLED(SENSORLESS_HOMING) - sensorless_homing_per_axis(axis, false); + end_sensorless_homing_per_axis(axis, stealth_states); #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], ")"); } /** @@ -1214,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); @@ -1242,7 +1294,7 @@ void set_axis_is_at_home(const AxisEnum axis) { #elif ENABLED(DELTA) current_position[axis] = (axis == Z_AXIS ? delta_height #if HAS_BED_PROBE - - zprobe_zoffset + Z_PROBE_OFFSET_FROM_EXTRUDER + - zprobe_zoffset #endif : base_home_pos(axis)); #else @@ -1258,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 - - #elif ENABLED(DEBUG_LEVELING_FEATURE) + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("*** Z HOMED WITH PROBE (Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) ***\n> zprobe_zoffset = ", zprobe_zoffset); - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("*** Z HOMED TO ENDSTOP (Z_MIN_PROBE_ENDSTOP) ***"); + #else - #endif - } - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("*** Z HOMED TO ENDSTOP ***"); - #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); @@ -1341,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) @@ -1362,7 +1390,7 @@ void homeaxis(const AxisEnum axis) { #endif // Set flags for X, Y, Z motor locking - #if ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS + #if HAS_EXTRA_ENDSTOPS switch (axis) { #if ENABLED(X_DUAL_ENDSTOPS) case X_AXIS: @@ -1379,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( @@ -1399,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 @@ -1413,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 @@ -1423,24 +1447,22 @@ 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 } - #if ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS + #if HAS_EXTRA_ENDSTOPS const bool pos_dir = axis_home_dir > 0; #if ENABLED(X_DUAL_ENDSTOPS) if (axis == X_AXIS) { @@ -1551,24 +1573,18 @@ 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); } - #else + #else // CARTESIAN / CORE - // For cartesian/core machines, - // set the axis to its home position set_axis_is_at_home(axis); sync_plan_position(); 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 @@ -1582,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 702df69aeca8..2252f4cac910 100644 --- a/Marlin/src/module/motion.h +++ b/Marlin/src/module/motion.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -31,7 +31,7 @@ #include "../inc/MarlinConfig.h" #if IS_SCARA - #include "../module/scara.h" + #include "scara.h" #endif // Axis homed and known-position states @@ -58,7 +58,7 @@ extern float cartes[XYZ]; extern float delta[ABC]; #endif -#if OLDSCHOOL_ABL +#if HAS_ABL_NOT_UBL extern float xy_probe_feedrate_mm_s; #define XY_PROBE_FEEDRATE_MM_S xy_probe_feedrate_mm_s #elif defined(XY_PROBE_SPEED) @@ -71,8 +71,9 @@ extern float cartes[XYZ]; * Feed rates are often configured with mm/m * but the planner and stepper like mm/s units. */ -extern const float homing_feedrate_mm_s[4]; +extern const float homing_feedrate_mm_s[XYZ]; FORCE_INLINE float homing_feedrate(const AxisEnum a) { return pgm_read_float(&homing_feedrate_mm_s[a]); } +float get_homing_bump_feedrate(const AxisEnum axis); extern float feedrate_mm_s; @@ -89,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); } @@ -114,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(); @@ -148,7 +156,7 @@ void sync_plan_position_e(); * Move the planner to the current position from wherever it last moved * (or from wherever it has been told it is located). */ -void line_to_current_position(); +void line_to_current_position(const float &fr_mm_s=feedrate_mm_s); /** * Move the planner to the position stored in the destination array, which is @@ -157,7 +165,7 @@ void line_to_current_position(); void buffer_line_to_destination(const float fr_mm_s); #if IS_KINEMATIC - void prepare_uninterpolated_move_to_destination(const float fr_mm_s=0); + void prepare_uninterpolated_move_to_destination(const float &fr_mm_s=0); #endif void prepare_move_to_destination(); @@ -170,39 +178,22 @@ void do_blocking_move_to_x(const float &rx, const float &fr_mm_s=0); void do_blocking_move_to_z(const float &rz, const float &fr_mm_s=0); void do_blocking_move_to_xy(const float &rx, const float &ry, const float &fr_mm_s=0); -FORCE_INLINE void do_blocking_move_to(const float (&raw)[XYZ], const float &fr_mm_s) { +FORCE_INLINE void do_blocking_move_to(const float (&raw)[XYZ], const float &fr_mm_s=0) { do_blocking_move_to(raw[X_AXIS], raw[Y_AXIS], raw[Z_AXIS], fr_mm_s); } -FORCE_INLINE void do_blocking_move_to(const float (&raw)[XYZE], const float &fr_mm_s) { +FORCE_INLINE void do_blocking_move_to(const float (&raw)[XYZE], const float &fr_mm_s=0) { do_blocking_move_to(raw[X_AXIS], raw[Y_AXIS], raw[Z_AXIS], fr_mm_s); } void setup_for_endstop_or_probe_move(); void clean_up_after_endstop_or_probe_move(); -void bracket_probe_move(const bool before); -void setup_for_endstop_or_probe_move(); -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()) @@ -216,10 +207,6 @@ void set_axis_is_not_at_home(const AxisEnum axis); void homeaxis(const AxisEnum axis); -#if ENABLED(SENSORLESS_HOMING) - void sensorless_homing_per_axis(const AxisEnum axis, const bool enable=true); -#endif - /** * Workspace offsets */ @@ -326,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 /** @@ -342,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; } @@ -359,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 c185678ad0aa..ff4f13e1d735 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -65,7 +65,7 @@ #include "planner.h" #include "stepper.h" #include "motion.h" -#include "../module/temperature.h" +#include "temperature.h" #include "../lcd/ultralcd.h" #include "../core/language.h" #include "../gcode/parser.h" @@ -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. @@ -236,7 +236,6 @@ void Planner::init() { } #if ENABLED(S_CURVE_ACCELERATION) - #ifdef __AVR__ /** * This routine returns 0x1000000 / d, getting the inverse as fast as possible. @@ -1179,10 +1178,9 @@ void Planner::check_axes_activity() { #endif if (has_blocks_queued()) { - #if FAN_COUNT > 0 - for (uint8_t i = 0; i < FAN_COUNT; i++) - tail_fan_speed[i] = block_buffer[block_buffer_tail].fan_speed[i]; + FANS_LOOP(i) + tail_fan_speed[i] = (block_buffer[block_buffer_tail].fan_speed[i] * uint16_t(thermalManager.fan_speed_scaler[i])) >> 7; #endif block_t* block; @@ -1204,7 +1202,8 @@ void Planner::check_axes_activity() { } else { #if FAN_COUNT > 0 - for (uint8_t i = 0; i < FAN_COUNT; i++) tail_fan_speed[i] = fan_speed[i]; + FANS_LOOP(i) + tail_fan_speed[i] = (thermalManager.fan_speed[i] * uint16_t(thermalManager.fan_speed_scaler[i])) >> 7; #endif #if ENABLED(BARICUDA) @@ -1265,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 @@ -1274,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 @@ -1541,11 +1555,99 @@ void Planner::synchronize() { while ( has_blocks_queued() || cleaning_buffer_counter #if ENABLED(EXTERNAL_CLOSED_LOOP_CONTROLLER) - || !READ(CLOSED_LOOP_MOVE_COMPLETE_PIN) + || (READ(CLOSED_LOOP_ENABLE_PIN) && !READ(CLOSED_LOOP_MOVE_COMPLETE_PIN)) #endif ) idle(); } +/** + * The following implements axis backlash correction. To minimize seams + * on the printed part, the backlash correction only adds steps to the + * current segment (instead of creating a new segment, which causes + * discontinuities and print artifacts). + * + * When BACKLASH_SMOOTHING_MM is enabled and non-zero, the backlash + * correction is spread over multiple segments, smoothing out print + * artifacts even more. + */ +#if ENABLED(BACKLASH_COMPENSATION) + #if ENABLED(BACKLASH_GCODE) + 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, + constexpr uint8_t backlash_correction = BACKLASH_CORRECTION * 255; + #ifdef BACKLASH_SMOOTHING_MM + constexpr float backlash_smoothing_mm = BACKLASH_SMOOTHING_MM; + #endif + #endif + + void Planner::add_backlash_correction_steps(const int32_t da, const int32_t db, const int32_t dc, const uint8_t dm, block_t * const block) { + static uint8_t last_direction_bits; + uint8_t changed_dir = last_direction_bits ^ dm; + // Ignore direction change if no steps are taken in that direction + if (da == 0) CBI(changed_dir, X_AXIS); + if (db == 0) CBI(changed_dir, Y_AXIS); + if (dc == 0) CBI(changed_dir, Z_AXIS); + last_direction_bits ^= changed_dir; + + if (backlash_correction == 0) return; + + #ifdef BACKLASH_SMOOTHING_MM + // The segment proportion is a value greater than 0.0 indicating how much residual_error + // is corrected for in this segment. The contribution is based on segment length and the + // smoothing distance. Since the computation of this proportion involves a floating point + // division, defer computation until needed. + float segment_proportion = 0; + + // Residual error carried forward across multiple segments, so correction can be applied + // to segments where there is no direction change. + static int32_t residual_error[XYZ] = { 0 }; + #else + // No leftover residual error from segment to segment + int32_t residual_error[XYZ] = { 0 }; + // No direction change, no correction. + 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] += (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]; + #ifdef BACKLASH_SMOOTHING_MM + if (error_correction && backlash_smoothing_mm != 0) { + // Take up a portion of the residual_error in this segment, but only when + // the current segment travels in the same direction as the correction + if (reversing == (error_correction < 0)) { + if (segment_proportion == 0) + segment_proportion = MIN(1.0f, block->millimeters / backlash_smoothing_mm); + 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 + } + #endif + // Making a correction reduces the residual error and modifies delta_mm + if (error_correction) { + block->steps[axis] += ABS(error_correction); + residual_error[axis] -= error_correction; + } + } + } + } +#endif // BACKLASH_COMPENSATION + /** * Planner::_buffer_steps * @@ -1652,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)) { @@ -1661,8 +1763,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, position_float[E_AXIS] = target_float[E_AXIS]; #endif de = 0; // no difference - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP); + SERIAL_ECHO_MSG(MSG_ERR_COLD_EXTRUDE_STOP); } #endif // PREVENT_COLD_EXTRUSION #if ENABLED(PREVENT_LENGTHY_EXTRUDE) @@ -1672,8 +1773,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, position_float[E_AXIS] = target_float[E_AXIS]; #endif de = 0; // no difference - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP); + SERIAL_ECHO_MSG(MSG_ERR_LONG_EXTRUDE_STOP); } #endif // PREVENT_LENGTHY_EXTRUDE } @@ -1740,6 +1840,76 @@ bool Planner::_populate_block(block_t * const block, bool split_move, block->steps[C_AXIS] = ABS(dc); #endif + /** + * This part of the code calculates the total length of the movement. + * For cartesian bots, the X_AXIS is the real X movement and same for Y_AXIS. + * But for corexy bots, that is not true. The "X_AXIS" and "Y_AXIS" motors (that should be named to A_AXIS + * and B_AXIS) cannot be used for X and Y length, because A=X+Y and B=X-Y. + * So we need to create other 2 "AXIS", named X_HEAD and Y_HEAD, meaning the real displacement of the Head. + * Having the real displacement of the head, we can calculate the total movement length and apply the desired speed. + */ + #if IS_CORE + float delta_mm[Z_HEAD + 1]; + #if CORE_IS_XY + delta_mm[X_HEAD] = da * steps_to_mm[A_AXIS]; + delta_mm[Y_HEAD] = db * steps_to_mm[B_AXIS]; + delta_mm[Z_AXIS] = dc * steps_to_mm[Z_AXIS]; + delta_mm[A_AXIS] = (da + db) * steps_to_mm[A_AXIS]; + delta_mm[B_AXIS] = CORESIGN(da - db) * steps_to_mm[B_AXIS]; + #elif CORE_IS_XZ + delta_mm[X_HEAD] = da * steps_to_mm[A_AXIS]; + delta_mm[Y_AXIS] = db * steps_to_mm[Y_AXIS]; + delta_mm[Z_HEAD] = dc * steps_to_mm[C_AXIS]; + delta_mm[A_AXIS] = (da + dc) * steps_to_mm[A_AXIS]; + delta_mm[C_AXIS] = CORESIGN(da - dc) * steps_to_mm[C_AXIS]; + #elif CORE_IS_YZ + delta_mm[X_AXIS] = da * steps_to_mm[X_AXIS]; + delta_mm[Y_HEAD] = db * steps_to_mm[B_AXIS]; + delta_mm[Z_HEAD] = dc * steps_to_mm[C_AXIS]; + delta_mm[B_AXIS] = (db + dc) * steps_to_mm[B_AXIS]; + delta_mm[C_AXIS] = CORESIGN(db - dc) * steps_to_mm[C_AXIS]; + #endif + #else + float delta_mm[ABCE]; + delta_mm[A_AXIS] = da * steps_to_mm[A_AXIS]; + delta_mm[B_AXIS] = db * steps_to_mm[B_AXIS]; + delta_mm[C_AXIS] = dc * steps_to_mm[C_AXIS]; + #endif + delta_mm[E_AXIS] = esteps_float * steps_to_mm[E_AXIS_N(extruder)]; + + if (block->steps[A_AXIS] < MIN_STEPS_PER_SEGMENT && block->steps[B_AXIS] < MIN_STEPS_PER_SEGMENT && block->steps[C_AXIS] < MIN_STEPS_PER_SEGMENT) { + block->millimeters = ABS(delta_mm[E_AXIS]); + } + else { + if (millimeters) + block->millimeters = millimeters; + else + block->millimeters = SQRT( + #if CORE_IS_XY + sq(delta_mm[X_HEAD]) + sq(delta_mm[Y_HEAD]) + sq(delta_mm[Z_AXIS]) + #elif CORE_IS_XZ + sq(delta_mm[X_HEAD]) + sq(delta_mm[Y_AXIS]) + sq(delta_mm[Z_HEAD]) + #elif CORE_IS_YZ + sq(delta_mm[X_AXIS]) + sq(delta_mm[Y_HEAD]) + sq(delta_mm[Z_HEAD]) + #else + sq(delta_mm[X_AXIS]) + sq(delta_mm[Y_AXIS]) + sq(delta_mm[Z_AXIS]) + #endif + ); + + /** + * At this point at least one of the axes has more steps than + * MIN_STEPS_PER_SEGMENT, ensuring the segment won't get dropped as + * zero-length. It's important to not apply corrections + * to blocks that would get dropped! + * + * A correction function is permitted to add steps to an axis, it + * should *never* remove steps! + */ + #if ENABLED(BACKLASH_COMPENSATION) + add_backlash_correction_steps(da, db, dc, dm, block); + #endif + } + block->steps[E_AXIS] = esteps; block->step_event_count = MAX(block->steps[A_AXIS], block->steps[B_AXIS], block->steps[C_AXIS], esteps); @@ -1751,7 +1921,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, #endif #if FAN_COUNT > 0 - for (uint8_t i = 0; i < FAN_COUNT; i++) block->fan_speed[i] = fan_speed[i]; + FANS_LOOP(i) block->fan_speed[i] = thermalManager.fan_speed[i]; #endif #if ENABLED(BARICUDA) @@ -1829,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; @@ -1927,62 +2097,6 @@ bool Planner::_populate_block(block_t * const block, bool split_move, else NOLESS(fr_mm_s, settings.min_travel_feedrate_mm_s); - /** - * This part of the code calculates the total length of the movement. - * For cartesian bots, the X_AXIS is the real X movement and same for Y_AXIS. - * But for corexy bots, that is not true. The "X_AXIS" and "Y_AXIS" motors (that should be named to A_AXIS - * and B_AXIS) cannot be used for X and Y length, because A=X+Y and B=X-Y. - * So we need to create other 2 "AXIS", named X_HEAD and Y_HEAD, meaning the real displacement of the Head. - * Having the real displacement of the head, we can calculate the total movement length and apply the desired speed. - */ - #if IS_CORE - float delta_mm[Z_HEAD + 1]; - #if CORE_IS_XY - delta_mm[X_HEAD] = da * steps_to_mm[A_AXIS]; - delta_mm[Y_HEAD] = db * steps_to_mm[B_AXIS]; - delta_mm[Z_AXIS] = dc * steps_to_mm[Z_AXIS]; - delta_mm[A_AXIS] = (da + db) * steps_to_mm[A_AXIS]; - delta_mm[B_AXIS] = CORESIGN(da - db) * steps_to_mm[B_AXIS]; - #elif CORE_IS_XZ - delta_mm[X_HEAD] = da * steps_to_mm[A_AXIS]; - delta_mm[Y_AXIS] = db * steps_to_mm[Y_AXIS]; - delta_mm[Z_HEAD] = dc * steps_to_mm[C_AXIS]; - delta_mm[A_AXIS] = (da + dc) * steps_to_mm[A_AXIS]; - delta_mm[C_AXIS] = CORESIGN(da - dc) * steps_to_mm[C_AXIS]; - #elif CORE_IS_YZ - delta_mm[X_AXIS] = da * steps_to_mm[X_AXIS]; - delta_mm[Y_HEAD] = db * steps_to_mm[B_AXIS]; - delta_mm[Z_HEAD] = dc * steps_to_mm[C_AXIS]; - delta_mm[B_AXIS] = (db + dc) * steps_to_mm[B_AXIS]; - delta_mm[C_AXIS] = CORESIGN(db - dc) * steps_to_mm[C_AXIS]; - #endif - #else - float delta_mm[ABCE]; - delta_mm[A_AXIS] = da * steps_to_mm[A_AXIS]; - delta_mm[B_AXIS] = db * steps_to_mm[B_AXIS]; - delta_mm[C_AXIS] = dc * steps_to_mm[C_AXIS]; - #endif - delta_mm[E_AXIS] = esteps_float * steps_to_mm[E_AXIS_N(extruder)]; - - if (block->steps[A_AXIS] < MIN_STEPS_PER_SEGMENT && block->steps[B_AXIS] < MIN_STEPS_PER_SEGMENT && block->steps[C_AXIS] < MIN_STEPS_PER_SEGMENT) { - block->millimeters = ABS(delta_mm[E_AXIS]); - } - else if (!millimeters) { - block->millimeters = SQRT( - #if CORE_IS_XY - sq(delta_mm[X_HEAD]) + sq(delta_mm[Y_HEAD]) + sq(delta_mm[Z_AXIS]) - #elif CORE_IS_XZ - sq(delta_mm[X_HEAD]) + sq(delta_mm[Y_AXIS]) + sq(delta_mm[Z_HEAD]) - #elif CORE_IS_YZ - sq(delta_mm[X_AXIS]) + sq(delta_mm[Y_HEAD]) + sq(delta_mm[Z_HEAD]) - #else - sq(delta_mm[X_AXIS]) + sq(delta_mm[Y_AXIS]) + sq(delta_mm[Z_AXIS]) - #endif - ); - } - else - block->millimeters = millimeters; - const float inverse_millimeters = 1.0f / block->millimeters; // Inverse millimeters to remove multiple divides // Calculate inverse time for this move. No divide by zero due to previous checks. @@ -1993,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 @@ -2061,11 +2175,11 @@ 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; - if (i == E_AXIS && mixer.get_current_v_tool() == MIXER_AUTORETRACT_TOOL) + if (i == E_AXIS && mixer.get_current_vtool() == MIXER_AUTORETRACT_TOOL) delta_mm_i = delta_mm[i] / MIXING_STEPPERS; else delta_mm_i = delta_mm[i]; @@ -2243,7 +2357,6 @@ bool Planner::_populate_block(block_t * const block, bool split_move, float vmax_junction_sqr; // Initial limit on the segment entry velocity (mm/s)^2 #if ENABLED(JUNCTION_DEVIATION) - /** * Compute maximum allowable entry speed at junction by centripetal acceleration approximation. * Let a circle be tangent to both previous and current path line segments, where the junction @@ -2297,6 +2410,15 @@ bool Planner::_populate_block(block_t * const block, bool split_move, }; #endif + #if IS_CORE && ENABLED(JUNCTION_DEVIATION) + /** + * On CoreXY the length of the vector [A,B] is SQRT(2) times the length of the head movement vector [X,Y]. + * So taking Z and E into account, we cannot scale to a unit vector with "inverse_millimeters". + * => normalize the complete junction vector + */ + normalize_junction_vector(unit_vec); + #endif + // Skip first block or when previous_nominal_speed is used as a flag for homing and offset cycles. if (moves_queued && !UNEAR_ZERO(previous_nominal_speed_sqr)) { // Compute cosine of angle between previous and current path. (prev_unit_vec is negative) @@ -2366,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) @@ -2403,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) @@ -2480,6 +2602,10 @@ bool Planner::_populate_block(block_t * const block, bool split_move, COPY(position_float, target_float); #endif + #if ENABLED(GRADIENT_MIX) + mixer.gradient_control(target_float[Z_AXIS]); + #endif + // Movement was accepted return true; } // _populate_block() @@ -2542,8 +2668,8 @@ bool Planner::buffer_segment(const float &a, const float &b, const float &c, con // When changing extruders recalculate steps corresponding to the E position #if ENABLED(DISTINCT_E_FACTORS) - if (last_extruder != extruder && settings.axis_steps_per_mm[E_AXIS_N(extruder)] != settings.axis_steps_per_mm[E_AXIS + last_extruder]) { - position[E_AXIS] = LROUND(position[E_AXIS] * settings.axis_steps_per_mm[E_AXIS_N(extruder)] * steps_to_mm[E_AXIS + last_extruder]); + if (last_extruder != extruder && settings.axis_steps_per_mm[E_AXIS_N(extruder)] != settings.axis_steps_per_mm[E_AXIS_N(last_extruder)]) { + position[E_AXIS] = LROUND(position[E_AXIS] * settings.axis_steps_per_mm[E_AXIS_N(extruder)] * steps_to_mm[E_AXIS_N(last_extruder)]); last_extruder = extruder; } #endif @@ -2770,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 8cf37f0758fb..a95c3f26054a 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -114,7 +114,7 @@ typedef struct block_t { #endif #if ENABLED(MIXING_EXTRUDER) - MIXER_BLOCK_DEFINITION; // Normalized color for the mixing steppers + MIXER_BLOCK_FIELD; // Normalized color for the mixing steppers #endif // Settings for the trapezoid generator @@ -159,7 +159,7 @@ typedef struct block_t { } block_t; -#define HAS_POSITION_FLOAT (ENABLED(LIN_ADVANCE) || ENABLED(SCARA_FEEDRATE_SCALING)) +#define HAS_POSITION_FLOAT ANY(LIN_ADVANCE, SCARA_FEEDRATE_SCALING, GRADIENT_MIX) #define BLOCK_MOD(n) ((n)&(BLOCK_BUFFER_SIZE-1)) @@ -175,13 +175,9 @@ typedef struct { min_travel_feedrate_mm_s; // (mm/s) M205 T - Minimum travel feedrate } planner_settings_t; -#ifndef XY_SKEW_FACTOR +#if DISABLED(SKEW_CORRECTION) #define XY_SKEW_FACTOR 0 -#endif -#ifndef XZ_SKEW_FACTOR #define XZ_SKEW_FACTOR 0 -#endif -#ifndef YZ_SKEW_FACTOR #define YZ_SKEW_FACTOR 0 #endif @@ -257,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. @@ -342,6 +338,10 @@ class Planner { volatile static uint32_t block_buffer_runtime_us; //Theoretical block buffer runtime in µs #endif + #if ENABLED(BACKLASH_COMPENSATION) + static void add_backlash_correction_steps(const int32_t da, const int32_t db, const int32_t dc, const uint8_t dm, block_t * const block); + #endif + public: /** @@ -861,12 +861,12 @@ 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) for (uint8_t i = 0; i < EXTRUDERS; i++) - max_e_jerk[i] = GET_MAX_E_JERK(settings.max_acceleration_mm_per_s2[E_AXIS + i]); + max_e_jerk[i] = GET_MAX_E_JERK(settings.max_acceleration_mm_per_s2[E_AXIS_N(i)]); #else max_e_jerk = GET_MAX_E_JERK(settings.max_acceleration_mm_per_s2[E_AXIS]); #endif diff --git a/Marlin/src/module/planner_bezier.cpp b/Marlin/src/module/planner_bezier.cpp index a547e2308620..e27c87ee7d24 100644 --- a/Marlin/src/module/planner_bezier.cpp +++ b/Marlin/src/module/planner_bezier.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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/planner_bezier.h b/Marlin/src/module/planner_bezier.h index ec4031f15543..60166b71d015 100644 --- a/Marlin/src/module/planner_bezier.h +++ b/Marlin/src/module/planner_bezier.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/printcounter.cpp b/Marlin/src/module/printcounter.cpp index 0c6934807be3..4fa3e501f399 100644 --- a/Marlin/src/module/printcounter.cpp +++ b/Marlin/src/module/printcounter.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -33,11 +33,34 @@ Stopwatch print_job_timer; // Global Print Job Timer instance #include "../Marlin.h" #include "../HAL/shared/persistent_store_api.h" +#if HAS_BUZZER && SERVICE_WARNING_BUZZES > 0 + #include "../libs/buzzer.h" +#endif + +// Service intervals +#if HAS_SERVICE_INTERVALS + #if SERVICE_INTERVAL_1 > 0 + #define SERVICE_INTERVAL_SEC_1 (3600UL * SERVICE_INTERVAL_1) + #else + #define SERVICE_INTERVAL_SEC_1 (3600UL * 100) + #endif + #if SERVICE_INTERVAL_2 > 0 + #define SERVICE_INTERVAL_SEC_2 (3600UL * SERVICE_INTERVAL_2) + #else + #define SERVICE_INTERVAL_SEC_2 (3600UL * 100) + #endif + #if SERVICE_INTERVAL_3 > 0 + #define SERVICE_INTERVAL_SEC_3 (3600UL * SERVICE_INTERVAL_3) + #else + #define SERVICE_INTERVAL_SEC_3 (3600UL * 100) + #endif +#endif + PrintCounter print_job_timer; // Global Print Job Timer instance printStatistics PrintCounter::data; -const PrintCounter::promdress PrintCounter::address = STATS_EEPROM_ADDRESS; +const PrintCounter::eeprom_address_t PrintCounter::address = STATS_EEPROM_ADDRESS; millis_t PrintCounter::lastDuration; bool PrintCounter::loaded = false; @@ -69,7 +92,19 @@ void PrintCounter::initStats() { #endif loaded = true; - data = { 0, 0, 0, 0, 0.0 }; + data = { 0, 0, 0, 0, 0.0 + #if HAS_SERVICE_INTERVALS + #if SERVICE_INTERVAL_1 > 0 + , SERVICE_INTERVAL_SEC_1 + #endif + #if SERVICE_INTERVAL_2 > 0 + , SERVICE_INTERVAL_SEC_2 + #endif + #if SERVICE_INTERVAL_3 > 0 + , SERVICE_INTERVAL_SEC_3 + #endif + #endif + }; saveStats(); persistentStore.access_start(); @@ -77,6 +112,18 @@ void PrintCounter::initStats() { persistentStore.access_finish(); } +#if HAS_SERVICE_INTERVALS + inline void _print_divider() { SERIAL_ECHO_MSG("============================================="); } + inline bool _service_warn(const char * const msg) { + _print_divider(); + SERIAL_ECHO_START(); + serialprintPGM(msg); + SERIAL_ECHOLNPGM("!"); + _print_divider(); + return true; + } +#endif + void PrintCounter::loadStats() { #if ENABLED(DEBUG_PRINTCOUNTER) debug(PSTR("loadStats")); @@ -92,6 +139,22 @@ void PrintCounter::loadStats() { persistentStore.read_data(address + sizeof(uint8_t), (uint8_t*)&data, sizeof(printStatistics)); persistentStore.access_finish(); loaded = true; + + #if HAS_SERVICE_INTERVALS + bool doBuzz = false; + #if SERVICE_INTERVAL_1 > 0 + if (data.nextService1 == 0) doBuzz = _service_warn(PSTR(" " SERVICE_NAME_1)); + #endif + #if SERVICE_INTERVAL_2 > 0 + if (data.nextService2 == 0) doBuzz = _service_warn(PSTR(" " SERVICE_NAME_2)); + #endif + #if SERVICE_INTERVAL_3 > 0 + if (data.nextService3 == 0) doBuzz = _service_warn(PSTR(" " SERVICE_NAME_3)); + #endif + #if HAS_BUZZER && SERVICE_WARNING_BUZZES > 0 + if (doBuzz) for (int i = 0; i < SERVICE_WARNING_BUZZES; i++) BUZZ(200, 404); + #endif + #endif // HAS_SERVICE_INTERVALS } void PrintCounter::saveStats() { @@ -108,56 +171,57 @@ void PrintCounter::saveStats() { persistentStore.access_finish(); } +#if HAS_SERVICE_INTERVALS + inline void _service_when(char buffer[], const char * const msg, const uint32_t when) { + duration_t elapsed = when; + elapsed.toString(buffer); + SERIAL_ECHOPGM(MSG_STATS); + serialprintPGM(msg); + SERIAL_ECHOLNPAIR(" in ", buffer); + } +#endif + void PrintCounter::showStats() { char buffer[21]; - SERIAL_PROTOCOLPGM(MSG_STATS); - - 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_PROTOCOLPGM(MSG_STATS); + 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(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_PROTOCOLPGM(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 + _service_when(buffer, PSTR(SERVICE_NAME_1), data.nextService1); + #endif + #if SERVICE_INTERVAL_2 > 0 + _service_when(buffer, PSTR(SERVICE_NAME_2), data.nextService2); + #endif + #if SERVICE_INTERVAL_3 > 0 + _service_when(buffer, PSTR(SERVICE_NAME_3), data.nextService3); + #endif } void PrintCounter::tick() { @@ -170,7 +234,19 @@ void PrintCounter::tick() { #if ENABLED(DEBUG_PRINTCOUNTER) debug(PSTR("tick")); #endif - data.printTime += deltaDuration(); + millis_t delta = deltaDuration(); + data.printTime += delta; + + #if SERVICE_INTERVAL_1 > 0 + data.nextService1 -= MIN(delta, data.nextService1); + #endif + #if SERVICE_INTERVAL_2 > 0 + data.nextService2 -= MIN(delta, data.nextService2); + #endif + #if SERVICE_INTERVAL_3 > 0 + data.nextService3 -= MIN(delta, data.nextService3); + #endif + update_next = now + updateInterval * 1000; } @@ -229,6 +305,40 @@ void PrintCounter::reset() { lastDuration = 0; } +#if HAS_SERVICE_INTERVALS + + void PrintCounter::resetServiceInterval(const int index) { + switch (index) { + #if SERVICE_INTERVAL_1 > 0 + case 1: data.nextService1 = SERVICE_INTERVAL_SEC_1; + #endif + #if SERVICE_INTERVAL_2 > 0 + case 2: data.nextService2 = SERVICE_INTERVAL_SEC_2; + #endif + #if SERVICE_INTERVAL_3 > 0 + case 3: data.nextService3 = SERVICE_INTERVAL_SEC_3; + #endif + } + saveStats(); + } + + bool PrintCounter::needsService(const int index) { + switch (index) { + #if SERVICE_INTERVAL_1 > 0 + case 1: return data.nextService1 == 0; + #endif + #if SERVICE_INTERVAL_2 > 0 + case 2: return data.nextService2 == 0; + #endif + #if SERVICE_INTERVAL_3 > 0 + case 3: return data.nextService3 == 0; + #endif + default: return false; + } + } + +#endif // HAS_SERVICE_INTERVALS + #if ENABLED(DEBUG_PRINTCOUNTER) void PrintCounter::debug(const char func[]) { @@ -238,6 +348,7 @@ void PrintCounter::reset() { SERIAL_ECHOLNPGM("()"); } } + #endif #endif // PRINTCOUNTER diff --git a/Marlin/src/module/printcounter.h b/Marlin/src/module/printcounter.h index ce3fd05b3cf9..089c385e3308 100644 --- a/Marlin/src/module/printcounter.h +++ b/Marlin/src/module/printcounter.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 @@ -42,16 +42,25 @@ struct printStatistics { // 16 bytes uint32_t printTime; // Accumulated printing time uint32_t longestPrint; // Longest successful print job float filamentUsed; // Accumulated filament consumed in mm + #if SERVICE_INTERVAL_1 > 0 + uint32_t nextService1; // Service intervals (or placeholders) + #endif + #if SERVICE_INTERVAL_2 > 0 + uint32_t nextService2; + #endif + #if SERVICE_INTERVAL_3 > 0 + uint32_t nextService3; + #endif }; class PrintCounter: public Stopwatch { private: typedef Stopwatch super; - #if ENABLED(I2C_EEPROM) || ENABLED(SPI_EEPROM) || defined(CPU_32_BIT) - typedef uint32_t promdress; + #if EITHER(I2C_EEPROM, SPI_EEPROM) || defined(CPU_32_BIT) + typedef uint32_t eeprom_address_t; #else - typedef uint16_t promdress; + typedef uint16_t eeprom_address_t; #endif static printStatistics data; @@ -60,7 +69,7 @@ class PrintCounter: public Stopwatch { * @brief EEPROM address * @details Defines the start offset address where the data is stored. */ - static const promdress address; + static const eeprom_address_t address; /** * @brief Interval in seconds between counter updates @@ -174,6 +183,11 @@ class PrintCounter: public Stopwatch { static bool stop(); static void reset(); + #if HAS_SERVICE_INTERVALS + static void resetServiceInterval(const int index); + static bool needsService(const int index); + #endif + #if ENABLED(DEBUG_PRINTCOUNTER) /** diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index 750d30894dfb..8988b15bea45 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -38,14 +38,16 @@ #include "../gcode/gcode.h" #include "../lcd/ultralcd.h" -#include "../Marlin.h" +#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 #if HAS_LEVELING #include "../feature/bedlevel/bedlevel.h" #endif #if ENABLED(DELTA) - #include "../module/delta.h" + #include "delta.h" #endif #if ENABLED(BABYSTEP_ZPROBE_OFFSET) @@ -54,8 +56,12 @@ float zprobe_zoffset; // Initialized by settings.load() +#if ENABLED(BLTOUCH) + #include "../feature/bltouch.h" +#endif + #if HAS_Z_SERVO_PROBE - #include "../module/servo.h" + #include "servo.h" #endif #if ENABLED(SENSORLESS_PROBING) @@ -63,6 +69,13 @@ float zprobe_zoffset; // Initialized by settings.load() #include "../feature/tmc_util.h" #endif +#if QUIET_PROBING + #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 @@ -76,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)); @@ -262,31 +269,13 @@ float zprobe_zoffset; // Initialized by settings.load() #endif // Z_PROBE_ALLEN_KEY -#if ENABLED(PROBING_FANS_OFF) - - void fans_pause(const bool p) { - 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; - } - else - for (uint8_t x = 0; x < FAN_COUNT; x++) - fan_speed[x] = paused_fan_speed[x]; - } - } - -#endif // PROBING_FANS_OFF - #if QUIET_PROBING void probing_pause(const bool p) { #if ENABLED(PROBING_HEATERS_OFF) thermalManager.pause(p); #endif #if ENABLED(PROBING_FANS_OFF) - fans_pause(p); + thermalManager.set_fans_paused(p); #endif #if ENABLED(PROBING_STEPPERS_OFF) disable_e_steppers(); @@ -304,55 +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_START(); - SERIAL_ERRORLNPGM(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; @@ -365,21 +310,35 @@ inline void do_probe_raise(const float z_raise) { FORCE_INLINE void probe_specific_action(const bool deploy) { #if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + do { + #if ENABLED(PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED) + if (deploy == (READ(Z_MIN_PROBE_PIN) == Z_MIN_PROBE_ENDSTOP_INVERTING)) break; + #endif - BUZZ(100, 659); - BUZZ(100, 698); + BUZZ(100, 659); + BUZZ(100, 698); - PGM_P const ds_str = deploy ? PSTR(MSG_MANUAL_DEPLOY) : PSTR(MSG_MANUAL_STOW); - ui.return_to_status(); // To display the new status message - ui.set_status_P(ds_str, 99); - serialprintPGM(ds_str); - SERIAL_EOL(); + PGM_P const ds_str = deploy ? PSTR(MSG_MANUAL_DEPLOY) : PSTR(MSG_MANUAL_STOW); + ui.return_to_status(); // To display the new status message + ui.set_status_P(ds_str, 99); + serialprintPGM(ds_str); + SERIAL_EOL(); - KEEPALIVE_STATE(PAUSED_FOR_USER); - wait_for_user = true; - while (wait_for_user) idle(); - ui.reset_status(); - KEEPALIVE_STATE(IN_HANDLER); + KEEPALIVE_STATE(PAUSED_FOR_USER); + wait_for_user = true; + #if ENABLED(HOST_PROMPT_SUPPORT) + host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Stow Probe"), PSTR("Continue")); + #endif + while (wait_for_user) idle(); + ui.reset_status(); + KEEPALIVE_STATE(IN_HANDLER); + } while( + #if ENABLED(PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED) + true + #else + false + #endif + ); #endif // PAUSE_BEFORE_DEPLOY_STOW @@ -415,12 +374,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; @@ -443,15 +400,14 @@ 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 #define _AUE_ARGS #endif if (axis_unhomed_error(_AUE_ARGS)) { - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM(MSG_STOP_UNHOMED); + SERIAL_ERROR_MSG(MSG_STOP_UNHOMED); stop(); return true; } @@ -461,7 +417,7 @@ bool set_probe_deployed(const bool deploy) { oldYpos = current_position[Y_AXIS]; #if ENABLED(PROBE_TRIGGERED_WHEN_STOWED_TEST) - #if ENABLED(Z_MIN_PROBE_ENDSTOP) + #if USES_Z_MIN_PROBE_ENDSTOP #define PROBE_STOWED() (READ(Z_MIN_PROBE_PIN) != Z_MIN_PROBE_ENDSTOP_INVERTING) #else #define PROBE_STOWED() (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING) @@ -479,8 +435,7 @@ bool set_probe_deployed(const bool deploy) { if (PROBE_STOWED() == deploy) { // Unchanged after deploy/stow action? if (IsRunning()) { - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM("Z-Probe failed"); + SERIAL_ERROR_MSG("Z-Probe failed"); LCD_ALERTMESSAGEPGM("Err: ZPROBE"); } stop(); @@ -508,6 +463,30 @@ bool set_probe_deployed(const bool deploy) { } #endif +#if ENABLED(MEASURE_BACKLASH_WHEN_PROBING) + #if USES_Z_MIN_PROBE_ENDSTOP + #define TEST_PROBE_PIN (READ(Z_MIN_PROBE_PIN) != Z_MIN_PROBE_ENDSTOP_INVERTING) + #else + #define TEST_PROBE_PIN (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING) + #endif + + extern float backlash_measured_mm[]; + extern uint8_t backlash_measured_num[]; + + /* Measure Z backlash by raising nozzle in increments until probe deactivates */ + static void measure_backlash_with_probe() { + if (backlash_measured_num[Z_AXIS] == 255) return; + + float start_height = current_position[Z_AXIS]; + while (current_position[Z_AXIS] < (start_height + BACKLASH_MEASUREMENT_LIMIT) && TEST_PROBE_PIN) + do_blocking_move_to_z(current_position[Z_AXIS] + BACKLASH_MEASUREMENT_RESOLUTION, MMM_TO_MMS(BACKLASH_MEASUREMENT_FEEDRATE)); + + // The backlash from all probe points is averaged, so count the number of measurements + backlash_measured_mm[Z_AXIS] += current_position[Z_AXIS] - start_height; + backlash_measured_num[Z_AXIS]++; + } +#endif + /** * @brief Used by run_z_probe to do a single Z probe move. * @@ -521,9 +500,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 @@ -537,16 +514,17 @@ 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. #if ENABLED(SENSORLESS_PROBING) + sensorless_t stealth_states { false, false, false, false, false, false, false }; #if ENABLED(DELTA) - tmc_stallguard(stepperX); - tmc_stallguard(stepperY); + stealth_states.x = tmc_enable_stallguard(stepperX); + stealth_states.y = tmc_enable_stallguard(stepperY); #endif - tmc_stallguard(stepperZ); + stealth_states.z = tmc_enable_stallguard(stepperZ); endstops.enable(true); #endif @@ -559,7 +537,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(), @@ -580,15 +558,15 @@ static bool do_probe_move(const float z, const float fr_mm_s) { #if ENABLED(SENSORLESS_PROBING) endstops.not_homing(); #if ENABLED(DELTA) - tmc_stallguard(stepperX, false); - tmc_stallguard(stepperY, false); + tmc_disable_stallguard(stepperX, stealth_states.x); + tmc_disable_stallguard(stepperY, stealth_states.y); #endif - tmc_stallguard(stepperZ, false); + tmc_disable_stallguard(stepperZ, stealth_states.z); #endif // 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 @@ -600,9 +578,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; } @@ -615,9 +591,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. @@ -628,20 +602,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)); @@ -665,15 +635,17 @@ 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; } + #if ENABLED(MEASURE_BACKLASH_WHEN_PROBING) + measure_backlash_with_probe(); + #endif + #if MULTIPLE_PROBING > 2 probes_total += current_position[Z_AXIS]; if (p > 1) do_blocking_move_to_z(current_position[Z_AXIS] + Z_CLEARANCE_MULTI_PROBE, MMM_TO_MMS(Z_PROBE_SPEED_FAST)); @@ -689,12 +661,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; @@ -706,9 +673,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; } @@ -723,17 +688,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; @@ -771,13 +734,9 @@ float probe_pt(const float &rx, const float &ry, const ProbePtRaise raise_after/ } if (verbose_level > 2) { - SERIAL_PROTOCOLPGM("Bed X: "); - SERIAL_PROTOCOL_F(LOGICAL_X_POSITION(rx), 3); - SERIAL_PROTOCOLPGM(" Y: "); - SERIAL_PROTOCOL_F(LOGICAL_Y_POSITION(ry), 3); - SERIAL_PROTOCOLPGM(" Z: "); - SERIAL_PROTOCOL_F(measured_z, 3); - SERIAL_EOL(); + SERIAL_ECHOPAIR_F("Bed X: ", LOGICAL_X_POSITION(rx), 3); + SERIAL_ECHOPAIR_F(" Y: ", LOGICAL_Y_POSITION(ry), 3); + SERIAL_ECHOLNPAIR_F(" Z: ", measured_z, 3); } feedrate_mm_s = old_feedrate_mm_s; @@ -785,13 +744,10 @@ float probe_pt(const float &rx, const float &ry, const ProbePtRaise raise_after/ if (isnan(measured_z)) { STOW_PROBE(); LCD_MESSAGEPGM(MSG_ERR_PROBING_FAILED); - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM(MSG_ERR_PROBING_FAILED); + 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 830911a6ba21..4bf69417194b 100644 --- a/Marlin/src/module/probe.h +++ b/Marlin/src/module/probe.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -57,17 +57,3 @@ #if QUIET_PROBING void probing_pause(const bool p); #endif - -#if ENABLED(PROBING_FANS_OFF) - void fans_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 8063c444436e..19b9c7343c3e 100644 --- a/Marlin/src/module/scara.cpp +++ b/Marlin/src/module/scara.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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_PROTOCOLPAIR("SCARA Theta:", planner.get_axis_position_degrees(A_AXIS)); - SERIAL_PROTOCOLLNPAIR(" 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/scara.h b/Marlin/src/module/scara.h index fc7049997ad2..cb69da6207e7 100644 --- a/Marlin/src/module/scara.h +++ b/Marlin/src/module/scara.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/servo.cpp b/Marlin/src/module/servo.cpp index fbb3e6a764f0..036f98aaae4d 100644 --- a/Marlin/src/module/servo.cpp +++ b/Marlin/src/module/servo.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -31,7 +31,10 @@ #include "servo.h" HAL_SERVO_LIB servo[NUM_SERVOS]; -uint16_t servo_angles[NUM_SERVOS][2]; + +#if ENABLED(EDITABLE_SERVO_ANGLES) + uint16_t servo_angles[NUM_SERVOS][2]; +#endif void servo_init() { #if NUM_SERVOS >= 1 && HAS_SERVO_0 diff --git a/Marlin/src/module/servo.h b/Marlin/src/module/servo.h index 7dc70559c74e..d417cc877f28 100644 --- a/Marlin/src/module/servo.h +++ b/Marlin/src/module/servo.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -28,13 +28,69 @@ #include "../inc/MarlinConfig.h" #include "../HAL/shared/servo.h" -extern HAL_SERVO_LIB servo[NUM_SERVOS]; -extern uint16_t servo_angles[NUM_SERVOS][2]; -extern void servo_init(); +#if HAS_SERVO_ANGLES + + #if ENABLED(SWITCHING_EXTRUDER) + #ifndef SWITCHING_EXTRUDER_E23_SERVO_NR + #define SWITCHING_EXTRUDER_E23_SERVO_NR -1 + #endif + #if EXTRUDERS > 3 + #define REQ_ANGLES 4 + #else + #define REQ_ANGLES 2 + #endif + #define SADATA SWITCHING_EXTRUDER_SERVO_ANGLES + #define ASRC(N,E) (SWITCHING_EXTRUDER_SERVO_NR == N ? asrc[E] : SWITCHING_EXTRUDER_E23_SERVO_NR == N ? asrc[E+2] : 0) + #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_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) + extern uint16_t servo_angles[NUM_SERVOS][2]; + #define BASE_SERVO_ANGLES base_servo_angles + #else + #define BASE_SERVO_ANGLES servo_angles + #endif + + constexpr uint16_t asrc[] = SADATA; + #if REQ_ANGLES + static_assert(COUNT(asrc) == REQ_ANGLES, "SWITCHING_EXTRUDER_SERVO_ANGLES needs " STRINGIFY(REQ_ANGLES) " angles."); + #endif + + constexpr uint16_t BASE_SERVO_ANGLES [NUM_SERVOS][2] = { + { ASRC(0,0), ASRC(0,1) } + #if NUM_SERVOS > 1 + , { ASRC(1,0), ASRC(1,1) } + #if NUM_SERVOS > 2 + , { ASRC(2,0), ASRC(2,1) } + #if NUM_SERVOS > 3 + , { ASRC(3,0), ASRC(3,1) } + #endif + #endif + #endif + }; + + #if HAS_Z_SERVO_PROBE + #define DEPLOY_Z_SERVO() MOVE_SERVO(Z_PROBE_SERVO_NR, servo_angles[Z_PROBE_SERVO_NR][0]) + #define STOW_Z_SERVO() MOVE_SERVO(Z_PROBE_SERVO_NR, servo_angles[Z_PROBE_SERVO_NR][1]) + #endif + +#endif // HAS_SERVO_ANGLES #define MOVE_SERVO(I, P) servo[I].move(P) -#if HAS_Z_SERVO_PROBE - #define DEPLOY_Z_SERVO() MOVE_SERVO(Z_PROBE_SERVO_NR, servo_angles[Z_PROBE_SERVO_NR][0]) - #define STOW_Z_SERVO() MOVE_SERVO(Z_PROBE_SERVO_NR, servo_angles[Z_PROBE_SERVO_NR][1]) -#endif +extern HAL_SERVO_LIB servo[NUM_SERVOS]; +extern void servo_init(); diff --git a/Marlin/src/module/speed_lookuptable.h b/Marlin/src/module/speed_lookuptable.h index ade4e01bd446..f799235010e4 100644 --- a/Marlin/src/module/speed_lookuptable.h +++ b/Marlin/src/module/speed_lookuptable.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index e9593730c3bb..ce3141c12ff3 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -79,6 +79,12 @@ #include "stepper.h" +Stepper stepper; // Singleton + +#if HAS_MOTOR_CURRENT_PWM + bool Stepper::initialized; // = false +#endif + #ifdef __AVR__ #include "speed_lookuptable.h" #endif @@ -87,7 +93,7 @@ #include "planner.h" #include "motion.h" -#include "../module/temperature.h" +#include "temperature.h" #include "../lcd/ultralcd.h" #include "../core/language.h" #include "../gcode/queue.h" @@ -107,15 +113,17 @@ #include "../feature/mixing.h" #endif -Stepper stepper; // Singleton - #if FILAMENT_RUNOUT_DISTANCE_MM > 0 #include "../feature/runout.h" #endif +#if HAS_DRIVER(L6470) + #include "../libs/L6470/L6470_Marlin.h" +#endif + // public: -#if ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS || ENABLED(Z_STEPPER_AUTO_ALIGN) +#if HAS_EXTRA_ENDSTOPS || ENABLED(Z_STEPPER_AUTO_ALIGN) bool Stepper::separate_multi_axis = false; #endif @@ -125,10 +133,10 @@ Stepper stepper; // Singleton // private: -block_t* Stepper::current_block = NULL; // A pointer to the block currently being traced +block_t* Stepper::current_block; // (= NULL) A pointer to the block currently being traced -uint8_t Stepper::last_direction_bits = 0, - Stepper::axis_did_move; +uint8_t Stepper::last_direction_bits, // = 0 + Stepper::axis_did_move; // = 0 bool Stepper::abort_current_block; @@ -145,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 @@ -256,6 +264,18 @@ int8_t Stepper::count_direction[NUM_AXIS] = { 0, 0, 0, 0 }; A##3_STEP_WRITE(V); \ } +#define TRIPLE_SEPARATE_APPLY_STEP(A,V) \ + if (separate_multi_axis) { \ + if (!locked_##A##_motor) A##_STEP_WRITE(V); \ + if (!locked_##A##2_motor) A##2_STEP_WRITE(V); \ + if (!locked_##A##3_motor) A##3_STEP_WRITE(V); \ + } \ + else { \ + A##_STEP_WRITE(V); \ + A##2_STEP_WRITE(V); \ + A##3_STEP_WRITE(V); \ + } + #if ENABLED(X_DUAL_STEPPER_DRIVERS) #define X_APPLY_DIR(v,Q) do{ X_DIR_WRITE(v); X2_DIR_WRITE((v) != INVERT_X2_VS_X_DIR); }while(0) #if ENABLED(X_DUAL_ENDSTOPS) @@ -264,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) @@ -301,6 +313,8 @@ int8_t Stepper::count_direction[NUM_AXIS] = { 0, 0, 0, 0 }; #define Z_APPLY_DIR(v,Q) do{ Z_DIR_WRITE(v); Z2_DIR_WRITE(v); Z3_DIR_WRITE(v); }while(0) #if ENABLED(Z_TRIPLE_ENDSTOPS) #define Z_APPLY_STEP(v,Q) TRIPLE_ENDSTOP_APPLY_STEP(Z,v) + #elif ENABLED(Z_STEPPER_AUTO_ALIGN) + #define Z_APPLY_STEP(v,Q) TRIPLE_SEPARATE_APPLY_STEP(Z,v) #else #define Z_APPLY_STEP(v,Q) do{ Z_STEP_WRITE(v); Z2_STEP_WRITE(v); Z3_STEP_WRITE(v); }while(0) #endif @@ -336,22 +350,28 @@ void Stepper::wake_up() { */ void Stepper::set_directions() { - #define SET_STEP_DIR(A) \ - if (motor_direction(_AXIS(A))) { \ - A##_APPLY_DIR(INVERT_## A##_DIR, false); \ - count_direction[_AXIS(A)] = -1; \ - } \ - else { \ + #if HAS_DRIVER(L6470) + uint8_t L6470_buf[MAX_L6470 + 1]; // chip command sequence - element 0 not used + #endif + + #define SET_STEP_DIR(A) \ + if (motor_direction(_AXIS(A))) { \ + A##_APPLY_DIR(INVERT_## A##_DIR, false); \ + count_direction[_AXIS(A)] = -1; \ + } \ + else { \ A##_APPLY_DIR(!INVERT_## A##_DIR, false); \ - count_direction[_AXIS(A)] = 1; \ + count_direction[_AXIS(A)] = 1; \ } #if HAS_X_DIR SET_STEP_DIR(X); // A #endif + #if HAS_Y_DIR SET_STEP_DIR(Y); // B #endif + #if HAS_Z_DIR SET_STEP_DIR(Z); // C #endif @@ -380,6 +400,27 @@ void Stepper::set_directions() { #endif #endif // !LIN_ADVANCE + #if HAS_DRIVER(L6470) + + if (L6470.spi_active) { + L6470.spi_abort = true; // interrupted a SPI transfer - need to shut it down gracefully + for (uint8_t j = 1; j <= L6470::chain[0]; j++) + L6470_buf[j] = dSPIN_NOP; // fill buffer with NOOP commands + L6470.transfer(L6470_buf, L6470::chain[0]); // send enough NOOPs to complete any command + L6470.transfer(L6470_buf, L6470::chain[0]); + L6470.transfer(L6470_buf, L6470::chain[0]); + } + + // The L6470.dir_commands[] array holds the direction command for each stepper + + //scan command array and copy matches into L6470.transfer + for (uint8_t j = 1; j <= L6470::chain[0]; j++) + L6470_buf[j] = L6470.dir_commands[L6470::chain[j]]; + + L6470.transfer(L6470_buf, L6470::chain[0]); // send the command stream to the drivers + + #endif + // A small delay may be needed after changing direction #if MINIMUM_STEPPER_DIR_DELAY > 0 DELAY_NS(MINIMUM_STEPPER_DIR_DELAY); @@ -1197,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(); @@ -1409,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]; @@ -1429,7 +1470,12 @@ void Stepper::stepper_pulse_phase_isr() { #endif #endif - #if MINIMUM_STEPPER_PULSE + #if ENABLED(I2S_STEPPER_STREAM) + i2s_push_sample(); + #endif + + // TODO: need to deal with MINIMUM_STEPPER_PULSE over i2s + #if MINIMUM_STEPPER_PULSE && DISABLED(I2S_STEPPER_STREAM) // Just wait for the requested pulse duration while (HAL_timer_get_count(PULSE_TIMER_NUM) < pulse_end) { /* nada */ } #endif @@ -1633,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 != @@ -1651,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 != @@ -1669,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 != @@ -1752,10 +1798,15 @@ uint32_t Stepper::stepper_block_phase_isr() { else LA_isr_rate = LA_ADV_NEVER; #endif - if (current_block->direction_bits != last_direction_bits + if ( + #if HAS_DRIVER(L6470) + true // Always set direction for L6470 (This also enables the chips) + #else + current_block->direction_bits != last_direction_bits #if DISABLED(MIXING_EXTRUDER) || stepper_extruder != last_moved_extruder #endif + #endif ) { last_direction_bits = current_block->direction_bits; #if EXTRUDERS > 1 @@ -1920,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; @@ -1984,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 @@ -2047,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 @@ -2093,13 +2139,26 @@ void Stepper::init() { E_AXIS_INIT(5); #endif - // Init Stepper ISR to 122 Hz for quick starting - HAL_timer_start(STEP_TIMER_NUM, 122); + #if DISABLED(I2S_STEPPER_STREAM) + HAL_timer_start(STEP_TIMER_NUM, 122); // Init Stepper ISR to 122 Hz for quick starting + ENABLE_STEPPER_DRIVER_INTERRUPT(); + sei(); + #endif + + // Init direction bits for first moves + last_direction_bits = 0 + | (INVERT_X_DIR ? _BV(X_AXIS) : 0) + | (INVERT_Y_DIR ? _BV(Y_AXIS) : 0) + | (INVERT_Z_DIR ? _BV(Z_AXIS) : 0); - ENABLE_STEPPER_DRIVER_INTERRUPT(); + set_directions(); - sei(); - set_directions(); // Init directions to last_direction_bits = 0 Keeps Z from being reversed + #if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM + #if HAS_MOTOR_CURRENT_PWM + initialized = true; + #endif + digipot_init(); + #endif } /** @@ -2218,25 +2277,25 @@ void Stepper::report_positions() { if (was_enabled) ENABLE_STEPPER_DRIVER_INTERRUPT(); #if CORE_IS_XY || CORE_IS_XZ || ENABLED(DELTA) || IS_SCARA - SERIAL_PROTOCOLPGM(MSG_COUNT_A); + SERIAL_ECHOPGM(MSG_COUNT_A); #else - SERIAL_PROTOCOLPGM(MSG_COUNT_X); + SERIAL_ECHOPGM(MSG_COUNT_X); #endif - SERIAL_PROTOCOL(xpos); + SERIAL_ECHO(xpos); #if CORE_IS_XY || CORE_IS_YZ || ENABLED(DELTA) || IS_SCARA - SERIAL_PROTOCOLPGM(" B:"); + SERIAL_ECHOPGM(" B:"); #else - SERIAL_PROTOCOLPGM(" Y:"); + SERIAL_ECHOPGM(" Y:"); #endif - SERIAL_PROTOCOL(ypos); + SERIAL_ECHO(ypos); #if CORE_IS_XZ || CORE_IS_YZ || ENABLED(DELTA) - SERIAL_PROTOCOLPGM(" C:"); + SERIAL_ECHOPGM(" C:"); #else - SERIAL_PROTOCOLPGM(" Z:"); + SERIAL_ECHOPGM(" Z:"); #endif - SERIAL_PROTOCOL(zpos); + SERIAL_ECHO(zpos); SERIAL_EOL(); } @@ -2405,15 +2464,16 @@ void Stepper::report_positions() { #if HAS_MOTOR_CURRENT_PWM void Stepper::refresh_motor_power() { + 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]); @@ -2424,99 +2484,109 @@ void Stepper::report_positions() { #endif // HAS_MOTOR_CURRENT_PWM -#if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM +#if !MB(PRINTRBOARD_G2) - void Stepper::digipot_current(const uint8_t driver, const int16_t current) { + #if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM - #if HAS_DIGIPOTSS + void Stepper::digipot_current(const uint8_t driver, const int16_t current) { - const uint8_t digipot_ch[] = DIGIPOT_CHANNELS; - digitalPotWrite(digipot_ch[driver], current); + #if HAS_DIGIPOTSS - #elif HAS_MOTOR_CURRENT_PWM + const uint8_t digipot_ch[] = DIGIPOT_CHANNELS; + digitalPotWrite(digipot_ch[driver], current); - if (WITHIN(driver, 0, COUNT(motor_current_setting) - 1)) - motor_current_setting[driver] = current; // update motor_current_setting + #elif HAS_MOTOR_CURRENT_PWM - #define _WRITE_CURRENT_PWM(P) analogWrite(MOTOR_CURRENT_PWM_## P ##_PIN, 255L * current / (MOTOR_CURRENT_PWM_RANGE)) - switch (driver) { - case 0: - #if PIN_EXISTS(MOTOR_CURRENT_PWM_X) - _WRITE_CURRENT_PWM(X); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_Y) - _WRITE_CURRENT_PWM(Y); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) - _WRITE_CURRENT_PWM(XY); - #endif - break; - case 1: - #if PIN_EXISTS(MOTOR_CURRENT_PWM_Z) - _WRITE_CURRENT_PWM(Z); - #endif - break; - case 2: - #if PIN_EXISTS(MOTOR_CURRENT_PWM_E) - _WRITE_CURRENT_PWM(E); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_E0) - _WRITE_CURRENT_PWM(E0); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_E1) - _WRITE_CURRENT_PWM(E1); - #endif - break; - } - #endif - } + if (!initialized) return; - void Stepper::digipot_init() { + if (WITHIN(driver, 0, COUNT(motor_current_setting) - 1)) + motor_current_setting[driver] = current; // update motor_current_setting - #if HAS_DIGIPOTSS + #define _WRITE_CURRENT_PWM(P) analogWrite(MOTOR_CURRENT_PWM_## P ##_PIN, 255L * current / (MOTOR_CURRENT_PWM_RANGE)) + switch (driver) { + case 0: + #if PIN_EXISTS(MOTOR_CURRENT_PWM_X) + _WRITE_CURRENT_PWM(X); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_Y) + _WRITE_CURRENT_PWM(Y); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) + _WRITE_CURRENT_PWM(XY); + #endif + break; + case 1: + #if PIN_EXISTS(MOTOR_CURRENT_PWM_Z) + _WRITE_CURRENT_PWM(Z); + #endif + break; + case 2: + #if PIN_EXISTS(MOTOR_CURRENT_PWM_E) + _WRITE_CURRENT_PWM(E); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_E0) + _WRITE_CURRENT_PWM(E0); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_E1) + _WRITE_CURRENT_PWM(E1); + #endif + break; + } + #endif + } - static const uint8_t digipot_motor_current[] = DIGIPOT_MOTOR_CURRENT; + void Stepper::digipot_init() { - SPI.begin(); - SET_OUTPUT(DIGIPOTSS_PIN); + #if HAS_DIGIPOTSS - for (uint8_t i = 0; i < COUNT(digipot_motor_current); i++) { - //digitalPotWrite(digipot_ch[i], digipot_motor_current[i]); - digipot_current(i, digipot_motor_current[i]); - } + static const uint8_t digipot_motor_current[] = DIGIPOT_MOTOR_CURRENT; - #elif HAS_MOTOR_CURRENT_PWM + SPI.begin(); + SET_OUTPUT(DIGIPOTSS_PIN); - #if PIN_EXISTS(MOTOR_CURRENT_PWM_X) - SET_OUTPUT(MOTOR_CURRENT_PWM_X_PIN); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_Y) - SET_OUTPUT(MOTOR_CURRENT_PWM_Y_PIN); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) - SET_OUTPUT(MOTOR_CURRENT_PWM_XY_PIN); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_Z) - SET_OUTPUT(MOTOR_CURRENT_PWM_Z_PIN); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_E) - SET_OUTPUT(MOTOR_CURRENT_PWM_E_PIN); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_E0) - SET_OUTPUT(MOTOR_CURRENT_PWM_E0_PIN); - #endif - #if PIN_EXISTS(MOTOR_CURRENT_PWM_E1) - SET_OUTPUT(MOTOR_CURRENT_PWM_E1_PIN); - #endif + for (uint8_t i = 0; i < COUNT(digipot_motor_current); i++) { + //digitalPotWrite(digipot_ch[i], digipot_motor_current[i]); + digipot_current(i, digipot_motor_current[i]); + } - refresh_motor_power(); + #elif HAS_MOTOR_CURRENT_PWM - // Set Timer5 to 31khz so the PWM of the motor power is as constant as possible. (removes a buzzing noise) - #ifdef __AVR__ - SET_CS5(PRESCALER_1); + #if PIN_EXISTS(MOTOR_CURRENT_PWM_X) + SET_PWM(MOTOR_CURRENT_PWM_X_PIN); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_Y) + SET_PWM(MOTOR_CURRENT_PWM_Y_PIN); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) + SET_PWM(MOTOR_CURRENT_PWM_XY_PIN); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_Z) + SET_PWM(MOTOR_CURRENT_PWM_Z_PIN); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_E) + SET_PWM(MOTOR_CURRENT_PWM_E_PIN); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_E0) + SET_PWM(MOTOR_CURRENT_PWM_E0_PIN); + #endif + #if PIN_EXISTS(MOTOR_CURRENT_PWM_E1) + SET_PWM(MOTOR_CURRENT_PWM_E1_PIN); + #endif + + refresh_motor_power(); + + // Set Timer5 to 31khz so the PWM of the motor power is as constant as possible. (removes a buzzing noise) + #ifdef __AVR__ + SET_CS5(PRESCALER_1); + #endif #endif - #endif - } + } + + #endif + +#else + + #include "../HAL/HAL_DUE/G2_PWM.h" #endif @@ -2813,82 +2883,81 @@ void Stepper::report_positions() { case 128: microstep_ms(driver, MICROSTEP128); break; #endif - default: SERIAL_ERROR_START(); SERIAL_ERRORLNPGM("Microsteps unavailable"); break; + default: SERIAL_ERROR_MSG("Microsteps unavailable"); break; } } void Stepper::microstep_readings() { - SERIAL_PROTOCOLLNPGM("MS1,MS2,MS3 Pins"); - SERIAL_PROTOCOLPGM("X: "); + SERIAL_ECHOPGM("MS1,MS2,MS3 Pins\nX: "); #if HAS_X_MICROSTEPS - SERIAL_PROTOCOL(READ(X_MS1_PIN)); - SERIAL_PROTOCOL(READ(X_MS2_PIN)); + SERIAL_CHAR('0' + READ(X_MS1_PIN)); + SERIAL_CHAR('0' + READ(X_MS2_PIN)); #if PIN_EXISTS(X_MS3) - SERIAL_PROTOCOLLN(READ(X_MS3_PIN)); + SERIAL_ECHOLN((int)READ(X_MS3_PIN)); #endif #endif #if HAS_Y_MICROSTEPS - SERIAL_PROTOCOLPGM("Y: "); - SERIAL_PROTOCOL(READ(Y_MS1_PIN)); - SERIAL_PROTOCOL(READ(Y_MS2_PIN)); + SERIAL_ECHOPGM("Y: "); + SERIAL_CHAR('0' + READ(Y_MS1_PIN)); + SERIAL_CHAR('0' + READ(Y_MS2_PIN)); #if PIN_EXISTS(Y_MS3) - SERIAL_PROTOCOLLN(READ(Y_MS3_PIN)); + SERIAL_ECHOLN((int)READ(Y_MS3_PIN)); #endif #endif #if HAS_Z_MICROSTEPS - SERIAL_PROTOCOLPGM("Z: "); - SERIAL_PROTOCOL(READ(Z_MS1_PIN)); - SERIAL_PROTOCOL(READ(Z_MS2_PIN)); + SERIAL_ECHOPGM("Z: "); + SERIAL_CHAR('0' + READ(Z_MS1_PIN)); + SERIAL_CHAR('0' + READ(Z_MS2_PIN)); #if PIN_EXISTS(Z_MS3) - SERIAL_PROTOCOLLN(READ(Z_MS3_PIN)); + SERIAL_ECHOLN((int)READ(Z_MS3_PIN)); #endif #endif #if HAS_E0_MICROSTEPS - SERIAL_PROTOCOLPGM("E0: "); - SERIAL_PROTOCOL(READ(E0_MS1_PIN)); - SERIAL_PROTOCOL(READ(E0_MS2_PIN)); + SERIAL_ECHOPGM("E0: "); + SERIAL_CHAR('0' + READ(E0_MS1_PIN)); + SERIAL_CHAR('0' + READ(E0_MS2_PIN)); #if PIN_EXISTS(E0_MS3) - SERIAL_PROTOCOLLN(READ(E0_MS3_PIN)); + SERIAL_ECHOLN((int)READ(E0_MS3_PIN)); #endif #endif #if HAS_E1_MICROSTEPS - SERIAL_PROTOCOLPGM("E1: "); - SERIAL_PROTOCOL(READ(E1_MS1_PIN)); - SERIAL_PROTOCOL(READ(E1_MS2_PIN)); + SERIAL_ECHOPGM("E1: "); + SERIAL_CHAR('0' + READ(E1_MS1_PIN)); + SERIAL_CHAR('0' + READ(E1_MS2_PIN)); #if PIN_EXISTS(E1_MS3) - SERIAL_PROTOCOLLN(READ(E1_MS3_PIN)); + SERIAL_ECHOLN((int)READ(E1_MS3_PIN)); #endif #endif #if HAS_E2_MICROSTEPS - SERIAL_PROTOCOLPGM("E2: "); - SERIAL_PROTOCOL(READ(E2_MS1_PIN)); - SERIAL_PROTOCOL(READ(E2_MS2_PIN)); + SERIAL_ECHOPGM("E2: "); + SERIAL_CHAR('0' + READ(E2_MS1_PIN)); + SERIAL_CHAR('0' + READ(E2_MS2_PIN)); #if PIN_EXISTS(E2_MS3) - SERIAL_PROTOCOLLN(READ(E2_MS3_PIN)); + SERIAL_ECHOLN((int)READ(E2_MS3_PIN)); #endif #endif #if HAS_E3_MICROSTEPS - SERIAL_PROTOCOLPGM("E3: "); - SERIAL_PROTOCOL(READ(E3_MS1_PIN)); - SERIAL_PROTOCOL(READ(E3_MS2_PIN)); + SERIAL_ECHOPGM("E3: "); + SERIAL_CHAR('0' + READ(E3_MS1_PIN)); + SERIAL_CHAR('0' + READ(E3_MS2_PIN)); #if PIN_EXISTS(E3_MS3) - SERIAL_PROTOCOLLN(READ(E3_MS3_PIN)); + SERIAL_ECHOLN((int)READ(E3_MS3_PIN)); #endif #endif #if HAS_E4_MICROSTEPS - SERIAL_PROTOCOLPGM("E4: "); - SERIAL_PROTOCOL(READ(E4_MS1_PIN)); - SERIAL_PROTOCOL(READ(E4_MS2_PIN)); + SERIAL_ECHOPGM("E4: "); + SERIAL_CHAR('0' + READ(E4_MS1_PIN)); + SERIAL_CHAR('0' + READ(E4_MS2_PIN)); #if PIN_EXISTS(E4_MS3) - SERIAL_PROTOCOLLN(READ(E4_MS3_PIN)); + SERIAL_ECHOLN((int)READ(E4_MS3_PIN)); #endif #endif #if HAS_E5_MICROSTEPS - SERIAL_PROTOCOLPGM("E5: "); - SERIAL_PROTOCOL(READ(E5_MS1_PIN)); - SERIAL_PROTOCOLLN(READ(E5_MS2_PIN)); + SERIAL_ECHOPGM("E5: "); + SERIAL_CHAR('0' + READ(E5_MS1_PIN)); + SERIAL_ECHOLN((int)READ(E5_MS2_PIN)); #if PIN_EXISTS(E5_MS3) - SERIAL_PROTOCOLLN(READ(E5_MS3_PIN)); + SERIAL_ECHOLN((int)READ(E5_MS3_PIN)); #endif #endif } diff --git a/Marlin/src/module/stepper.h b/Marlin/src/module/stepper.h index 5f7cdc54cc69..46bc9d706a57 100644 --- a/Marlin/src/module/stepper.h +++ b/Marlin/src/module/stepper.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,18 +50,6 @@ // Estimate the amount of time the Stepper ISR will take to execute // -#ifndef MINIMUM_STEPPER_PULSE - #define MINIMUM_STEPPER_PULSE 0UL -#endif - -#ifndef MAXIMUM_STEPPER_RATE - #if MINIMUM_STEPPER_PULSE - #define MAXIMUM_STEPPER_RATE (1000000UL / (2UL * (unsigned long)(MINIMUM_STEPPER_PULSE))) - #else - #define MAXIMUM_STEPPER_RATE 500000UL - #endif -#endif - #ifdef CPU_32_BIT // The base ISR takes 792 cycles @@ -235,14 +223,14 @@ #include "speed_lookuptable.h" #endif -#include "../module/planner.h" +#include "planner.h" #include "../core/language.h" class Stepper { public: - #if ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS || ENABLED(Z_STEPPER_AUTO_ALIGN) + #if HAS_EXTRA_ENDSTOPS || ENABLED(Z_STEPPER_AUTO_ALIGN) static bool separate_multi_axis; #endif @@ -251,6 +239,7 @@ class Stepper { #define PWM_MOTOR_CURRENT DEFAULT_PWM_MOTOR_CURRENT #endif static uint32_t motor_current_setting[3]; + static bool initialized; #endif private: @@ -278,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 @@ -419,7 +408,7 @@ class Stepper { static void microstep_readings(); #endif - #if ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS || ENABLED(Z_STEPPER_AUTO_ALIGN) + #if HAS_EXTRA_ENDSTOPS || ENABLED(Z_STEPPER_AUTO_ALIGN) FORCE_INLINE static void set_separate_multi_axis(const bool state) { separate_multi_axis = state; } #endif #if ENABLED(X_DUAL_ENDSTOPS) @@ -434,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.cpp b/Marlin/src/module/stepper_indirection.cpp index bf0cb7f68145..2e25b11afd6f 100644 --- a/Marlin/src/module/stepper_indirection.cpp +++ b/Marlin/src/module/stepper_indirection.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -35,7 +35,11 @@ #include "../inc/MarlinConfig.h" -#include "../module/stepper.h" +#include "stepper.h" + +#if HAS_DRIVER(L6470) + #include "L6470/L6470_Marlin.h" +#endif // // TMC26X Driver objects and inits @@ -51,43 +55,43 @@ #define _TMC26X_DEFINE(ST) TMC26XStepper stepper##ST(200, ST##_CS_PIN, ST##_STEP_PIN, ST##_DIR_PIN, ST##_MAX_CURRENT, ST##_SENSE_RESISTOR) - #if AXIS_DRIVER_TYPE(X, TMC26X) + #if AXIS_DRIVER_TYPE_X(TMC26X) _TMC26X_DEFINE(X); #endif - #if AXIS_DRIVER_TYPE(X2, TMC26X) + #if AXIS_DRIVER_TYPE_X2(TMC26X) _TMC26X_DEFINE(X2); #endif - #if AXIS_DRIVER_TYPE(Y, TMC26X) + #if AXIS_DRIVER_TYPE_Y(TMC26X) _TMC26X_DEFINE(Y); #endif - #if AXIS_DRIVER_TYPE(Y2, TMC26X) + #if AXIS_DRIVER_TYPE_Y2(TMC26X) _TMC26X_DEFINE(Y2); #endif - #if AXIS_DRIVER_TYPE(Z, TMC26X) + #if AXIS_DRIVER_TYPE_Z(TMC26X) _TMC26X_DEFINE(Z); #endif - #if AXIS_DRIVER_TYPE(Z2, TMC26X) + #if AXIS_DRIVER_TYPE_Z2(TMC26X) _TMC26X_DEFINE(Z2); #endif - #if AXIS_DRIVER_TYPE(Z3, TMC26X) + #if AXIS_DRIVER_TYPE_Z3(TMC26X) _TMC26X_DEFINE(Z3); #endif - #if AXIS_DRIVER_TYPE(E0, TMC26X) + #if AXIS_DRIVER_TYPE_E0(TMC26X) _TMC26X_DEFINE(E0); #endif - #if AXIS_DRIVER_TYPE(E1, TMC26X) + #if AXIS_DRIVER_TYPE_E1(TMC26X) _TMC26X_DEFINE(E1); #endif - #if AXIS_DRIVER_TYPE(E2, TMC26X) + #if AXIS_DRIVER_TYPE_E2(TMC26X) _TMC26X_DEFINE(E2); #endif - #if AXIS_DRIVER_TYPE(E3, TMC26X) + #if AXIS_DRIVER_TYPE_E3(TMC26X) _TMC26X_DEFINE(E3); #endif - #if AXIS_DRIVER_TYPE(E4, TMC26X) + #if AXIS_DRIVER_TYPE_E4(TMC26X) _TMC26X_DEFINE(E4); #endif - #if AXIS_DRIVER_TYPE(E5, TMC26X) + #if AXIS_DRIVER_TYPE_E5(TMC26X) _TMC26X_DEFINE(E5); #endif @@ -97,50 +101,51 @@ }while(0) void tmc26x_init_to_defaults() { - #if AXIS_DRIVER_TYPE(X, TMC26X) + #if AXIS_DRIVER_TYPE_X(TMC26X) _TMC26X_INIT(X); #endif - #if AXIS_DRIVER_TYPE(X2, TMC26X) + #if AXIS_DRIVER_TYPE_X2(TMC26X) _TMC26X_INIT(X2); #endif - #if AXIS_DRIVER_TYPE(Y, TMC26X) + #if AXIS_DRIVER_TYPE_Y(TMC26X) _TMC26X_INIT(Y); #endif - #if AXIS_DRIVER_TYPE(Y2, TMC26X) + #if AXIS_DRIVER_TYPE_Y2(TMC26X) _TMC26X_INIT(Y2); #endif - #if AXIS_DRIVER_TYPE(Z, TMC26X) + #if AXIS_DRIVER_TYPE_Z(TMC26X) _TMC26X_INIT(Z); #endif - #if AXIS_DRIVER_TYPE(Z2, TMC26X) + #if AXIS_DRIVER_TYPE_Z2(TMC26X) _TMC26X_INIT(Z2); #endif - #if AXIS_DRIVER_TYPE(Z3, TMC26X) + #if AXIS_DRIVER_TYPE_Z3(TMC26X) _TMC26X_INIT(Z3); #endif - #if AXIS_DRIVER_TYPE(E0, TMC26X) + #if AXIS_DRIVER_TYPE_E0(TMC26X) _TMC26X_INIT(E0); #endif - #if AXIS_DRIVER_TYPE(E1, TMC26X) + #if AXIS_DRIVER_TYPE_E1(TMC26X) _TMC26X_INIT(E1); #endif - #if AXIS_DRIVER_TYPE(E2, TMC26X) + #if AXIS_DRIVER_TYPE_E2(TMC26X) _TMC26X_INIT(E2); #endif - #if AXIS_DRIVER_TYPE(E3, TMC26X) + #if AXIS_DRIVER_TYPE_E3(TMC26X) _TMC26X_INIT(E3); #endif - #if AXIS_DRIVER_TYPE(E4, TMC26X) + #if AXIS_DRIVER_TYPE_E4(TMC26X) _TMC26X_INIT(E4); #endif - #if AXIS_DRIVER_TYPE(E5, TMC26X) + #if AXIS_DRIVER_TYPE_E5(TMC26X) _TMC26X_INIT(E5); #endif } #endif // TMC26X #if HAS_TRINAMIC - #define _TMC_INIT(ST, SPMM) tmc_init(stepper##ST, ST##_CURRENT, ST##_MICROSTEPS, ST##_HYBRID_THRESHOLD, SPMM) + enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E }; + #define _TMC_INIT(ST, SPMM_INDEX, STEALTH_INDEX) tmc_init(stepper##ST, ST##_CURRENT, ST##_MICROSTEPS, ST##_HYBRID_THRESHOLD, planner.settings.axis_steps_per_mm[SPMM_INDEX], stealthchop_by_axis[STEALTH_INDEX]) #endif // @@ -153,91 +158,194 @@ #include "../core/enum.h" #if ENABLED(TMC_USE_SW_SPI) - #define _TMC2130_DEFINE(ST, L) TMCMarlin stepper##ST(ST##_CS_PIN, R_SENSE, TMC_SW_MOSI, TMC_SW_MISO, TMC_SW_SCK) + #define _TMC2130_DEFINE(ST, L) TMCMarlin stepper##ST(ST##_CS_PIN, ST##_RSENSE, TMC_SW_MOSI, TMC_SW_MISO, TMC_SW_SCK) #define TMC2130_DEFINE(ST) _TMC2130_DEFINE(ST, TMC_##ST##_LABEL) #else - #define _TMC2130_DEFINE(ST, L) TMCMarlin stepper##ST(ST##_CS_PIN, R_SENSE) + #define _TMC2130_DEFINE(ST, L) TMCMarlin stepper##ST(ST##_CS_PIN, ST##_RSENSE) #define TMC2130_DEFINE(ST) _TMC2130_DEFINE(ST, TMC_##ST##_LABEL) #endif // Stepper objects of TMC2130 steppers used - #if AXIS_DRIVER_TYPE(X, TMC2130) + #if AXIS_DRIVER_TYPE_X(TMC2130) TMC2130_DEFINE(X); #endif - #if AXIS_DRIVER_TYPE(X2, TMC2130) + #if AXIS_DRIVER_TYPE_X2(TMC2130) TMC2130_DEFINE(X2); #endif - #if AXIS_DRIVER_TYPE(Y, TMC2130) + #if AXIS_DRIVER_TYPE_Y(TMC2130) TMC2130_DEFINE(Y); #endif - #if AXIS_DRIVER_TYPE(Y2, TMC2130) + #if AXIS_DRIVER_TYPE_Y2(TMC2130) TMC2130_DEFINE(Y2); #endif - #if AXIS_DRIVER_TYPE(Z, TMC2130) + #if AXIS_DRIVER_TYPE_Z(TMC2130) TMC2130_DEFINE(Z); #endif - #if AXIS_DRIVER_TYPE(Z2, TMC2130) + #if AXIS_DRIVER_TYPE_Z2(TMC2130) TMC2130_DEFINE(Z2); #endif - #if AXIS_DRIVER_TYPE(Z3, TMC2130) + #if AXIS_DRIVER_TYPE_Z3(TMC2130) TMC2130_DEFINE(Z3); #endif - #if AXIS_DRIVER_TYPE(E0, TMC2130) + #if AXIS_DRIVER_TYPE_E0(TMC2130) TMC2130_DEFINE(E0); #endif - #if AXIS_DRIVER_TYPE(E1, TMC2130) + #if AXIS_DRIVER_TYPE_E1(TMC2130) TMC2130_DEFINE(E1); #endif - #if AXIS_DRIVER_TYPE(E2, TMC2130) + #if AXIS_DRIVER_TYPE_E2(TMC2130) TMC2130_DEFINE(E2); #endif - #if AXIS_DRIVER_TYPE(E3, TMC2130) + #if AXIS_DRIVER_TYPE_E3(TMC2130) TMC2130_DEFINE(E3); #endif - #if AXIS_DRIVER_TYPE(E4, TMC2130) + #if AXIS_DRIVER_TYPE_E4(TMC2130) TMC2130_DEFINE(E4); #endif - #if AXIS_DRIVER_TYPE(E5, TMC2130) + #if AXIS_DRIVER_TYPE_E5(TMC2130) TMC2130_DEFINE(E5); #endif template - void tmc_init(TMCMarlin &st, const uint16_t mA, const uint16_t microsteps, const uint32_t thrs, const float spmm) { - #if DISABLED(STEALTHCHOP) || DISABLED(HYBRID_THRESHOLD) + void tmc_init(TMCMarlin &st, const uint16_t mA, const uint16_t microsteps, const uint32_t thrs, const float spmm, const bool stealth) { + st.begin(); + + CHOPCONF_t chopconf{0}; + chopconf.tbl = 1; + chopconf.toff = chopper_timing.toff; + chopconf.intpol = INTERPOLATE; + chopconf.hend = chopper_timing.hend + 3; + chopconf.hstrt = chopper_timing.hstrt - 1; + st.CHOPCONF(chopconf.sr); + + st.rms_current(mA, HOLD_MULTIPLIER); + st.microsteps(microsteps); + st.iholddelay(10); + st.TPOWERDOWN(128); // ~2s until driver lowers to hold current + + st.en_pwm_mode(stealth); + st.stored.stealthChop_enabled = stealth; + + PWMCONF_t pwmconf{0}; + pwmconf.pwm_freq = 0b01; // f_pwm = 2/683 f_clk + pwmconf.pwm_autoscale = true; + pwmconf.pwm_grad = 5; + pwmconf.pwm_ampl = 180; + st.PWMCONF(pwmconf.sr); + + #if ENABLED(HYBRID_THRESHOLD) + st.TPWMTHRS(12650000UL*microsteps/(256*thrs*spmm)); + #else UNUSED(thrs); UNUSED(spmm); #endif + + st.GSTAT(); // Clear GSTAT + } +#endif // TMC2130 + +// +// TMC2160 Driver objects and inits +// +#if HAS_DRIVER(TMC2160) + + #include + #include "planner.h" + #include "../core/enum.h" + + #if ENABLED(TMC_USE_SW_SPI) + #define _TMC2160_DEFINE(ST, L) TMCMarlin stepper##ST(ST##_CS_PIN, ST##_RSENSE, TMC_SW_MOSI, TMC_SW_MISO, TMC_SW_SCK) + #define TMC2160_DEFINE(ST) _TMC2160_DEFINE(ST, TMC_##ST##_LABEL) + #else + #define _TMC2160_DEFINE(ST, L) TMCMarlin stepper##ST(ST##_CS_PIN, ST##_RSENSE) + #define TMC2160_DEFINE(ST) _TMC2160_DEFINE(ST, TMC_##ST##_LABEL) + #endif + // Stepper objects of TMC2160 steppers used + #if AXIS_DRIVER_TYPE(X, TMC2160) + TMC2160_DEFINE(X); + #endif + #if AXIS_DRIVER_TYPE(X2, TMC2160) + TMC2160_DEFINE(X2); + #endif + #if AXIS_DRIVER_TYPE(Y, TMC2160) + TMC2160_DEFINE(Y); + #endif + #if AXIS_DRIVER_TYPE(Y2, TMC2160) + TMC2160_DEFINE(Y2); + #endif + #if AXIS_DRIVER_TYPE(Z, TMC2160) + TMC2160_DEFINE(Z); + #endif + #if AXIS_DRIVER_TYPE(Z2, TMC2160) + TMC2160_DEFINE(Z2); + #endif + #if AXIS_DRIVER_TYPE(Z3, TMC2160) + TMC2160_DEFINE(Z3); + #endif + #if AXIS_DRIVER_TYPE(E0, TMC2160) + TMC2160_DEFINE(E0); + #endif + #if AXIS_DRIVER_TYPE(E1, TMC2160) + TMC2160_DEFINE(E1); + #endif + #if AXIS_DRIVER_TYPE(E2, TMC2160) + TMC2160_DEFINE(E2); + #endif + #if AXIS_DRIVER_TYPE(E3, TMC2160) + TMC2160_DEFINE(E3); + #endif + #if AXIS_DRIVER_TYPE(E4, TMC2160) + TMC2160_DEFINE(E4); + #endif + #if AXIS_DRIVER_TYPE(E5, TMC2160) + TMC2160_DEFINE(E5); + #endif + + template + void tmc_init(TMCMarlin &st, const uint16_t mA, const uint16_t microsteps, const uint32_t thrs, const float spmm, const bool stealth) { st.begin(); + static constexpr int8_t timings[] = CHOPPER_TIMING; // Default 4, -2, 1 + CHOPCONF_t chopconf{0}; chopconf.tbl = 1; - chopconf.toff = 3; + chopconf.toff = timings[0]; chopconf.intpol = INTERPOLATE; - chopconf.hstrt = 2; - chopconf.hend = 5; + chopconf.hend = timings[1] + 3; + chopconf.hstrt = timings[2] - 1; st.CHOPCONF(chopconf.sr); st.rms_current(mA, HOLD_MULTIPLIER); st.microsteps(microsteps); st.iholddelay(10); st.TPOWERDOWN(128); // ~2s until driver lowers to hold current + st.TCOOLTHRS(0xFFFFF); - #if ENABLED(STEALTHCHOP) - st.en_pwm_mode(true); + #if ENABLED(ADAPTIVE_CURRENT) + COOLCONF_t coolconf{0}; + coolconf.semin = INCREASE_CURRENT_THRS; + coolconf.semax = REDUCE_CURRENT_THRS; + st.COOLCONF(coolconf.sr); + #endif - PWMCONF_t pwmconf{0}; - pwmconf.pwm_freq = 0b01; // f_pwm = 2/683 f_clk - pwmconf.pwm_autoscale = true; - pwmconf.pwm_grad = 5; - pwmconf.pwm_ampl = 180; - st.PWMCONF(pwmconf.sr); + st.en_pwm_mode(stealth); - #if ENABLED(HYBRID_THRESHOLD) - st.TPWMTHRS(12650000UL*microsteps/(256*thrs*spmm)); - #endif + PWMCONF_t pwmconf{0}; + pwmconf.pwm_freq = 0b01; // f_pwm = 2/683 f_clk + pwmconf.pwm_autoscale = true; + pwmconf.pwm_grad = 5; + pwmconf.pwm_ampl = 180; + st.PWMCONF(pwmconf.sr); + + #if ENABLED(HYBRID_THRESHOLD) + st.TPWMTHRS(12650000UL*microsteps/(256*thrs*spmm)); + #else + UNUSED(thrs); + UNUSED(spmm); #endif + st.GSTAT(); // Clear GSTAT } -#endif // TMC2130 +#endif // TMC2160 // // TMC2208 Driver objects and inits @@ -246,98 +354,98 @@ #include #include "planner.h" - #define _TMC2208_DEFINE_HARDWARE(ST, L) TMCMarlin stepper##ST(&ST##_HARDWARE_SERIAL, R_SENSE) + #define _TMC2208_DEFINE_HARDWARE(ST, L) TMCMarlin stepper##ST(&ST##_HARDWARE_SERIAL, ST##_RSENSE) #define TMC2208_DEFINE_HARDWARE(ST) _TMC2208_DEFINE_HARDWARE(ST, TMC_##ST##_LABEL) - #define _TMC2208_DEFINE_SOFTWARE(ST, L) TMCMarlin stepper##ST(ST##_SERIAL_RX_PIN, ST##_SERIAL_TX_PIN, R_SENSE, ST##_SERIAL_RX_PIN > -1) + #define _TMC2208_DEFINE_SOFTWARE(ST, L) TMCMarlin stepper##ST(ST##_SERIAL_RX_PIN, ST##_SERIAL_TX_PIN, ST##_RSENSE, ST##_SERIAL_RX_PIN > -1) #define TMC2208_DEFINE_SOFTWARE(ST) _TMC2208_DEFINE_SOFTWARE(ST, TMC_##ST##_LABEL) // Stepper objects of TMC2208 steppers used - #if AXIS_DRIVER_TYPE(X, TMC2208) + #if AXIS_DRIVER_TYPE_X(TMC2208) #ifdef X_HARDWARE_SERIAL TMC2208_DEFINE_HARDWARE(X); #else TMC2208_DEFINE_SOFTWARE(X); #endif #endif - #if AXIS_DRIVER_TYPE(X2, TMC2208) + #if AXIS_DRIVER_TYPE_X2(TMC2208) #ifdef X2_HARDWARE_SERIAL TMC2208_DEFINE_HARDWARE(X2); #else TMC2208_DEFINE_SOFTWARE(X2); #endif #endif - #if AXIS_DRIVER_TYPE(Y, TMC2208) + #if AXIS_DRIVER_TYPE_Y(TMC2208) #ifdef Y_HARDWARE_SERIAL TMC2208_DEFINE_HARDWARE(Y); #else TMC2208_DEFINE_SOFTWARE(Y); #endif #endif - #if AXIS_DRIVER_TYPE(Y2, TMC2208) + #if AXIS_DRIVER_TYPE_Y2(TMC2208) #ifdef Y2_HARDWARE_SERIAL TMC2208_DEFINE_HARDWARE(Y2); #else TMC2208_DEFINE_SOFTWARE(Y2); #endif #endif - #if AXIS_DRIVER_TYPE(Z, TMC2208) + #if AXIS_DRIVER_TYPE_Z(TMC2208) #ifdef Z_HARDWARE_SERIAL TMC2208_DEFINE_HARDWARE(Z); #else TMC2208_DEFINE_SOFTWARE(Z); #endif #endif - #if AXIS_DRIVER_TYPE(Z2, TMC2208) + #if AXIS_DRIVER_TYPE_Z2(TMC2208) #ifdef Z2_HARDWARE_SERIAL TMC2208_DEFINE_HARDWARE(Z2); #else TMC2208_DEFINE_SOFTWARE(Z2); #endif #endif - #if AXIS_DRIVER_TYPE(Z3, TMC2208) + #if AXIS_DRIVER_TYPE_Z3(TMC2208) #ifdef Z3_HARDWARE_SERIAL TMC2208_DEFINE_HARDWARE(Z3); #else TMC2208_DEFINE_SOFTWARE(Z3); #endif #endif - #if AXIS_DRIVER_TYPE(E0, TMC2208) + #if AXIS_DRIVER_TYPE_E0(TMC2208) #ifdef E0_HARDWARE_SERIAL TMC2208_DEFINE_HARDWARE(E0); #else TMC2208_DEFINE_SOFTWARE(E0); #endif #endif - #if AXIS_DRIVER_TYPE(E1, TMC2208) + #if AXIS_DRIVER_TYPE_E1(TMC2208) #ifdef E1_HARDWARE_SERIAL TMC2208_DEFINE_HARDWARE(E1); #else TMC2208_DEFINE_SOFTWARE(E1); #endif #endif - #if AXIS_DRIVER_TYPE(E2, TMC2208) + #if AXIS_DRIVER_TYPE_E2(TMC2208) #ifdef E2_HARDWARE_SERIAL TMC2208_DEFINE_HARDWARE(E2); #else TMC2208_DEFINE_SOFTWARE(E2); #endif #endif - #if AXIS_DRIVER_TYPE(E3, TMC2208) + #if AXIS_DRIVER_TYPE_E3(TMC2208) #ifdef E3_HARDWARE_SERIAL TMC2208_DEFINE_HARDWARE(E3); #else TMC2208_DEFINE_SOFTWARE(E3); #endif #endif - #if AXIS_DRIVER_TYPE(E4, TMC2208) + #if AXIS_DRIVER_TYPE_E4(TMC2208) #ifdef E4_HARDWARE_SERIAL TMC2208_DEFINE_HARDWARE(E4); #else TMC2208_DEFINE_SOFTWARE(E4); #endif #endif - #if AXIS_DRIVER_TYPE(E5, TMC2208) + #if AXIS_DRIVER_TYPE_E5(TMC2208) #ifdef E5_HARDWARE_SERIAL TMC2208_DEFINE_HARDWARE(E5); #else @@ -346,91 +454,91 @@ #endif void tmc2208_serial_begin() { - #if AXIS_DRIVER_TYPE(X, TMC2208) + #if AXIS_DRIVER_TYPE_X(TMC2208) #ifdef X_HARDWARE_SERIAL X_HARDWARE_SERIAL.begin(115200); #else stepperX.beginSerial(115200); #endif #endif - #if AXIS_DRIVER_TYPE(X2, TMC2208) + #if AXIS_DRIVER_TYPE_X2(TMC2208) #ifdef X2_HARDWARE_SERIAL X2_HARDWARE_SERIAL.begin(115200); #else stepperX2.beginSerial(115200); #endif #endif - #if AXIS_DRIVER_TYPE(Y, TMC2208) + #if AXIS_DRIVER_TYPE_Y(TMC2208) #ifdef Y_HARDWARE_SERIAL Y_HARDWARE_SERIAL.begin(115200); #else stepperY.beginSerial(115200); #endif #endif - #if AXIS_DRIVER_TYPE(Y2, TMC2208) + #if AXIS_DRIVER_TYPE_Y2(TMC2208) #ifdef Y2_HARDWARE_SERIAL Y2_HARDWARE_SERIAL.begin(115200); #else stepperY2.beginSerial(115200); #endif #endif - #if AXIS_DRIVER_TYPE(Z, TMC2208) + #if AXIS_DRIVER_TYPE_Z(TMC2208) #ifdef Z_HARDWARE_SERIAL Z_HARDWARE_SERIAL.begin(115200); #else stepperZ.beginSerial(115200); #endif #endif - #if AXIS_DRIVER_TYPE(Z2, TMC2208) + #if AXIS_DRIVER_TYPE_Z2(TMC2208) #ifdef Z2_HARDWARE_SERIAL Z2_HARDWARE_SERIAL.begin(115200); #else stepperZ2.beginSerial(115200); #endif #endif - #if AXIS_DRIVER_TYPE(Z3, TMC2208) + #if AXIS_DRIVER_TYPE_Z3(TMC2208) #ifdef Z3_HARDWARE_SERIAL Z3_HARDWARE_SERIAL.begin(115200); #else stepperZ3.beginSerial(115200); #endif #endif - #if AXIS_DRIVER_TYPE(E0, TMC2208) + #if AXIS_DRIVER_TYPE_E0(TMC2208) #ifdef E0_HARDWARE_SERIAL E0_HARDWARE_SERIAL.begin(115200); #else stepperE0.beginSerial(115200); #endif #endif - #if AXIS_DRIVER_TYPE(E1, TMC2208) + #if AXIS_DRIVER_TYPE_E1(TMC2208) #ifdef E1_HARDWARE_SERIAL E1_HARDWARE_SERIAL.begin(115200); #else stepperE1.beginSerial(115200); #endif #endif - #if AXIS_DRIVER_TYPE(E2, TMC2208) + #if AXIS_DRIVER_TYPE_E2(TMC2208) #ifdef E2_HARDWARE_SERIAL E2_HARDWARE_SERIAL.begin(115200); #else stepperE2.beginSerial(115200); #endif #endif - #if AXIS_DRIVER_TYPE(E3, TMC2208) + #if AXIS_DRIVER_TYPE_E3(TMC2208) #ifdef E3_HARDWARE_SERIAL E3_HARDWARE_SERIAL.begin(115200); #else stepperE3.beginSerial(115200); #endif #endif - #if AXIS_DRIVER_TYPE(E4, TMC2208) + #if AXIS_DRIVER_TYPE_E4(TMC2208) #ifdef E4_HARDWARE_SERIAL E4_HARDWARE_SERIAL.begin(115200); #else stepperE4.beginSerial(115200); #endif #endif - #if AXIS_DRIVER_TYPE(E5, TMC2208) + #if AXIS_DRIVER_TYPE_E5(TMC2208) #ifdef E5_HARDWARE_SERIAL E5_HARDWARE_SERIAL.begin(115200); #else @@ -440,48 +548,45 @@ } template - void tmc_init(TMCMarlin &st, const uint16_t mA, const uint16_t microsteps, const uint32_t thrs, const float spmm) { - #if DISABLED(STEALTHCHOP) || DISABLED(HYBRID_THRESHOLD) - UNUSED(thrs); - UNUSED(spmm); - #endif - + void tmc_init(TMCMarlin &st, const uint16_t mA, const uint16_t microsteps, const uint32_t thrs, const float spmm, const bool stealth) { TMC2208_n::GCONF_t gconf{0}; gconf.pdn_disable = true; // Use UART gconf.mstep_reg_select = true; // Select microsteps with UART gconf.i_scale_analog = false; + gconf.en_spreadcycle = !stealth; + st.GCONF(gconf.sr); + st.stored.stealthChop_enabled = stealth; TMC2208_n::CHOPCONF_t chopconf{0}; chopconf.tbl = 0b01; // blank_time = 24 - chopconf.toff = 5; + chopconf.toff = chopper_timing.toff; chopconf.intpol = INTERPOLATE; - chopconf.hstrt = 2; - chopconf.hend = 5; + chopconf.hend = chopper_timing.hend + 3; + chopconf.hstrt = chopper_timing.hstrt - 1; st.CHOPCONF(chopconf.sr); st.rms_current(mA, HOLD_MULTIPLIER); st.microsteps(microsteps); st.iholddelay(10); st.TPOWERDOWN(128); // ~2s until driver lowers to hold current - #if ENABLED(STEALTHCHOP) - gconf.en_spreadcycle = false; - - TMC2208_n::PWMCONF_t pwmconf{0}; - pwmconf.pwm_lim = 12; - pwmconf.pwm_reg = 8; - pwmconf.pwm_autograd = true; - pwmconf.pwm_autoscale = true; - pwmconf.pwm_freq = 0b01; - pwmconf.pwm_grad = 14; - pwmconf.pwm_ofs = 36; - st.PWMCONF(pwmconf.sr); - #if ENABLED(HYBRID_THRESHOLD) - st.TPWMTHRS(12650000UL*microsteps/(256*thrs*spmm)); - #endif + + TMC2208_n::PWMCONF_t pwmconf{0}; + pwmconf.pwm_lim = 12; + pwmconf.pwm_reg = 8; + pwmconf.pwm_autograd = true; + pwmconf.pwm_autoscale = true; + pwmconf.pwm_freq = 0b01; + pwmconf.pwm_grad = 14; + pwmconf.pwm_ofs = 36; + st.PWMCONF(pwmconf.sr); + + #if ENABLED(HYBRID_THRESHOLD) + st.TPWMTHRS(12650000UL*microsteps/(256*thrs*spmm)); #else - gconf.en_spreadcycle = true; + UNUSED(thrs); + UNUSED(spmm); #endif - st.GCONF(gconf.sr); + st.GSTAT(0b111); // Clear delay(200); } @@ -497,64 +602,270 @@ #include "../core/enum.h" #if ENABLED(TMC_USE_SW_SPI) - #define _TMC2660_DEFINE(ST, L) TMCMarlin stepper##ST(ST##_CS_PIN, R_SENSE, TMC_SW_MOSI, TMC_SW_MISO, TMC_SW_SCK) + #define _TMC2660_DEFINE(ST, L) TMCMarlin stepper##ST(ST##_CS_PIN, ST##_RSENSE, TMC_SW_MOSI, TMC_SW_MISO, TMC_SW_SCK) #define TMC2660_DEFINE(ST) _TMC2660_DEFINE(ST, TMC_##ST##_LABEL) #else - #define _TMC2660_DEFINE(ST, L) TMCMarlin stepper##ST(ST##_CS_PIN, R_SENSE) + #define _TMC2660_DEFINE(ST, L) TMCMarlin stepper##ST(ST##_CS_PIN, ST##_RSENSE) #define TMC2660_DEFINE(ST) _TMC2660_DEFINE(ST, TMC_##ST##_LABEL) #endif // Stepper objects of TMC2660 steppers used - #if AXIS_DRIVER_TYPE(X, TMC2660) + #if AXIS_DRIVER_TYPE_X(TMC2660) TMC2660_DEFINE(X); #endif - #if AXIS_DRIVER_TYPE(X2, TMC2660) + #if AXIS_DRIVER_TYPE_X2(TMC2660) TMC2660_DEFINE(X2); #endif - #if AXIS_DRIVER_TYPE(Y, TMC2660) + #if AXIS_DRIVER_TYPE_Y(TMC2660) TMC2660_DEFINE(Y); #endif - #if AXIS_DRIVER_TYPE(Y2, TMC2660) + #if AXIS_DRIVER_TYPE_Y2(TMC2660) TMC2660_DEFINE(Y2); #endif - #if AXIS_DRIVER_TYPE(Z, TMC2660) + #if AXIS_DRIVER_TYPE_Z(TMC2660) TMC2660_DEFINE(Z); #endif - #if AXIS_DRIVER_TYPE(Z2, TMC2660) + #if AXIS_DRIVER_TYPE_Z2(TMC2660) TMC2660_DEFINE(Z2); #endif - #if AXIS_DRIVER_TYPE(E0, TMC2660) + #if AXIS_DRIVER_TYPE_E0(TMC2660) TMC2660_DEFINE(E0); #endif - #if AXIS_DRIVER_TYPE(E1, TMC2660) + #if AXIS_DRIVER_TYPE_E1(TMC2660) TMC2660_DEFINE(E1); #endif - #if AXIS_DRIVER_TYPE(E2, TMC2660) + #if AXIS_DRIVER_TYPE_E2(TMC2660) TMC2660_DEFINE(E2); #endif - #if AXIS_DRIVER_TYPE(E3, TMC2660) + #if AXIS_DRIVER_TYPE_E3(TMC2660) TMC2660_DEFINE(E3); #endif - #if AXIS_DRIVER_TYPE(E4, TMC2660) + #if AXIS_DRIVER_TYPE_E4(TMC2660) TMC2660_DEFINE(E4); #endif - #if AXIS_DRIVER_TYPE(E5, TMC2660) + #if AXIS_DRIVER_TYPE_E5(TMC2660) TMC2660_DEFINE(E5); #endif template - void tmc_init(TMCMarlin &st, const uint16_t mA, const uint16_t microsteps, const uint32_t, const float) { + void tmc_init(TMCMarlin &st, const uint16_t mA, const uint16_t microsteps, const uint32_t, const float, const bool) { st.begin(); + + TMC2660_n::CHOPCONF_t chopconf{0}; + chopconf.tbl = 1; + chopconf.toff = chopper_timing.toff; + chopconf.hend = chopper_timing.hend + 3; + chopconf.hstrt = chopper_timing.hstrt - 1; + st.CHOPCONF(chopconf.sr); + st.rms_current(mA); st.microsteps(microsteps); - st.blank_time(24); - st.toff(5); // Only enables the driver if used with stealthChop st.intpol(INTERPOLATE); - //st.hysteresis_start(3); - //st.hysteresis_end(2); + st.diss2g(true); // Disable short to ground protection. Too many false readings? + + #if ENABLED(TMC_DEBUG) + st.rdsel(0b01); + #endif } #endif // TMC2660 +// +// TMC5130 Driver objects and inits +// +#if HAS_DRIVER(TMC5130) + + #include + #include "planner.h" + #include "../core/enum.h" + + #if ENABLED(TMC_USE_SW_SPI) + #define _TMC5130_DEFINE(ST, L) TMCMarlin stepper##ST(ST##_CS_PIN, ST##_RSENSE, TMC_SW_MOSI, TMC_SW_MISO, TMC_SW_SCK) + #define TMC5130_DEFINE(ST) _TMC5130_DEFINE(ST, TMC_##ST##_LABEL) + #else + #define _TMC5130_DEFINE(ST, L) TMCMarlin stepper##ST(ST##_CS_PIN, ST##_RSENSE) + #define TMC5130_DEFINE(ST) _TMC5130_DEFINE(ST, TMC_##ST##_LABEL) + #endif + // Stepper objects of TMC5130 steppers used + #if AXIS_DRIVER_TYPE_X(TMC5130) + TMC5130_DEFINE(X); + #endif + #if AXIS_DRIVER_TYPE_X2(TMC5130) + TMC5130_DEFINE(X2); + #endif + #if AXIS_DRIVER_TYPE_Y(TMC5130) + TMC5130_DEFINE(Y); + #endif + #if AXIS_DRIVER_TYPE_Y2(TMC5130) + TMC5130_DEFINE(Y2); + #endif + #if AXIS_DRIVER_TYPE_Z(TMC5130) + TMC5130_DEFINE(Z); + #endif + #if AXIS_DRIVER_TYPE_Z2(TMC5130) + TMC5130_DEFINE(Z2); + #endif + #if AXIS_DRIVER_TYPE_Z3(TMC5130) + TMC5130_DEFINE(Z3); + #endif + #if AXIS_DRIVER_TYPE_E0(TMC5130) + TMC5130_DEFINE(E0); + #endif + #if AXIS_DRIVER_TYPE_E1(TMC5130) + TMC5130_DEFINE(E1); + #endif + #if AXIS_DRIVER_TYPE_E2(TMC5130) + TMC5130_DEFINE(E2); + #endif + #if AXIS_DRIVER_TYPE_E3(TMC5130) + TMC5130_DEFINE(E3); + #endif + #if AXIS_DRIVER_TYPE_E4(TMC5130) + TMC5130_DEFINE(E4); + #endif + #if AXIS_DRIVER_TYPE_E5(TMC5130) + TMC5130_DEFINE(E5); + #endif + + template + void tmc_init(TMCMarlin &st, const uint16_t mA, const uint16_t microsteps, const uint32_t thrs, const float spmm, const bool stealth) { + st.begin(); + + CHOPCONF_t chopconf{0}; + chopconf.tbl = 1; + chopconf.toff = chopper_timing.toff; + chopconf.intpol = INTERPOLATE; + chopconf.hend = chopper_timing.hend + 3; + chopconf.hstrt = chopper_timing.hstrt - 1; + st.CHOPCONF(chopconf.sr); + + st.rms_current(mA, HOLD_MULTIPLIER); + st.microsteps(microsteps); + st.iholddelay(10); + st.TPOWERDOWN(128); // ~2s until driver lowers to hold current + + st.en_pwm_mode(stealth); + st.stored.stealthChop_enabled = stealth; + + PWMCONF_t pwmconf{0}; + pwmconf.pwm_freq = 0b01; // f_pwm = 2/683 f_clk + pwmconf.pwm_autoscale = true; + pwmconf.pwm_grad = 5; + pwmconf.pwm_ampl = 180; + st.PWMCONF(pwmconf.sr); + + #if ENABLED(HYBRID_THRESHOLD) + st.TPWMTHRS(12650000UL*microsteps/(256*thrs*spmm)); + #else + UNUSED(thrs); + UNUSED(spmm); + #endif + + st.GSTAT(); // Clear GSTAT + } +#endif // TMC5130 + +// +// TMC5160 Driver objects and inits +// +#if HAS_DRIVER(TMC5160) + + #include + #include "planner.h" + #include "../core/enum.h" + + #if ENABLED(TMC_USE_SW_SPI) + #define _TMC5160_DEFINE(ST, L) TMCMarlin stepper##ST(ST##_CS_PIN, ST##_RSENSE, TMC_SW_MOSI, TMC_SW_MISO, TMC_SW_SCK) + #define TMC5160_DEFINE(ST) _TMC5160_DEFINE(ST, TMC_##ST##_LABEL) + #else + #define _TMC5160_DEFINE(ST, L) TMCMarlin stepper##ST(ST##_CS_PIN, ST##_RSENSE) + #define TMC5160_DEFINE(ST) _TMC5160_DEFINE(ST, TMC_##ST##_LABEL) + #endif + // Stepper objects of TMC5160 steppers used + #if AXIS_DRIVER_TYPE(X, TMC5160) + TMC5160_DEFINE(X); + #endif + #if AXIS_DRIVER_TYPE(X2, TMC5160) + TMC5160_DEFINE(X2); + #endif + #if AXIS_DRIVER_TYPE(Y, TMC5160) + TMC5160_DEFINE(Y); + #endif + #if AXIS_DRIVER_TYPE(Y2, TMC5160) + TMC5160_DEFINE(Y2); + #endif + #if AXIS_DRIVER_TYPE(Z, TMC5160) + TMC5160_DEFINE(Z); + #endif + #if AXIS_DRIVER_TYPE(Z2, TMC5160) + TMC5160_DEFINE(Z2); + #endif + #if AXIS_DRIVER_TYPE(Z3, TMC5160) + TMC5160_DEFINE(Z3); + #endif + #if AXIS_DRIVER_TYPE(E0, TMC5160) + TMC5160_DEFINE(E0); + #endif + #if AXIS_DRIVER_TYPE(E1, TMC5160) + TMC5160_DEFINE(E1); + #endif + #if AXIS_DRIVER_TYPE(E2, TMC5160) + TMC5160_DEFINE(E2); + #endif + #if AXIS_DRIVER_TYPE(E3, TMC5160) + TMC5160_DEFINE(E3); + #endif + #if AXIS_DRIVER_TYPE(E4, TMC5160) + TMC5160_DEFINE(E4); + #endif + #if AXIS_DRIVER_TYPE(E5, TMC5160) + TMC5160_DEFINE(E5); + #endif + + template + void tmc_init(TMCMarlin &st, const uint16_t mA, const uint16_t microsteps, const uint32_t thrs, const float spmm, const bool stealth) { + st.begin(); + + int8_t timings[] = CHOPPER_TIMING; // Default 4, -2, 1 + + CHOPCONF_t chopconf{0}; + chopconf.tbl = 1; + chopconf.toff = timings[0]; + chopconf.intpol = INTERPOLATE; + chopconf.hend = timings[1] + 3; + chopconf.hstrt = timings[2] - 1; + st.CHOPCONF(chopconf.sr); + + st.rms_current(mA, HOLD_MULTIPLIER); + st.microsteps(microsteps); + st.iholddelay(10); + st.TPOWERDOWN(128); // ~2s until driver lowers to hold current + + #if ENABLED(ADAPTIVE_CURRENT) + COOLCONF_t coolconf{0}; + coolconf.semin = INCREASE_CURRENT_THRS; + coolconf.semax = REDUCE_CURRENT_THRS; + st.COOLCONF(coolconf.sr); + #endif + + st.en_pwm_mode(stealth); + + PWMCONF_t pwmconf{0}; + pwmconf.pwm_freq = 0b01; // f_pwm = 2/683 f_clk + pwmconf.pwm_autoscale = true; + pwmconf.pwm_grad = 5; + pwmconf.pwm_ampl = 180; + st.PWMCONF(pwmconf.sr); + + #if ENABLED(HYBRID_THRESHOLD) + st.TPWMTHRS(12650000UL*microsteps/(256*thrs*spmm)); + #else + UNUSED(thrs); + UNUSED(spmm); + #endif + st.GSTAT(); // Clear GSTAT + } +#endif // TMC5160 + void restore_stepper_drivers() { #if AXIS_IS_TMC(X) stepperX.push(); @@ -598,51 +909,75 @@ void restore_stepper_drivers() { } void reset_stepper_drivers() { + #if HAS_DRIVER(TMC26X) tmc26x_init_to_defaults(); #endif - #if ENABLED(HAVE_L6470DRIVER) - L6470_init_to_defaults(); + + #if HAS_DRIVER(L6470) + L6470.init_to_defaults(); + #endif + + #if HAS_TRINAMIC + static constexpr bool stealthchop_by_axis[] = { + #if ENABLED(STEALTHCHOP_XY) + true + #else + false + #endif + , + #if ENABLED(STEALTHCHOP_Z) + true + #else + false + #endif + , + #if ENABLED(STEALTHCHOP_E) + true + #else + false + #endif + }; #endif #if AXIS_IS_TMC(X) - _TMC_INIT(X, planner.settings.axis_steps_per_mm[X_AXIS]); + _TMC_INIT(X, X_AXIS, STEALTH_AXIS_XY); #endif #if AXIS_IS_TMC(X2) - _TMC_INIT(X2, planner.settings.axis_steps_per_mm[X_AXIS]); + _TMC_INIT(X2, X_AXIS, STEALTH_AXIS_XY); #endif #if AXIS_IS_TMC(Y) - _TMC_INIT(Y, planner.settings.axis_steps_per_mm[Y_AXIS]); + _TMC_INIT(Y, Y_AXIS, STEALTH_AXIS_XY); #endif #if AXIS_IS_TMC(Y2) - _TMC_INIT(Y2, planner.settings.axis_steps_per_mm[Y_AXIS]); + _TMC_INIT(Y2, Y_AXIS, STEALTH_AXIS_XY); #endif #if AXIS_IS_TMC(Z) - _TMC_INIT(Z, planner.settings.axis_steps_per_mm[Z_AXIS]); + _TMC_INIT(Z, Z_AXIS, STEALTH_AXIS_Z); #endif #if AXIS_IS_TMC(Z2) - _TMC_INIT(Z2, planner.settings.axis_steps_per_mm[Z_AXIS]); + _TMC_INIT(Z2, Z_AXIS, STEALTH_AXIS_Z); #endif #if AXIS_IS_TMC(Z3) - _TMC_INIT(Z3, planner.settings.axis_steps_per_mm[Z_AXIS]); + _TMC_INIT(Z3, Z_AXIS, STEALTH_AXIS_Z); #endif #if AXIS_IS_TMC(E0) - _TMC_INIT(E0, planner.settings.axis_steps_per_mm[E_AXIS_N(0)]); + _TMC_INIT(E0, E_AXIS, STEALTH_AXIS_E); #endif #if AXIS_IS_TMC(E1) - _TMC_INIT(E1, planner.settings.axis_steps_per_mm[E_AXIS_N(1)]); + _TMC_INIT(E1, E_AXIS_N(1), STEALTH_AXIS_E); #endif #if AXIS_IS_TMC(E2) - _TMC_INIT(E2, planner.settings.axis_steps_per_mm[E_AXIS_N(2)]); + _TMC_INIT(E2, E_AXIS_N(2), STEALTH_AXIS_E); #endif #if AXIS_IS_TMC(E3) - _TMC_INIT(E3, planner.settings.axis_steps_per_mm[E_AXIS_N(3)]); + _TMC_INIT(E3, E_AXIS_N(3), STEALTH_AXIS_E); #endif #if AXIS_IS_TMC(E4) - _TMC_INIT(E4, planner.settings.axis_steps_per_mm[E_AXIS_N(4)]); + _TMC_INIT(E4, E_AXIS_N(4), STEALTH_AXIS_E); #endif #if AXIS_IS_TMC(E5) - _TMC_INIT(E5, planner.settings.axis_steps_per_mm[E_AXIS_N(5)]); + _TMC_INIT(E5, E_AXIS_N(5), STEALTH_AXIS_E); #endif #if USE_SENSORLESS @@ -679,7 +1014,9 @@ void reset_stepper_drivers() { TMC_ADV() #endif - stepper.set_directions(); + #if HAS_TRINAMIC + stepper.set_directions(); + #endif } // @@ -687,99 +1024,114 @@ void reset_stepper_drivers() { // #if HAS_DRIVER(L6470) - #include - #include + // create stepper objects - #define _L6470_DEFINE(ST) L6470 stepper##ST(ST##_ENABLE_PIN) + #define _L6470_DEFINE(ST) L6470 stepper##ST((const int)L6470_CHAIN_SS_PIN) // L6470 Stepper objects - #if AXIS_DRIVER_TYPE(X, L6470) + #if AXIS_DRIVER_TYPE_X(L6470) _L6470_DEFINE(X); #endif - #if AXIS_DRIVER_TYPE(X2, L6470) + #if AXIS_DRIVER_TYPE_X2(L6470) _L6470_DEFINE(X2); #endif - #if AXIS_DRIVER_TYPE(Y, L6470) + #if AXIS_DRIVER_TYPE_Y(L6470) _L6470_DEFINE(Y); #endif - #if AXIS_DRIVER_TYPE(Y2, L6470) + #if AXIS_DRIVER_TYPE_Y2(L6470) _L6470_DEFINE(Y2); #endif - #if AXIS_DRIVER_TYPE(Z, L6470) + #if AXIS_DRIVER_TYPE_Z(L6470) _L6470_DEFINE(Z); #endif - #if AXIS_DRIVER_TYPE(Z2, L6470) + #if AXIS_DRIVER_TYPE_Z2(L6470) _L6470_DEFINE(Z2); #endif - #if AXIS_DRIVER_TYPE(Z3, L6470) + #if AXIS_DRIVER_TYPE_Z3(L6470) _L6470_DEFINE(Z3); #endif - #if AXIS_DRIVER_TYPE(E0, L6470) + #if AXIS_DRIVER_TYPE_E0(L6470) _L6470_DEFINE(E0); #endif - #if AXIS_DRIVER_TYPE(E1, L6470) + #if AXIS_DRIVER_TYPE_E1(L6470) _L6470_DEFINE(E1); #endif - #if AXIS_DRIVER_TYPE(E2, L6470) + #if AXIS_DRIVER_TYPE_E2(L6470) _L6470_DEFINE(E2); #endif - #if AXIS_DRIVER_TYPE(E3, L6470) + #if AXIS_DRIVER_TYPE_E3(L6470) _L6470_DEFINE(E3); #endif - #if AXIS_DRIVER_TYPE(E4, L6470) + #if AXIS_DRIVER_TYPE_E4(L6470) _L6470_DEFINE(E4); #endif - #if AXIS_DRIVER_TYPE(E5, L6470) + #if AXIS_DRIVER_TYPE_E5(L6470) _L6470_DEFINE(E5); #endif - #define _L6470_INIT(A) do{ \ - stepper##A.init(); \ - stepper##A.softFree(); \ - stepper##A.setMicroSteps(A##_MICROSTEPS); \ - stepper##A.setOverCurrent(A##_OVERCURRENT); \ - stepper##A.setStallCurrent(A##_STALLCURRENT); \ + // not using L6470 library's init command because it + // briefly sends power to the steppers + + #define _L6470_INIT_CHIP(Q) do{ \ + stepper##Q.resetDev(); \ + stepper##Q.softFree(); \ + stepper##Q.SetParam(L6470_CONFIG, CONFIG_PWM_DIV_1 \ + | CONFIG_PWM_MUL_2 \ + | CONFIG_SR_290V_us \ + | CONFIG_OC_SD_DISABLE \ + | CONFIG_VS_COMP_DISABLE \ + | CONFIG_SW_HARD_STOP \ + | CONFIG_INT_16MHZ); \ + stepper##Q.SetParam(L6470_KVAL_RUN, 0xFF); \ + stepper##Q.SetParam(L6470_KVAL_ACC, 0xFF); \ + stepper##Q.SetParam(L6470_KVAL_DEC, 0xFF); \ + stepper##Q.setMicroSteps(Q##_MICROSTEPS); \ + stepper##Q.setOverCurrent(Q##_OVERCURRENT); \ + stepper##Q.setStallCurrent(Q##_STALLCURRENT); \ + stepper##Q.SetParam(L6470_KVAL_HOLD, Q##_MAX_VOLTAGE); \ + stepper##Q.SetParam(L6470_ABS_POS, 0); \ + stepper##Q.getStatus(); \ }while(0) - void L6470_init_to_defaults() { - #if AXIS_DRIVER_TYPE(X, L6470) - _L6470_INIT(X); + void L6470_Marlin::init_to_defaults() { + #if AXIS_DRIVER_TYPE_X(L6470) + _L6470_INIT_CHIP(X); #endif - #if AXIS_DRIVER_TYPE(X2, L6470) - _L6470_INIT(X2); + #if AXIS_DRIVER_TYPE_X2(L6470) + _L6470_INIT_CHIP(X2); #endif - #if AXIS_DRIVER_TYPE(Y, L6470) - _L6470_INIT(Y); + #if AXIS_DRIVER_TYPE_Y(L6470) + _L6470_INIT_CHIP(Y); #endif - #if AXIS_DRIVER_TYPE(Y2, L6470) - _L6470_INIT(Y2); + #if AXIS_DRIVER_TYPE_Y2(L6470) + _L6470_INIT_CHIP(Y2); #endif - #if AXIS_DRIVER_TYPE(Z, L6470) - _L6470_INIT(Z); + #if AXIS_DRIVER_TYPE_Z(L6470) + _L6470_INIT_CHIP(Z); #endif - #if AXIS_DRIVER_TYPE(Z2, L6470) - _L6470_INIT(Z2); + #if AXIS_DRIVER_TYPE_Z2(L6470) + _L6470_INIT_CHIP(Z2); #endif - #if AXIS_DRIVER_TYPE(Z3, L6470) - _L6470_INIT(Z3); + #if AXIS_DRIVER_TYPE_Z3(L6470) + _L6470_INIT_CHIP(Z3); #endif - #if AXIS_DRIVER_TYPE(E0, L6470) - _L6470_INIT(E0); + #if AXIS_DRIVER_TYPE_E0(L6470) + _L6470_INIT_CHIP(E0); #endif - #if AXIS_DRIVER_TYPE(E1, L6470) - _L6470_INIT(E1); + #if AXIS_DRIVER_TYPE_E1(L6470) + _L6470_INIT_CHIP(E1); #endif - #if AXIS_DRIVER_TYPE(E2, L6470) - _L6470_INIT(E2); + #if AXIS_DRIVER_TYPE_E2(L6470) + _L6470_INIT_CHIP(E2); #endif - #if AXIS_DRIVER_TYPE(E3, L6470) - _L6470_INIT(E3); + #if AXIS_DRIVER_TYPE_E3(L6470) + _L6470_INIT_CHIP(E3); #endif - #if AXIS_DRIVER_TYPE(E4, L6470) - _L6470_INIT(E4); + #if AXIS_DRIVER_TYPE_E4(L6470) + _L6470_INIT_CHIP(E4); #endif - #if AXIS_DRIVER_TYPE(E5, L6470) - _L6470_INIT(E5); + #if AXIS_DRIVER_TYPE_E5(L6470) + _L6470_INIT_CHIP(E5); #endif } diff --git a/Marlin/src/module/stepper_indirection.h b/Marlin/src/module/stepper_indirection.h index 1b0e6c883d52..39d4fceacbf9 100644 --- a/Marlin/src/module/stepper_indirection.h +++ b/Marlin/src/module/stepper_indirection.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -62,10 +62,20 @@ #error "Update TMCStepper library to 0.2.2 or newer." #endif - #define __TMC_CLASS(MODEL, A, I) TMCMarlin + #define ____TMC_CLASS(MODEL, A, I) TMCMarlin + #define ___TMC_CLASS(MODEL, A, I) ____TMC_CLASS(MODEL, A, I) + #define __TMC_CLASS(MODEL, A, I) ___TMC_CLASS(_##MODEL, A, I) #define _TMC_CLASS(MODEL, L) __TMC_CLASS(MODEL, L) #define TMC_CLASS(ST) _TMC_CLASS(ST##_DRIVER_TYPE, TMC_##ST##_LABEL) + typedef struct { + uint8_t toff; + int8_t hend; + uint8_t hstrt; + } chopper_timing_t; + + static constexpr chopper_timing_t chopper_timing = CHOPPER_TIMING; + #if HAS_DRIVER(TMC2208) void tmc2208_serial_begin(); #endif @@ -73,35 +83,34 @@ // L6470 has STEP on normal pins, but DIR/ENABLE via SPI #if HAS_DRIVER(L6470) - #include - #include - void L6470_init_to_defaults(); + #include "L6470/L6470_Marlin.h" + #define L6470_WRITE_DIR_COMMAND(STATE,Q) do{ L6470_dir_commands[Q] = (STATE ? dSPIN_STEP_CLOCK_REV : dSPIN_STEP_CLOCK_FWD); }while(0) #endif void restore_stepper_drivers(); // Called by PSU_ON void reset_stepper_drivers(); // Called by settings.load / settings.reset // X Stepper -#if AXIS_DRIVER_TYPE(X, L6470) +#if AXIS_DRIVER_TYPE_X(L6470) extern L6470 stepperX; #define X_ENABLE_INIT NOOP - #define X_ENABLE_WRITE(STATE) do{ if (STATE) stepperX.Step_Clock(stepperX.getStatus() & STATUS_HIZ); else stepperX.softFree(); }while(0) + #define X_ENABLE_WRITE(STATE) NOOP #define X_ENABLE_READ (stepperX.getStatus() & STATUS_HIZ) #define X_DIR_INIT NOOP - #define X_DIR_WRITE(STATE) stepperX.Step_Clock(STATE) + #define X_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,X) #define X_DIR_READ (stepperX.getStatus() & STATUS_DIR) #else #if AXIS_IS_TMC(X) extern TMC_CLASS(X) stepperX; #endif - #if AXIS_DRIVER_TYPE(X, TMC26X) + #if AXIS_DRIVER_TYPE_X(TMC26X) extern TMC26XStepper stepperX; #define X_ENABLE_INIT NOOP #define X_ENABLE_WRITE(STATE) stepperX.setEnabled(STATE) #define X_ENABLE_READ stepperX.isEnabled() - #elif AXIS_DRIVER_TYPE(X, TMC2660) + #elif ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(X) #define X_ENABLE_INIT NOOP - #define X_ENABLE_WRITE(STATE) stepperX.toff((STATE)==X_ENABLE_ON ? stepperX.savedToff() : 0) + #define X_ENABLE_WRITE(STATE) stepperX.toff((STATE)==X_ENABLE_ON ? chopper_timing.toff : 0) #define X_ENABLE_READ stepperX.isEnabled() #else #define X_ENABLE_INIT SET_OUTPUT(X_ENABLE_PIN) @@ -117,26 +126,26 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #define X_STEP_READ READ(X_STEP_PIN) // Y Stepper -#if AXIS_DRIVER_TYPE(Y, L6470) +#if AXIS_DRIVER_TYPE_Y(L6470) extern L6470 stepperY; #define Y_ENABLE_INIT NOOP - #define Y_ENABLE_WRITE(STATE) do{ if (STATE) stepperY.Step_Clock(stepperY.getStatus() & STATUS_HIZ); else stepperY.softFree(); }while(0) + #define Y_ENABLE_WRITE(STATE) NOOP #define Y_ENABLE_READ (stepperY.getStatus() & STATUS_HIZ) #define Y_DIR_INIT NOOP - #define Y_DIR_WRITE(STATE) stepperY.Step_Clock(STATE) + #define Y_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,Y) #define Y_DIR_READ (stepperY.getStatus() & STATUS_DIR) #else #if AXIS_IS_TMC(Y) extern TMC_CLASS(Y) stepperY; #endif - #if AXIS_DRIVER_TYPE(Y, TMC26X) + #if AXIS_DRIVER_TYPE_Y(TMC26X) extern TMC26XStepper stepperY; #define Y_ENABLE_INIT NOOP #define Y_ENABLE_WRITE(STATE) stepperY.setEnabled(STATE) #define Y_ENABLE_READ stepperY.isEnabled() - #elif AXIS_DRIVER_TYPE(Y, TMC2660) + #elif ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Y) #define Y_ENABLE_INIT NOOP - #define Y_ENABLE_WRITE(STATE) stepperY.toff((STATE)==Y_ENABLE_ON ? stepperY.savedToff() : 0) + #define Y_ENABLE_WRITE(STATE) stepperY.toff((STATE)==Y_ENABLE_ON ? chopper_timing.toff : 0) #define Y_ENABLE_READ stepperY.isEnabled() #else #define Y_ENABLE_INIT SET_OUTPUT(Y_ENABLE_PIN) @@ -152,26 +161,26 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #define Y_STEP_READ READ(Y_STEP_PIN) // Z Stepper -#if AXIS_DRIVER_TYPE(Z, L6470) +#if AXIS_DRIVER_TYPE_Z(L6470) extern L6470 stepperZ; #define Z_ENABLE_INIT NOOP - #define Z_ENABLE_WRITE(STATE) do{ if (STATE) stepperZ.Step_Clock(stepperZ.getStatus() & STATUS_HIZ); else stepperZ.softFree(); }while(0) + #define Z_ENABLE_WRITE(STATE) NOOP #define Z_ENABLE_READ (stepperZ.getStatus() & STATUS_HIZ) #define Z_DIR_INIT NOOP - #define Z_DIR_WRITE(STATE) stepperZ.Step_Clock(STATE) + #define Z_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,Z) #define Z_DIR_READ (stepperZ.getStatus() & STATUS_DIR) #else #if AXIS_IS_TMC(Z) extern TMC_CLASS(Z) stepperZ; #endif - #if AXIS_DRIVER_TYPE(Z, TMC26X) + #if AXIS_DRIVER_TYPE_Z(TMC26X) extern TMC26XStepper stepperZ; #define Z_ENABLE_INIT NOOP #define Z_ENABLE_WRITE(STATE) stepperZ.setEnabled(STATE) #define Z_ENABLE_READ stepperZ.isEnabled() - #elif AXIS_DRIVER_TYPE(Z, TMC2660) + #elif ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z) #define Z_ENABLE_INIT NOOP - #define Z_ENABLE_WRITE(STATE) stepperZ.toff((STATE)==Z_ENABLE_ON ? stepperZ.savedToff() : 0) + #define Z_ENABLE_WRITE(STATE) stepperZ.toff((STATE)==Z_ENABLE_ON ? chopper_timing.toff : 0) #define Z_ENABLE_READ stepperZ.isEnabled() #else #define Z_ENABLE_INIT SET_OUTPUT(Z_ENABLE_PIN) @@ -188,26 +197,26 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset // X2 Stepper #if HAS_X2_ENABLE - #if AXIS_DRIVER_TYPE(X2, L6470) + #if AXIS_DRIVER_TYPE_X2(L6470) extern L6470 stepperX2; #define X2_ENABLE_INIT NOOP - #define X2_ENABLE_WRITE(STATE) do{ if (STATE) stepperX2.Step_Clock(stepperX2.getStatus() & STATUS_HIZ); else stepperX2.softFree(); }while(0) + #define X2_ENABLE_WRITE(STATE) NOOP #define X2_ENABLE_READ (stepperX2.getStatus() & STATUS_HIZ) #define X2_DIR_INIT NOOP - #define X2_DIR_WRITE(STATE) stepperX2.Step_Clock(STATE) + #define X2_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,X2) #define X2_DIR_READ (stepperX2.getStatus() & STATUS_DIR) #else #if AXIS_IS_TMC(X2) extern TMC_CLASS(X2) stepperX2; #endif - #if AXIS_DRIVER_TYPE(X2, TMC26X) + #if AXIS_DRIVER_TYPE_X2(TMC26X) extern TMC26XStepper stepperX2; #define X2_ENABLE_INIT NOOP #define X2_ENABLE_WRITE(STATE) stepperX2.setEnabled(STATE) #define X2_ENABLE_READ stepperX2.isEnabled() - #elif AXIS_DRIVER_TYPE(X2, TMC2660) + #elif ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(X2) #define X2_ENABLE_INIT NOOP - #define X2_ENABLE_WRITE(STATE) stepperX2.toff((STATE)==X_ENABLE_ON ? stepperX2.savedToff() : 0) + #define X2_ENABLE_WRITE(STATE) stepperX2.toff((STATE)==X_ENABLE_ON ? chopper_timing.toff : 0) #define X2_ENABLE_READ stepperX2.isEnabled() #else #define X2_ENABLE_INIT SET_OUTPUT(X2_ENABLE_PIN) @@ -225,26 +234,26 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset // Y2 Stepper #if HAS_Y2_ENABLE - #if AXIS_DRIVER_TYPE(Y2, L6470) + #if AXIS_DRIVER_TYPE_Y2(L6470) extern L6470 stepperY2; #define Y2_ENABLE_INIT NOOP - #define Y2_ENABLE_WRITE(STATE) do{ if (STATE) stepperY2.Step_Clock(stepperY2.getStatus() & STATUS_HIZ); else stepperY2.softFree(); }while(0) + #define Y2_ENABLE_WRITE(STATE) NOOP #define Y2_ENABLE_READ (stepperY2.getStatus() & STATUS_HIZ) #define Y2_DIR_INIT NOOP - #define Y2_DIR_WRITE(STATE) stepperY2.Step_Clock(STATE) + #define Y2_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,Y2) #define Y2_DIR_READ (stepperY2.getStatus() & STATUS_DIR) #else #if AXIS_IS_TMC(Y2) extern TMC_CLASS(Y2) stepperY2; #endif - #if AXIS_DRIVER_TYPE(Y2, TMC26X) + #if AXIS_DRIVER_TYPE_Y2(TMC26X) extern TMC26XStepper stepperY2; #define Y2_ENABLE_INIT NOOP #define Y2_ENABLE_WRITE(STATE) stepperY2.setEnabled(STATE) #define Y2_ENABLE_READ stepperY2.isEnabled() - #elif AXIS_DRIVER_TYPE(Y2, TMC2660) + #elif ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Y2) #define Y2_ENABLE_INIT NOOP - #define Y2_ENABLE_WRITE(STATE) stepperY2.toff((STATE)==Y_ENABLE_ON ? stepperY2.savedToff() : 0) + #define Y2_ENABLE_WRITE(STATE) stepperY2.toff((STATE)==Y_ENABLE_ON ? chopper_timing.toff : 0) #define Y2_ENABLE_READ stepperY2.isEnabled() #else #define Y2_ENABLE_INIT SET_OUTPUT(Y2_ENABLE_PIN) @@ -258,30 +267,32 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #define Y2_STEP_INIT SET_OUTPUT(Y2_STEP_PIN) #define Y2_STEP_WRITE(STATE) WRITE(Y2_STEP_PIN,STATE) #define Y2_STEP_READ READ(Y2_STEP_PIN) +#else + #define Y2_DIR_WRITE(STATE) NOOP #endif // Z2 Stepper #if HAS_Z2_ENABLE - #if AXIS_DRIVER_TYPE(Z2, L6470) + #if AXIS_DRIVER_TYPE_Z2(L6470) extern L6470 stepperZ2; #define Z2_ENABLE_INIT NOOP - #define Z2_ENABLE_WRITE(STATE) do{ if (STATE) stepperZ2.Step_Clock(stepperZ2.getStatus() & STATUS_HIZ); else stepperZ2.softFree(); }while(0) + #define Z2_ENABLE_WRITE(STATE) NOOP #define Z2_ENABLE_READ (stepperZ2.getStatus() & STATUS_HIZ) #define Z2_DIR_INIT NOOP - #define Z2_DIR_WRITE(STATE) stepperZ2.Step_Clock(STATE) + #define Z2_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,Z2) #define Z2_DIR_READ (stepperZ2.getStatus() & STATUS_DIR) #else #if AXIS_IS_TMC(Z2) extern TMC_CLASS(Z2) stepperZ2; #endif - #if AXIS_DRIVER_TYPE(Z2, TMC26X) + #if AXIS_DRIVER_TYPE_Z2(TMC26X) extern TMC26XStepper stepperZ2; #define Z2_ENABLE_INIT NOOP #define Z2_ENABLE_WRITE(STATE) stepperZ2.setEnabled(STATE) #define Z2_ENABLE_READ stepperZ2.isEnabled() - #elif AXIS_DRIVER_TYPE(Z2, TMC2660) + #elif ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z2) #define Z2_ENABLE_INIT NOOP - #define Z2_ENABLE_WRITE(STATE) stepperZ2.toff((STATE)==Z_ENABLE_ON ? stepperZ2.savedToff() : 0) + #define Z2_ENABLE_WRITE(STATE) stepperZ2.toff((STATE)==Z_ENABLE_ON ? chopper_timing.toff : 0) #define Z2_ENABLE_READ stepperZ2.isEnabled() #else #define Z2_ENABLE_INIT SET_OUTPUT(Z2_ENABLE_PIN) @@ -295,17 +306,19 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #define Z2_STEP_INIT SET_OUTPUT(Z2_STEP_PIN) #define Z2_STEP_WRITE(STATE) WRITE(Z2_STEP_PIN,STATE) #define Z2_STEP_READ READ(Z2_STEP_PIN) +#else + #define Z2_DIR_WRITE(STATE) NOOP #endif // Z3 Stepper #if HAS_Z3_ENABLE - #if ENABLED(Z3_IS_L6470) + #if AXIS_DRIVER_TYPE_Z3(L6470) extern L6470 stepperZ3; #define Z3_ENABLE_INIT NOOP - #define Z3_ENABLE_WRITE(STATE) do{ if (STATE) stepperZ3.Step_Clock(stepperZ3.getStatus() & STATUS_HIZ); else stepperZ3.softFree(); }while(0) + #define Z3_ENABLE_WRITE(STATE) NOOP #define Z3_ENABLE_READ (stepperZ3.getStatus() & STATUS_HIZ) #define Z3_DIR_INIT NOOP - #define Z3_DIR_WRITE(STATE) stepperZ3.Step_Clock(STATE) + #define Z3_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,Z3) #define Z3_DIR_READ (stepperZ3.getStatus() & STATUS_DIR) #else #if AXIS_IS_TMC(Z3) @@ -316,9 +329,9 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #define Z3_ENABLE_INIT NOOP #define Z3_ENABLE_WRITE(STATE) stepperZ3.setEnabled(STATE) #define Z3_ENABLE_READ stepperZ3.isEnabled() - #elif AXIS_DRIVER_TYPE(Z3, TMC2660) + #elif ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z3) #define Z3_ENABLE_INIT NOOP - #define Z3_ENABLE_WRITE(STATE) stepperZ3.toff((STATE)==Z_ENABLE_ON ? stepperZ3.savedToff() : 0) + #define Z3_ENABLE_WRITE(STATE) stepperZ3.toff((STATE)==Z_ENABLE_ON ? chopper_timing.toff : 0) #define Z3_ENABLE_READ stepperZ3.isEnabled() #else #define Z3_ENABLE_INIT SET_OUTPUT(Z3_ENABLE_PIN) @@ -332,29 +345,31 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #define Z3_STEP_INIT SET_OUTPUT(Z3_STEP_PIN) #define Z3_STEP_WRITE(STATE) WRITE(Z3_STEP_PIN,STATE) #define Z3_STEP_READ READ(Z3_STEP_PIN) +#else + #define Z3_DIR_WRITE(STATE) NOOP #endif // E0 Stepper -#if AXIS_DRIVER_TYPE(E0, L6470) +#if AXIS_DRIVER_TYPE_E0(L6470) extern L6470 stepperE0; #define E0_ENABLE_INIT NOOP - #define E0_ENABLE_WRITE(STATE) do{ if (STATE) stepperE0.Step_Clock(stepperE0.getStatus() & STATUS_HIZ); else stepperE0.softFree(); }while(0) + #define E0_ENABLE_WRITE(STATE) NOOP #define E0_ENABLE_READ (stepperE0.getStatus() & STATUS_HIZ) #define E0_DIR_INIT NOOP - #define E0_DIR_WRITE(STATE) stepperE0.Step_Clock(STATE) + #define E0_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,E0) #define E0_DIR_READ (stepperE0.getStatus() & STATUS_DIR) #else #if AXIS_IS_TMC(E0) extern TMC_CLASS(E0) stepperE0; #endif - #if AXIS_DRIVER_TYPE(E0, TMC26X) + #if AXIS_DRIVER_TYPE_E0(TMC26X) extern TMC26XStepper stepperE0; #define E0_ENABLE_INIT NOOP #define E0_ENABLE_WRITE(STATE) stepperE0.setEnabled(STATE) #define E0_ENABLE_READ stepperE0.isEnabled() - #elif AXIS_DRIVER_TYPE(E0, TMC2660) + #elif ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E0) #define E0_ENABLE_INIT NOOP - #define E0_ENABLE_WRITE(STATE) stepperE0.toff((STATE)==E_ENABLE_ON ? stepperE0.savedToff() : 0) + #define E0_ENABLE_WRITE(STATE) stepperE0.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0) #define E0_ENABLE_READ stepperE0.isEnabled() #else #define E0_ENABLE_INIT SET_OUTPUT(E0_ENABLE_PIN) @@ -370,26 +385,26 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #define E0_STEP_READ READ(E0_STEP_PIN) // E1 Stepper -#if AXIS_DRIVER_TYPE(E1, L6470) +#if AXIS_DRIVER_TYPE_E1(L6470) extern L6470 stepperE1; #define E1_ENABLE_INIT NOOP - #define E1_ENABLE_WRITE(STATE) do{ if (STATE) stepperE1.Step_Clock(stepperE1.getStatus() & STATUS_HIZ); else stepperE1.softFree(); }while(0) + #define E1_ENABLE_WRITE(STATE) NOOP #define E1_ENABLE_READ (stepperE1.getStatus() & STATUS_HIZ) #define E1_DIR_INIT NOOP - #define E1_DIR_WRITE(STATE) stepperE1.Step_Clock(STATE) + #define E1_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,E1) #define E1_DIR_READ (stepperE1.getStatus() & STATUS_DIR) #else #if AXIS_IS_TMC(E1) extern TMC_CLASS(E1) stepperE1; #endif - #if AXIS_DRIVER_TYPE(E1, TMC26X) + #if AXIS_DRIVER_TYPE_E1(TMC26X) extern TMC26XStepper stepperE1; #define E1_ENABLE_INIT NOOP #define E1_ENABLE_WRITE(STATE) stepperE1.setEnabled(STATE) #define E1_ENABLE_READ stepperE1.isEnabled() - #elif AXIS_DRIVER_TYPE(E1, TMC2660) + #elif ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E1) #define E1_ENABLE_INIT NOOP - #define E1_ENABLE_WRITE(STATE) stepperE1.toff((STATE)==E_ENABLE_ON ? stepperE1.savedToff() : 0) + #define E1_ENABLE_WRITE(STATE) stepperE1.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0) #define E1_ENABLE_READ stepperE1.isEnabled() #else #define E1_ENABLE_INIT SET_OUTPUT(E1_ENABLE_PIN) @@ -405,26 +420,26 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #define E1_STEP_READ READ(E1_STEP_PIN) // E2 Stepper -#if AXIS_DRIVER_TYPE(E2, L6470) +#if AXIS_DRIVER_TYPE_E2(L6470) extern L6470 stepperE2; #define E2_ENABLE_INIT NOOP - #define E2_ENABLE_WRITE(STATE) do{ if (STATE) stepperE2.Step_Clock(stepperE2.getStatus() & STATUS_HIZ); else stepperE2.softFree(); }while(0) + #define E2_ENABLE_WRITE(STATE) NOOP #define E2_ENABLE_READ (stepperE2.getStatus() & STATUS_HIZ) #define E2_DIR_INIT NOOP - #define E2_DIR_WRITE(STATE) stepperE2.Step_Clock(STATE) + #define E2_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,E2) #define E2_DIR_READ (stepperE2.getStatus() & STATUS_DIR) #else #if AXIS_IS_TMC(E2) extern TMC_CLASS(E2) stepperE2; #endif - #if AXIS_DRIVER_TYPE(E2, TMC26X) + #if AXIS_DRIVER_TYPE_E2(TMC26X) extern TMC26XStepper stepperE2; #define E2_ENABLE_INIT NOOP #define E2_ENABLE_WRITE(STATE) stepperE2.setEnabled(STATE) #define E2_ENABLE_READ stepperE2.isEnabled() - #elif AXIS_DRIVER_TYPE(E2, TMC2660) + #elif ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E2) #define E2_ENABLE_INIT NOOP - #define E2_ENABLE_WRITE(STATE) stepperE2.toff((STATE)==E_ENABLE_ON ? stepperE2.savedToff() : 0) + #define E2_ENABLE_WRITE(STATE) stepperE2.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0) #define E2_ENABLE_READ stepperE2.isEnabled() #else #define E2_ENABLE_INIT SET_OUTPUT(E2_ENABLE_PIN) @@ -440,26 +455,26 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #define E2_STEP_READ READ(E2_STEP_PIN) // E3 Stepper -#if AXIS_DRIVER_TYPE(E3, L6470) +#if AXIS_DRIVER_TYPE_E3(L6470) extern L6470 stepperE3; #define E3_ENABLE_INIT NOOP - #define E3_ENABLE_WRITE(STATE) do{ if (STATE) stepperE3.Step_Clock(stepperE3.getStatus() & STATUS_HIZ); else stepperE3.softFree(); }while(0) + #define E3_ENABLE_WRITE(STATE) NOOP #define E3_ENABLE_READ (stepperE3.getStatus() & STATUS_HIZ) #define E3_DIR_INIT NOOP - #define E3_DIR_WRITE(STATE) stepperE3.Step_Clock(STATE) + #define E3_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,E3) #define E3_DIR_READ (stepperE3.getStatus() & STATUS_DIR) #else #if AXIS_IS_TMC(E3) extern TMC_CLASS(E3) stepperE3; #endif - #if AXIS_DRIVER_TYPE(E3, TMC26X) + #if AXIS_DRIVER_TYPE_E3(TMC26X) extern TMC26XStepper stepperE3; #define E3_ENABLE_INIT NOOP #define E3_ENABLE_WRITE(STATE) stepperE3.setEnabled(STATE) #define E3_ENABLE_READ stepperE3.isEnabled() - #elif AXIS_DRIVER_TYPE(E3, TMC2660) + #elif ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E3) #define E3_ENABLE_INIT NOOP - #define E3_ENABLE_WRITE(STATE) stepperE3.toff((STATE)==E_ENABLE_ON ? stepperE3.savedToff() : 0) + #define E3_ENABLE_WRITE(STATE) stepperE3.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0) #define E3_ENABLE_READ stepperE3.isEnabled() #else #define E3_ENABLE_INIT SET_OUTPUT(E3_ENABLE_PIN) @@ -475,26 +490,26 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #define E3_STEP_READ READ(E3_STEP_PIN) // E4 Stepper -#if AXIS_DRIVER_TYPE(E4, L6470) +#if AXIS_DRIVER_TYPE_E4(L6470) extern L6470 stepperE4; #define E4_ENABLE_INIT NOOP - #define E4_ENABLE_WRITE(STATE) do{ if (STATE) stepperE4.Step_Clock(stepperE4.getStatus() & STATUS_HIZ); else stepperE4.softFree(); }while(0) + #define E4_ENABLE_WRITE(STATE) NOOP #define E4_ENABLE_READ (stepperE4.getStatus() & STATUS_HIZ) #define E4_DIR_INIT NOOP - #define E4_DIR_WRITE(STATE) stepperE4.Step_Clock(STATE) + #define E4_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,E4) #define E4_DIR_READ (stepperE4.getStatus() & STATUS_DIR) #else #if AXIS_IS_TMC(E4) extern TMC_CLASS(E4) stepperE4; #endif - #if AXIS_DRIVER_TYPE(E4, TMC26X) + #if AXIS_DRIVER_TYPE_E4(TMC26X) extern TMC26XStepper stepperE4; #define E4_ENABLE_INIT NOOP #define E4_ENABLE_WRITE(STATE) stepperE4.setEnabled(STATE) #define E4_ENABLE_READ stepperE4.isEnabled() - #elif AXIS_DRIVER_TYPE(E4, TMC2660) + #elif ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E4) #define E4_ENABLE_INIT NOOP - #define E4_ENABLE_WRITE(STATE) stepperE4.toff((STATE)==E_ENABLE_ON ? stepperE4.savedToff() : 0) + #define E4_ENABLE_WRITE(STATE) stepperE4.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0) #define E4_ENABLE_READ stepperE4.isEnabled() #else #define E4_ENABLE_INIT SET_OUTPUT(E4_ENABLE_PIN) @@ -510,26 +525,26 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #define E4_STEP_READ READ(E4_STEP_PIN) // E5 Stepper -#if AXIS_DRIVER_TYPE(E5, L6470) +#if AXIS_DRIVER_TYPE_E5(L6470) extern L6470 stepperE5; #define E5_ENABLE_INIT NOOP - #define E5_ENABLE_WRITE(STATE) do{ if (STATE) stepperE5.Step_Clock(stepperE5.getStatus() & STATUS_HIZ); else stepperE5.softFree(); }while(0) + #define E5_ENABLE_WRITE(STATE) NOOP #define E5_ENABLE_READ (stepperE5.getStatus() & STATUS_HIZ) #define E5_DIR_INIT NOOP - #define E5_DIR_WRITE(STATE) stepperE5.Step_Clock(STATE) + #define E5_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,E5) #define E5_DIR_READ (stepperE5.getStatus() & STATUS_DIR) #else #if AXIS_IS_TMC(E5) extern TMC_CLASS(E5) stepperE5; #endif - #if AXIS_DRIVER_TYPE(E5, TMC26X) + #if AXIS_DRIVER_TYPE_E5(TMC26X) extern TMC26XStepper stepperE5; #define E5_ENABLE_INIT NOOP #define E5_ENABLE_WRITE(STATE) stepperE5.setEnabled(STATE) #define E5_ENABLE_READ stepperE5.isEnabled() - #elif AXIS_DRIVER_TYPE(E5, TMC2660) + #elif ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E5) #define E5_ENABLE_INIT NOOP - #define E5_ENABLE_WRITE(STATE) stepperE5.toff((STATE)==E_ENABLE_ON ? stepperE5.savedToff() : 0) + #define E5_ENABLE_WRITE(STATE) stepperE5.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0) #define E5_ENABLE_READ stepperE5.isEnabled() #else #define E5_ENABLE_INIT SET_OUTPUT(E5_ENABLE_PIN) @@ -569,47 +584,93 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #define NORM_E_DIR(E) do{ E0_DIR_WRITE(E ? INVERT_E0_DIR : !INVERT_E0_DIR); }while(0) #define REV_E_DIR(E) do{ E0_DIR_WRITE(E ? !INVERT_E0_DIR : INVERT_E0_DIR); }while(0) #endif +#elif ENABLED(PRUSA_MMU2) + #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) + #elif ENABLED(MK2_MULTIPLEXER) // One multiplexed stepper driver, reversed on odd index #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) + #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) + #endif + + #if HAS_DUPLICATION_MODE - #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) + #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 - #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) #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) _E_STEP_WRITE(E,V) + #define NORM_E_DIR(E) _NORM_E_DIR(E) + #define REV_E_DIR(E) _REV_E_DIR(E) + #endif -#else + +#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 71624a266b4d..25a45661aaad 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -33,14 +33,23 @@ #include "../core/language.h" #include "../HAL/shared/Delay.h" -#if ENABLED(HEATER_0_USES_MAX6675) +#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 "../feature/babystep.h" + #if ENABLED(BABYSTEP_ALWAYS_AVAILABLE) + #include "../gcode/gcode.h" + #endif +#endif + #include "printcounter.h" #if ENABLED(FILAMENT_WIDTH_SENSOR) @@ -55,13 +64,17 @@ #include "../feature/leds/printer_event_leds.h" #endif +#if ENABLED(SINGLENOZZLE) + #include "tool_change.h" +#endif + #if HOTEND_USES_THERMISTOR #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) static void* heater_ttbl_map[2] = { (void*)HEATER_0_TEMPTABLE, (void*)HEATER_1_TEMPTABLE }; 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 @@ -71,80 +84,159 @@ 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(M,E) (E) == -1 ? PSTR(M) : +#else + #define _BED_PSTR(M,E) +#endif +#if HAS_HEATED_CHAMBER + #define _CHAMBER_PSTR(M,E) (E) == -2 ? PSTR(M) : #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 _CHAMBER_PSTR(M,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(M##_BED,E) _CHAMBER_PSTR(M##_CHAMBER,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: -float Temperature::current_temperature[HOTENDS] = { 0.0 }; -int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 }, - Temperature::target_temperature[HOTENDS] = { 0 }; +#if ENABLED(NO_FAN_SLOWING_IN_PID_TUNING) + bool Temperature::adaptive_fan_slowing = true; +#endif + +hotend_info_t Temperature::temp_hotend[HOTENDS]; // = { 0 } #if ENABLED(AUTO_POWER_E_FANS) - uint8_t Temperature::autofan_speed[HOTENDS] = { 0 }; + uint8_t Temperature::autofan_speed[HOTENDS]; // = { 0 } +#endif + +#if FAN_COUNT > 0 + + uint8_t Temperature::fan_speed[FAN_COUNT]; // = { 0 } + + #if ENABLED(EXTRA_FAN_SPEED) + uint8_t Temperature::old_fan_speed[FAN_COUNT], Temperature::new_fan_speed[FAN_COUNT]; + + void Temperature::set_temp_fan_speed(const uint8_t fan, const uint16_t tmp_temp) { + switch (tmp_temp) { + case 1: + set_fan_speed(fan, old_fan_speed[fan]); + break; + case 2: + old_fan_speed[fan] = fan_speed[fan]; + set_fan_speed(fan, new_fan_speed[fan]); + break; + default: + new_fan_speed[fan] = MIN(tmp_temp, 255U); + break; + } + } + + #endif + + #if ENABLED(PROBING_FANS_OFF) + bool Temperature::fans_paused; // = false; + uint8_t Temperature::paused_fan_speed[FAN_COUNT]; // = { 0 } + #endif + + #if ENABLED(ADAPTIVE_FAN_SLOWING) + uint8_t Temperature::fan_speed_scaler[FAN_COUNT] = ARRAY_N(FAN_COUNT, 128, 128, 128, 128, 128, 128); + #endif + + #if HAS_LCD_MENU + + uint8_t Temperature::lcd_tmpfan_speed[ + #if ENABLED(SINGLENOZZLE) + MAX(EXTRUDERS, FAN_COUNT) + #else + FAN_COUNT + #endif + ]; // = { 0 } + + #endif + + void Temperature::set_fan_speed(uint8_t target, uint16_t speed) { + + NOMORE(speed, 255U); + + #if ENABLED(SINGLENOZZLE) + if (target != active_extruder) { + if (target < EXTRUDERS) singlenozzle_fan_speed[target] = speed; + return; + } + target = 0; // Always use fan index 0 with SINGLENOZZLE + #endif + + if (target >= FAN_COUNT) return; + + fan_speed[target] = speed; + #if HAS_LCD_MENU + lcd_tmpfan_speed[target] = speed; + #endif + } + + #if ENABLED(PROBING_FANS_OFF) + + void Temperature::set_fans_paused(const bool p) { + if (p != fans_paused) { + fans_paused = p; + if (p) + FANS_LOOP(x) { paused_fan_speed[x] = fan_speed[x]; fan_speed[x] = 0; } + else + FANS_LOOP(x) fan_speed[x] = paused_fan_speed[x]; + } + } + + #endif // PROBING_FANS_OFF + +#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) @@ -165,21 +257,22 @@ int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 }, volatile bool Temperature::temp_meas_ready = false; -#if ENABLED(PIDTEMP) - #if ENABLED(PID_EXTRUSION_SCALING) - long Temperature::last_e_position; - long Temperature::lpq[LPQ_MAX_LEN]; - int Temperature::lpq_ptr = 0; - #endif +#if ENABLED(PID_EXTRUSION_SCALING) + 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 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 }; -// 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); +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 }; @@ -197,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]; @@ -212,10 +303,7 @@ 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 uint32_t Temperature::current_ADCKey_raw = 0; @@ -228,13 +316,15 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS]; #if HAS_PID_HEATING - inline void say_default_() { SERIAL_PROTOCOLPGM("#define DEFAULT_"); } + inline void say_default_() { SERIAL_ECHOPGM("#define DEFAULT_"); } /** * PID Autotuning (M303) * * Alternately heat and cool the nozzle, observing its behavior to * determine the best PID values to achieve a stable temperature. + * Needs sufficient heater power to make some overshoot at target + * temperature to succeed. */ void Temperature::PID_autotune(const float &target, const int8_t heater, const int8_t ncycles, const bool set_result/*=false*/) { float current = 0.0; @@ -250,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) @@ -286,18 +376,27 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS]; next_auto_fan_check_ms = next_temp_ms + 2500UL; #endif + if (target > GHV(BED_MAXTEMP, temp_range[heater].maxtemp) - 15) { + SERIAL_ECHOLNPGM(MSG_PID_TEMP_TOO_HIGH); + return; + } + SERIAL_ECHOLNPGM(MSG_PID_AUTOTUNE_START); 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 + #if ENABLED(NO_FAN_SLOWING_IN_PID_TUNING) + adaptive_fan_slowing = false; + #endif + // PID Tuning loop while (wait_for_heatup) { @@ -307,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); @@ -325,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; @@ -343,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_PROTOCOLPAIR(MSG_BIAS, bias); - SERIAL_PROTOCOLPAIR(MSG_D, d); - SERIAL_PROTOCOLPAIR(MSG_T_MIN, min); - SERIAL_PROTOCOLPAIR(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_PROTOCOLPAIR(MSG_KU, Ku); - SERIAL_PROTOCOLPAIR(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_PROTOCOLLNPGM("\n" MSG_CLASSIC_PID); - SERIAL_PROTOCOLPAIR(MSG_KP, tune_pid.Kp); - SERIAL_PROTOCOLPAIR(MSG_KI, tune_pid.Ki); - SERIAL_PROTOCOLLNPAIR(MSG_KD, tune_pid.Kd); + SERIAL_ECHOPAIR(MSG_KU, Ku, MSG_TU, Tu); + SERIAL_ECHOLNPGM("\n" MSG_CLASSIC_PID); + 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_PROTOCOLLNPGM(" Some overshoot"); - SERIAL_PROTOCOLPAIR(" Kp: ", tune_pid.Kp); - SERIAL_PROTOCOLPAIR(" Ki: ", tune_pid.Ki); - SERIAL_PROTOCOLPAIR(" Kd: ", tune_pid.Kd); + SERIAL_ECHOLNPGM(" Some overshoot"); + 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_PROTOCOLLNPGM(" No overshoot"); - SERIAL_PROTOCOLPAIR(" Kp: ", tune_pid.Kp); - SERIAL_PROTOCOLPAIR(" Ki: ", tune_pid.Ki); - SERIAL_PROTOCOLPAIR(" 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; } @@ -389,7 +477,7 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS]; #define MAX_OVERSHOOT_PID_AUTOTUNE 20 #endif if (current > target + MAX_OVERSHOOT_PID_AUTOTUNE) { - SERIAL_PROTOCOLLNPGM(MSG_PID_TEMP_TOO_HIGH); + SERIAL_ECHOLNPGM(MSG_PID_TEMP_TOO_HIGH); break; } @@ -402,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 @@ -432,32 +520,32 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS]; #define MAX_CYCLE_TIME_PID_AUTOTUNE 20L #endif if (((ms - t1) + (ms - t2)) > (MAX_CYCLE_TIME_PID_AUTOTUNE * 60L * 1000L)) { - SERIAL_PROTOCOLLNPGM(MSG_PID_TIMEOUT); + SERIAL_ECHOLNPGM(MSG_PID_TIMEOUT); break; } - if (cycles > ncycles) { - SERIAL_PROTOCOLLNPGM(MSG_PID_AUTOTUNE_FINISHED); + if (cycles > ncycles && cycles > 2) { + SERIAL_ECHOLNPGM(MSG_PID_AUTOTUNE_FINISHED); #if HAS_PID_FOR_BOTH const char * const estring = GHV(PSTR("bed"), PSTR("")); - say_default_(); serialprintPGM(estring); SERIAL_PROTOCOLLNPAIR("Kp ", tune_pid.Kp); - say_default_(); serialprintPGM(estring); SERIAL_PROTOCOLLNPAIR("Ki ", tune_pid.Ki); - say_default_(); serialprintPGM(estring); SERIAL_PROTOCOLLNPAIR("Kd ", tune_pid.Kd); + say_default_(); serialprintPGM(estring); SERIAL_ECHOLNPAIR("Kp ", tune_pid.Kp); + say_default_(); serialprintPGM(estring); SERIAL_ECHOLNPAIR("Ki ", tune_pid.Ki); + say_default_(); serialprintPGM(estring); SERIAL_ECHOLNPAIR("Kd ", tune_pid.Kd); #elif ENABLED(PIDTEMP) - say_default_(); SERIAL_PROTOCOLLNPAIR("Kp ", tune_pid.Kp); - say_default_(); SERIAL_PROTOCOLLNPAIR("Ki ", tune_pid.Ki); - say_default_(); SERIAL_PROTOCOLLNPAIR("Kd ", tune_pid.Kd); + say_default_(); SERIAL_ECHOLNPAIR("Kp ", tune_pid.Kp); + say_default_(); SERIAL_ECHOLNPAIR("Ki ", tune_pid.Ki); + say_default_(); SERIAL_ECHOLNPAIR("Kd ", tune_pid.Kd); #else - say_default_(); SERIAL_PROTOCOLLNPAIR("bedKp ", tune_pid.Kp); - say_default_(); SERIAL_PROTOCOLLNPAIR("bedKi ", tune_pid.Ki); - say_default_(); SERIAL_PROTOCOLLNPAIR("bedKd ", tune_pid.Kd); + say_default_(); SERIAL_ECHOLNPAIR("bedKp ", tune_pid.Kp); + say_default_(); SERIAL_ECHOLNPAIR("bedKi ", tune_pid.Ki); + say_default_(); SERIAL_ECHOLNPAIR("bedKd ", tune_pid.Kd); #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 { \ @@ -476,18 +564,27 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS]; _SET_BED_PID(); #endif } + #if ENABLED(PRINTER_EVENT_LEDS) printerEventLEDs.onPidTuningDone(color); #endif - return; + goto EXIT_M303; } ui.update(); } + disable_all_heaters(); + #if ENABLED(PRINTER_EVENT_LEDS) printerEventLEDs.onPidTuningDone(color); #endif + + EXIT_M303: + #if ENABLED(NO_FAN_SLOWING_IN_PID_TUNING) + adaptive_fan_slowing = true; + #endif + return; } #endif // HAS_PID_HEATING @@ -498,59 +595,116 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS]; Temperature::Temperature() { } -int Temperature::getHeaterPower(const int heater) { +int16_t Temperature::getHeaterPower(const int8_t heater) { return ( + #if HAS_HEATED_CHAMBER + #if HAS_HEATED_BED + heater == -2 + #else + heater < 0 + #endif + ? temp_chamber.soft_pwm_amount : + #endif #if HAS_HEATED_BED - heater < 0 ? soft_pwm_amount_bed : + #if HAS_HEATED_CHAMBER + heater == -1 + #else + heater < 0 + #endif + ? 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); } } @@ -564,8 +718,13 @@ void Temperature::_temp_error(const int8_t heater, PGM_P const serial_msg, PGM_P if (IsRunning()) { SERIAL_ERROR_START(); serialprintPGM(serial_msg); - SERIAL_ERRORPGM(MSG_STOPPED_HEATER); - if (heater >= 0) SERIAL_ERRORLN((int)heater); else SERIAL_ERRORLNPGM(MSG_HEATER_BED); + SERIAL_ECHOPGM(MSG_STOPPED_HEATER); + 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) { @@ -588,107 +747,107 @@ 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) static hotend_pid_t work_pid[HOTENDS]; static float temp_iState[HOTENDS] = { 0 }, temp_dState[HOTENDS] = { 0 }; static bool pid_reset[HOTENDS] = { false }; - float pid_output, - pid_error = target_temperature[HOTEND_INDEX] - current_temperature[HOTEND_INDEX]; - work_pid[HOTEND_INDEX].Kd = PID_K2 * PID_PARAM(Kd, HOTEND_INDEX) * (current_temperature[HOTEND_INDEX] - temp_dState[HOTEND_INDEX]) + float(PID_K1) * work_pid[HOTEND_INDEX].Kd; - temp_dState[HOTEND_INDEX] = current_temperature[HOTEND_INDEX]; - #if HEATER_IDLE_HANDLER - if (heater_idle_timeout_exceeded[HOTEND_INDEX]) { - 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; - } - 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 + 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]; - 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; + pid_output = work_pid[HOTEND_INDEX].Kp + work_pid[HOTEND_INDEX].Ki - work_pid[HOTEND_INDEX].Kd; + + #if ENABLED(PID_EXTRUSION_SCALING) + work_pid[HOTEND_INDEX].Kc = 0; + if (_HOTEND_TEST) { + const long e_position = stepper.position(E_AXIS); + if (e_position > last_e_position) { + lpq[lpq_ptr] = e_position - last_e_position; + last_e_position = e_position; } + else + lpq[lpq_ptr] = 0; + + if (++lpq_ptr >= lpq_len) lpq_ptr = 0; + work_pid[HOTEND_INDEX].Kc = (lpq[lpq_ptr] * planner.steps_to_mm[E_AXIS]) * PID_PARAM(Kc, HOTEND_INDEX); + pid_output += work_pid[HOTEND_INDEX].Kc; } + #endif // PID_EXTRUSION_SCALING + + if (pid_output > PID_MAX) { + if (pid_error > 0) temp_iState[HOTEND_INDEX] -= pid_error; // conditional un-integration + pid_output = PID_MAX; + } + else if (pid_output < 0) { + if (pid_error < 0) temp_iState[HOTEND_INDEX] -= pid_error; // conditional un-integration + pid_output = 0; + } + } #else // PID_OPENLOOP - const float pid_output = constrain(target_temperature[HOTEND_INDEX], 0, PID_MAX); + 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]) ? PID_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; @@ -703,13 +862,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) { @@ -723,19 +882,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; @@ -762,7 +922,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 @@ -775,37 +935,54 @@ 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 + #define HAS_THERMAL_PROTECTION (ENABLED(THERMAL_PROTECTION_HOTENDS) || HAS_THERMALLY_PROTECTED_BED || ENABLED(THERMAL_PROTECTION_CHAMBER)) + + #if HAS_THERMAL_PROTECTION || DISABLED(PIDTEMPBED) || HAS_AUTO_FAN || HEATER_IDLE_HANDLER millis_t ms = millis(); #endif + #if HAS_THERMAL_PROTECTION + #ifndef THERMAL_PROTECTION_GRACE_PERIOD + #define THERMAL_PROTECTION_GRACE_PERIOD 0 // No grace period needed on well-behaved boards + #endif + #if THERMAL_PROTECTION_GRACE_PERIOD > 0 + static millis_t grace_period = ms + THERMAL_PROTECTION_GRACE_PERIOD; + if (ELAPSED(ms, grace_period)) grace_period = 0UL; + #else + static constexpr millis_t grace_period = 0UL; + #endif + #endif + HOTEND_LOOP() { + #if ENABLED(THERMAL_PROTECTION_HOTENDS) + if (!grace_period && degHotend(e) > temp_range[e].maxtemp) + _temp_error(e, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, e)); + #endif #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); @@ -814,7 +991,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 @@ -842,40 +1019,44 @@ void Temperature::manage_heater() { #if HAS_HEATED_BED - #if WATCH_THE_BED + #if ENABLED(THERMAL_PROTECTION_BED) + if (!grace_period && degBed() > BED_MAXTEMP) + _temp_error(-1, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, -1)); + #endif + + #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 @@ -884,26 +1065,78 @@ 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 ENABLED(THERMAL_PROTECTION_CHAMBER) + if (!grace_period && degChamber() > CHAMBER_MAXTEMP) + _temp_error(-2, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, -2)); + #endif + + #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 + TEMP_CHAMBER_HYSTERESIS) + temp_chamber.soft_pwm_amount = 0; + else if (temp_chamber.current <= temp_chamber.target - (TEMP_CHAMBER_HYSTERESIS)) + temp_chamber.soft_pwm_amount = MAX_CHAMBER_POWER >> 1; + #else + 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) @@ -940,8 +1173,8 @@ float Temperature::analog_to_celsius_hotend(const int raw, const uint8_t e) { #endif { SERIAL_ERROR_START(); - SERIAL_ERROR((int)e); - SERIAL_ERRORLNPGM(MSG_INVALID_EXTRUDER_NUM); + SERIAL_ECHO((int)e); + SERIAL_ECHOLNPGM(MSG_INVALID_EXTRUDER_NUM); kill(); return 0.0; } @@ -991,6 +1224,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; } @@ -1022,7 +1263,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) @@ -1043,17 +1284,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); @@ -1094,16 +1335,29 @@ void Temperature::updateTemperaturesFromRawValues() { #endif -#if ENABLED(HEATER_0_USES_MAX6675) - #ifndef MAX6675_SCK_PIN - #define MAX6675_SCK_PIN SCK_PIN - #endif - #ifndef MAX6675_DO_PIN - #define MAX6675_DO_PIN MISO_PIN - #endif +#if MAX6675_SEPARATE_SPI 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() @@ -1116,18 +1370,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 @@ -1144,41 +1396,32 @@ void Temperature::init() { OUT_WRITE(HEATER_3_PIN, HEATER_3_INVERTING); #endif #if HAS_HEATER_4 - OUT_WRITE(HEATER_3_PIN, HEATER_4_INVERTING); + 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 ENABLED(HEATER_0_USES_MAX6675) + #if MAX6675_SEPARATE_SPI OUT_WRITE(SCK_PIN, LOW); OUT_WRITE(MOSI_PIN, HIGH); @@ -1189,7 +1432,7 @@ void Temperature::init() { OUT_WRITE(SS_PIN, HIGH); OUT_WRITE(MAX6675_SS_PIN, HIGH); - #endif // HEATER_0_USES_MAX6675 + #endif #if ENABLED(HEATER_1_USES_MAX6675) OUT_WRITE(MAX6675_SS2_PIN, HIGH); @@ -1229,210 +1472,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 @@ -1440,19 +1588,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. @@ -1460,55 +1606,69 @@ 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 HAS_THERMAL_PROTECTION #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 < 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); - if (heater_id >= 0) - SERIAL_ECHOPAIR(" ; Idle Timeout:", heater_idle_timeout_exceeded[heater_id]); - else - SERIAL_ECHOPAIR(" ; Idle Timeout:", bed_idle_timeout_exceeded); - SERIAL_EOL(); - */ + 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:", sm.state, " ; Timer:", sm.timer, " ; Temperature:", current, " ; Target Temp:", target); + if (heater_id >= 0) + SERIAL_ECHOPAIR(" ; Idle Timeout:", hotend_idle[heater_id].timed_out); + else + SERIAL_ECHOPAIR(" ; Idle Timeout:", bed_idle.timed_out); + SERIAL_EOL(); + //*/ const int heater_index = heater_id >= 0 ? heater_id : HOTENDS; #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 @@ -1517,31 +1677,51 @@ 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: + + #if ENABLED(ADAPTIVE_FAN_SLOWING) + if (adaptive_fan_slowing && heater_id >= 0) { + const int fan_index = MIN(heater_id, FAN_COUNT - 1); + if (fan_speed[fan_index] == 0 || current >= tr_target_temperature[heater_id] - (hysteresis_degc * 0.25f)) + fan_speed_scaler[fan_index] = 128; + else if (current >= tr_target_temperature[heater_id] - (hysteresis_degc * 0.3335f)) + fan_speed_scaler[fan_index] = 96; + else if (current >= tr_target_temperature[heater_id] - (hysteresis_degc * 0.5f)) + fan_speed_scaler[fan_index] = 64; + else if (current >= tr_target_temperature[heater_id] - (hysteresis_degc * 0.8f)) + fan_speed_scaler[fan_index] = 32; + else + fan_speed_scaler[fan_index] = 0; + } + #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() { @@ -1555,6 +1735,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); @@ -1562,7 +1746,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); \ } @@ -1586,12 +1770,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) @@ -1600,9 +1792,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 { @@ -1625,6 +1817,9 @@ void Temperature::disable_all_heaters() { ) { #if COUNT_6675 == 1 constexpr uint8_t hindex = 0; + #else + // Needed to return the correct temp when this is called too soon + static uint16_t max6675_temp_previous[COUNT_6675] = { 0 }; #endif #define MAX6675_HEAT_INTERVAL 250UL @@ -1644,25 +1839,37 @@ void Temperature::disable_all_heaters() { // Return last-read value between readings static millis_t next_max6675_ms[COUNT_6675] = { 0 }; millis_t ms = millis(); - if (PENDING(ms, next_max6675_ms[hindex])) return int(max6675_temp); + if (PENDING(ms, next_max6675_ms[hindex])) + return int( + #if COUNT_6675 == 1 + max6675_temp + #else + max6675_temp_previous[hindex] // Need to return the correct previous value + #endif + ); + next_max6675_ms[hindex] = ms + MAX6675_HEAT_INTERVAL; // // TODO: spiBegin, spiRec and spiInit doesn't work when soft spi is used. // - #if MB(MIGHTYBOARD_REVE) + #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 @@ -1671,7 +1878,7 @@ void Temperature::disable_all_heaters() { max6675_temp = 0; for (uint8_t i = sizeof(max6675_temp); i--;) { max6675_temp |= ( - #if MB(MIGHTYBOARD_REVE) + #if MAX6675_SEPARATE_SPI max6675_spi.receive() #else spiRec() @@ -1684,17 +1891,17 @@ void Temperature::disable_all_heaters() { if (max6675_temp & MAX6675_ERROR_MASK) { SERIAL_ERROR_START(); - SERIAL_ERRORPGM("Temp measurement error! "); + SERIAL_ECHOPGM("Temp measurement error! "); #if MAX6675_ERROR_MASK == 7 - SERIAL_ERRORPGM("MAX31855 "); + SERIAL_ECHOPGM("MAX31855 "); if (max6675_temp & 1) - SERIAL_ERRORLNPGM("Open Circuit"); + SERIAL_ECHOLNPGM("Open Circuit"); else if (max6675_temp & 2) - SERIAL_ERRORLNPGM("Short to GND"); + SERIAL_ECHOLNPGM("Short to GND"); else if (max6675_temp & 4) - SERIAL_ERRORLNPGM("Short to VCC"); + SERIAL_ECHOLNPGM("Short to VCC"); #else - SERIAL_ERRORLNPGM("MAX6675"); + SERIAL_ECHOLNPGM("MAX6675"); #endif // Thermocouple open @@ -1710,10 +1917,14 @@ void Temperature::disable_all_heaters() { } else max6675_temp >>= MAX6675_DISCARD_BITS; - #if ENABLED(MAX6675_IS_MAX31855) - // Support negative temperature - if (max6675_temp & 0x00002000) max6675_temp |= 0xFFFFC000; - #endif + + #if ENABLED(MAX6675_IS_MAX31855) + if (max6675_temp & 0x00002000) max6675_temp |= 0xFFFFC000; // Support negative temperature + #endif + + #if COUNT_6675 > 1 + max6675_temp_previous[hindex] = max6675_temp; + #endif return int(max6675_temp); } @@ -1726,38 +1937,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; } @@ -1774,18 +1984,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 @@ -1810,14 +2018,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 @@ -1830,18 +2038,29 @@ 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 (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 } @@ -1860,7 +2079,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(); @@ -1868,6 +2087,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; @@ -1880,36 +2124,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 + #endif + + 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) @@ -1922,27 +2148,26 @@ void Temperature::isr() { ; /** - * Standard PWM modulation + * Standard heater PWM modulation */ 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 @@ -1950,45 +2175,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) @@ -2021,96 +2258,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 - - } // slow_pwm_count == 0 + #endif // HOTENDS - 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 @@ -2140,24 +2358,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 @@ -2178,9 +2396,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; @@ -2216,7 +2434,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 @@ -2225,7 +2443,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 @@ -2234,7 +2452,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 @@ -2243,7 +2461,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 @@ -2252,7 +2470,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 @@ -2261,7 +2479,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 @@ -2270,7 +2488,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 @@ -2279,7 +2497,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 @@ -2331,15 +2549,8 @@ void Temperature::isr() { // #if ENABLED(BABYSTEPPING) - 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]++; - } - } - #endif // BABYSTEPPING + babystep.task(); + #endif // Poll endstops state, if required endstops.poll(); @@ -2356,17 +2567,14 @@ void Temperature::isr() { #if ENABLED(SHOW_TEMP_ADC_VALUES) , const float r #endif - #if NUM_SERIAL > 1 - , const int8_t port=-1 - #endif , const int8_t e=-3 ) { #if !(HAS_HEATED_BED && HAS_TEMP_HOTEND && HAS_TEMP_CHAMBER) && HOTENDS <= 1 UNUSED(e); #endif - SERIAL_PROTOCOLCHAR_P(port, ' '); - SERIAL_PROTOCOLCHAR_P(port, + SERIAL_CHAR(' '); + SERIAL_CHAR( #if HAS_TEMP_CHAMBER && HAS_HEATED_BED && HAS_TEMP_HOTEND e == -2 ? 'C' : e == -1 ? 'B' : 'T' #elif HAS_HEATED_BED && HAS_TEMP_HOTEND @@ -2378,31 +2586,24 @@ void Temperature::isr() { #endif ); #if HOTENDS > 1 - if (e >= 0) SERIAL_PROTOCOLCHAR_P(port, '0' + e); + if (e >= 0) SERIAL_CHAR('0' + e); #endif - SERIAL_PROTOCOLCHAR_P(port, ':'); - SERIAL_PROTOCOL_P(port, c); - SERIAL_PROTOCOLPAIR_P(port, " /" , t); + SERIAL_CHAR(':'); + SERIAL_ECHO(c); + SERIAL_ECHOPAIR(" /" , t); #if ENABLED(SHOW_TEMP_ADC_VALUES) - SERIAL_PROTOCOLPAIR_P(port, " (", r / OVERSAMPLENR); - SERIAL_PROTOCOLCHAR_P(port, ')'); + SERIAL_ECHOPAIR(" (", r / OVERSAMPLENR); + SERIAL_CHAR(')'); #endif delay(2); } - void Temperature::print_heater_states(const uint8_t target_extruder - #if NUM_SERIAL > 1 - , const int8_t port - #endif - ) { + void Temperature::print_heater_states(const uint8_t target_extruder) { #if HAS_TEMP_HOTEND print_heater_state(degHotend(target_extruder), degTargetHotend(target_extruder) #if ENABLED(SHOW_TEMP_ADC_VALUES) , rawHotendTemp(target_extruder) #endif - #if NUM_SERIAL > 1 - , port - #endif ); #endif #if HAS_HEATED_BED @@ -2410,42 +2611,46 @@ void Temperature::isr() { #if ENABLED(SHOW_TEMP_ADC_VALUES) , rawBedTemp() #endif - #if NUM_SERIAL > 1 - , port - #endif , -1 // BED ); #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) #if ENABLED(SHOW_TEMP_ADC_VALUES) , rawHotendTemp(e) #endif - #if NUM_SERIAL > 1 - , port - #endif , e ); #endif - SERIAL_PROTOCOLPGM_P(port, " @:"); - SERIAL_PROTOCOL_P(port, getHeaterPower(target_extruder)); + SERIAL_ECHOPAIR(" @:", getHeaterPower(target_extruder)); #if HAS_HEATED_BED - SERIAL_PROTOCOLPGM_P(port, " B@:"); - SERIAL_PROTOCOL_P(port, getHeaterPower(-1)); + SERIAL_ECHOPAIR(" B@:", getHeaterPower(-1)); + #endif + #if HAS_HEATED_CHAMBER + SERIAL_ECHOPAIR(" C@:", getHeaterPower(-2)); #endif #if HOTENDS > 1 HOTEND_LOOP() { - SERIAL_PROTOCOLPAIR_P(port, " @", e); - SERIAL_PROTOCOLCHAR_P(port, ':'); - SERIAL_PROTOCOL_P(port, getHeaterPower(e)); + SERIAL_ECHOPAIR(" @", e); + SERIAL_CHAR(':'); + SERIAL_ECHO(getHeaterPower(e)); } #endif } @@ -2458,6 +2663,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(); } @@ -2465,11 +2671,11 @@ void Temperature::isr() { #endif // AUTO_REPORT_TEMPERATURES - #if ENABLED(ULTRA_LCD) + #if EITHER(ULTRA_LCD, EXTENSIBLE_UI) void Temperature::set_heating_message(const uint8_t e) { const bool heating = isHeatingHotend(e); #if HOTENDS > 1 - ui.status_printf_P(0, heating ? PSTR("E%i " MSG_HEATING) : PSTR("E%i " MSG_COOLING), int(e + 1)); + ui.status_printf_P(0, heating ? PSTR("E%c " MSG_HEATING) : PSTR("E%c " MSG_COOLING), '1' + e); #else ui.set_status_P(heating ? PSTR("E " MSG_HEATING) : PSTR("E " MSG_COOLING)); #endif @@ -2510,7 +2716,7 @@ void Temperature::isr() { #endif float target_temp = -1.0, old_temp = 9999.0; - bool wants_to_cool = false; + bool wants_to_cool = false, first_loop = true; wait_for_heatup = true; millis_t now, next_temp_ms = 0, next_cool_check_ms = 0; do { @@ -2528,11 +2734,11 @@ void Temperature::isr() { next_temp_ms = now + 1000UL; print_heater_states(target_extruder); #if TEMP_RESIDENCY_TIME > 0 - SERIAL_PROTOCOLPGM(" W:"); + SERIAL_ECHOPGM(" W:"); if (residency_start_ms) - SERIAL_PROTOCOL(long((((TEMP_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL)); + SERIAL_ECHO(long((((TEMP_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL)); else - SERIAL_PROTOCOLCHAR('?'); + SERIAL_CHAR('?'); #endif SERIAL_EOL(); } @@ -2553,7 +2759,10 @@ void Temperature::isr() { if (!residency_start_ms) { // Start the TEMP_RESIDENCY_TIME timer when we reach target temp for the first time. - if (temp_diff < TEMP_WINDOW) residency_start_ms = now; + if (temp_diff < TEMP_WINDOW) { + residency_start_ms = now; + if (first_loop) residency_start_ms += (TEMP_RESIDENCY_TIME) * 1000UL; + } } else if (temp_diff > TEMP_HYSTERESIS) { // Restart the timer whenever the temperature falls outside the hysteresis. @@ -2580,6 +2789,8 @@ void Temperature::isr() { } #endif + first_loop = false; + } while (wait_for_heatup && TEMP_CONDITIONS); if (wait_for_heatup) { @@ -2622,7 +2833,7 @@ void Temperature::isr() { #endif float target_temp = -1, old_temp = 9999; - bool wants_to_cool = false; + bool wants_to_cool = false, first_loop = true; wait_for_heatup = true; millis_t now, next_temp_ms = 0, next_cool_check_ms = 0; @@ -2651,11 +2862,11 @@ void Temperature::isr() { next_temp_ms = now + 1000UL; print_heater_states(active_extruder); #if TEMP_BED_RESIDENCY_TIME > 0 - SERIAL_PROTOCOLPGM(" W:"); + SERIAL_ECHOPGM(" W:"); if (residency_start_ms) - SERIAL_PROTOCOL(long((((TEMP_BED_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL)); + SERIAL_ECHO(long((((TEMP_BED_RESIDENCY_TIME) * 1000UL) - (now - residency_start_ms)) / 1000UL)); else - SERIAL_PROTOCOLCHAR('?'); + SERIAL_CHAR('?'); #endif SERIAL_EOL(); } @@ -2676,7 +2887,10 @@ void Temperature::isr() { if (!residency_start_ms) { // Start the TEMP_BED_RESIDENCY_TIME timer when we reach target temp for the first time. - if (temp_diff < TEMP_BED_WINDOW) residency_start_ms = now; + if (temp_diff < TEMP_BED_WINDOW) { + residency_start_ms = now; + if (first_loop) residency_start_ms += (TEMP_BED_RESIDENCY_TIME) * 1000UL; + } } else if (temp_diff > TEMP_BED_HYSTERESIS) { // Restart the timer whenever the temperature falls outside the hysteresis. @@ -2703,6 +2917,8 @@ void Temperature::isr() { } #endif + first_loop = false; + } while (wait_for_heatup && TEMP_BED_CONDITIONS); if (wait_for_heatup) ui.reset_status(); diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index f9d21c354141..b24f84fb585e 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -28,10 +28,6 @@ #include "thermistor/thermistors.h" #include "../inc/MarlinConfig.h" -#if ENABLED(BABYSTEPPING) - extern uint8_t axis_known_position; -#endif - #if ENABLED(AUTO_POWER_CONTROL) #include "../feature/power.h" #endif @@ -40,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 @@ -51,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 @@ -58,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 @@ -84,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, @@ -100,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, @@ -140,16 +147,109 @@ 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_HEATED_CHAMBER + typedef heater_info_t chamber_info_t; +#elif HAS_TEMP_CHAMBER + typedef temp_info_t chamber_info_t; +#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]; @@ -160,37 +260,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 @@ -201,6 +280,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 @@ -208,11 +297,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) @@ -220,45 +307,39 @@ class Temperature { static float redundant_temperature; #endif - #if ENABLED(PIDTEMP) - #if ENABLED(PID_EXTRUSION_SCALING) - static long last_e_position; - static long lpq[LPQ_MAX_LEN]; - static int lpq_ptr; - #endif + #if ENABLED(PID_EXTRUSION_SCALING) + 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 + static millis_t next_chamber_check_ms; + #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 @@ -285,11 +366,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; @@ -317,9 +393,74 @@ 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 + + static uint8_t fan_speed[FAN_COUNT]; + #define FANS_LOOP(I) LOOP_L_N(I, FAN_COUNT) + + static void set_fan_speed(const uint8_t target, const uint16_t speed); + + #if ENABLED(PROBING_FANS_OFF) + static bool fans_paused; + static uint8_t paused_fan_speed[FAN_COUNT]; + #endif + + 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]; + #else + static constexpr uint8_t fan_speed_scaler[FAN_COUNT] = ARRAY_N(FAN_COUNT, 128, 128, 128, 128, 128, 128); + #endif + + static inline uint8_t lcd_fanSpeedActual(const uint8_t target) { + return (fan_speed[target] * uint16_t(fan_speed_scaler[target])) >> 7; + } + + #if ENABLED(EXTRA_FAN_SPEED) + static uint8_t old_fan_speed[FAN_COUNT], new_fan_speed[FAN_COUNT]; + static void set_temp_fan_speed(const uint8_t fan, const uint16_t tmp_temp); + #endif + + #if HAS_LCD_MENU + + static uint8_t lcd_tmpfan_speed[ + #if ENABLED(SINGLENOZZLE) + MAX(EXTRUDERS, FAN_COUNT) + #else + FAN_COUNT + #endif + ]; + + static inline void lcd_setFanSpeed(const uint8_t target) { set_fan_speed(target, lcd_tmpfan_speed[target]); } + + #if HAS_FAN0 + FORCE_INLINE static void lcd_setFanSpeed0() { lcd_setFanSpeed(0); } + #endif + #if HAS_FAN1 || (ENABLED(SINGLENOZZLE) && EXTRUDERS > 1) + FORCE_INLINE static void lcd_setFanSpeed1() { lcd_setFanSpeed(1); } + #endif + #if HAS_FAN2 || (ENABLED(SINGLENOZZLE) && EXTRUDERS > 2) + FORCE_INLINE static void lcd_setFanSpeed2() { lcd_setFanSpeed(2); } + #endif + + #endif // HAS_LCD_MENU + + #if ENABLED(PROBING_FANS_OFF) + void set_fans_paused(const bool p); + #endif + + #endif // FAN_COUNT > 0 + + static inline void zero_fan_speeds() { + #if FAN_COUNT > 0 + FANS_LOOP(i) set_fan_speed(i, 0); + #endif + } + /** * Called from the Temperature ISR */ @@ -336,21 +477,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 @@ -368,63 +503,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] = celsius; - #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 @@ -438,33 +591,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) + 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 @@ -475,10 +628,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; @@ -487,7 +645,7 @@ class Temperature { /** * The software PWM power for a heater */ - static int getHeaterPower(const int heater); + static int16_t getHeaterPower(const int8_t heater); /** * Switch off all heaters, set all target temperatures to 0 @@ -500,6 +658,12 @@ class Temperature { #if HAS_PID_HEATING static void PID_autotune(const float &target, const int8_t hotend, const int8_t ncycles, const bool set_result=false); + #if ENABLED(NO_FAN_SLOWING_IN_PID_TUNING) + static bool adaptive_fan_slowing; + #elif ENABLED(ADAPTIVE_FAN_SLOWING) + static constexpr bool adaptive_fan_slowing = true; + #endif + /** * Update the temp manager when PID values change */ @@ -513,41 +677,6 @@ class Temperature { #endif - #if ENABLED(BABYSTEPPING) - - static void babystep_axis(const AxisEnum axis, const int16_t distance) { - if (TEST(axis_known_position, axis)) { - #if IS_CORE - #if ENABLED(BABYSTEP_XY) - switch (axis) { - case CORE_AXIS_1: // X on CoreXY and CoreXZ, Y on CoreYZ - 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 - 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: - babystepsTodo[NORMAL_AXIS] += distance; - break; - } - #elif CORE_IS_XZ || CORE_IS_YZ - // Only Z stepping needs to be handled here - babystepsTodo[CORE_AXIS_1] += CORESIGN(distance * 2); - babystepsTodo[CORE_AXIS_2] -= CORESIGN(distance * 2); - #else - babystepsTodo[Z_AXIS] += distance; - #endif - #else - babystepsTodo[axis] += distance; - #endif - } - } - - #endif // BABYSTEPPING - #if ENABLED(PROBING_HEATERS_OFF) static void pause(const bool p); FORCE_INLINE static bool is_paused() { return paused; } @@ -555,62 +684,28 @@ 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 #if HAS_TEMP_SENSOR - static void print_heater_states(const uint8_t target_extruder - #if NUM_SERIAL > 1 - , const int8_t port = -1 - #endif - ); + static void print_heater_states(const uint8_t target_extruder); #if ENABLED(AUTO_REPORT_TEMPERATURES) static uint8_t auto_report_temp_interval; static millis_t next_temp_report_ms; static void auto_report_temperatures(void); - FORCE_INLINE void set_auto_report_interval(uint8_t v) { + static inline void set_auto_report_interval(uint8_t v) { NOMORE(v, 60); auto_report_temp_interval = v; next_temp_report_ms = millis() + 1000UL * v; @@ -618,23 +713,17 @@ class Temperature { #endif #endif - #if ENABLED(ULTRA_LCD) + #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 @@ -659,25 +748,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 TRState thermal_runaway_bed_state_machine; - static millis_t thermal_runaway_bed_timer; + 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 + + 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_1.h b/Marlin/src/module/thermistor/thermistor_1.h index ea887952f5aa..c87ee36a574f 100644 --- a/Marlin/src/module/thermistor/thermistor_1.h +++ b/Marlin/src/module/thermistor/thermistor_1.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/thermistor/thermistor_10.h b/Marlin/src/module/thermistor/thermistor_10.h index b54425fff857..ba07d13ecaaa 100644 --- a/Marlin/src/module/thermistor/thermistor_10.h +++ b/Marlin/src/module/thermistor/thermistor_10.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/thermistor/thermistor_1010.h b/Marlin/src/module/thermistor/thermistor_1010.h index 863a92fff82c..5883fb8732b4 100644 --- a/Marlin/src/module/thermistor/thermistor_1010.h +++ b/Marlin/src/module/thermistor/thermistor_1010.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/thermistor/thermistor_1047.h b/Marlin/src/module/thermistor/thermistor_1047.h index b4c69f58030c..bdfae4be9cc4 100644 --- a/Marlin/src/module/thermistor/thermistor_1047.h +++ b/Marlin/src/module/thermistor/thermistor_1047.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/thermistor/thermistor_11.h b/Marlin/src/module/thermistor/thermistor_11.h index eb8030697f29..caaab72206ca 100644 --- a/Marlin/src/module/thermistor/thermistor_11.h +++ b/Marlin/src/module/thermistor/thermistor_11.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/thermistor/thermistor_110.h b/Marlin/src/module/thermistor/thermistor_110.h index 5a5d387d4d45..0bad85132ff5 100644 --- a/Marlin/src/module/thermistor/thermistor_110.h +++ b/Marlin/src/module/thermistor/thermistor_110.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/thermistor/thermistor_12.h b/Marlin/src/module/thermistor/thermistor_12.h index c05ba4077b24..0182c7a6ec7e 100644 --- a/Marlin/src/module/thermistor/thermistor_12.h +++ b/Marlin/src/module/thermistor/thermistor_12.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/thermistor/thermistor_13.h b/Marlin/src/module/thermistor/thermistor_13.h index b0bfd8aa621d..39346c8eb0e2 100644 --- a/Marlin/src/module/thermistor/thermistor_13.h +++ b/Marlin/src/module/thermistor/thermistor_13.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/thermistor/thermistor_147.h b/Marlin/src/module/thermistor/thermistor_147.h index 22fe8a8e76d6..46d9146fb703 100644 --- a/Marlin/src/module/thermistor/thermistor_147.h +++ b/Marlin/src/module/thermistor/thermistor_147.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/thermistor/thermistor_15.h b/Marlin/src/module/thermistor/thermistor_15.h index 8e207cdca4e2..b39c94c230e1 100644 --- a/Marlin/src/module/thermistor/thermistor_15.h +++ b/Marlin/src/module/thermistor/thermistor_15.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/thermistor/thermistor_2.h b/Marlin/src/module/thermistor/thermistor_2.h index e747b2ffad23..6e85c6820211 100644 --- a/Marlin/src/module/thermistor/thermistor_2.h +++ b/Marlin/src/module/thermistor/thermistor_2.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/thermistor/thermistor_20.h b/Marlin/src/module/thermistor/thermistor_20.h index 1cd9480c8001..46d89b84d295 100644 --- a/Marlin/src/module/thermistor/thermistor_20.h +++ b/Marlin/src/module/thermistor/thermistor_20.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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/thermistor_3.h b/Marlin/src/module/thermistor/thermistor_3.h index a82a9b6ff9fb..23a27fafbd90 100644 --- a/Marlin/src/module/thermistor/thermistor_3.h +++ b/Marlin/src/module/thermistor/thermistor_3.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/thermistor/thermistor_4.h b/Marlin/src/module/thermistor/thermistor_4.h index 6c3ea6170929..a66d1d01fa92 100644 --- a/Marlin/src/module/thermistor/thermistor_4.h +++ b/Marlin/src/module/thermistor/thermistor_4.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/thermistor/thermistor_5.h b/Marlin/src/module/thermistor/thermistor_5.h index 676fbbd46048..18beb72e729c 100644 --- a/Marlin/src/module/thermistor/thermistor_5.h +++ b/Marlin/src/module/thermistor/thermistor_5.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/thermistor/thermistor_501.h b/Marlin/src/module/thermistor/thermistor_501.h index ac40d119b39d..5dec645ed1f0 100644 --- a/Marlin/src/module/thermistor/thermistor_501.h +++ b/Marlin/src/module/thermistor/thermistor_501.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/thermistor/thermistor_51.h b/Marlin/src/module/thermistor/thermistor_51.h index 0746c7055894..7461bf47a91e 100644 --- a/Marlin/src/module/thermistor/thermistor_51.h +++ b/Marlin/src/module/thermistor/thermistor_51.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/thermistor/thermistor_52.h b/Marlin/src/module/thermistor/thermistor_52.h index 63b53e1a709b..8abd92da93d4 100644 --- a/Marlin/src/module/thermistor/thermistor_52.h +++ b/Marlin/src/module/thermistor/thermistor_52.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/thermistor/thermistor_55.h b/Marlin/src/module/thermistor/thermistor_55.h index aa6677febec6..3f8678bb80e0 100644 --- a/Marlin/src/module/thermistor/thermistor_55.h +++ b/Marlin/src/module/thermistor/thermistor_55.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/thermistor/thermistor_6.h b/Marlin/src/module/thermistor/thermistor_6.h index bb97267ba910..e3f656576a61 100644 --- a/Marlin/src/module/thermistor/thermistor_6.h +++ b/Marlin/src/module/thermistor/thermistor_6.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/thermistor/thermistor_60.h b/Marlin/src/module/thermistor/thermistor_60.h index ab92406f4628..62ffc3d42e30 100644 --- a/Marlin/src/module/thermistor/thermistor_60.h +++ b/Marlin/src/module/thermistor/thermistor_60.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/thermistor/thermistor_61.h b/Marlin/src/module/thermistor/thermistor_61.h new file mode 100644 index 000000000000..4c481dc28eed --- /dev/null +++ b/Marlin/src/module/thermistor/thermistor_61.h @@ -0,0 +1,115 @@ +/** + * 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 . + * + */ + +// R25 = 100 kOhm, beta25 = 3950 K, 4.7 kOhm pull-up, +// Formbot / Vivedino high temp 100k thermistor +// 100KR13950181203 +// Generated with modified version of https://www.thingiverse.com/thing:103668 +// Using table 1 with datasheet values +// Resistance 100k Ohms at 25deg. C +// Resistance Tolerance + / -1% +// B Value 3950K at 25/50 deg. C +// B Value Tolerance + / - 1% +const short temptable_61[][2] PROGMEM = { + { OV( 2.00), 420 }, // Guestimate to ensure we dont lose a reading and drop temps to -50 when over + { OV( 12.07), 350 }, + { OV( 12.79), 345 }, + { OV( 13.59), 340 }, + { OV( 14.44), 335 }, + { OV( 15.37), 330 }, + { OV( 16.38), 325 }, + { OV( 17.46), 320 }, + { OV( 18.63), 315 }, + { OV( 19.91), 310 }, + { OV( 21.29), 305 }, + { OV( 22.79), 300 }, + { OV( 24.43), 295 }, + { OV( 26.21), 290 }, + { OV( 28.15), 285 }, + { OV( 30.27), 280 }, + { OV( 32.58), 275 }, + { OV( 35.10), 270 }, + { OV( 38.44), 265 }, + { OV( 40.89), 260 }, + { OV( 44.19), 255 }, + { OV( 47.83), 250 }, + { OV( 51.80), 245 }, + { OV( 56.20), 240 }, + { OV( 61.00), 235 }, + { OV( 66.30), 230 }, + { OV( 72.11), 225 }, + { OV( 78.51), 220 }, + { OV( 85.57), 215 }, + { OV( 93.34), 210 }, + { OV( 101.91), 205 }, + { OV( 111.34), 200 }, + { OV( 121.73), 195 }, + { OV( 133.17), 190 }, + { OV( 145.74), 185 }, + { OV( 159.57), 180 }, + { OV( 174.73), 175 }, + { OV( 191.35), 170 }, + { OV( 209.53), 165 }, + { OV( 229.35), 160 }, + { OV( 250.90), 155 }, + { OV( 274.25), 150 }, + { OV( 299.46), 145 }, + { OV( 326.52), 140 }, + { OV( 355.44), 135 }, + { OV( 386.15), 130 }, + { OV( 418.53), 125 }, + { OV( 452.43), 120 }, + { OV( 487.62), 115 }, + { OV( 523.82), 110 }, + { OV( 560.70), 105 }, + { OV( 597.88), 100 }, + { OV( 634.97), 95 }, + { OV( 671.55), 90 }, + { OV( 707.21), 85 }, + { OV( 741.54), 80 }, + { OV( 779.65), 75 }, + { OV( 809.57), 70 }, + { OV( 833.40), 65 }, + { OV( 859.55), 60 }, + { OV( 883.27), 55 }, + { OV( 904.53), 50 }, + { OV( 923.38), 45 }, + { OV( 939.91), 40 }, + { OV( 954.26), 35 }, + { OV( 966.59), 30 }, + { OV( 977.08), 25 }, + { OV( 985.92), 20 }, + { OV( 993.39), 15 }, + { OV( 999.42), 10 }, + { OV(1004.43), 5 }, + { OV(1008.51), 0 }, + { OV(1011.79), -5 }, + { OV(1014.40), -10 }, + { OV(1016.48), -15 }, + { OV(1018.10), -20 }, + { OV(1019.35), -25 }, + { OV(1020.32), -30 }, + { OV(1021.05), -35 }, + { OV(1021.60), -40 }, + { OV(1022.01), -45 }, + { OV(1022.31), -50 } +}; diff --git a/Marlin/src/module/thermistor/thermistor_66.h b/Marlin/src/module/thermistor/thermistor_66.h index 197029082c6b..895abd7a9371 100644 --- a/Marlin/src/module/thermistor/thermistor_66.h +++ b/Marlin/src/module/thermistor/thermistor_66.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -47,6 +47,6 @@ const short temptable_66[][2] PROGMEM = { { OV(1006.6), 80 }, { OV(1015.8), 60 }, { OV(1021.3), 30 }, - { OV( 1023) - 1, 25 }, + { OV( 1022), 25 }, { OV( 1023), 20 } }; diff --git a/Marlin/src/module/thermistor/thermistor_666.h b/Marlin/src/module/thermistor/thermistor_666.h index be76b03dfa73..c6261b8f8734 100755 --- a/Marlin/src/module/thermistor/thermistor_666.h +++ b/Marlin/src/module/thermistor/thermistor_666.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/thermistor/thermistor_67.h b/Marlin/src/module/thermistor/thermistor_67.h new file mode 100644 index 000000000000..4483fb5f8a54 --- /dev/null +++ b/Marlin/src/module/thermistor/thermistor_67.h @@ -0,0 +1,80 @@ +/** + * 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 . + * + */ + +// R25 = 500 KOhm, beta25 = 3800 K, 4.7 kOhm pull-up, SliceEngineering 450 °C Thermistor +const short temptable_67[][2] PROGMEM = { + { OV( 22 ), 500 }, + { OV( 23 ), 490 }, + { OV( 25 ), 480 }, + { OV( 27 ), 470 }, + { OV( 29 ), 460 }, + { OV( 32 ), 450 }, + { OV( 35 ), 440 }, + { OV( 38 ), 430 }, + { OV( 41 ), 420 }, + { OV( 45 ), 410 }, + { OV( 50 ), 400 }, + { OV( 55 ), 390 }, + { OV( 60 ), 380 }, + { OV( 67 ), 370 }, + { OV( 74 ), 360 }, + { OV( 82 ), 350 }, + { OV( 91 ), 340 }, + { OV( 102 ), 330 }, + { OV( 114 ), 320 }, + { OV( 127 ), 310 }, + { OV( 143 ), 300 }, + { OV( 161 ), 290 }, + { OV( 181 ), 280 }, + { OV( 204 ), 270 }, + { OV( 229 ), 260 }, + { OV( 259 ), 250 }, + { OV( 290 ), 240 }, + { OV( 325 ), 230 }, + { OV( 364 ), 220 }, + { OV( 407 ), 210 }, + { OV( 453 ), 200 }, + { OV( 501 ), 190 }, + { OV( 551 ), 180 }, + { OV( 603 ), 170 }, + { OV( 655 ), 160 }, + { OV( 706 ), 150 }, + { OV( 755 ), 140 }, + { OV( 801 ), 130 }, + { OV( 842 ), 120 }, + { OV( 879 ), 110 }, + { OV( 910 ), 100 }, + { OV( 936 ), 90 }, + { OV( 948 ), 85 }, + { OV( 958 ), 80 }, + { OV( 975 ), 70 }, + { OV( 988 ), 60 }, + { OV( 998 ), 50 }, + { OV(1006 ), 40 }, + { OV(1011 ), 30 }, + { OV(1013 ), 25 }, + { OV(1015 ), 20 }, + { OV(1018 ), 10 }, + { OV(1020 ), 0 }, + { OV(1021 ), -10 }, + { OV(1022 ), -20 } +}; diff --git a/Marlin/src/module/thermistor/thermistor_7.h b/Marlin/src/module/thermistor/thermistor_7.h index 025c53ce974f..ce13b1f837bc 100644 --- a/Marlin/src/module/thermistor/thermistor_7.h +++ b/Marlin/src/module/thermistor/thermistor_7.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/thermistor/thermistor_70.h b/Marlin/src/module/thermistor/thermistor_70.h index 2f9434e30067..a7984a93751b 100644 --- a/Marlin/src/module/thermistor/thermistor_70.h +++ b/Marlin/src/module/thermistor/thermistor_70.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/thermistor/thermistor_71.h b/Marlin/src/module/thermistor/thermistor_71.h index f28a4ceabb28..12da429a0e5a 100644 --- a/Marlin/src/module/thermistor/thermistor_71.h +++ b/Marlin/src/module/thermistor/thermistor_71.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/thermistor/thermistor_75.h b/Marlin/src/module/thermistor/thermistor_75.h index 488535aaad30..d83e153e946d 100644 --- a/Marlin/src/module/thermistor/thermistor_75.h +++ b/Marlin/src/module/thermistor/thermistor_75.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/thermistor/thermistor_8.h b/Marlin/src/module/thermistor/thermistor_8.h index 3ef78da0c512..6372253cba24 100644 --- a/Marlin/src/module/thermistor/thermistor_8.h +++ b/Marlin/src/module/thermistor/thermistor_8.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/thermistor/thermistor_9.h b/Marlin/src/module/thermistor/thermistor_9.h index e9ef924d1f2d..14a4c4c2735d 100644 --- a/Marlin/src/module/thermistor/thermistor_9.h +++ b/Marlin/src/module/thermistor/thermistor_9.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/thermistor/thermistor_998.h b/Marlin/src/module/thermistor/thermistor_998.h index 66becc7029f5..ac8c9dc46651 100644 --- a/Marlin/src/module/thermistor/thermistor_998.h +++ b/Marlin/src/module/thermistor/thermistor_998.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/thermistor/thermistor_999.h b/Marlin/src/module/thermistor/thermistor_999.h index ea45952f602f..fab9e3fdef68 100644 --- a/Marlin/src/module/thermistor/thermistor_999.h +++ b/Marlin/src/module/thermistor/thermistor_999.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/thermistor/thermistors.h b/Marlin/src/module/thermistor/thermistors.h index 953fdf7fead8..ab82f2603dbb 100644 --- a/Marlin/src/module/thermistor/thermistors.h +++ b/Marlin/src/module/thermistor/thermistors.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 // @@ -98,9 +98,15 @@ #if ANY_THERMISTOR_IS(60) // beta25 = 3950 K, R25 = 100 kOhm, Pull-up = 4.7 kOhm, "Maker's Tool Works Kapton Bed" #include "thermistor_60.h" #endif +#if ANY_THERMISTOR_IS(61) // beta25 = 3950 K, R25 = 100 kOhm, Pull-up = 4.7 kOhm, "Formbot 350°C Thermistor" + #include "thermistor_61.h" +#endif #if ANY_THERMISTOR_IS(66) // beta25 = 4500 K, R25 = 2.5 MOhm, Pull-up = 4.7 kOhm, "DyzeDesign 500 °C Thermistor" #include "thermistor_66.h" #endif +#if ANY_THERMISTOR_IS(67) // R25 = 500 KOhm, beta25 = 3800 K, 4.7 kOhm pull-up, SliceEngineering 450 °C Thermistor + #include "thermistor_67.h" +#endif #if ANY_THERMISTOR_IS(12) // beta25 = 4700 K, R25 = 100 kOhm, Pull-up = 4.7 kOhm, "Personal calibration for Makibox hot bed" #include "thermistor_12.h" #endif @@ -185,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) @@ -256,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 a4e202c5157b..aa9e7ed873a3 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 @@ -42,12 +45,12 @@ #endif #endif -#if ENABLED(PARKING_EXTRUDER) && PARKING_EXTRUDER_SOLENOIDS_DELAY > 0 +#if ENABLED(MAGNETIC_PARKING_EXTRUDER) || (ENABLED(PARKING_EXTRUDER) && PARKING_EXTRUDER_SOLENOIDS_DELAY > 0) #include "../gcode/gcode.h" // for dwell() #endif -#if ENABLED(SWITCHING_EXTRUDER) || ENABLED(SWITCHING_NOZZLE) || ENABLED(SWITCHING_TOOLHEAD) - #include "../module/servo.h" +#if ANY(SWITCHING_EXTRUDER, SWITCHING_NOZZLE, SWITCHING_TOOLHEAD) + #include "servo.h" #endif #if ENABLED(EXT_SOLENOID) && DISABLED(PARKING_EXTRUDER) @@ -70,6 +73,10 @@ #include "../feature/fanmux.h" #endif +#if ENABLED(PRUSA_MMU2) + #include "../feature/prusa_MMU2/mmu2.h" +#endif + #if HAS_LCD_MENU #include "../lcd/ultralcd.h" #endif @@ -96,25 +103,159 @@ #endif // DO_SWITCH_EXTRUDER #if ENABLED(SWITCHING_NOZZLE) - void move_nozzle_servo(const uint8_t e) { + + #if SWITCHING_NOZZLE_TWO_SERVOS + + inline void _move_nozzle_servo(const uint8_t e, const uint8_t angle_index) { + constexpr int8_t sns_index[2] = { SWITCHING_NOZZLE_SERVO_NR, SWITCHING_NOZZLE_E1_SERVO_NR }; + constexpr int16_t sns_angles[2] = SWITCHING_NOZZLE_SERVO_ANGLES; + planner.synchronize(); + MOVE_SERVO(sns_index[e], sns_angles[angle_index]); + safe_delay(500); + } + + void lower_nozzle(const uint8_t e) { _move_nozzle_servo(e, 0); } + void raise_nozzle(const uint8_t e) { _move_nozzle_servo(e, 1); } + + #else + + void move_nozzle_servo(const uint8_t angle_index) { + planner.synchronize(); + MOVE_SERVO(SWITCHING_NOZZLE_SERVO_NR, servo_angles[SWITCHING_NOZZLE_SERVO_NR][angle_index]); + safe_delay(500); + } + + #endif + +#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 + parkinggrabdistance , // M951 I + parkingslowspeed, // M951 J + parkinghighspeed , // M951 H + parkingtraveldistance, // M951 D + compensationmultiplier; + + inline void magnetic_parking_extruder_tool_change(const uint8_t tmp_extruder) { + + const float oldx = current_position[X_AXIS], + grabpos = mpe_settings.parking_xpos[tmp_extruder] + (tmp_extruder ? mpe_settings.grab_distance : -mpe_settings.grab_distance), + offsetcompensation = + #if HAS_HOTEND_OFFSET + hotend_offset[X_AXIS][active_extruder] * mpe_settings.compensation_factor + #else + 0 + #endif + ; + + if (axis_unhomed_error(true, false, false)) return; + + /** + * Z Lift and Nozzle Offset shift ar defined in caller method to work equal with any Multi Hotend realization + * + * Steps: + * 1. Move high speed to park position of new extruder + * 2. Move to couple position of new extruder (this also discouple the old extruder) + * 3. Move to park position of new extruder + * 4. Move high speed to approach park position of old extruder + * 5. Move to park position of old extruder + * 6. Move to starting position + */ + + // STEP 1 + + current_position[X_AXIS] = mpe_settings.parking_xpos[tmp_extruder] + offsetcompensation; + + 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(); - MOVE_SERVO(SWITCHING_NOZZLE_SERVO_NR, servo_angles[SWITCHING_NOZZLE_SERVO_NR][e]); - safe_delay(500); + + // STEP 2 + + current_position[X_AXIS] = grabpos + offsetcompensation; + + 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(); + + // Delay before moving tool, to allow magnetic coupling + gcode.dwell(150); + + // STEP 3 + + current_position[X_AXIS] = mpe_settings.parking_xpos[tmp_extruder] + offsetcompensation; + 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(); + + // STEP 4 + + current_position[X_AXIS] = mpe_settings.parking_xpos[active_extruder] + (active_extruder == 0 ? MPE_TRAVEL_DISTANCE : -MPE_TRAVEL_DISTANCE) + offsetcompensation; + 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(); + + // STEP 5 + + current_position[X_AXIS] = mpe_settings.parking_xpos[active_extruder] + offsetcompensation; + + 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(); + + // STEP 6 + + current_position[X_AXIS] = oldx; + + 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 (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Autopark done."); } -#endif // SWITCHING_NOZZLE -#if ENABLED(PARKING_EXTRUDER) +#elif ENABLED(PARKING_EXTRUDER) - void pe_magnet_init() { + void pe_solenoid_init() { for (uint8_t n = 0; n <= 1; ++n) #if ENABLED(PARKING_EXTRUDER_SOLENOIDS_INVERT) - pe_activate_magnet(n); + pe_activate_solenoid(n); #else - pe_deactivate_magnet(n); + pe_deactivate_solenoid(n); #endif } - void pe_set_magnet(const uint8_t extruder_num, const uint8_t state) { + void pe_set_solenoid(const uint8_t extruder_num, const uint8_t state) { switch (extruder_num) { case 1: OUT_WRITE(SOL1_PIN, state); break; default: OUT_WRITE(SOL0_PIN, state); break; @@ -139,90 +280,64 @@ grabpos = parkingposx[tmp_extruder] + (tmp_extruder ? PARKING_EXTRUDER_GRAB_DISTANCE : -(PARKING_EXTRUDER_GRAB_DISTANCE)) + x_offset; /** - * 1. Raise Z-Axis to give enough clearance - * 2. Move to park position of old extruder - * 3. Disengage magnetic field, wait for delay - * 4. Move near new extruder - * 5. Engage magnetic field for new extruder - * 6. Move to parking incl. offset of new extruder - * 7. Lower Z-Axis + * 1. Move to park position of old extruder + * 2. Disengage magnetic field, wait for delay + * 3. Move near new extruder + * 4. Engage magnetic field for new extruder + * 5. Move to parking incl. offset of new extruder + * 6. Lower Z-Axis */ // 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; + current_position[X_AXIS] = parkingposx[active_extruder] + x_offset; - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("(1) Raise Z-Axis", current_position); - #endif + if (DEBUGGING(LEVELING)) { + DEBUG_ECHOLNPAIR("(1) Park extruder ", int(active_extruder)); + DEBUG_POS("Moving ParkPos", current_position); + } - planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Z_AXIS], active_extruder); + fast_line_to_current(X_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_ECHOLNPGM("(2) Disengage magnet "); - planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS], active_extruder); - planner.synchronize(); + pe_deactivate_solenoid(active_extruder); // STEP 3 - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(3) Disengage magnet "); - #endif - - pe_deactivate_magnet(active_extruder); - - // STEP 4 - - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(4) Move to position near new extruder"); - #endif + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(3) 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 + // STEP 4 + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(4) Engage magnetic field"); #if ENABLED(PARKING_EXTRUDER_SOLENOIDS_INVERT) - pe_activate_magnet(active_extruder); //just save power for inverted magnets + pe_activate_solenoid(active_extruder); //just save power for inverted magnets #endif - pe_activate_magnet(tmp_extruder); + pe_activate_solenoid(tmp_extruder); - // STEP 6 + // STEP 5 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("(5) 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 + // STEP 6 current_position[X_AXIS] = midpos #if HAS_HOTEND_OFFSET @@ -230,32 +345,20 @@ #endif ; - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("(7) Move midway between hotends", current_position); - #endif + if (DEBUGGING(LEVELING)) DEBUG_POS("(6) 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 - pe_activate_magnet(tmp_extruder); + pe_activate_solenoid(tmp_extruder); #if ENABLED(PARKING_EXTRUDER_SOLENOIDS_INVERT) - pe_activate_magnet(active_extruder); // Just save power for inverted magnets + 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 @@ -272,113 +375,78 @@ grabxpos = toolheadposx[tmp_extruder]; /** - * 1. Raise Z to give enough clearance - * 2. Move to switch position of current toolhead - * 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 + * 1. Move to switch position of current toolhead + * 2. Unlock tool and drop it in the dock + * 3. Move to the new toolhead + * 4. Grab and lock the new toolhead */ - // STEP 1 + // 1. Move to switch position of current toolhead - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("Starting Toolhead change", current_position); - #endif - - current_position[Z_AXIS] += toolchange_settings.z_raise; - - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("(1) Raise Z-Axis", current_position); - #endif - - planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Z_AXIS], active_extruder); - planner.synchronize(); - - // STEP 2 + if (DEBUGGING(LEVELING)) DEBUG_POS("Starting Toolhead change", current_position); 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("(1) 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 + // 2. 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("(2) 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 + // 3. 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("(3) 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 + // 4. 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("(4) 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(); @@ -389,29 +457,132 @@ 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 (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Toolhead change done."); + } - #if HAS_HOTEND_OFFSET - current_position[Z_AXIS] += hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder]; - #endif +#endif // SWITCHING_TOOLHEAD - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) DEBUG_POS("(6) Apply Z offset", current_position); - #endif +#if ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) - #if ENABLED(DEBUG_LEVELING_FEATURE) - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("Toolhead change done."); - #endif + inline void magnetic_switching_toolhead_tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool no_move/*=false*/) { + if (no_move) return; + + const float toolheadposx[] = SWITCHING_TOOLHEAD_X_POS, + placexpos = toolheadposx[active_extruder], + grabxpos = toolheadposx[tmp_extruder]; + + /** + * 1. Move to switch position of current toolhead + * 2. Release and place toolhead in the dock + * 3. Move to the new toolhead + * 4. Grab the new toolhead and move to security position + */ + + if (DEBUGGING(LEVELING)) DEBUG_POS("Starting Toolhead change", current_position); + + // 1. Move to switch position current toolhead + + current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_CLEAR; + + if (DEBUGGING(LEVELING)) { + SERIAL_ECHOLNPAIR("(1) Place old tool ", int(active_extruder)); + DEBUG_POS("Move Y SwitchPos + Security", current_position); + } + + planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Y_AXIS], active_extruder); + planner.synchronize(); + + current_position[X_AXIS] = placexpos + SWITCHING_TOOLHEAD_X_SECURITY; + + if (DEBUGGING(LEVELING)) DEBUG_POS("Move X SwitchPos + Security", current_position); + + planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS], active_extruder); + planner.synchronize(); + + current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS; + + if (DEBUGGING(LEVELING)) DEBUG_POS("Move Y SwitchPos", current_position); + + planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Y_AXIS], active_extruder); + planner.synchronize(); + + current_position[X_AXIS] = placexpos; + + if (DEBUGGING(LEVELING)) DEBUG_POS("Move X SwitchPos", current_position); + + planner.buffer_line(current_position, (planner.settings.max_feedrate_mm_s[X_AXIS] * 0.25), active_extruder); + planner.synchronize(); + + // 2. Release and place toolhead in the dock + + if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(2) Release and Place Toolhead"); + + current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_RELEASE; + + if (DEBUGGING(LEVELING)) DEBUG_POS("Move Y SwitchPos + Release", current_position); + + planner.buffer_line(current_position, (planner.settings.max_feedrate_mm_s[Y_AXIS] * 0.1), active_extruder); + planner.synchronize(); + + current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_SECURITY; + + if (DEBUGGING(LEVELING)) DEBUG_POS("Move Y SwitchPos + Security", current_position); + + planner.buffer_line(current_position, (planner.settings.max_feedrate_mm_s[Y_AXIS]), active_extruder); + planner.synchronize(); + + // 3. Move to new toolhead position + + if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(3) Move to new toolhead position"); + + current_position[X_AXIS] = grabxpos; + + if (DEBUGGING(LEVELING)) DEBUG_POS("Move to new toolhead X", current_position); + + planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS], active_extruder); + planner.synchronize(); + + // 4. Grab the new toolhead and move to security position + + if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(4) Grab new toolhead and move to security position"); + + current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_RELEASE; + + if (DEBUGGING(LEVELING)) DEBUG_POS("Move Y SwitchPos + Release", current_position); + + planner.buffer_line(current_position, (planner.settings.max_feedrate_mm_s[Y_AXIS]), active_extruder); + planner.synchronize(); + + current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS; + + if (DEBUGGING(LEVELING)) DEBUG_POS("Move Y SwitchPos", current_position); + + planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Y_AXIS] * 0.2, active_extruder); + planner.synchronize(); + safe_delay(100); + + current_position[X_AXIS] = grabxpos + SWITCHING_TOOLHEAD_X_SECURITY; + + if (DEBUGGING(LEVELING)) DEBUG_POS("Move to new toolhead X + Security", current_position); + + planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS] * 0.1, active_extruder); + planner.synchronize(); + safe_delay(100); + + current_position[Y_AXIS] += SWITCHING_TOOLHEAD_Y_CLEAR; + + if (DEBUGGING(LEVELING)) DEBUG_POS("Move back Y clear", current_position); + + planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Y_AXIS], active_extruder); // move away from docked toolhead + planner.synchronize(); } -#endif // SWITCHING_TOOLHEAD +#endif // MAGNETIC_SWITCHING_TOOLHEAD inline void invalid_extruder_error(const uint8_t e) { SERIAL_ECHO_START(); @@ -422,17 +593,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 @@ -440,29 +609,20 @@ 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(); } - // Apply Y & Z extruder offset (X offset is used as home pos with Dual X) - current_position[Y_AXIS] -= hotend_offset[Y_AXIS][active_extruder] - hotend_offset[Y_AXIS][tmp_extruder]; - current_position[Z_AXIS] -= hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder]; - // Activate the new extruder ahead of calling set_axis_is_at_home! active_extruder = tmp_extruder; // 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: @@ -481,12 +641,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 @@ -496,6 +654,11 @@ inline void invalid_extruder_error(const uint8_t e) { * previous tool out of the way and the new tool into place. */ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool no_move/*=false*/) { + + #if ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + if (tmp_extruder == active_extruder) return; + #endif + #if ENABLED(MIXING_EXTRUDER) UNUSED(fr_mm_s); UNUSED(no_move); @@ -503,11 +666,17 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n if (tmp_extruder >= MIXING_VIRTUAL_TOOLS) return invalid_extruder_error(tmp_extruder); - #if MIXING_VIRTUAL_TOOLS > 1 + #if MIXING_VIRTUAL_TOOLS > 1 // T0-Tnnn: Switch virtual tool by changing the index to the mix - mixer.T(uint_fast8_t(tmp_extruder)); + mixer.T(tmp_extruder); #endif + #elif ENABLED(PRUSA_MMU2) + + UNUSED(fr_mm_s); UNUSED(no_move); + + mmu2.tool_change(tmp_extruder); + #elif EXTRUDERS < 2 UNUSED(fr_mm_s); UNUSED(no_move); @@ -519,7 +688,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 @@ -535,9 +704,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 @@ -553,8 +720,7 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n #endif if (should_swap) { if (too_cold) { - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM(MSG_ERR_HOTEND_TOO_COLD); + SERIAL_ECHO_MSG(MSG_ERR_HOTEND_TOO_COLD); #if ENABLED(SINGLENOZZLE) active_extruder = tmp_extruder; return; @@ -572,26 +738,16 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n #endif // TOOLCHANGE_FILAMENT_SWAP if (tmp_extruder != active_extruder) { - const float old_feedrate_mm_s = fr_mm_s > 0.0 ? fr_mm_s : feedrate_mm_s; - feedrate_mm_s = fr_mm_s > 0.0 ? fr_mm_s : XY_PROBE_FEEDRATE_MM_S; - #if 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 + #if SWITCHING_NOZZLE_TWO_SERVOS + raise_nozzle(active_extruder); + #endif - // Don't move the new extruder out of bounds - if (!WITHIN(current_position[X_AXIS], minx, maxx)) no_move = true; + 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 HAS_SOFTWARE_ENDSTOPS && ENABLED(DUAL_X_CARRIAGE) + update_software_endstops(X_AXIS, active_extruder, tmp_extruder); #endif set_destination_from_current(); @@ -599,20 +755,21 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n if (!no_move) { #if DISABLED(SWITCHING_NOZZLE) // Do a small lift to avoid the workpiece in the move back (below) + current_position[Z_AXIS] += toolchange_settings.z_raise; + #if HAS_SOFTWARE_ENDSTOPS + NOMORE(current_position[Z_AXIS], soft_endstop[Z_AXIS].max); + #endif + fast_line_to_current(Z_AXIS); #if ENABLED(TOOLCHANGE_PARK) current_position[X_AXIS] = toolchange_settings.change_point.x; current_position[Y_AXIS] = toolchange_settings.change_point.y; #endif - current_position[Z_AXIS] += toolchange_settings.z_raise; - #if HAS_SOFTWARE_ENDSTOPS - NOMORE(current_position[Z_AXIS], soft_endstop_max[Z_AXIS]); - #endif planner.buffer_line(current_position, feedrate_mm_s, active_extruder); #endif planner.synchronize(); } - #if HOTENDS > 1 + #if HAS_HOTEND_OFFSET #if ENABLED(DUAL_X_CARRIAGE) constexpr float xdiff = 0; #else @@ -628,26 +785,24 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n dualx_tool_change(tmp_extruder, no_move); #elif ENABLED(PARKING_EXTRUDER) // Dual Parking extruder parking_extruder_tool_change(tmp_extruder, no_move); + #elif ENABLED(MAGNETIC_PARKING_EXTRUDER) // Magnetic Parking extruder + magnetic_parking_extruder_tool_change(tmp_extruder); #elif ENABLED(SWITCHING_TOOLHEAD) // Switching Toolhead switching_toolhead_tool_change(tmp_extruder, fr_mm_s, no_move); - #elif ENABLED(SWITCHING_NOZZLE) - // Always raise by a configured distance to avoid workpiece + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) // Magnetic Switching Toolhead + magnetic_switching_toolhead_tool_change(tmp_extruder, fr_mm_s, no_move); + #elif ENABLED(SWITCHING_NOZZLE) && !SWITCHING_NOZZLE_TWO_SERVOS + // Raise by a configured distance to avoid workpiece, except with + // SWITCHING_NOZZLE_TWO_SERVOS, as both nozzles will lift instead. 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; @@ -669,20 +824,18 @@ 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 - singlenozzle_fan_speed[active_extruder] = fan_speed[0]; - fan_speed[0] = singlenozzle_fan_speed[tmp_extruder]; + singlenozzle_fan_speed[active_extruder] = thermalManager.fan_speed[0]; + 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) + #if EITHER(ULTRA_LCD, EXTENSIBLE_UI) thermalManager.set_heating_message(0); #endif (void)thermalManager.wait_for_hotend(0, false); // Wait for heating or cooling @@ -693,17 +846,34 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) if (should_swap && !too_cold) { #if ENABLED(ADVANCED_PAUSE_FEATURE) - do_pause_e_move(toolchange_settings.swap_length, toolchange_settings.prime_speed); + do_pause_e_move(toolchange_settings.swap_length + TOOLCHANGE_FIL_EXTRA_PRIME, MMM_TO_MMS(toolchange_settings.prime_speed)); #else - current_position[E_AXIS] += toolchange_settings.swap_length / planner.e_factor[tmp_extruder]; - planner.buffer_line(current_position, toolchange_settings.prime_speed, tmp_extruder); + current_position[E_AXIS] += (toolchange_settings.swap_length + TOOLCHANGE_FIL_EXTRA_PRIME) / planner.e_factor[tmp_extruder]; + planner.buffer_line(current_position, MMM_TO_MMS(toolchange_settings.prime_speed), tmp_extruder); + #endif + planner.synchronize(); + + #if TOOLCHANGE_FIL_EXTRA_PRIME + planner.set_e_position_mm((destination[E_AXIS] = current_position[E_AXIS] = current_position[E_AXIS] - (TOOLCHANGE_FIL_EXTRA_PRIME))); #endif + } + #endif + + // Prevent a move outside physical bounds + #if ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + // If the original position is within tool store area, go to X origin at once + if (destination[Y_AXIS] < SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_CLEAR) { + current_position[X_AXIS] = 0; + planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS], active_extruder); planner.synchronize(); } + #else + apply_motion_limits(destination); #endif // Move back to the original (or tweaked) position - do_blocking_move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS]); + do_blocking_move_to(destination); + #if ENABLED(DUAL_X_CARRIAGE) active_extruder_parked = false; #endif @@ -715,6 +885,15 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n do_blocking_move_to_z(destination[Z_AXIS], planner.settings.max_feedrate_mm_s[Z_AXIS]); } #endif + + #if ENABLED(PRUSA_MMU2) + mmu2.tool_change(tmp_extruder); + #endif + + #if SWITCHING_NOZZLE_TWO_SERVOS + lower_nozzle(active_extruder); + #endif + } // (tmp_extruder != active_extruder) planner.synchronize(); @@ -724,10 +903,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/module/tool_change.h b/Marlin/src/module/tool_change.h index 39f6a4b52f8c..07f88dce8821 100644 --- a/Marlin/src/module/tool_change.h +++ b/Marlin/src/module/tool_change.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -45,7 +45,12 @@ #endif #if ENABLED(SWITCHING_NOZZLE) - void move_nozzle_servo(const uint8_t e); + #if SWITCHING_NOZZLE_TWO_SERVOS + void lower_nozzle(const uint8_t e); + void raise_nozzle(const uint8_t e); + #else + void move_nozzle_servo(const uint8_t angle_index); + #endif #endif #if ENABLED(PARKING_EXTRUDER) @@ -56,14 +61,29 @@ #define PE_MAGNET_ON_STATE PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE #endif - void pe_set_magnet(const uint8_t extruder_num, const uint8_t state); + void pe_set_solenoid(const uint8_t extruder_num, const uint8_t state); + + inline void pe_activate_solenoid(const uint8_t extruder_num) { pe_set_solenoid(extruder_num, PE_MAGNET_ON_STATE); } + inline void pe_deactivate_solenoid(const uint8_t extruder_num) { pe_set_solenoid(extruder_num, !PE_MAGNET_ON_STATE); } + + void pe_solenoid_init(); - inline void pe_activate_magnet(const uint8_t extruder_num) { pe_set_magnet(extruder_num, PE_MAGNET_ON_STATE); } - inline void pe_deactivate_magnet(const uint8_t extruder_num) { pe_set_magnet(extruder_num, !PE_MAGNET_ON_STATE); } +#elif ENABLED(MAGNETIC_PARKING_EXTRUDER) - void pe_magnet_init(); + typedef struct MPESettings { + float parking_xpos[2], // M951 L R + grab_distance, // M951 I + slow_feedrate, // M951 J + fast_feedrate, // M951 H + travel_distance, // M951 D + compensation_factor; // M951 C + } mpe_settings_t; -#endif // PARKING_EXTRUDER + extern mpe_settings_t mpe_settings; + + void mpe_settings_init(); + +#endif #if ENABLED(SINGLENOZZLE) extern uint16_t singlenozzle_temp[EXTRUDERS]; diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index da1b0cd43552..bb7a10108e64 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -94,12 +94,16 @@ #include "pins_K8200.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560 (3DRAG) #elif MB(K8400) #include "pins_K8400.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560 (3DRAG) +#elif MB(K8800) + #include "pins_K8800.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560 (3DRAG) #elif MB(BAM_DICE) #include "pins_RAMPS.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560 #elif MB(BAM_DICE_DUE) #include "pins_BAM_DICE_DUE.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560 #elif MB(MKS_BASE) #include "pins_MKS_BASE.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560 +#elif MB(MKS_BASE_14) + #include "pins_MKS_BASE_14.h" // ATmega2560 env:megaatmega2560 #elif MB(MKS_BASE_15) #include "pins_MKS_BASE_15.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560 #elif MB(MKS_BASE_HEROIC) @@ -109,7 +113,7 @@ #elif MB(MKS_GEN_L) #include "pins_MKS_GEN_L.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560 #elif MB(KFB_2) - #include "pins_KFB_2.h" // ATmega2560 env:megaatmega2560 + #include "pins_BIQU_KFB_2.h" // ATmega2560 env:megaatmega2560 #elif MB(ZRIB_V20) #include "pins_ZRIB_V20.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560 (MKS_GEN_13) #elif MB(FELIX2) @@ -142,6 +146,8 @@ #include "pins_RUMBA.h" // ATmega2560 env:megaatmega2560 #elif MB(RUMBA_RAISE3D) #include "pins_RUMBA_RAISE3D.h" // ATmega2560 env:megaatmega2560 +#elif MB(RL200) + #include "pins_RL200.h" // ATmega2560 env:megaatmega2560 #elif MB(BQ_ZUM_MEGA_3D) #include "pins_BQ_ZUM_MEGA_3D.h" // ATmega2560 env:megaatmega2560 #elif MB(MAKEBOARD_MINI) @@ -156,6 +162,12 @@ #include "pins_RAMPS_CREALITY.h" // ATmega2560 env:megaatmega2560 #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 +#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 @@ -175,7 +187,7 @@ #include "pins_MEGATRONICS.h" // ATmega2560 env:megaatmega2560 #elif MB(MEGATRONICS_2) #include "pins_MEGATRONICS_2.h" // ATmega2560 env:megaatmega2560 -#elif MB(MEGATRONICS_3) || MB(MEGATRONICS_31) +#elif MB(MEGATRONICS_3) || MB(MEGATRONICS_31) || MB(MEGATRONICS_32) #include "pins_MEGATRONICS_3.h" // ATmega2560 env:megaatmega2560 #elif MB(RAMBO) #include "pins_RAMBO.h" // ATmega2560 env:rambo @@ -201,6 +213,8 @@ #include "pins_GT2560_V3.h" // ATmega2560 env:megaatmega2560 #elif MB(GT2560_V3_MC2) #include "pins_GT2560_V3_MC2.h" // ATmega2560 env:megaatmega2560 +#elif MB(GT2560_V3_A20) + #include "pins_GT2560_V3_A20.h" // ATmega2560 env:megaatmega2560 #elif MB(EINSTART_S) #include "pins_EINSTART-S.h" // ATmega1280, ATmega2560 env:megaatmega1280 env:megaatmega2560 @@ -291,33 +305,43 @@ // #elif MB(RAMPS_14_RE_ARM_EFB) - #include "pins_RAMPS_RE_ARM.h" // LPC1768 env:LPC1768 + #include "pins_RAMPS_RE_ARM.h" // LPC1768 env:LPC1768 #elif MB(RAMPS_14_RE_ARM_EEB) - #include "pins_RAMPS_RE_ARM.h" // LPC1768 env:LPC1768 + #include "pins_RAMPS_RE_ARM.h" // LPC1768 env:LPC1768 #elif MB(RAMPS_14_RE_ARM_EFF) - #include "pins_RAMPS_RE_ARM.h" // LPC1768 env:LPC1768 + #include "pins_RAMPS_RE_ARM.h" // LPC1768 env:LPC1768 #elif MB(RAMPS_14_RE_ARM_EEF) - #include "pins_RAMPS_RE_ARM.h" // LPC1768 env:LPC1768 + #include "pins_RAMPS_RE_ARM.h" // LPC1768 env:LPC1768 #elif MB(RAMPS_14_RE_ARM_SF) - #include "pins_RAMPS_RE_ARM.h" // LPC1768 env:LPC1768 + #include "pins_RAMPS_RE_ARM.h" // LPC1768 env:LPC1768 #elif MB(MKS_SBASE) - #include "pins_MKS_SBASE.h" // LPC1768 env:LPC1768 + #include "pins_MKS_SBASE.h" // LPC1768 env:LPC1768 +#elif MB(MKS_SGEN) + #include "pins_MKS_SGEN.h" // LPC1769 env:LPC1769 #elif MB(AZSMZ_MINI) - #include "pins_AZSMZ_MINI.h" // LPC1768 env:LPC1768 + #include "pins_AZSMZ_MINI.h" // LPC1768 env:LPC1768 #elif MB(AZTEEG_X5_GT) - #include "pins_AZTEEG_X5_GT.h" // LPC1769 env:LPC1769 + #include "pins_AZTEEG_X5_GT.h" // LPC1769 env:LPC1769 +#elif MB(AZTEEG_X5_MINI) + #include "pins_AZTEEG_X5_MINI.h" // LPC1769 env:LPC1769 #elif MB(AZTEEG_X5_MINI_WIFI) - #include "pins_AZTEEG_X5_MINI_WIFI.h" // LPC1769 env:LPC1769 + #include "pins_AZTEEG_X5_MINI_WIFI.h" // LPC1769 env:LPC1769 #elif MB(BIQU_BQ111_A4) - #include "pins_BIQU_BQ111_A4.h" // LPC1768 env:LPC1768 + #include "pins_BIQU_BQ111_A4.h" // LPC1768 env:LPC1768 #elif MB(SELENA_COMPACT) - #include "pins_SELENA_COMPACT.h" // LPC1768 env:LPC1768 + #include "pins_SELENA_COMPACT.h" // LPC1768 env:LPC1768 #elif MB(COHESION3D_REMIX) - #include "pins_COHESION3D_REMIX.h" // LPC1769 env:LPC1769 + #include "pins_COHESION3D_REMIX.h" // LPC1769 env:LPC1769 #elif MB(COHESION3D_MINI) - #include "pins_COHESION3D_MINI.h" // LPC1769 env:LPC1769 + #include "pins_COHESION3D_MINI.h" // LPC1769 env:LPC1769 #elif MB(SMOOTHIEBOARD) - #include "pins_SMOOTHIEBOARD.h" // LPC1769 env:LPC1769 + #include "pins_SMOOTHIEBOARD.h" // LPC1769 env:LPC1769 +#elif MB(BIQU_SKR_V1_1) + #include "pins_BIQU_SKR_V1.1.h" // LPC1768 env:LPC1768 +#elif MB(BIQU_B300_V1_0) + #include "pins_BIQU_B300_V1.0.h" // LPC1768 env:LPC1768 +#elif MB(BIGTREE_SKR_V1_3) + #include "pins_BIGTREE_SKR_V1.3.h" // LPC1768 env:LPC1768 // // Other 32-bit Boards @@ -375,6 +399,10 @@ #include "pins_ARCHIM2.h" // SAM3X8E env:DUE env:DUE_debug #elif MB(ALLIGATOR) #include "pins_ALLIGATOR_R2.h" // SAM3X8E env:DUE env:DUE_debug +#elif MB(ADSK) + #include "pins_ADSK.h" // SAM3X8E env:DUE env:DUE_debug +#elif MB(PRINTRBOARD_G2) + #include "pins_PRINTRBOARD_G2.h" // SAM3X8C env:DUE_USB // // STM32 ARM Cortex-M3 @@ -392,6 +420,8 @@ #include "pins_GTM32_PRO_VB.h" // STM32F1 env:STM32F1 #elif MB(MORPHEUS) #include "pins_MORPHEUS.h" // STM32F1 env:STM32F1 +#elif MB(MKS_ROBIN) + #include "pins_MKS_ROBIN.h" // STM32F1 env:mks_robin // // STM32 ARM Cortex-M4F @@ -407,6 +437,14 @@ #include "pins_STM32F4.h" // STM32F4 env:STM32F4 #elif MB(ARMED) #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 @@ -424,6 +462,13 @@ #elif MB(ESP32) #include "pins_ESP32.h" +// +// Linux Native Debug board +// + +#elif MB(LINUX_RAMPS) + #include "pins_RAMPS_LINUX.h" // Linux env:linux_native + #else #error "Unknown MOTHERBOARD value set in Configuration.h" #endif @@ -777,7 +822,7 @@ // // Disable unused endstop / probe pins // -#if !HAS_BED_PROBE || DISABLED(Z_MIN_PROBE_ENDSTOP) +#if !USES_Z_MIN_PROBE_ENDSTOP #undef Z_MIN_PROBE_PIN #define Z_MIN_PROBE_PIN -1 #endif @@ -837,7 +882,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 108a16b92f10..2cf896abbb03 100644 --- a/Marlin/src/pins/pinsDebug.h +++ b/Marlin/src/pins/pinsDebug.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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,12 +142,12 @@ 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)); - SERIAL_PROTOCOL(READ(46)); + print_input_or_output(IS_OUTPUT(46)); + SERIAL_CHAR('0' + READ(46)); } else if (pin == 47) { - print_input_or_output(GET_OUTPUT(47)); - SERIAL_PROTOCOL(READ(47)); + print_input_or_output(IS_OUTPUT(47)); + SERIAL_CHAR('0' + READ(47)); } } else @@ -160,14 +163,14 @@ inline void report_pin_state_extended(pin_t pin, bool ignore, bool extended = fa // because this could interfere with inductive/capacitive // sensors (high impedance voltage divider) and with PT100 amplifier print_input_or_output(false); - SERIAL_PROTOCOL(digitalRead_mod(pin)); + SERIAL_ECHO(digitalRead_mod(pin)); } else if (pwm_status(pin)) { // do nothing } else { print_input_or_output(true); - SERIAL_PROTOCOL(digitalRead_mod(pin)); + SERIAL_ECHO(digitalRead_mod(pin)); } } if (!multi_name_pin && extended) pwm_details(pin); // report PWM capabilities only on the first pass & only if doing an extended report @@ -193,23 +196,23 @@ inline void report_pin_state_extended(pin_t pin, bool ignore, bool extended = fa if (extended) { #if AVR_AT90USB1286_FAMILY //Teensy IDEs don't know about these pins so must use FASTIO if (pin == 46 || pin == 47) { - SERIAL_PROTOCOL_SP(12); + SERIAL_ECHO_SP(12); if (pin == 46) { - print_input_or_output(GET_OUTPUT(46)); - SERIAL_PROTOCOL(READ(46)); + print_input_or_output(IS_OUTPUT(46)); + SERIAL_CHAR('0' + READ(46)); } else { - print_input_or_output(GET_OUTPUT(47)); - SERIAL_PROTOCOL(READ(47)); + print_input_or_output(IS_OUTPUT(47)); + SERIAL_CHAR('0' + READ(47)); } } else #endif { if (GET_PINMODE(pin)) { - SERIAL_PROTOCOL_SP(MAX_NAME_LENGTH - 16); + SERIAL_ECHO_SP(MAX_NAME_LENGTH - 16); print_input_or_output(true); - SERIAL_PROTOCOL(digitalRead_mod(pin)); + SERIAL_ECHO(digitalRead_mod(pin)); } else { if (IS_ANALOG(pin)) { @@ -221,7 +224,7 @@ inline void report_pin_state_extended(pin_t pin, bool ignore, bool extended = fa SERIAL_ECHO_SP(MAX_NAME_LENGTH - 16); // add padding if not an analog pin print_input_or_output(false); - SERIAL_PROTOCOL(digitalRead_mod(pin)); + SERIAL_ECHO(digitalRead_mod(pin)); } //if (!pwm_status(pin)) SERIAL_CHAR(' '); // add padding if it's not a PWM pin if (extended) pwm_details(pin); // report PWM capabilities only if doing an extended report diff --git a/Marlin/src/pins/pinsDebug_list.h b/Marlin/src/pins/pinsDebug_list.h index e7e38256e0df..c03bd1db3633 100644 --- a/Marlin/src/pins/pinsDebug_list.h +++ b/Marlin/src/pins/pinsDebug_list.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 @@ -605,9 +608,21 @@ #if PIN_EXISTS(MOTOR_CURRENT_PWM_E) REPORT_NAME_DIGITAL(__LINE__, MOTOR_CURRENT_PWM_E_PIN) #endif +#if PIN_EXISTS(MOTOR_CURRENT_PWM_X) + REPORT_NAME_DIGITAL(__LINE__, MOTOR_CURRENT_PWM_X_PIN) +#endif +#if PIN_EXISTS(MOTOR_CURRENT_PWM_Y) + REPORT_NAME_DIGITAL(__LINE__, MOTOR_CURRENT_PWM_Y_PIN) +#endif #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY) REPORT_NAME_DIGITAL(__LINE__, MOTOR_CURRENT_PWM_XY_PIN) #endif +#if PIN_EXISTS(MOTOR_CURRENT_PWM_X) + REPORT_NAME_DIGITAL(__LINE__, MOTOR_CURRENT_PWM_X_PIN) +#endif +#if PIN_EXISTS(MOTOR_CURRENT_PWM_Y) + REPORT_NAME_DIGITAL(__LINE__, MOTOR_CURRENT_PWM_Y_PIN) +#endif #if PIN_EXISTS(MOTOR_CURRENT_PWM_Z) REPORT_NAME_DIGITAL(__LINE__, MOTOR_CURRENT_PWM_Z_PIN) #endif @@ -773,8 +788,8 @@ #if PIN_EXISTS(SPINDLE_ENABLE) REPORT_NAME_DIGITAL(__LINE__, SPINDLE_ENABLE_PIN) #endif -#if PIN_EXISTS(SPINDLE_LASER_ENABLE) - REPORT_NAME_DIGITAL(__LINE__, SPINDLE_LASER_ENABLE_PIN) +#if PIN_EXISTS(SPINDLE_LASER_ENA) + REPORT_NAME_DIGITAL(__LINE__, SPINDLE_LASER_ENA_PIN) #endif #if PIN_EXISTS(SPINDLE_LASER_PWM) REPORT_NAME_DIGITAL(__LINE__, SPINDLE_LASER_PWM_PIN) @@ -1133,3 +1148,21 @@ #if PIN_EXISTS(E5_SERIAL_RX) REPORT_NAME_DIGITAL(__LINE__, E5_SERIAL_RX_PIN) #endif +#if PIN_EXISTS(L6470_CHAIN_SCK) + REPORT_NAME_DIGITAL(__LINE__, L6470_CHAIN_SCK_PIN) +#endif +#if PIN_EXISTS(L6470_CHAIN_MISO) + REPORT_NAME_DIGITAL(__LINE__, L6470_CHAIN_MISO_PIN) +#endif +#if PIN_EXISTS(L6470_CHAIN_MOSI) + REPORT_NAME_DIGITAL(__LINE__, L6470_CHAIN_MOSI_PIN) +#endif +#if PIN_EXISTS(L6470_CHAIN_SS) + REPORT_NAME_DIGITAL(__LINE__, L6470_CHAIN_SS_PIN) +#endif +#if PIN_EXISTS(L6470_RESET_CHAIN) + REPORT_NAME_DIGITAL(__LINE__, L6470_RESET_CHAIN_PIN) +#endif +#if PIN_EXISTS(FET_SAFETY) + REPORT_NAME_DIGITAL(__LINE__, FET_SAFETY_PIN) +#endif diff --git a/Marlin/src/pins/pins_3DRAG.h b/Marlin/src/pins/pins_3DRAG.h index 61cdb56c1dcf..6d32ada05237 100644 --- a/Marlin/src/pins/pins_3DRAG.h +++ b/Marlin/src/pins/pins_3DRAG.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -39,11 +39,11 @@ // // Heaters / Fans // -#define RAMPS_D8_PIN 9 -#define RAMPS_D9_PIN 8 -#define MOSFET_D_PIN 12 +#define RAMPS_D8_PIN 9 +#define RAMPS_D9_PIN 8 +#define MOSFET_D_PIN 12 -#define CASE_LIGHT_PIN -1 // MUST BE HARDWARE PWM but one is not available on expansion header +#define CASE_LIGHT_PIN -1 // MUST BE HARDWARE PWM but one is not available on expansion header #include "pins_RAMPS.h" @@ -51,7 +51,6 @@ // Limit Switches // #undef Z_MAX_PIN -#define Z_MAX_PIN -1 // // Steppers @@ -76,9 +75,8 @@ // // LCD / Controller // -#if ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL) +#if BOTH(ULTRA_LCD, NEWPANEL) #undef BEEPER_PIN - #define BEEPER_PIN -1 #undef LCD_PINS_RS #undef LCD_PINS_ENABLE @@ -126,7 +124,7 @@ * * stepper signal socket name socket name * ------- - * SPINDLE_LASER_ENABLE_PIN /ENABLE O| |O VMOT + * SPINDLE_LASER_ENA_PIN /ENABLE O| |O VMOT * MS1 O| |O GND * MS2 O| |O 2B * MS3 O| |O 2A @@ -139,7 +137,7 @@ * Note: Socket names vary from vendor to vendor */ #undef SPINDLE_LASER_PWM_PIN // Definitions in pins_RAMPS.h are not good with 3DRAG -#undef SPINDLE_LASER_ENABLE_PIN +#undef SPINDLE_LASER_ENA_PIN #undef SPINDLE_DIR_PIN #if ENABLED(SPINDLE_LASER_ENABLE) @@ -154,10 +152,10 @@ #define Z_ENABLE_PIN 24 #define Z_STEP_PIN 26 #define SPINDLE_LASER_PWM_PIN 46 // MUST BE HARDWARE PWM - #define SPINDLE_LASER_ENABLE_PIN 62 // Pin should have a pullup! + #define SPINDLE_LASER_ENA_PIN 62 // Pin should have a pullup! #define SPINDLE_DIR_PIN 48 - #elif !(ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL)) // use expansion header if no LCD in use - #define SPINDLE_LASER_ENABLE_PIN 16 // Pin should have a pullup/pulldown! + #elif !BOTH(ULTRA_LCD, NEWPANEL) // use expansion header if no LCD in use + #define SPINDLE_LASER_ENA_PIN 16 // Pin should have a pullup/pulldown! #define SPINDLE_DIR_PIN 17 #endif #endif diff --git a/Marlin/src/pins/pins_5DPRINT.h b/Marlin/src/pins/pins_5DPRINT.h index b90926c252a7..9eb36ba6215a 100755 --- a/Marlin/src/pins/pins_5DPRINT.h +++ b/Marlin/src/pins/pins_5DPRINT.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -142,4 +142,6 @@ #define SDSS 20 // B0 //DIGIPOTS slave addresses -#define DIGIPOT_I2C_ADDRESS_A 0x2C // unshifted slave address for DIGIPOT 0x2C (0x58 <- 0x2C << 1) +#ifndef DIGIPOT_I2C_ADDRESS_A + #define DIGIPOT_I2C_ADDRESS_A 0x2C // unshifted slave address for DIGIPOT 0x2C (0x58 <- 0x2C << 1) +#endif diff --git a/Marlin/src/pins/pins_ADSK.h b/Marlin/src/pins/pins_ADSK.h new file mode 100644 index 000000000000..fc46f0098448 --- /dev/null +++ b/Marlin/src/pins/pins_ADSK.h @@ -0,0 +1,207 @@ +/** + * 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 DUE Shield Kit (ADSK) pin assignments + */ + +#define BOARD_NAME "ADSK" + +#if !defined(__SAM3X8E__) && !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega2560__) + #error "Oops! Select 'Arduino Due or Mega' in 'Tools > Board.'" +#endif + +/* CNC shield modifications: +FROM THE BOTTOM CUT THE 5V PIN THAT GOES TO ARDUINO!!! +On the top put jumper between 5V and 3V3 pins, + jumper between D12 and A.STEP, jumper between D13 and A.DIR +*/ + +/* CNC shield 3D printer connections: +X,Y,Z steppers as normal +A stepper for E0 extruder +(X-)&(GND) - X limit +(Y-)&(GND) - Y limit +(Z-)&(GND) - Z limit +(Abort)&(GND) - Extruder thermistor (also require pullup resistor 4.7K between "Abort" and + Vcc (now "5V" on the board but actual 3.3V because of jumper)) +(Hold)&(GND) - Bed thermistor (also require pullup resistor 4.7K between "Hold" and + Vcc (now "5V" on the board but actual 3.3V because of jumper)) +(CoolEn) - 3.3v signal to controll extruder heater MOSFET +(Resume) - 3.3v signal to control heatbed MOSFET +(SDA) - 3.3v signal to controll extruder fan +(SCL) - 3.3v signal to controll extruder cooling fan +*/ + +/* CNC Shield pinout +"Name on the board": DUE pin +"Abort": Analog pin 0 or Digital pin 54 +"Hold": Analog pin 1 or Digital pin 55 +"Resume": Analog pin 2 or Digital pin 56 +"CoolEn": Analog pin 3 or Digital pin 57 +"SDA": Analog pin 4 or Digital pin 58 +"SCL": Analog pin 5 or Digital pin 59 +"E-STOP": Reset pin +"RX": Digital pin 0 +"TX": Digital pin 1 +"X.STEP": Digital pin 2 +"Y.STEP": Digital pin 3 +"Z.STEP": Digital pin 4 +"X.DIR": Digital pin 5 +"Y.DIR": Digital pin 6 +"Z.DIR": Digital pin 7 +"EN": Digital pin 8 +"X+","X-": Digital pin 9 +"Y+","Y-": Digital pin 10 +"Z+","Z-": Digital pin 11 +"SpinEn": Digital pin 12 -> will be connected to A.STEP with jumper +"SpinDir": Digital pin 13 -> will be connected to A.DIR with jumper +*/ + +// +// Servos +// +#define SERVO0_PIN 61 // Analog pin 7, Digital pin 61 + +// +// Limit Switches +// +#define X_MIN_PIN 9 +#define Y_MIN_PIN 10 +#define Z_MIN_PIN 11 + +#define Z_MIN_PROBE_PIN 62 // Analog pin 8, Digital pin 62 + +// +// Steppers +// +#define X_STEP_PIN 2 +#define X_DIR_PIN 5 +#define X_ENABLE_PIN 8 + +#define Y_STEP_PIN 3 +#define Y_DIR_PIN 6 +#define Y_ENABLE_PIN 8 + +#define Z_STEP_PIN 4 +#define Z_DIR_PIN 7 +#define Z_ENABLE_PIN 8 + +#define E0_STEP_PIN 12 +#define E0_DIR_PIN 13 +#define E0_ENABLE_PIN 8 + +// +// Heaters / Fans +// +#define HEATER_0_PIN 55 // "Hold": Analog pin 1, Digital pin 55 +#define HEATER_BED_PIN 57 // "CoolEn": Analog pin 3, Digital pin 57 +#define FAN_PIN 54 // "Abort": Analog pin 0, Digital pin 54 +#undef E0_AUTO_FAN_PIN +#define E0_AUTO_FAN_PIN 56 // "Resume": Analog pin 2, Digital pin 56 + +// +// Temperature Sensors +// +#define TEMP_0_PIN 4 // "SDA": Analog pin 4, Digital pin 58 +#define TEMP_BED_PIN 5 // "SCL": Analog pin 5, Digital pin 59 + +// +// Misc. Functions +// +#define SDSS 52 + +#if ENABLED(ZONESTAR_LCD) + + /** + * The 2004 LCD should be powered with 5V. + * The next LCD pins RS,D4,D5,D6,D7 have internal pull-ups to 5V and as result the 5V will be on these pins. + * Luckily these internal pull-ups have really high resistance and adding 33K pull-down resistors will create + * simple voltage divider that will bring the voltage down just slightly bellow 3.3V. + * + * This LCD also has buttons that connected to the same ADC pin with different voltage divider combinations. + * On the LCD panel there is internal pull-up resistor of the 4.7K connected to 5V. + * Connecting another 4.7K pull-down resistor between ADC pin and the GND + * will result in scaled values for voltage dividers and will bring them down to be always below 3.3V. + * + * For 2004 LCD to work with 3.3V board like Arduino DUE the next required: + * Pull-down resistors of 33K between each of LCD pins RS,D4,D5,D6,D7 and the GND. + * Pull-down resistor of 4.7K between ADC_KEYPAD_PIN and the GND + * + * All these modifications will still work with 5V based boards but require proper scaled ADC values + */ + + #ifdef __SAM3X8E__ + #define AREF_VOLTS 3.3 + #else + #define AREF_VOLTS 5.0 + #endif + + // + // LCD / Controller + // + #define LCD_PINS_ENABLE 14 + #define LCD_PINS_RS 15 + #define LCD_PINS_D4 16 + #define LCD_PINS_D5 17 + #define LCD_PINS_D6 18 + #define LCD_PINS_D7 19 + #define ADC_KEYPAD_PIN 6 //60 // Analog pin 6, Digital pin 60 + + /** + * The below defines will scale all the values to work properly on both + * 5V (Mega) and 3.3V (DUE) boards with all pull-up resistors added for 3.3V + */ + + #define ADC_BUTTONS_VALUE_SCALE (5.0/AREF_VOLTS) // The LCD module pullup voltage is 5.0V but ADC reference voltage is 3.3V + + #define ADC_BUTTONS_R_PULLDOWN 4.7 // Moves voltage down to be bellow 3.3V instead of 5V + // the resistors values will be scaled because of 4.7K pulldown parallel resistor + #define _ADC_BUTTONS_R_SCALED(R) ((R) * (ADC_BUTTONS_R_PULLDOWN) / ((R) + ADC_BUTTONS_R_PULLDOWN)) + + // buttons pullup resistor + #define ADC_BUTTONS_R_PULLUP 4.7 // the resistor on the 2004 LCD panel + // buttons resistors with scaled values because of parallel pulldown resistor + #define ADC_BUTTONS_LEFT_R_PULLDOWN _ADC_BUTTONS_R_SCALED(0.47) + #define ADC_BUTTONS_RIGHT_R_PULLDOWN _ADC_BUTTONS_R_SCALED(4.7) + #define ADC_BUTTONS_UP_R_PULLDOWN _ADC_BUTTONS_R_SCALED(1.0) + #define ADC_BUTTONS_DOWN_R_PULLDOWN _ADC_BUTTONS_R_SCALED(10.0) + #define ADC_BUTTONS_MIDDLE_R_PULLDOWN _ADC_BUTTONS_R_SCALED(2.2) + +#endif // ZONESTAR_LCD + +/** + * RJ45 8 pins extruder connector + * + * 1 - GND (Please do not connect to the same GND as extruder heater to prevent ground offset voltage) + * 2 - thermistor + * 3 - SERVO PWM + * 4 - extruder heater + * 5 - FAN (print cooling) + * 6 - FAN (extruder cooling) + * 7 - Probe signal + * 8 - 5V + * + * Standard ethernet pairs: 1&2, 3&6, 4&5, 7&8 + * Use CAT7 cable to have all pairs shielded + * + */ diff --git a/Marlin/src/pins/pins_ALLIGATOR_R2.h b/Marlin/src/pins/pins_ALLIGATOR_R2.h index 2eb38c0c9d9e..e170af796f09 100644 --- a/Marlin/src/pins/pins_ALLIGATOR_R2.h +++ b/Marlin/src/pins/pins_ALLIGATOR_R2.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -29,133 +29,131 @@ #error "Oops! Select 'Arduino Due' in 'Tools > Board.'" #endif -#define BOARD_NAME "Alligator Board R2" +#define BOARD_NAME "Alligator Board R2" // // Servos // -#define SERVO0_PIN 36 -#define SERVO1_PIN 40 -#define SERVO2_PIN 41 -#define SERVO3_PIN -1 +#define SERVO0_PIN 36 +#define SERVO1_PIN 40 +#define SERVO2_PIN 41 +#define SERVO3_PIN -1 // // Limit Switches // -#define X_MIN_PIN 33 // PC1 -#define X_MAX_PIN 34 // PC2 -#define Y_MIN_PIN 35 // PC3 -#define Y_MAX_PIN 37 // PC5 -#define Z_MIN_PIN 38 // PC6 -#define Z_MAX_PIN 39 // PC7 +#define X_MIN_PIN 33 // PC1 +#define X_MAX_PIN 34 // PC2 +#define Y_MIN_PIN 35 // PC3 +#define Y_MAX_PIN 37 // PC5 +#define Z_MIN_PIN 38 // PC6 +#define Z_MAX_PIN 39 // PC7 // // Steppers // -#define X_STEP_PIN 96 // PB24 -#define X_DIR_PIN 2 // PB25 -#define X_ENABLE_PIN 24 // PA15, motor RESET pin +#define X_STEP_PIN 96 // PB24 +#define X_DIR_PIN 2 // PB25 +#define X_ENABLE_PIN 24 // PA15, motor RESET pin -#define Y_STEP_PIN 94 // PB22 -#define Y_DIR_PIN 95 // PB23 -#define Y_ENABLE_PIN 24 // PA15, motor RESET pin +#define Y_STEP_PIN 94 // PB22 +#define Y_DIR_PIN 95 // PB23 +#define Y_ENABLE_PIN 24 // PA15, motor RESET pin -#define Z_STEP_PIN 98 // PC27 -#define Z_DIR_PIN 3 // PC28 -#define Z_ENABLE_PIN 24 // PA15, motor RESET pin +#define Z_STEP_PIN 98 // PC27 +#define Z_DIR_PIN 3 // PC28 +#define Z_ENABLE_PIN 24 // PA15, motor RESET pin -#define E0_STEP_PIN 5 // PC25 -#define E0_DIR_PIN 4 // PC26 -#define E0_ENABLE_PIN 24 // PA15, motor RESET pin +#define E0_STEP_PIN 5 // PC25 +#define E0_DIR_PIN 4 // PC26 +#define E0_ENABLE_PIN 24 // PA15, motor RESET pin -#define E1_STEP_PIN 28 // PD3 on piggy -#define E1_DIR_PIN 27 // PD2 on piggy -#define E1_ENABLE_PIN 24 // PA15, motor RESET pin +#define E1_STEP_PIN 28 // PD3 on piggy +#define E1_DIR_PIN 27 // PD2 on piggy +#define E1_ENABLE_PIN 24 // PA15, motor RESET pin -#define E2_STEP_PIN 11 // PD7 on piggy -#define E2_DIR_PIN 29 // PD6 on piggy -#define E2_ENABLE_PIN 24 // PA15, motor RESET pin +#define E2_STEP_PIN 11 // PD7 on piggy +#define E2_DIR_PIN 29 // PD6 on piggy +#define E2_ENABLE_PIN 24 // PA15, motor RESET pin -#define E3_STEP_PIN 30 // PD9 on piggy -#define E3_DIR_PIN 12 // PD8 on piggy -#define E3_ENABLE_PIN 24 // PA15, motor RESET pin +#define E3_STEP_PIN 30 // PD9 on piggy +#define E3_DIR_PIN 12 // PD8 on piggy +#define E3_ENABLE_PIN 24 // PA15, motor RESET pin // Microstepping pins - Mapping not from fastio.h (?) -#define X_MS1_PIN 99 // PC10 -#define Y_MS1_PIN 10 // PC29 -#define Z_MS1_PIN 44 // PC19 -#define E0_MS1_PIN 45 // PC18 +#define X_MS1_PIN 99 // PC10 +#define Y_MS1_PIN 10 // PC29 +#define Z_MS1_PIN 44 // PC19 +#define E0_MS1_PIN 45 // PC18 -//#define MOTOR_FAULT_PIN 22 // PB26 , motor X-Y-Z-E0 motor FAULT +//#define MOTOR_FAULT_PIN 22 // PB26 , motor X-Y-Z-E0 motor FAULT // // Temperature Sensors // -#define TEMP_0_PIN 1 // Analog Input (PA24) -#define TEMP_1_PIN 2 // Analog Input (PA23 on piggy) -#define TEMP_2_PIN 3 // Analog Input (PA22 on piggy) -#define TEMP_3_PIN 4 // Analog Input (PA6 on piggy) -#define TEMP_BED_PIN 0 // Analog Input (PA16) +#define TEMP_0_PIN 1 // Analog Input (PA24) +#define TEMP_1_PIN 2 // Analog Input (PA23 on piggy) +#define TEMP_2_PIN 3 // Analog Input (PA22 on piggy) +#define TEMP_3_PIN 4 // Analog Input (PA6 on piggy) +#define TEMP_BED_PIN 0 // Analog Input (PA16) // // Heaters / Fans // // Note that on the Due pin A0 on the board is channel 2 on the ARM chip -#define HEATER_0_PIN 68 // PA1 -#define HEATER_1_PIN 8 // PC22 on piggy -#define HEATER_2_PIN 9 // PC21 on piggy -#define HEATER_3_PIN 97 // PC20 on piggy -#define HEATER_BED_PIN 69 // PA0 +#define HEATER_0_PIN 68 // PA1 +#define HEATER_1_PIN 8 // PC22 on piggy +#define HEATER_2_PIN 9 // PC21 on piggy +#define HEATER_3_PIN 97 // PC20 on piggy +#define HEATER_BED_PIN 69 // PA0 #ifndef FAN_PIN - #define FAN_PIN 92 // PA5 + #define FAN_PIN 92 // PA5 #endif -#define FAN1_PIN 31 // PA7 +#define FAN1_PIN 31 // PA7 // // Misc. Functions // -#define SDSS 77 // PA28 -#define SD_DETECT_PIN 87 // PA29 -#define LED_RED_PIN 40 // PC8 -#define LED_GREEN_PIN 41 // PC9 +#define SDSS 77 // PA28 +#define SD_DETECT_PIN 87 // PA29 +#define LED_RED_PIN 40 // PC8 +#define LED_GREEN_PIN 41 // PC9 #define EXP_VOLTAGE_LEVEL_PIN 65 -#define SPI_CHAN_DAC 1 +#define SPI_CHAN_DAC 1 -#define DAC0_SYNC 53 // PB14 -#define DAC1_SYNC 6 // PC24 +#define DAC0_SYNC 53 // PB14 +#define DAC1_SYNC 6 // PC24 // 64K SPI EEPROM #define SPI_EEPROM -#define SPI_CHAN_EEPROM1 2 -#define SPI_EEPROM1_CS 25 // PD0 +#define SPI_CHAN_EEPROM1 2 +#define SPI_EEPROM1_CS 25 // PD0 // 2K SPI EEPROM -#define SPI_EEPROM2_CS 26 // PD1 +#define SPI_EEPROM2_CS 26 // PD1 // FLASH SPI // 32Mb -#define SPI_FLASH_CS 23 // PA14 +#define SPI_FLASH_CS 23 // PA14 // // LCD / Controller // #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) - #define LCD_PINS_RS 18 - #define LCD_PINS_ENABLE 15 - #define LCD_PINS_D4 19 - #define BEEPER_PIN 64 + #define LCD_PINS_RS 18 + #define LCD_PINS_ENABLE 15 + #define LCD_PINS_D4 19 + #define BEEPER_PIN 64 - #define BTN_EN1 14 - #define BTN_EN2 16 - #define BTN_ENC 17 + #define BTN_EN1 14 + #define BTN_EN2 16 + #define BTN_ENC 17 - #if UI_VOLTAGE_LEVEL != 1 - #undef UI_VOLTAGE_LEVEL - #define UI_VOLTAGE_LEVEL 1 - #endif + #undef UI_VOLTAGE_LEVEL + #define UI_VOLTAGE_LEVEL 1 #endif // REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER diff --git a/Marlin/src/pins/pins_ANET_10.h b/Marlin/src/pins/pins_ANET_10.h index 85b4f53f8f3c..192373834f8b 100644 --- a/Marlin/src/pins/pins_ANET_10.h +++ b/Marlin/src/pins/pins_ANET_10.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -89,7 +89,7 @@ */ #ifndef __AVR_ATmega1284P__ - #error "Oops! Select 'Anet V1.0', 'Anet V1.0 (Optiboot)' or 'Sanguino' in 'Tools > Board' and 'ATmega1284P' in 'Tools > Processor.'" + #error "Oops! Select 'Sanguino' in 'Tools > Board' and 'ATmega1284P' in 'Tools > Processor.' (For PlatformIO, use 'melzi' or 'melzi_optiboot.')" #endif #define BOARD_NAME "Anet 1.0" @@ -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_ARCHIM1.h b/Marlin/src/pins/pins_ARCHIM1.h index 5a69561d41e6..71287abe81f3 100644 --- a/Marlin/src/pins/pins_ARCHIM1.h +++ b/Marlin/src/pins/pins_ARCHIM1.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_ARCHIM2.h b/Marlin/src/pins/pins_ARCHIM2.h index 3d532a426f93..86c9fba2727f 100644 --- a/Marlin/src/pins/pins_ARCHIM2.h +++ b/Marlin/src/pins/pins_ARCHIM2.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -38,6 +38,8 @@ #ifndef __SAM3X8E__ #error "Oops! Select 'Archim' in 'Tools > Board.'" +#elif DISABLED(TMC_USE_SW_SPI) + #error "Archim2 requires Software SPI. Enable TMC_USE_SW_SPI in Configuration_adv.h." #endif #define BOARD_NAME "Archim 2.0" diff --git a/Marlin/src/pins/pins_ARMED.h b/Marlin/src/pins/pins_ARMED.h index fd6ffe6e0e33..0db0e73355b2 100644 --- a/Marlin/src/pins/pins_ARMED.h +++ b/Marlin/src/pins/pins_ARMED.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -29,10 +29,13 @@ #endif #define DEFAULT_MACHINE_NAME "Arm'ed" + +#undef BOARD_NAME #define BOARD_NAME "Arm'ed" #define I2C_EEPROM +#undef E2END #define E2END 0xFFF // EEPROM end address (4kB) #if HOTENDS > 2 || E_STEPPERS > 2 diff --git a/Marlin/src/pins/pins_AZSMZ_MINI.h b/Marlin/src/pins/pins_AZSMZ_MINI.h index e83ebf46a2f7..6b0d8cc68621 100644 --- a/Marlin/src/pins/pins_AZSMZ_MINI.h +++ b/Marlin/src/pins/pins_AZSMZ_MINI.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_AZTEEG_X1.h b/Marlin/src/pins/pins_AZTEEG_X1.h index 17290d11084e..d11802132e89 100644 --- a/Marlin/src/pins/pins_AZTEEG_X1.h +++ b/Marlin/src/pins/pins_AZTEEG_X1.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_AZTEEG_X3.h b/Marlin/src/pins/pins_AZTEEG_X3.h index 13d9b35fd7a5..fe5cb627a972 100644 --- a/Marlin/src/pins/pins_AZTEEG_X3.h +++ b/Marlin/src/pins/pins_AZTEEG_X3.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 @@ -83,7 +83,7 @@ // M3/M4/M5 - Spindle/Laser Control // #undef SPINDLE_LASER_PWM_PIN // Definitions in pins_RAMPS.h are no good with the AzteegX3 board -#undef SPINDLE_LASER_ENABLE_PIN +#undef SPINDLE_LASER_ENA_PIN #undef SPINDLE_DIR_PIN #if ENABLED(SPINDLE_LASER_ENABLE) @@ -94,6 +94,6 @@ #define SERVO0_PIN 11 #endif #define SPINDLE_LASER_PWM_PIN 7 // MUST BE HARDWARE PWM - #define SPINDLE_LASER_ENABLE_PIN 20 // Pin should have a pullup! + #define SPINDLE_LASER_ENA_PIN 20 // Pin should have a pullup! #define SPINDLE_DIR_PIN 21 #endif diff --git a/Marlin/src/pins/pins_AZTEEG_X3_PRO.h b/Marlin/src/pins/pins_AZTEEG_X3_PRO.h index 832dfe429ee6..55ee39f84f36 100644 --- a/Marlin/src/pins/pins_AZTEEG_X3_PRO.h +++ b/Marlin/src/pins/pins_AZTEEG_X3_PRO.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -48,8 +48,12 @@ #include "pins_RAMPS.h" // DIGIPOT slave addresses -#define DIGIPOT_I2C_ADDRESS_A 0x2C // unshifted slave address for first DIGIPOT 0x2C (0x58 <- 0x2C << 1) -#define DIGIPOT_I2C_ADDRESS_B 0x2E // unshifted slave address for second DIGIPOT 0x2E (0x5C <- 0x2E << 1) +#ifndef DIGIPOT_I2C_ADDRESS_A + #define DIGIPOT_I2C_ADDRESS_A 0x2C // unshifted slave address for first DIGIPOT 0x2C (0x58 <- 0x2C << 1) +#endif +#ifndef DIGIPOT_I2C_ADDRESS_B + #define DIGIPOT_I2C_ADDRESS_B 0x2E // unshifted slave address for second DIGIPOT 0x2E (0x5C <- 0x2E << 1) +#endif // // Servos @@ -139,7 +143,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 +156,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 @@ -162,15 +166,15 @@ // M3/M4/M5 - Spindle/Laser Control // #undef SPINDLE_LASER_PWM_PIN // Definitions in pins_RAMPS.h are no good with the AzteegX3pro board -#undef SPINDLE_LASER_ENABLE_PIN +#undef SPINDLE_LASER_ENA_PIN #undef SPINDLE_DIR_PIN #if ENABLED(SPINDLE_LASER_ENABLE) // EXP2 header - #if ENABLED(VIKI2) || ENABLED(miniVIKI) + #if ANY(VIKI2, miniVIKI) #undef BTN_EN2 #define BTN_EN2 31 // need 7 for the spindle speed PWM #endif #define SPINDLE_LASER_PWM_PIN 7 // must have a hardware PWM - #define SPINDLE_LASER_ENABLE_PIN 20 // Pin should have a pullup! + #define SPINDLE_LASER_ENA_PIN 20 // Pin should have a pullup! #define SPINDLE_DIR_PIN 21 #endif diff --git a/Marlin/src/pins/pins_AZTEEG_X5_GT.h b/Marlin/src/pins/pins_AZTEEG_X5_GT.h index 4d1d824eb31b..9de083cffb54 100755 --- a/Marlin/src/pins/pins_AZTEEG_X5_GT.h +++ b/Marlin/src/pins/pins_AZTEEG_X5_GT.h @@ -1,7 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -25,12 +24,12 @@ * Azteeg X5 GT pin assignments */ -#ifndef TARGET_LPC1768 - #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." +#ifndef LPC1769 + #error "Oops! Make sure you have the LPC1769 environment selected in your IDE." #endif -#define BOARD_NAME "Azteeg X5 GT" -#define DEFAULT_WEBSITE_URL "https://www.panucatt.com/azteeg_X5_GT_reprap_3d_printer_controller_p/ax5gt.htm" +#define BOARD_NAME "Azteeg X5 GT" +#define BOARD_WEBSITE_URL "https://www.panucatt.com/azteeg_X5_GT_reprap_3d_printer_controller_p/ax5gt.htm" // // Set CPU @@ -113,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.h b/Marlin/src/pins/pins_AZTEEG_X5_MINI.h new file mode 100644 index 000000000000..f3ce5b4179cc --- /dev/null +++ b/Marlin/src/pins/pins_AZTEEG_X5_MINI.h @@ -0,0 +1,214 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * Azteeg X5 MINI pin assignments + */ + +#ifndef LPC1769 + #error "Oops! Make sure you have the LPC1769 environment selected in your IDE." +#endif + +#ifndef BOARD_NAME + #define BOARD_NAME "Azteeg X5 MINI" +#endif +#define BOARD_WEBSITE_URL "http://www.panucatt.com/azteeg_X5_mini_reprap_3d_printer_controller_p/ax5mini.htm" + +// +// LED +// +#define LED_PIN P1_18 + +// +// Servos +// +#define SERVO0_PIN P1_29 + +// +// Limit Switches +// +#define X_STOP_PIN P1_24 +#define Y_STOP_PIN P1_26 +#define Z_STOP_PIN P1_28 + +#ifndef FILWIDTH_PIN + #define FILWIDTH_PIN P2_04 +#endif + +// +// Steppers +// +#define X_STEP_PIN P2_01 +#define X_DIR_PIN P0_11 +#define X_ENABLE_PIN P0_10 + +#define Y_STEP_PIN P2_02 +#define Y_DIR_PIN P0_20 +#define Y_ENABLE_PIN P0_19 + +#define Z_STEP_PIN P2_03 +#define Z_DIR_PIN P0_22 +#define Z_ENABLE_PIN P0_21 + +#define E0_STEP_PIN P2_00 +#define E0_DIR_PIN P0_05 +#define E0_ENABLE_PIN P0_04 + +// +// DIGIPOT slave addresses +// +#ifndef DIGIPOT_I2C_ADDRESS_A + #define DIGIPOT_I2C_ADDRESS_A 0x2C // unshifted slave address for first DIGIPOT +#endif + +#ifndef DIGIPOT_I2C_ADDRESS_B + #define DIGIPOT_I2C_ADDRESS_B 0x2E // unshifted slave address for second DIGIPOT +#endif + +// +// Temperature Sensors +// 3.3V max when defined as an analog input +// +#define TEMP_BED_PIN 0 // A0 (TH1) +#define TEMP_0_PIN 1 // A1 (TH2) + +// +// Heaters / Fans +// +#define HEATER_BED_PIN P2_07 +#define HEATER_0_PIN P2_05 +#ifndef FAN_PIN + #define FAN_PIN P0_26 +#endif +#define FAN1_PIN P1_25 + +// +// Display +// +#if ENABLED(ULTRA_LCD) + + #if ENABLED(CR10_STOCKDISPLAY) + + // Re-Arm can support Creality stock display without SD card reader and single cable on EXP3. + // Re-Arm J3 pins 1 (p1.31) & 2 (P3.26) are not used. Stock cable will need to have one + // 10-pin IDC connector trimmed or replaced with a 12-pin IDC connector to fit J3. + // Requires REVERSE_ENCODER_DIRECTION in Configuration.h + + #define BEEPER_PIN P2_11 // J3-3 & AUX-4 + + #define BTN_EN1 P0_16 // J3-7 & AUX-4 + #define BTN_EN2 P1_23 // J3-5 & AUX-4 + #define BTN_ENC P3_25 // J3-4 & AUX-4 + + #define LCD_PINS_RS P0_15 // J3-9 & AUX-4 (CS) + #define LCD_PINS_ENABLE P0_18 // J3-10 & AUX-3 (SID, MOSI) + #define LCD_PINS_D4 P2_06 // J3-8 & AUX-3 (SCK, CLK) + + #else + + #define BTN_EN1 P3_26 // (31) J3-2 & AUX-4 + #define BTN_EN2 P3_25 // (33) J3-4 & AUX-4 + #define BTN_ENC P2_11 // (35) J3-3 & AUX-4 + + #define SD_DETECT_PIN P1_31 // (49) not 5V tolerant J3-1 & AUX-3 + #define KILL_PIN P1_22 // (41) J5-4 & AUX-4 + #define LCD_PINS_RS P0_16 // (16) J3-7 & AUX-4 + #define LCD_SDSS P0_16 // (16) J3-7 & AUX-4 + #define LCD_BACKLIGHT_PIN P0_16 // (16) J3-7 & AUX-4 - only used on DOGLCD controllers + #define LCD_PINS_ENABLE P0_18 // (51) (MOSI) J3-10 & AUX-3 + #define LCD_PINS_D4 P0_15 // (52) (SCK) J3-9 & AUX-3 + + #define DOGLCD_A0 P2_06 // (59) J3-8 & AUX-2 + + #if ENABLED(REPRAPWORLD_KEYPAD) + #define SHIFT_OUT P0_18 // (51) (MOSI) J3-10 & AUX-3 + #define SHIFT_CLK P0_15 // (52) (SCK) J3-9 & AUX-3 + #define SHIFT_LD P1_31 // (49) not 5V tolerant J3-1 & AUX-3 + #elif DISABLED(NEWPANEL) + //#define SHIFT_OUT P2_11 // (35) J3-3 & AUX-4 + //#define SHIFT_CLK P3_26 // (31) J3-2 & AUX-4 + //#define SHIFT_LD P3_25 // (33) J3-4 & AUX-4 + //#define SHIFT_EN P1_22 // (41) J5-4 & AUX-4 + #endif + + #if ANY(VIKI2, miniVIKI) + //#define LCD_SCREEN_ROT_180 + + #define BEEPER_PIN P1_30 // (37) may change if cable changes + #define DOGLCD_CS P0_26 // (63) J5-3 & AUX-2 + #define DOGLCD_SCK SCK_PIN + #define DOGLCD_MOSI MOSI_PIN + + #define STAT_LED_BLUE_PIN P0_26 // (63) may change if cable changes + #define STAT_LED_RED_PIN P1_21 // ( 6) may change if cable changes + #else + #if ENABLED(ULTIPANEL) + #define LCD_PINS_D5 P1_17 // (71) ENET_MDIO + #define LCD_PINS_D6 P1_14 // (73) ENET_RX_ER + #define LCD_PINS_D7 P1_10 // (75) ENET_RXD1 + #endif + #define BEEPER_PIN P1_30 // (37) not 5V tolerant + #define DOGLCD_CS P0_16 // (16) + #endif + + #if ENABLED(MINIPANEL) + // GLCD features + // Uncomment screen orientation + //#define LCD_SCREEN_ROT_90 + //#define LCD_SCREEN_ROT_180 + //#define LCD_SCREEN_ROT_270 + #endif + + #endif + +#endif // ULTRA_LCD + +// +// SD Support +// +#if !ANY(LPC_SD_LCD, LPC_SD_ONBOARD, LPC_SD_CUSTOM_CABLE) + #define LPC_SD_ONBOARD +#endif + +#if ENABLED(LPC_SD_LCD) + + #define SCK_PIN P0_15 + #define MISO_PIN P0_17 + #define MOSI_PIN P0_18 + #define SS_PIN P1_23 // Chip select for SD card used by Marlin + #define ONBOARD_SD_CS P0_06 // Chip select for "System" SD card + +#elif ENABLED(LPC_SD_ONBOARD) + + #if ENABLED(USB_SD_ONBOARD) + // When sharing the SD card with a PC we want the menu options to + // mount/unmount the card and refresh it. So we disable card detect. + #define SHARED_SD_CARD + #undef SD_DETECT_PIN // there is also no detect pin for the onboard card + #endif + #define SCK_PIN P0_07 + #define MISO_PIN P0_08 + #define MOSI_PIN P0_09 + #define SS_PIN P0_06 // Chip select for SD card used by Marlin + #define ONBOARD_SD_CS P0_06 // Chip select for "System" SD card + +#endif diff --git a/Marlin/src/pins/pins_AZTEEG_X5_MINI_WIFI.h b/Marlin/src/pins/pins_AZTEEG_X5_MINI_WIFI.h index dee7a783ac37..760e0d76debb 100644 --- a/Marlin/src/pins/pins_AZTEEG_X5_MINI_WIFI.h +++ b/Marlin/src/pins/pins_AZTEEG_X5_MINI_WIFI.h @@ -1,7 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -25,185 +24,20 @@ * Azteeg X5 MINI pin assignments */ -#ifndef TARGET_LPC1768 - #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." +#ifndef LPC1769 + #error "Oops! Make sure you have the LPC1769 environment selected in your IDE." #endif -#define BOARD_NAME "Azteeg X5 MINI WIFI" -#define DEFAULT_WEBSITE_URL "http://www.panucatt.com/azteeg_X5_mini_reprap_3d_printer_controller_p/ax5mini.htm" - -// -// LED -// -#define LED_PIN P1_18 - -// -// Servo -// -#define SERVO0_PIN P1_29 - -// -// Limit Switches -// -#define X_MIN_PIN P1_24 -#define Y_MIN_PIN P1_26 -#define Z_MIN_PIN P1_28 - -// -// Steppers -// -#define X_STEP_PIN P2_01 -#define X_DIR_PIN P0_11 -#define X_ENABLE_PIN P0_10 - -#define Y_STEP_PIN P2_02 -#define Y_DIR_PIN P0_20 -#define Y_ENABLE_PIN P0_19 - -#define Z_STEP_PIN P2_03 -#define Z_DIR_PIN P0_22 -#define Z_ENABLE_PIN P0_21 - -#define E0_STEP_PIN P2_00 -#define E0_DIR_PIN P0_05 -#define E0_ENABLE_PIN P0_04 +#define BOARD_NAME "Azteeg X5 MINI WIFI" // // DIGIPOT slave addresses // -#define DIGIPOT_I2C_ADDRESS_A 0x58 // shifted slave address for first DIGIPOT (0x58 <- 0x2C << 1) -#define DIGIPOT_I2C_ADDRESS_B 0x5C // shifted slave address for second DIGIPOT (0x5C <- 0x2E << 1) - -// -// Temperature Sensors -// 3.3V max when defined as an analog input -// -#define TEMP_BED_PIN 0 // A0 (TH1) -#define TEMP_0_PIN 1 // A1 (TH2) - -// -// Heaters / Fans -// -#define HEATER_BED_PIN P2_07 -#define HEATER_0_PIN P2_05 -#ifndef FAN_PIN - #define FAN_PIN P0_26 +#ifndef DIGIPOT_I2C_ADDRESS_A + #define DIGIPOT_I2C_ADDRESS_A 0x58 // shifted slave address for first DIGIPOT (0x58 <- 0x2C << 1) #endif -#define FAN1_PIN P1_25 - -// -// Display -// -#if ENABLED(ULTRA_LCD) - - #if ENABLED(CR10_STOCKDISPLAY) - - // Re-Arm can support Creality stock display without SD card reader and single cable on EXP3. - // Re-Arm J3 pins 1 (p1.31) & 2 (P3.26) are not used. Stock cable will need to have one - // 10-pin IDC connector trimmed or replaced with a 12-pin IDC connector to fit J3. - // Requires REVERSE_ENCODER_DIRECTION in Configuration.h - - #define BEEPER_PIN P2_11 // J3-3 & AUX-4 - - #define BTN_EN1 P0_16 // J3-7 & AUX-4 - #define BTN_EN2 P1_23 // J3-5 & AUX-4 - #define BTN_ENC P3_25 // J3-4 & AUX-4 - - #define LCD_PINS_RS P0_15 // J3-9 & AUX-4 (CS) - #define LCD_PINS_ENABLE P0_18 // J3-10 & AUX-3 (SID, MOSI) - #define LCD_PINS_D4 P2_06 // J3-8 & AUX-3 (SCK, CLK) - - #else - - #define BTN_EN1 P3_26 // (31) J3-2 & AUX-4 - #define BTN_EN2 P3_25 // (33) J3-4 & AUX-4 - #define BTN_ENC P2_11 // (35) J3-3 & AUX-4 - - #define SD_DETECT_PIN P1_31 // (49) not 5V tolerant J3-1 & AUX-3 - #define KILL_PIN P1_22 // (41) J5-4 & AUX-4 - #define LCD_PINS_RS P0_16 // (16) J3-7 & AUX-4 - #define LCD_SDSS P0_16 // (16) J3-7 & AUX-4 - #define LCD_BACKLIGHT_PIN P0_16 // (16) J3-7 & AUX-4 - only used on DOGLCD controllers - #define LCD_PINS_ENABLE P0_18 // (51) (MOSI) J3-10 & AUX-3 - #define LCD_PINS_D4 P0_15 // (52) (SCK) J3-9 & AUX-3 - - #define DOGLCD_A0 P2_06 // (59) J3-8 & AUX-2 - - #if ENABLED(REPRAPWORLD_KEYPAD) - #define SHIFT_OUT P0_18 // (51) (MOSI) J3-10 & AUX-3 - #define SHIFT_CLK P0_15 // (52) (SCK) J3-9 & AUX-3 - #define SHIFT_LD P1_31 // (49) not 5V tolerant J3-1 & AUX-3 - #elif DISABLED(NEWPANEL) - //#define SHIFT_OUT P2_11 // (35) J3-3 & AUX-4 - //#define SHIFT_CLK P3_26 // (31) J3-2 & AUX-4 - //#define SHIFT_LD P3_25 // (33) J3-4 & AUX-4 - //#define SHIFT_EN P1_22 // (41) J5-4 & AUX-4 - #endif - - #if ENABLED(VIKI2) || ENABLED(miniVIKI) - //#define LCD_SCREEN_ROT_180 - - #define BEEPER_PIN P1_30 // (37) may change if cable changes - #define DOGLCD_CS P0_26 // (63) J5-3 & AUX-2 - #define DOGLCD_SCK SCK_PIN - #define DOGLCD_MOSI MOSI_PIN - - #define STAT_LED_BLUE_PIN P0_26 // (63) may change if cable changes - #define STAT_LED_RED_PIN P1_21 // ( 6) may change if cable changes - #else - #if ENABLED(ULTIPANEL) - #define LCD_PINS_D5 P1_17 // (71) ENET_MDIO - #define LCD_PINS_D6 P1_14 // (73) ENET_RX_ER - #define LCD_PINS_D7 P1_10 // (75) ENET_RXD1 - #endif - #define BEEPER_PIN P1_30 // (37) not 5V tolerant - #define DOGLCD_CS P0_16 // (16) - #endif - - #if ENABLED(MINIPANEL) - // GLCD features - //#define LCD_CONTRAST 190 - // Uncomment screen orientation - //#define LCD_SCREEN_ROT_90 - //#define LCD_SCREEN_ROT_180 - //#define LCD_SCREEN_ROT_270 - #endif - - #endif - -#endif // ULTRA_LCD - -// -// SD Support -// -//#define USB_SD_DISABLED // Disable host access to SD card as mass storage device through USB -//#define USB_SD_ONBOARD // Enable host access to SD card as mass storage device through USB - -//#define LPC_SD_LCD // Marlin uses the SD drive attached to the LCD -#define LPC_SD_ONBOARD // Marlin uses the SD drive on the control board. There is no SD detect pin - // for the onboard card. Init card from LCD menu or send M21 whenever printer - // is powered on to enable SD access. - -#if ENABLED(LPC_SD_LCD) - - #define SCK_PIN P0_15 - #define MISO_PIN P0_17 - #define MOSI_PIN P0_18 - #define SS_PIN P1_23 // Chip select for SD card used by Marlin - #define ONBOARD_SD_CS P0_06 // Chip select for "System" SD card - -#elif ENABLED(LPC_SD_ONBOARD) - - #if ENABLED(USB_SD_ONBOARD) - // When sharing the SD card with a PC we want the menu options to - // mount/unmount the card and refresh it. So we disable card detect. - #define SHARED_SD_CARD - #undef SD_DETECT_PIN // there is also no detect pin for the onboard card - #endif - #define SCK_PIN P0_07 - #define MISO_PIN P0_08 - #define MOSI_PIN P0_09 - #define SS_PIN P0_06 // Chip select for SD card used by Marlin - #define ONBOARD_SD_CS P0_06 // Chip select for "System" SD card - +#ifndef DIGIPOT_I2C_ADDRESS_B + #define DIGIPOT_I2C_ADDRESS_B 0x5C // shifted slave address for second DIGIPOT (0x5C <- 0x2E << 1) #endif + +#include "pins_AZTEEG_X5_MINI.h" diff --git a/Marlin/src/pins/pins_BAM_DICE_DUE.h b/Marlin/src/pins/pins_BAM_DICE_DUE.h index d763392c5da0..e985b140d8d5 100644 --- a/Marlin/src/pins/pins_BAM_DICE_DUE.h +++ b/Marlin/src/pins/pins_BAM_DICE_DUE.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -33,7 +33,7 @@ // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_ENABLE_PIN 66 // Pin should have a pullup/pulldown! +#define SPINDLE_LASER_ENA_PIN 66 // Pin should have a pullup/pulldown! #define SPINDLE_DIR_PIN 67 #define SPINDLE_LASER_PWM_PIN 44 // MUST BE HARDWARE PWM diff --git a/Marlin/src/pins/pins_BEAST.h b/Marlin/src/pins/pins_BEAST.h index 64f5614806ba..5f9709a17599 100644 --- a/Marlin/src/pins/pins_BEAST.h +++ b/Marlin/src/pins/pins_BEAST.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 new file mode 100644 index 000000000000..319c56f31f07 --- /dev/null +++ b/Marlin/src/pins/pins_BIGTREE_SKR_V1.3.h @@ -0,0 +1,304 @@ +/** + * 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 . + * + */ + +#ifndef TARGET_LPC1768 + #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." +#endif + +#ifndef BOARD_NAME + #define BOARD_NAME "BIGTREE SKR V1.3" +#endif + +// +// Servos +// +#define SERVO0_PIN P2_00 + +// +// Limit Switches +// +#define X_MIN_PIN P1_29 +#define X_MAX_PIN P1_28 +#define Y_MIN_PIN P1_27 +#define Y_MAX_PIN P1_26 +#define Z_MIN_PIN P1_25 +#define Z_MAX_PIN P1_24 + +// +// Z Probe (when not Z_MIN_PIN) +// +#ifndef Z_MIN_PROBE_PIN + #define Z_MIN_PROBE_PIN P1_24 +#endif + +// +// Filament Runout Sensor +// +#ifndef FIL_RUNOUT_PIN + #define FIL_RUNOUT_PIN P1_28 +#endif + +// +// Steppers +// +#define X_STEP_PIN P2_02 +#define X_DIR_PIN P2_06 +#define X_ENABLE_PIN P2_01 +#ifndef X_CS_PIN + #define X_CS_PIN P1_17 +#endif + +#define Y_STEP_PIN P0_19 +#define Y_DIR_PIN P0_20 +#define Y_ENABLE_PIN P2_08 +#ifndef Y_CS_PIN + #define Y_CS_PIN P1_15 +#endif + +#define Z_STEP_PIN P0_22 +#define Z_DIR_PIN P2_11 +#define Z_ENABLE_PIN P0_21 +#ifndef Z_CS_PIN + #define Z_CS_PIN P1_10 +#endif + +#define E0_STEP_PIN P2_13 +#define E0_DIR_PIN P0_11 +#define E0_ENABLE_PIN P2_12 +#ifndef E0_CS_PIN + #define E0_CS_PIN P1_08 +#endif + +#define E1_STEP_PIN P0_01 +#define E1_DIR_PIN P0_00 +#define E1_ENABLE_PIN P0_10 +#ifndef E1_CS_PIN + #define E1_CS_PIN P1_01 +#endif + +// +// Software SPI pins for TMC2130 stepper drivers +// +#if ENABLED(TMC_USE_SW_SPI) + #define TMC_SW_MOSI P4_28 + #define TMC_SW_MISO P0_05 + #define TMC_SW_SCK P0_04 +#endif + +#if HAS_DRIVER(TMC2208) + /** + * TMC2208 stepper drivers + * + * Hardware serial communication ports. + * If undefined software serial is used according to the pins below + */ + //#define X_HARDWARE_SERIAL Serial + //#define X2_HARDWARE_SERIAL Serial1 + //#define Y_HARDWARE_SERIAL Serial1 + //#define Y2_HARDWARE_SERIAL Serial1 + //#define Z_HARDWARE_SERIAL Serial1 + //#define Z2_HARDWARE_SERIAL Serial1 + //#define E0_HARDWARE_SERIAL Serial1 + //#define E1_HARDWARE_SERIAL Serial1 + //#define E2_HARDWARE_SERIAL Serial1 + //#define E3_HARDWARE_SERIAL Serial1 + //#define E4_HARDWARE_SERIAL Serial1 + + // + // Software serial + // + #define X_SERIAL_TX_PIN P4_29 + #define X_SERIAL_RX_PIN P1_17 + + #define Y_SERIAL_TX_PIN P1_16 + #define Y_SERIAL_RX_PIN P1_15 + + #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 Z2_SERIAL_TX_PIN P1_04 + #define Z2_SERIAL_RX_PIN P1_01 + +#endif + +// +// Temperature Sensors +// 3.3V max when defined as an analog input +// +#define TEMP_BED_PIN 0 // A0 (T0) - (67) - TEMP_BED_PIN +#define TEMP_0_PIN 1 // A1 (T1) - (68) - TEMP_0_PIN +#define TEMP_1_PIN 2 // A2 (T2) - (69) - TEMP_1_PIN + +// +// Heaters / Fans +// +#define HEATER_0_PIN P2_07 +#if HOTENDS == 1 + #define FAN1_PIN P2_04 +#else + #define HEATER_1_PIN P2_04 +#endif +#define FAN_PIN P2_03 +#define HEATER_BED_PIN P2_05 + +/* +| _____ _____ +| NC | · · | GND 5V | · · | GND +| RESET | · · | 1.31(SD_DETECT) (LCD_D7) 1.23 | · · | 1.22 (LCD_D6) +| (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 +*/ +#if ENABLED(ULTRA_LCD) + #define BEEPER_PIN P1_30 // (37) not 5V tolerant + #define BTN_ENC P0_28 // (58) open-drain + + #if ENABLED(CR10_STOCKDISPLAY) + #define LCD_PINS_RS P1_22 + + #define BTN_EN1 P1_18 + #define BTN_EN2 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 LCD_PINS_ENABLE P1_18 + #define LCD_PINS_D4 P1_20 + + #define LCD_SDSS P0_16 // (16) J3-7 & AUX-4 + #define SD_DETECT_PIN P1_31 // (49) (NOT 5V tolerant) + + #if ENABLED(FYSETC_MINI_12864) + #define DOGLCD_CS P1_18 + #define DOGLCD_A0 P1_19 + + #define LCD_BACKLIGHT_PIN -1 + + #define LCD_RESET_PIN P1_20 // Must be high or open for LCD to operate normally. + // Seems to work best if left open. + + #define FYSETC_MINI_12864_REV_1_2 + //#define FYSETC_MINI_12864_REV_2_0 + //#define FYSETC_MINI_12864_REV_2_1 + #if EITHER(FYSETC_MINI_12864_REV_1_2, FYSETC_MINI_12864_REV_2_0) + #define RGB_LED + #ifndef RGB_LED_R_PIN + #define RGB_LED_R_PIN P1_21 + #endif + #ifndef RGB_LED_G_PIN + #define RGB_LED_G_PIN P1_22 + #endif + #ifndef RGB_LED_B_PIN + #define RGB_LED_B_PIN P1_23 + #endif + #elif defined(FYSETC_MINI_12864_REV_2_1) + #define NEOPIXEL_LED + #define NEOPIXEL_TYPE NEO_GRB // NEO_GRBW / NEO_GRB - four/three channel driver type (defined in Adafruit_NeoPixel.h) + #define NEOPIXEL_PIN P1_21 // LED driving pin on motherboard 4 => D4 (EXP2-5 on Printrboard) / 30 => PC7 (EXP3-13 on Rumba) + #define NEOPIXEL_PIXELS 3 // 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 + #else + #error "Either FYSETC_MINI_12864_REV_1_2, FYSETC_MINI_12864_REV_2_0 or FYSETC_MINI_12864_REV_2_1 must be defined" + #endif + + #if !defined(LED_USER_PRESET_STARTUP) && EITHER(FYSETC_MINI_12864_REV_2_0, FYSETC_MINI_12864_REV_2_1) + #error "LED_USER_PRESET_STARTUP must be enabled when using FYSETC_MINI_12864 REV 2.0 and later" + #endif + + #else // !FYSETC_MINI_12864 + + #if ENABLED(MKS_MINI_12864) + #define DOGLCD_CS P1_21 + #define DOGLCD_A0 P1_22 + #endif + + #if ENABLED(ULTIPANEL) + #define LCD_PINS_D5 P1_21 + #define LCD_PINS_D6 P1_22 + #define LCD_PINS_D7 P1_23 + #endif + + #endif // !FYSETC_MINI_12864 + + #endif + +#endif // ULTRA_LCD + +// +// SD Support +// + +#if !ANY(LPC_SD_LCD, LPC_SD_ONBOARD, LPC_SD_CUSTOM_CABLE) + #undef USB_SD_DISABLED + #define USB_SD_ONBOARD + #define LPC_SD_LCD +#endif + +#if ENABLED(LPC_SD_LCD) + + #define SCK_PIN P0_15 + #define MISO_PIN P0_17 + #define MOSI_PIN P0_18 + #define SS_PIN P0_16 // Chip select for SD card used by Marlin + #define ONBOARD_SD_CS P0_06 // Chip select for "System" SD card + +#elif ENABLED(LPC_SD_ONBOARD) + + #if ENABLED(USB_SD_ONBOARD) + // When sharing the SD card with a PC we want the menu options to + // mount/unmount the card and refresh it. So we disable card detect. + #define SHARED_SD_CARD + #undef SD_DETECT_PIN + //#define SD_DETECT_PIN P0_27 // (57) open-drain + #endif + + #define SCK_PIN P0_07 + #define MISO_PIN P0_08 + #define MOSI_PIN P0_09 + #define SS_PIN P0_06 // Chip select for SD card used by Marlin + #define ONBOARD_SD_CS P0_06 // Chip select for "System" SD card + +#endif + + /** + * Special pins + * P1_30 (37) (NOT 5V tolerant) + * P1_31 (49) (NOT 5V tolerant) + * P0_27 (57) (Open collector) + * P0_28 (58) (Open collector) + */ diff --git a/Marlin/src/pins/pins_BIQU_B300_V1.0.h b/Marlin/src/pins/pins_BIQU_B300_V1.0.h new file mode 100644 index 000000000000..39f43839c0f8 --- /dev/null +++ b/Marlin/src/pins/pins_BIQU_B300_V1.0.h @@ -0,0 +1,176 @@ +/** + * 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 . + * + */ + +/** + * BIQU BQ111-A4 + * + * Applies to the following boards: + * + * BOARD_BIQU_BQ111_A4 (Hotend, Fan, Bed) + * + */ + +#ifndef TARGET_LPC1768 + #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." +#endif + +#ifndef BOARD_NAME + #define BOARD_NAME "BIQU Thunder B300 V1.0" +#endif + +// +// Limit Switches +// +#define X_MIN_PIN P1_24 // 10k pullup to 3.3V, 1K series +#define X_MAX_PIN P1_25 // 10k pullup to 3.3V, 1K series +#define Y_MIN_PIN P1_26 // 10k pullup to 3.3V, 1K series +#define Y_MAX_PIN P1_27 // 10k pullup to 3.3V, 1K series +#define Z_MIN_PIN P1_28 // 10k pullup to 3.3V, 1K series +#define Z_MAX_PIN P1_29 // 10k pullup to 3.3V, 1K series + +// +// Steppers +// +#define X_STEP_PIN P2_00 +#define X_DIR_PIN P0_05 +#define X_ENABLE_PIN P0_04 +#ifndef X_CS_PIN + #define X_CS_PIN P1_15 // ETH +#endif + +#define Y_STEP_PIN P2_01 +#define Y_DIR_PIN P0_11 +#define Y_ENABLE_PIN P0_10 +#ifndef Y_CS_PIN + #define Y_CS_PIN P1_14 // ETH +#endif + +#define Z_STEP_PIN P2_02 +#define Z_DIR_PIN P0_20 +#define Z_ENABLE_PIN P0_19 +#ifndef Z_CS_PIN + #define Z_CS_PIN P1_16 // ETH +#endif + +#define E0_STEP_PIN P2_03 +#define E0_DIR_PIN P0_22 +#define E0_ENABLE_PIN P0_21 +#ifndef E0_CS_PIN + #define E0_CS_PIN P1_17 // ETH +#endif + +// +// Software SPI pins for TMC2130 stepper drivers +// +#if ENABLED(TMC_USE_SW_SPI) + #define TMC_SW_MOSI P0_18 // ETH + #define TMC_SW_MISO P0_17 // ETH + #define TMC_SW_SCK P0_15 // ETH +#endif + +// +// Temperature Sensors +// 3.3V max when defined as an analog input +// +#define TEMP_0_PIN 1 // A0 (T0) +#define TEMP_BED_PIN 0 // A1 (T1) + +// +// Heaters / Fans +// +#define HEATER_0_PIN P2_07 +#define HEATER_BED_PIN P2_05 +#ifndef FAN_PIN + #define FAN_PIN P2_04 +#endif + +// +// Unused +// +//#define PIN_P2_10 P2_10 // IBOOT-1 +//#define PIN_P0_27 P0_27 // Onboard SD Detect + +/** + * LCD / Controller + * + * REPRAP_DISCOUNT_SMART_CONTROLLER is not supported due to the lack of LCD_PINS_D5, + * LCD_PINS_D6 or LCD_PINS_D7 in the EXP1 connector. + * + * A remote SD card is not supported as the pins routed to EXP2 are the same as used + * for the onboard SD card, and a chip select signal is not provided for the remote + * SD card. + */ +#if ENABLED(ULTRA_LCD) + + #define BEEPER_PIN P1_31 // EXP1-1 + + #define BTN_EN1 P3_26 // EXP2-3 + #define BTN_EN2 P3_25 // EXP2-5 + #define BTN_ENC P1_30 // EXP1-2 + + #define SD_DETECT_PIN P0_27 // EXP2-7 + #define LCD_PINS_RS P0_16 // EXP1-4 + #define LCD_PINS_ENABLE P0_18 // (MOSI) EXP1-3 + #define LCD_PINS_D4 P0_15 // (SCK) EXP1-5 + + #if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) && DISABLED(DOGLCD) + #error "REPRAP_DISCOUNT_SMART_CONTROLLER is not supported by the BIQU BQ111-A4" + #endif + + #if ENABLED(SDSUPPORT) + #error "SDSUPPORT is not supported by the BIQU BQ111-A4 when an LCD controller is used" + #endif + +#endif // ULTRA_LCD + +/** + * SD Card Reader + * + * Software SPI is used to interface with a stand-alone SD card reader connected to EXP1. + * Hardware SPI can't be used because P0_17 (MISO) is not brought out on this board. + */ +#if ENABLED(SDSUPPORT) + #define SCK_PIN P0_15 // EXP1-5 + #define MISO_PIN P0_16 // EXP1-4 + #define MOSI_PIN P0_18 // EXP1-3 + #define SS_PIN P1_30 // EXP1-2 + #define SDSS SS_PIN +#endif + +/** + * PWMS + * + * There are 6 PWMS. Each PWM can be assigned to one of two pins. + * + * PWM1.1 P0_18 LCD_PINS_ENABLE + * PWM1.1 P2_0 X_STEP_PIN + * PWM1.2 P1_20 + * PWM1.2 P2_1 Y_STEP_PIN + * PWM1.3 P1_21 + * PWM1.3 P2_2 Z_STEP_PIN + * PWM1.4 P1_23 + * PWM1.4 P2_3 E0_STEP_PIN + * PWM1.5 P1_24 X_MIN_PIN + * PWM1.5 P2_4 FAN_PIN + * PWM1.6 P1_26 Y_MIN_PIN + * PWM1.6 P2_5 HEATER_BED_PIN + */ diff --git a/Marlin/src/pins/pins_BIQU_BQ111_A4.h b/Marlin/src/pins/pins_BIQU_BQ111_A4.h index f499241ab97b..c20b06de3202 100644 --- a/Marlin/src/pins/pins_BIQU_BQ111_A4.h +++ b/Marlin/src/pins/pins_BIQU_BQ111_A4.h @@ -1,7 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_BIQU_KFB_2.h b/Marlin/src/pins/pins_BIQU_KFB_2.h index f629424a8d84..ab5919169017 100644 --- a/Marlin/src/pins/pins_BIQU_KFB_2.h +++ b/Marlin/src/pins/pins_BIQU_KFB_2.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_BIQU_SKR_V1.1.h b/Marlin/src/pins/pins_BIQU_SKR_V1.1.h new file mode 100644 index 000000000000..17af3c4d0400 --- /dev/null +++ b/Marlin/src/pins/pins_BIQU_SKR_V1.1.h @@ -0,0 +1,282 @@ +/** + * 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 . + * + */ + +#ifndef TARGET_LPC1768 + #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." +#endif + +#ifndef BOARD_NAME + #define BOARD_NAME "BIQU SKR V1.1" +#endif + +// +// Limit Switches +// +#define X_MIN_PIN P1_29 +#define X_MAX_PIN P1_28 +#define Y_MIN_PIN P1_27 +#define Y_MAX_PIN P1_26 +#define Z_MIN_PIN P1_25 +#define Z_MAX_PIN P1_24 + +// +// Steppers +// +#define X_STEP_PIN P0_04 +#define X_DIR_PIN P0_05 +#define X_ENABLE_PIN P4_28 + +#define Y_STEP_PIN P2_01 +#define Y_DIR_PIN P2_02 +#define Y_ENABLE_PIN P2_00 + +#define Z_STEP_PIN P0_20 +#define Z_DIR_PIN P0_21 +#define Z_ENABLE_PIN P0_19 + +#define E0_STEP_PIN P0_11 +#define E0_DIR_PIN P2_13 +#define E0_ENABLE_PIN P2_12 + +#define E1_STEP_PIN P0_01 +#define E1_DIR_PIN P0_00 +#define E1_ENABLE_PIN P0_10 + +// +// Temperature Sensors +// 3.3V max when defined as an analog input +// +#define TEMP_BED_PIN 0 // Analog Input +#define TEMP_0_PIN 1 // Analog Input +#define TEMP_1_PIN 2 // Analog Input + +// +// Heaters / Fans +// +#define HEATER_0_PIN P2_07 +#if HOTENDS == 1 + #define FAN1_PIN P2_04 +#else + #define HEATER_1_PIN P2_04 +#endif +#define FAN_PIN P2_03 +#define HEATER_BED_PIN P2_05 + +/** + * LCD / Controller + * + * As of 20 JAN 2019 only the REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER display has + * been tested with these settings. It can be connected to the SKR using standard cables + * via the EXP1 and EXP2 ports. Other displays may need a custom cable and/or changes to + * the pins defined below. + * + * The SD card on the LCD controller uses the same SPI signals as the LCD, resulting in + * garbage/lines on the LCD display during SD card access. The LCD code mitigates this + * by redrawing the screen after SD card accesses. + */ + +#if ENABLED(ULTRA_LCD) + #define BEEPER_PIN P1_30 + #define BTN_EN1 P3_26 + #define BTN_EN2 P3_25 + #define BTN_ENC P2_11 + + #define SD_DETECT_PIN P1_31 + #define LCD_SDSS P1_23 + #define LCD_PINS_RS P0_16 + #define LCD_PINS_ENABLE P0_18 + #define LCD_PINS_D4 P0_15 + + #if ENABLED(MKS_MINI_12864) + #define DOGLCD_CS P2_06 + #define DOGLCD_A0 P0_16 + #endif +#endif + +// +// SD Support +// +// MKS_MINI_12864 strongly prefers the SD card on the display and +// requires jumpers on the SKR V1.1 board as documented here: +// https://www.facebook.com/groups/505736576548648/permalink/630639874058317/ +#if !ANY(LPC_SD_LCD, LPC_SD_ONBOARD, LPC_SD_CUSTOM_CABLE) + #if ENABLED(MKS_MINI_12864) + #define LPC_SD_LCD + #undef USB_SD_DISABLED + #define USB_SD_ONBOARD + #else + #define USB_SD_ONBOARD + #define LPC_SD_ONBOARD + #endif +#endif + +#if ENABLED(LPC_SD_LCD) + + #define SCK_PIN P0_15 + #define MISO_PIN P0_17 + #define MOSI_PIN P0_18 + #define SS_PIN P1_23 // Chip select for SD card used by Marlin + #define ONBOARD_SD_CS P0_06 // Chip select for "System" SD card + +#elif ENABLED(LPC_SD_ONBOARD) + + #if ENABLED(USB_SD_ONBOARD) + // When sharing the SD card with a PC we want the menu options to + // mount/unmount the card and refresh it. So we disable card detect. + #define SHARED_SD_CARD + #undef SD_DETECT_PIN // there is also no detect pin for the onboard card + #endif + #define SCK_PIN P0_07 + #define MISO_PIN P0_08 + #define MOSI_PIN P0_09 + #define SS_PIN P0_06 // Chip select for SD card used by Marlin + #define ONBOARD_SD_CS P0_06 // Chip select for "System" SD card + +#endif + +// Trinamic driver support + +#if HAS_TRINAMIC + // Using TMC devices in intelligent mode requires extra connections to each device. Unfortunately + // the SKR does not have many free pins (especially if a display is in use). The SPI-based devices + // will require 3 connections (clock, mosi, miso), plus a chip select line (CS) for each driver. + // The UART-based devices require 2 pis per deriver (one of which must be interrupt capable). + // The same SPI pins can be shared with the display/SD card reader, meaning SPI-based devices are + // probably a good choice for this board. + // + // SOFTWARE_DRIVER_ENABLE is a good option. It uses SPI to control the driver enable and allows the + // hardware ENABLE pins for each driver to be repurposed as SPI chip select. To use this mode the + // driver modules will probably need to be modified, removing the pin used for the enable line from + // the module and wiring this connection directly to GND (as is the case for TMC2130). + // Using this option and sharing all of the SPI pins allows 5 TMC2130 drivers to be used along with + // a REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER without requiring the use of any extra pins. + // + // Other options will probably require the use of any free pins and the TFT serial port or a + // different type of display (like the TFT), using the pins normally used for the display and encoder. + // Unfortunately, tests show it's not possible to use endstop and thermistor pins for chip-select. + // Sample settings are provided below, but only some have been tested. + // + // Another option is to share the enable and chip-select pins when using SPI. Several users have + // reported that this works. However, it's unlikely that this configuration will allow SPI communi- + // cation with the device when the drivers are active, meaning that some of the more advanced TMC + // options may not be available. + + // When using any TMC SPI-based drivers, software SPI is used + // because pins may be shared with the display or SD card. + #define TMC_USE_SW_SPI + #define TMC_SW_MOSI P0_18 + #define TMC_SW_MISO P0_17 + // To minimize pin usage use the same clock pin as the display/SD card reader. (May generate LCD noise.) + #define TMC_SW_SCK P0_15 + // If pin 2_06 is unused, it can be used for the clock to avoid the LCD noise. + //#define TMC_SW_SCK P2_06 + + #if ENABLED(SOFTWARE_DRIVER_ENABLE) + + // Software enable allows the enable pins to be repurposed as chip-select pins. + // Note: Requires the driver modules to be modified to always be enabled with the enable pin removed. + #if AXIS_DRIVER_TYPE_X(TMC2130) + #define X_CS_PIN P4_28 + #undef X_ENABLE_PIN + #define X_ENABLE_PIN -1 + #endif + + #if AXIS_DRIVER_TYPE_Y(TMC2130) + #define Y_CS_PIN P2_00 + #undef Y_ENABLE_PIN + #define Y_ENABLE_PIN -1 + #endif + + #if AXIS_DRIVER_TYPE_Z(TMC2130) + #define Z_CS_PIN P0_19 + #undef Z_ENABLE_PIN + #define Z_ENABLE_PIN -1 + #endif + + #if AXIS_DRIVER_TYPE_E0(TMC2130) + #define E0_CS_PIN P2_12 + #undef E0_ENABLE_PIN + #define E0_ENABLE_PIN -1 + #endif + + + #if AXIS_DRIVER_TYPE_E1(TMC2130) + #define E1_CS_PIN P0_10 + #undef E1_ENABLE_PIN + #define E1_ENABLE_PIN -1 + #endif + + #else // !SOFTWARE_DRIVER_ENABLE + + // A chip-select pin is needed for each driver. + + // EXAMPLES + + // Example 1: No LCD attached or a TFT style display using the AUX header RX/TX pins. + // LPC_SD_LCD must not be enabled. Nothing should be connected to EXP1/EXP2. + //#define SKR_USE_LCD_PINS_FOR_CS + #if ENABLED(SKR_USE_LCD_PINS_FOR_CS) + #if ENABLED(LPC_SD_LCD) + #error "LPC_SD_LCD must not be enabled with SKR_USE_LCD_PINS_FOR_CS." + #endif + #define X_CS_PIN P1_23 + #define Y_CS_PIN P3_26 + #define Z_CS_PIN P2_11 + #define E0_CS_PIN P3_25 + #define E1_CS_PIN P1_31 + #endif + + // Example 2: A REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER + // The SD card reader attached to the LCD (if present) can't be used because + // the pins will be in use. So LPC_SD_LCD must not be defined. + //#define SKR_USE_LCD_SD_CARD_PINS_FOR_CS + #if ENABLED(SKR_USE_LCD_SD_CARD_PINS_FOR_CS) + #if ENABLED(LPC_SD_LCD) + #error "LPC_SD_LCD must not be enabled with SKR_USE_LCD_SD_CARD_PINS_FOR_CS." + #endif + #define X_CS_PIN P0_02 + #define Y_CS_PIN P0_03 + #define Z_CS_PIN P2_06 + // We use SD_DETECT_PIN for E0 + #undef SD_DETECT_PIN + #define E0_CS_PIN P1_31 + // We use LCD_SDSS pin for E1 + #undef LCD_SDSS + #define LCD_SDSS -1 + #define E1_CS_PIN P1_23 + #endif + + // Example 3: Use the driver enable pins for chip-select. + // Commands must not be sent to the drivers when enabled. So certain + // advanced features (like driver monitoring) will not be available. + //#define SKR_USE_ENABLE_CS + #if ENABLED(SKR_USE_ENABLE_FOR_CS) + #define X_CS_PIN X_ENABLE_PIN + #define Y_CS_PIN Y_ENABLE_PIN + #define Z_CS_PIN Z_ENABLE_PIN + #define E0_CS_PIN E0_ENABLE_PIN + #define E1_CS_PIN E1_ENABLE_PIN + #endif + + #endif // SOFTWARE_DRIVER_ENABLE + +#endif diff --git a/Marlin/src/pins/pins_BLACK_STM32F407VE.h b/Marlin/src/pins/pins_BLACK_STM32F407VE.h new file mode 100644 index 000000000000..477bb909adb7 --- /dev/null +++ b/Marlin/src/pins/pins_BLACK_STM32F407VE.h @@ -0,0 +1,131 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * STM32F407VET6 with RAMPS-like shield + * 'Black' STM32F407VET6 board - http://wiki.stm32duino.com/index.php?title=STM32F407 + * Shield - https://github.com/jmz52/Hardware + */ + +#pragma once + +#if !defined(STM32F4) && !defined(STM32F4xx) + #error "Oops! Select an STM32F4 board in 'Tools > Board.'" +#endif + +#define DEFAULT_MACHINE_NAME "STM32F407VET6" +//#define BOARD_NAME "Black STM32F4VET6" + +//#define I2C_EEPROM +//#define E2END 0x1FFF // EEPROM end address (8kB) +#define EEPROM_EMULATED_WITH_SRAM + +#if HOTENDS > 2 || E_STEPPERS > 2 + #error "Black STM32F4VET6 supports up to 2 hotends / E-steppers." +#endif + +// +// Servos +// +#define SERVO0_PIN PC6 +#define SERVO1_PIN PC7 + +// +// Limit Switches +// +#define X_MIN_PIN PC13 +#define X_MAX_PIN PA15 +#define Y_MIN_PIN PA5 +#define Y_MAX_PIN PD12 +#define Z_MIN_PIN PD14 +#define Z_MAX_PIN PD15 + +// +// Steppers +// +#define X_STEP_PIN PC4 +#define X_DIR_PIN PA4 +#define X_ENABLE_PIN PE7 + +#define Y_STEP_PIN PE5 +#define Y_DIR_PIN PE2 +#define Y_ENABLE_PIN PE6 + +#define Z_STEP_PIN PD5 +#define Z_DIR_PIN PD3 +#define Z_ENABLE_PIN PD6 + +#define E0_STEP_PIN PD7 +#define E0_DIR_PIN PD0 +#define E0_ENABLE_PIN PB9 + +#define E1_STEP_PIN PE0 +#define E1_DIR_PIN PE1 +#define E1_ENABLE_PIN PB8 + +// +// Temperature Sensors +// +#define TEMP_0_PIN PC0 // T0 +#define TEMP_1_PIN PC1 // T1 +#define TEMP_BED_PIN PC2 // TB +#define TEMP_CHAMBER_PIN PC3 // TC + +// +// Heaters / Fans +// +#define HEATER_0_PIN PA2 // Heater0 +#define HEATER_1_PIN PA3 // Heater1 +#define HEATER_BED_PIN PA1 // Hotbed + +#define FAN_PIN PE9 // Fan0 +#define FAN1_PIN PE11 // Fan1 +#define FAN2_PIN PE13 // Fan2 +#define FAN3_PIN PE14 // Fan3 + +// +// Misc. Functions +// +#define SDSS PB12 +#define LED_PIN PA6 +//#define LED_PIN PA7 +#define KILL_PIN PB1 + +// +// LCD / Controller +// +#define SD_DETECT_PIN PC5 +//#define SD_DETECT_PIN PA8 // SDIO SD_DETECT_PIN, external SDIO card reader only + +#define BEEPER_PIN PD10 +#define LCD_PINS_RS PE15 +#define LCD_PINS_ENABLE PD8 +#define LCD_PINS_D4 PE10 +#define LCD_PINS_D5 PE12 +#define LCD_PINS_D6 PD1 +#define LCD_PINS_D7 PE8 +#define BTN_ENC PD9 +#define BTN_EN1 PD4 +#define BTN_EN2 PD13 + +#define DOGLCD_CS LCD_PINS_D5 +#define DOGLCD_A0 LCD_PINS_D6 diff --git a/Marlin/src/pins/pins_BQ_ZUM_MEGA_3D.h b/Marlin/src/pins/pins_BQ_ZUM_MEGA_3D.h index c25115c7bb6c..c09e946f5d3c 100644 --- a/Marlin/src/pins/pins_BQ_ZUM_MEGA_3D.h +++ b/Marlin/src/pins/pins_BQ_ZUM_MEGA_3D.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -49,7 +49,7 @@ // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_ENABLE_PIN 40 // Pin should have a pullup/pulldown! +#define SPINDLE_LASER_ENA_PIN 40 // Pin should have a pullup/pulldown! #define SPINDLE_LASER_PWM_PIN 44 // MUST BE HARDWARE PWM #define SPINDLE_DIR_PIN 42 diff --git a/Marlin/src/pins/pins_BRAINWAVE.h b/Marlin/src/pins/pins_BRAINWAVE.h index e798dfb890ea..9e7eb47868a8 100644 --- a/Marlin/src/pins/pins_BRAINWAVE.h +++ b/Marlin/src/pins/pins_BRAINWAVE.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_BRAINWAVE_PRO.h b/Marlin/src/pins/pins_BRAINWAVE_PRO.h index 84542f69fe41..78269a62c5d1 100644 --- a/Marlin/src/pins/pins_BRAINWAVE_PRO.h +++ b/Marlin/src/pins/pins_BRAINWAVE_PRO.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_CHEAPTRONIC.h b/Marlin/src/pins/pins_CHEAPTRONIC.h index 65e81ae45dbb..8aa03cf7f97e 100644 --- a/Marlin/src/pins/pins_CHEAPTRONIC.h +++ b/Marlin/src/pins/pins_CHEAPTRONIC.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -77,10 +77,3 @@ // LCD / Controller // // Cheaptronic v1.0 doesn't support LCD -#define LCD_PINS_RS -1 -#define LCD_PINS_ENABLE -1 - -// Cheaptronic v1.0 doesn't support keypad -#define BTN_EN1 -1 -#define BTN_EN2 -1 -#define BTN_ENC -1 diff --git a/Marlin/src/pins/pins_CHEAPTRONICv2.h b/Marlin/src/pins/pins_CHEAPTRONICv2.h index 56617c537e34..963ebeab0ec9 100644 --- a/Marlin/src/pins/pins_CHEAPTRONICv2.h +++ b/Marlin/src/pins/pins_CHEAPTRONICv2.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -109,7 +109,7 @@ #endif // -// LCD +// LCD / Controller // #define LCD_PINS_RS 19 #define LCD_PINS_ENABLE 42 @@ -119,12 +119,18 @@ #define LCD_PINS_D7 40 // -// SD CARD, ROTARY ENCODER, BEEPER +// Beeper, SD Card, Encoder // -#define SDPOWER -1 -#define SDSS 53 -#define SD_DETECT_PIN 49 #define BEEPER_PIN 44 -#define BTN_EN1 11 -#define BTN_EN2 12 -#define BTN_ENC 43 + +#if ENABLED(SDSUPPORT) + #define SDPOWER -1 + #define SDSS 53 + #define SD_DETECT_PIN 49 +#endif + +#if ENABLED(NEWPANEL) + #define BTN_EN1 11 + #define BTN_EN2 12 + #define BTN_ENC 43 +#endif diff --git a/Marlin/src/pins/pins_CHITU3D.h b/Marlin/src/pins/pins_CHITU3D.h index 522193a82450..db094c76c030 100644 --- a/Marlin/src/pins/pins_CHITU3D.h +++ b/Marlin/src/pins/pins_CHITU3D.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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_COHESION3D_MINI.h b/Marlin/src/pins/pins_COHESION3D_MINI.h index 649403b7bb90..edea670b7a54 100644 --- a/Marlin/src/pins/pins_COHESION3D_MINI.h +++ b/Marlin/src/pins/pins_COHESION3D_MINI.h @@ -1,7 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -25,8 +24,8 @@ * Cohesion3D Mini pin assignments */ -#ifndef TARGET_LPC1768 - #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." +#ifndef LPC1769 + #error "Oops! Make sure you have the LPC1769 environment selected in your IDE." #endif #define BOARD_NAME "Cohesion3D Mini" @@ -34,53 +33,53 @@ // // Servos // -#define SERVO0_PIN P1_23 +#define SERVO0_PIN P1_23 // // Limit Switches // -#define X_MIN_PIN P1_24 // 10k pullup to 3.3V -#define X_MAX_PIN P1_25 // 10k pullup to 3.3V -#define Y_MIN_PIN P1_26 // 10k pullup to 3.3V -#define Y_MAX_PIN P1_27 // 10k pullup to 3.3V -#define Z_MIN_PIN P1_28 // 10k pullup to 3.3V -#define Z_MAX_PIN P1_29 // 10k pullup to 3.3V +#define X_MIN_PIN P1_24 // 10k pullup to 3.3V +#define X_MAX_PIN P1_25 // 10k pullup to 3.3V +#define Y_MIN_PIN P1_26 // 10k pullup to 3.3V +#define Y_MAX_PIN P1_27 // 10k pullup to 3.3V +#define Z_MIN_PIN P1_28 // 10k pullup to 3.3V +#define Z_MAX_PIN P1_29 // 10k pullup to 3.3V // // Steppers // -#define X_STEP_PIN P2_00 -#define X_DIR_PIN P0_05 -#define X_ENABLE_PIN P0_04 -#define X_CS_PIN P1_10 // Ethernet Expansion - Pin 9 +#define X_STEP_PIN P2_00 +#define X_DIR_PIN P0_05 +#define X_ENABLE_PIN P0_04 +#define X_CS_PIN P1_10 // Ethernet Expansion - Pin 9 -#define Y_STEP_PIN P2_01 -#define Y_DIR_PIN P0_11 -#define Y_ENABLE_PIN P0_10 -#define Y_CS_PIN P1_09 // Ethernet Expansion - Pin 10 +#define Y_STEP_PIN P2_01 +#define Y_DIR_PIN P0_11 +#define Y_ENABLE_PIN P0_10 +#define Y_CS_PIN P1_09 // Ethernet Expansion - Pin 10 -#define Z_STEP_PIN P2_02 -#define Z_DIR_PIN P0_20 -#define Z_ENABLE_PIN P0_19 -#define Z_CS_PIN P1_00 // Ethernet Expansion - Pin 11 +#define Z_STEP_PIN P2_02 +#define Z_DIR_PIN P0_20 +#define Z_ENABLE_PIN P0_19 +#define Z_CS_PIN P1_00 // Ethernet Expansion - Pin 11 -#define E0_STEP_PIN P2_03 -#define E0_DIR_PIN P0_22 -#define E0_ENABLE_PIN P0_21 -#define E0_CS_PIN P1_04 // Ethernet Expansion - Pin 12 +#define E0_STEP_PIN P2_03 +#define E0_DIR_PIN P0_22 +#define E0_ENABLE_PIN P0_21 +#define E0_CS_PIN P1_04 // Ethernet Expansion - Pin 12 // // Default pins for TMC software SPI // #if ENABLED(TMC_USE_SW_SPI) #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI P1_16 // Ethernet Expansion - Pin 5 + #define TMC_SW_MOSI P1_16 // Ethernet Expansion - Pin 5 #endif #ifndef TMC_SW_MISO - #define TMC_SW_MISO P1_17 // Ethernet Expansion - Pin 6 + #define TMC_SW_MISO P1_17 // Ethernet Expansion - Pin 6 #endif #ifndef TMC_SW_SCK - #define TMC_SW_SCK P1_08 // Ethernet Expansion - Pin 7 + #define TMC_SW_SCK P1_08 // Ethernet Expansion - Pin 7 #endif #endif @@ -94,36 +93,36 @@ // // Heaters / Fans // -#define HEATER_BED_PIN P2_05 -#define HEATER_0_PIN P2_07 // FET 1 +#define HEATER_BED_PIN P2_05 +#define HEATER_0_PIN P2_07 // FET 1 #ifndef FAN_PIN - #define FAN_PIN P2_06 // ReMix FET 4, Mini FET 3 + #define FAN_PIN P2_06 // FET 3 #endif // // Auto fans // -#define AUTO_FAN_PIN P2_04 // FET 4 +#define AUTO_FAN_PIN P2_04 // FET 4 -#define ORIG_E0_AUTO_FAN_PIN AUTO_FAN_PIN -#define ORIG_E1_AUTO_FAN_PIN AUTO_FAN_PIN -#define ORIG_E2_AUTO_FAN_PIN AUTO_FAN_PIN +#define ORIG_E0_AUTO_FAN_PIN AUTO_FAN_PIN +#define ORIG_E1_AUTO_FAN_PIN AUTO_FAN_PIN +#define ORIG_E2_AUTO_FAN_PIN AUTO_FAN_PIN // // Misc. Functions // -#define LED_PIN P4_28 // Play LED +#define LED_PIN P4_28 // Play LED // // M3/M4/M5 - Spindle/Laser Control // #if ENABLED(SPINDLE_LASER_ENABLE) #undef HEATER_0_PIN - #define SPINDLE_LASER_ENABLE_PIN P2_07 // FET 1 + #define SPINDLE_LASER_ENA_PIN P2_07 // FET 1 #undef HEATER_BED_PIN #define SPINDLE_LASER_PWM_PIN P2_05 // Bed FET #undef FAN_PIN - #define SPINDLE_DIR_PIN P2_06 // ReMix FET 4, Mini FET 3 + #define SPINDLE_DIR_PIN P2_06 // FET 3 #endif // @@ -138,18 +137,18 @@ // #if ENABLED(ULTRA_LCD) - #define BEEPER_PIN P0_27 // EXP2-7 - open drain + #define BEEPER_PIN P0_27 // EXP2-7 - open drain - #define BTN_EN1 P3_26 // EXP2-5 - #define BTN_EN2 P3_25 // EXP2-3 - #define BTN_ENC P1_30 // EXP1-2 + #define BTN_EN1 P3_26 // EXP2-5 + #define BTN_EN2 P3_25 // EXP2-3 + #define BTN_ENC P1_30 // EXP1-2 - #define LCD_PINS_RS P0_16 // EXP1-4 - #define LCD_SDSS P0_28 // EXP2-4 - #define LCD_PINS_ENABLE P0_18 // EXP1-3 - #define LCD_PINS_D4 P0_15 // EXP1-5 + #define LCD_PINS_RS P0_16 // EXP1-4 + #define LCD_SDSS P0_28 // EXP2-4 + #define LCD_PINS_ENABLE P0_18 // EXP1-3 + #define LCD_PINS_D4 P0_15 // EXP1-5 - #define KILL_PIN P2_11 // EXP2-10 + #define KILL_PIN P2_11 // EXP2-10 #if ENABLED(SDSUPPORT) #error "SDSUPPORT is not currently supported by the Cohesion3D boards" @@ -160,13 +159,13 @@ // // Ethernet pins // -#define ENET_MDIO P1_17 -#define ENET_RX_ER P1_14 -#define ENET_RXD1 P1_10 -#define ENET_MOC P1_16 -#define REF_CLK P1_15 -#define ENET_RXD0 P1_09 -#define ENET_CRS P1_08 -#define ENET_TX_EN P1_04 -#define ENET_TXD0 P1_00 -#define ENET_TXD1 P1_01 +#define ENET_MDIO P1_17 +#define ENET_RX_ER P1_14 +#define ENET_RXD1 P1_10 +#define ENET_MOC P1_16 +#define REF_CLK P1_15 +#define ENET_RXD0 P1_09 +#define ENET_CRS P1_08 +#define ENET_TX_EN P1_04 +#define ENET_TXD0 P1_00 +#define ENET_TXD1 P1_01 diff --git a/Marlin/src/pins/pins_COHESION3D_REMIX.h b/Marlin/src/pins/pins_COHESION3D_REMIX.h index 23e8d21d0234..00b6714cea4f 100644 --- a/Marlin/src/pins/pins_COHESION3D_REMIX.h +++ b/Marlin/src/pins/pins_COHESION3D_REMIX.h @@ -1,7 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -25,8 +24,8 @@ * Cohesion3D ReMix pin assignments */ -#ifndef TARGET_LPC1768 - #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." +#ifndef LPC1769 + #error "Oops! Make sure you have the LPC1769 environment selected in your IDE." #endif #define BOARD_NAME "Cohesion3D ReMix" @@ -34,63 +33,63 @@ // // Servos // -#define SERVO0_PIN P2_04 +#define SERVO0_PIN P2_04 // // Limit Switches // -#define X_MIN_PIN P1_24 // 10k pullup to 3.3V -#define X_MAX_PIN P1_25 // 10k pullup to 3.3V -#define Y_MIN_PIN P1_26 // 10k pullup to 3.3V -#define Y_MAX_PIN P1_27 // 10k pullup to 3.3V -#define Z_MIN_PIN P1_28 // 10k pullup to 3.3V -#define Z_MAX_PIN P1_29 // 10k pullup to 3.3V +#define X_MIN_PIN P1_24 // 10k pullup to 3.3V +#define X_MAX_PIN P1_25 // 10k pullup to 3.3V +#define Y_MIN_PIN P1_26 // 10k pullup to 3.3V +#define Y_MAX_PIN P1_27 // 10k pullup to 3.3V +#define Z_MIN_PIN P1_28 // 10k pullup to 3.3V +#define Z_MAX_PIN P1_29 // 10k pullup to 3.3V // // Steppers // -#define X_STEP_PIN P2_00 -#define X_DIR_PIN P0_05 -#define X_ENABLE_PIN P0_04 -#define X_CS_PIN P1_10 // Ethernet Expansion - Pin 9 +#define X_STEP_PIN P2_00 +#define X_DIR_PIN P0_05 +#define X_ENABLE_PIN P0_04 +#define X_CS_PIN P1_10 // Ethernet Expansion - Pin 9 -#define Y_STEP_PIN P2_01 -#define Y_DIR_PIN P0_11 -#define Y_ENABLE_PIN P0_10 -#define Y_CS_PIN P1_09 // Ethernet Expansion - Pin 10 +#define Y_STEP_PIN P2_01 +#define Y_DIR_PIN P0_11 +#define Y_ENABLE_PIN P0_10 +#define Y_CS_PIN P1_09 // Ethernet Expansion - Pin 10 -#define Z_STEP_PIN P2_02 -#define Z_DIR_PIN P0_20 -#define Z_ENABLE_PIN P0_19 -#define Z_CS_PIN P1_00 // Ethernet Expansion - Pin 11 +#define Z_STEP_PIN P2_02 +#define Z_DIR_PIN P0_20 +#define Z_ENABLE_PIN P0_19 +#define Z_CS_PIN P1_00 // Ethernet Expansion - Pin 11 -#define E0_STEP_PIN P2_03 -#define E0_DIR_PIN P0_22 -#define E0_ENABLE_PIN P0_21 -#define E0_CS_PIN P1_04 // Ethernet Expansion - Pin 12 +#define E0_STEP_PIN P2_03 +#define E0_DIR_PIN P0_22 +#define E0_ENABLE_PIN P0_21 +#define E0_CS_PIN P1_04 // Ethernet Expansion - Pin 12 -#define E1_STEP_PIN P2_08 -#define E1_DIR_PIN P2_13 -#define E1_ENABLE_PIN P4_29 -#define E1_CS_PIN P1_01 // Ethernet Expansion - Pin 14 +#define E1_STEP_PIN P2_08 +#define E1_DIR_PIN P2_13 +#define E1_ENABLE_PIN P4_29 +#define E1_CS_PIN P1_01 // Ethernet Expansion - Pin 14 -#define E2_STEP_PIN P1_20 -#define E2_DIR_PIN P1_19 -#define E2_ENABLE_PIN P1_21 -#define E2_CS_PIN P1_18 // FET 6 +#define E2_STEP_PIN P1_20 +#define E2_DIR_PIN P1_19 +#define E2_ENABLE_PIN P1_21 +#define E2_CS_PIN P1_18 // FET 6 // // Default pins for TMC software SPI // #if ENABLED(TMC_USE_SW_SPI) #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI P1_16 // Ethernet Expansion - Pin 5 + #define TMC_SW_MOSI P1_16 // Ethernet Expansion - Pin 5 #endif #ifndef TMC_SW_MISO - #define TMC_SW_MISO P1_17 // Ethernet Expansion - Pin 6 + #define TMC_SW_MISO P1_17 // Ethernet Expansion - Pin 6 #endif #ifndef TMC_SW_SCK - #define TMC_SW_SCK P1_08 // Ethernet Expansion - Pin 7 + #define TMC_SW_SCK P1_08 // Ethernet Expansion - Pin 7 #endif #endif @@ -110,21 +109,21 @@ // // Heaters / Fans // -#define HEATER_BED_PIN P2_05 -#define HEATER_0_PIN P2_07 // FET 1 -#define HEATER_1_PIN P1_23 // FET 2 -#define HEATER_2_PIN P1_22 // FET 3 +#define HEATER_BED_PIN P2_05 +#define HEATER_0_PIN P2_07 // FET 1 +#define HEATER_1_PIN P1_23 // FET 2 +#define HEATER_2_PIN P1_22 // FET 3 #ifndef FAN_PIN - #define FAN_PIN P2_06 // ReMix FET 4, Mini FET 3 + #define FAN_PIN P2_06 // FET 4 #endif // // Auto fans // #if HOTENDS == 3 - #define AUTO_FAN_PIN P1_18 // FET 6 + #define AUTO_FAN_PIN P1_18 // FET 6 #else - #define AUTO_FAN_PIN P1_22 // FET 3 + #define AUTO_FAN_PIN P1_22 // FET 3 #endif #define ORIG_E0_AUTO_FAN_PIN AUTO_FAN_PIN #define ORIG_E1_AUTO_FAN_PIN AUTO_FAN_PIN @@ -133,18 +132,18 @@ // // Misc. Functions // -#define LED_PIN P4_28 // Play LED +#define LED_PIN P4_28 // Play LED // // M3/M4/M5 - Spindle/Laser Control // #if ENABLED(SPINDLE_LASER_ENABLE) #undef HEATER_0_PIN - #define SPINDLE_LASER_ENABLE_PIN P2_07 // FET 1 + #define SPINDLE_LASER_ENA_PIN P2_07 // FET 1 #undef HEATER_BED_PIN #define SPINDLE_LASER_PWM_PIN P2_05 // Bed FET #undef FAN_PIN - #define SPINDLE_DIR_PIN P2_06 // ReMix FET 4, Mini FET 3 + #define SPINDLE_DIR_PIN P2_06 // FET 4 #endif // @@ -159,19 +158,19 @@ // #if ENABLED(ULTRA_LCD) - #define BEEPER_PIN P1_31 // EXP1-1 - #define SD_DETECT_PIN P0_27 // EXP2-7 + #define BEEPER_PIN P1_31 // EXP1-1 + #define SD_DETECT_PIN P0_27 // EXP2-7 - #define BTN_EN1 P3_26 // EXP2-5 - #define BTN_EN2 P3_25 // EXP2-3 - #define BTN_ENC P1_30 // EXP1-2 + #define BTN_EN1 P3_26 // EXP2-5 + #define BTN_EN2 P3_25 // EXP2-3 + #define BTN_ENC P1_30 // EXP1-2 - #define LCD_PINS_RS P0_16 // EXP1-4 - #define LCD_SDSS P0_28 // EXP2-4 - #define LCD_PINS_ENABLE P0_18 // EXP1-3 - #define LCD_PINS_D4 P0_15 // EXP1-5 + #define LCD_PINS_RS P0_16 // EXP1-4 + #define LCD_SDSS P0_28 // EXP2-4 + #define LCD_PINS_ENABLE P0_18 // EXP1-3 + #define LCD_PINS_D4 P0_15 // EXP1-5 - #define KILL_PIN P2_11 // EXP2-10 + #define KILL_PIN P2_11 // EXP2-10 #if ENABLED(SDSUPPORT) #error "SDSUPPORT is not currently supported by the Cohesion3D boards" @@ -182,13 +181,13 @@ // // Ethernet pins // -#define ENET_MDIO P1_17 -#define ENET_RX_ER P1_14 -#define ENET_RXD1 P1_10 -#define ENET_MOC P1_16 -#define REF_CLK P1_15 -#define ENET_RXD0 P1_09 -#define ENET_CRS P1_08 -#define ENET_TX_EN P1_04 -#define ENET_TXD0 P1_00 -#define ENET_TXD1 P1_01 +#define ENET_MDIO P1_17 +#define ENET_RX_ER P1_14 +#define ENET_RXD1 P1_10 +#define ENET_MOC P1_16 +#define REF_CLK P1_15 +#define ENET_RXD0 P1_09 +#define ENET_CRS P1_08 +#define ENET_TX_EN P1_04 +#define ENET_TXD0 P1_00 +#define ENET_TXD1 P1_01 diff --git a/Marlin/src/pins/pins_DUE3DOM.h b/Marlin/src/pins/pins_DUE3DOM.h index aa84053452ea..14957a0ef8e6 100644 --- a/Marlin/src/pins/pins_DUE3DOM.h +++ b/Marlin/src/pins/pins_DUE3DOM.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -146,7 +146,7 @@ #define SDSS 4 #define SD_DETECT_PIN 14 - #elif ENABLED(SSD1306_OLED_I2C_CONTROLLER) + #elif HAS_SSD1306_OLED_I2C #define BTN_EN1 50 #define BTN_EN2 52 diff --git a/Marlin/src/pins/pins_DUE3DOM_MINI.h b/Marlin/src/pins/pins_DUE3DOM_MINI.h index 3cd252a19562..314d5227473d 100644 --- a/Marlin/src/pins/pins_DUE3DOM_MINI.h +++ b/Marlin/src/pins/pins_DUE3DOM_MINI.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -138,7 +138,7 @@ #define SDSS 4 #define SD_DETECT_PIN 14 - #elif ENABLED(SSD1306_OLED_I2C_CONTROLLER) + #elif HAS_SSD1306_OLED_I2C #define BTN_EN1 50 #define BTN_EN2 52 diff --git a/Marlin/src/pins/pins_DUPLICATOR_I3_PLUS.h b/Marlin/src/pins/pins_DUPLICATOR_I3_PLUS.h new file mode 100644 index 000000000000..45d55aaf0930 --- /dev/null +++ b/Marlin/src/pins/pins_DUPLICATOR_I3_PLUS.h @@ -0,0 +1,183 @@ +/** + * 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 . + * + */ + +/** + * Wanhao Duplicator i3 Plus pin assignments + */ + +#ifndef __AVR_ATmega2560__ + #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" +#endif + +#define BOARD_NAME "Duplicator i3 Plus" + +// +// Limit Switches +// +#define X_STOP_PIN 54 // PF0 / A0 +#define Y_STOP_PIN 24 // PA2 / AD2 +#define Z_MIN_PIN 23 // PA1 / AD1 +#define Z_MAX_PIN 25 // PA3 / AD3 +#define SERVO0_PIN 40 // PG1 / !RD + +// +// Steppers +// +#define X_STEP_PIN 61 // PF7 / A7 +#define X_DIR_PIN 62 // PK0 / A8 +#define X_ENABLE_PIN 60 // PF6 / A6 + +#define Y_STEP_PIN 64 // PK2 / A10 +#define Y_DIR_PIN 65 // PK3 / A11 +#define Y_ENABLE_PIN 63 // PK1 / A9 + +#define Z_STEP_PIN 67 // PK5 / A13 +#define Z_DIR_PIN 69 // PK7 / A15 +#define Z_ENABLE_PIN 66 // PK4 / A12 +#define Z_MIN_PROBE_PIN 25 // PA3 / AD3 + +#define E0_STEP_PIN 58 // PF4 / A4 +#define E0_DIR_PIN 59 // PF5 / A5 +#define E0_ENABLE_PIN 57 // PF3 / A3 + +// +// Temperature Sensors +// +#define TEMP_0_PIN 1 // PF1 / A1 Analog +#define TEMP_BED_PIN 14 // PK6 / A14 Analog + +// +// Heaters / Fans +// +#define HEATER_0_PIN 4 // PG5 / PWM4 +#define HEATER_BED_PIN 3 // PE5 / PWM3 + +#define FAN_PIN 5 // PE3 / PWM5 + +// +// Misc. Functions +// +#define SDSS 53 // PB0 / SS +#define LED_PIN 13 // PB7 / PWM13 + +#define MISO_PIN 50 // PB3 +#define MOSI_PIN 51 // PB2 +#define SCK_PIN 52 // PB1 + +// +// LCDs and Controllers +// +#if ENABLED(ULTRA_LCD) + #if ENABLED(ZONESTAR_LCD) + #define LCD_PINS_RS 2 + #define LCD_PINS_ENABLE 36 + #define LCD_PINS_D4 37 + #define LCD_PINS_D5 34 + #define LCD_PINS_D6 35 + #define LCD_PINS_D7 32 + #define ADC_KEYPAD_PIN 12 // Analog + #endif +#endif + +/** + * == EXT connector == + * + * 2 4 6 8 10 + * #---------------# + * #2 | ° ° ° ° ° | + * #1 | ° ° ° ° ° | + * #---------------# + * 1 3 5 7 9 + * + * ################################## + * # Pin | ATMEGA2560 Pin | Arduino # + * ################################## + * # 1 | 52 / PG1 (!RD) | 40 # + * # 2 | 95 / PF2 (A2) | 2 # + * # 3 | 54 / PC1 (A9) | 36 # + * # 4 | 53 / PC0 (A8) | 37 # + * # 5 | 56 / PC3 (A11) | 34 # + * # 6 | 55 / PC2 (A10) | 35 # + * # 7 | 58 / PC5 (A13) | 32 # + * # 8 | 57 / PC4 (A12) | 33 # + * # 9 | GND | - # + * # 10 | VCC | + # + * ################################## + * + * @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + * + * == Z-probe connector == + * + * 1 2 3 + * #---------# + * | ° ° ° | + * #---------# + * + * ################################## + * # Pin | ATMEGA2560 Pin | Arduino # + * ################################## + * # 1 | 24V or 5V | + # + * # 2 | 75 / PA3 (AD3) | 25 # + * # 3 | GND | - # + * ################################## + * + * @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + * + * == Y-endstop == == Z-endstop == == Bed temperature == + * + * 1 2 1 2 1 2 + * #------# #------# #------# + * | ° ° | | ° ° | | ° ° | + * #------# #------# #------# + * + * ############### Y ################ ############### Z ################ ############## BED ############### + * # Pin | ATMEGA2560 Pin | Arduino # # Pin | ATMEGA2560 Pin | Arduino # # Pin | ATMEGA2560 Pin | Arduino # + * ################################## ################################## ################################## + * # 1 | GND | - # # 1 | GND | - # # 1 | GND | - # + * # 2 | 76 / PA2 (AD2) | 24 # # 2 | 77 / PA1 (AD1) | 23 # # 2 |83 / PK6 (ADC14)| 14 # + * ################################## ################################## ################################## + * + * @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + * + * == SPI connector == + * + * 5 3 1 + * #---------# + * | ° ° ° | + * | ° ° ° | + * #---------# + * 6 4 2 + * + * ################################## + * # 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 | - # + * ################################## + * + * Pictogram by Ludy https://github.com/Ludy87 + * See: https://sebastien.andrivet.com/en/posts/wanhao-duplicator-i3-plus-3d-printer/ + */ diff --git a/Marlin/src/pins/pins_EINSTART-S.h b/Marlin/src/pins/pins_EINSTART-S.h index 59fa5b0c662a..c078a2d9c657 100755 --- a/Marlin/src/pins/pins_EINSTART-S.h +++ b/Marlin/src/pins/pins_EINSTART-S.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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_RAMBO.h b/Marlin/src/pins/pins_EINSY_RAMBO.h index 420edfd65f83..0f2aff6dd90d 100644 --- a/Marlin/src/pins/pins_EINSY_RAMBO.h +++ b/Marlin/src/pins/pins_EINSY_RAMBO.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -33,7 +33,7 @@ // // TMC2130 Configuration_adv defaults for EinsyRambo // -#if !AXIS_DRIVER_TYPE(X, TMC2130) || !AXIS_DRIVER_TYPE(Y, TMC2130) || !AXIS_DRIVER_TYPE(Z, TMC2130) || !AXIS_DRIVER_TYPE(E0, TMC2130) +#if !AXIS_DRIVER_TYPE_X(TMC2130) || !AXIS_DRIVER_TYPE_Y(TMC2130) || !AXIS_DRIVER_TYPE_Z(TMC2130) || !AXIS_DRIVER_TYPE_E0(TMC2130) #error "You must set ([XYZ]|E0)_DRIVER_TYPE to TMC2130 in Configuration.h for EinsyRambo." #endif @@ -135,7 +135,7 @@ // // use P1 connector for spindle pins #define SPINDLE_LASER_PWM_PIN 9 // MUST BE HARDWARE PWM -#define SPINDLE_LASER_ENABLE_PIN 18 // Pin should have a pullup! +#define SPINDLE_LASER_ENA_PIN 18 // Pin should have a pullup! #define SPINDLE_DIR_PIN 19 // diff --git a/Marlin/src/pins/pins_EINSY_RETRO.h b/Marlin/src/pins/pins_EINSY_RETRO.h index 23cf3da91eaa..dd55c9b72703 100644 --- a/Marlin/src/pins/pins_EINSY_RETRO.h +++ b/Marlin/src/pins/pins_EINSY_RETRO.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -33,7 +33,7 @@ // // TMC2130 Configuration_adv defaults for EinsyRetro // -#if !AXIS_DRIVER_TYPE(X, TMC2130) || !AXIS_DRIVER_TYPE(Y, TMC2130) || !AXIS_DRIVER_TYPE(Z, TMC2130) || !AXIS_DRIVER_TYPE(E0, TMC2130) +#if !AXIS_DRIVER_TYPE_X(TMC2130) || !AXIS_DRIVER_TYPE_Y(TMC2130) || !AXIS_DRIVER_TYPE_Z(TMC2130) || !AXIS_DRIVER_TYPE_E0(TMC2130) #error "You must set ([XYZ]|E0)_DRIVER_TYPE to TMC2130 in Configuration.h for EinsyRetro." #endif @@ -149,7 +149,7 @@ // // use P1 connector for spindle pins #define SPINDLE_LASER_PWM_PIN 9 // MUST BE HARDWARE PWM -#define SPINDLE_LASER_ENABLE_PIN 18 // Pin should have a pullup! +#define SPINDLE_LASER_ENA_PIN 18 // Pin should have a pullup! #define SPINDLE_DIR_PIN 19 // @@ -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_ELEFU_3.h b/Marlin/src/pins/pins_ELEFU_3.h index e87b3e15a7da..70756b459f0d 100644 --- a/Marlin/src/pins/pins_ELEFU_3.h +++ b/Marlin/src/pins/pins_ELEFU_3.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_ESP32.h b/Marlin/src/pins/pins_ESP32.h index 681b89b0acad..9901dde2008c 100644 --- a/Marlin/src/pins/pins_ESP32.h +++ b/Marlin/src/pins/pins_ESP32.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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" // @@ -36,35 +40,38 @@ // // Steppers // -#define X_STEP_PIN 27 -#define X_DIR_PIN 26 -#define X_ENABLE_PIN 25 -//#define X_CS_PIN 0 +#define X_STEP_PIN 128 +#define X_DIR_PIN 129 +#define X_ENABLE_PIN 130 +//#define X_CS_PIN 0 -#define Y_STEP_PIN 33 -#define Y_DIR_PIN 32 -#define Y_ENABLE_PIN X_ENABLE_PIN -//#define Y_CS_PIN 13 +#define Y_STEP_PIN 131 +#define Y_DIR_PIN 132 +#define Y_ENABLE_PIN 133 +//#define Y_CS_PIN 13 -#define Z_STEP_PIN 14 -#define Z_DIR_PIN 12 -#define Z_ENABLE_PIN X_ENABLE_PIN -//#define Z_CS_PIN 5 // SS_PIN +#define Z_STEP_PIN 134 +#define Z_DIR_PIN 135 +#define Z_ENABLE_PIN 136 +//#define Z_CS_PIN 5 // SS_PIN -#define E0_STEP_PIN 16 -#define E0_DIR_PIN 17 -#define E0_ENABLE_PIN X_ENABLE_PIN -//#define E0_CS_PIN 21 +#define E0_STEP_PIN 137 +#define E0_DIR_PIN 138 +#define E0_ENABLE_PIN 139 +//#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 + +// SPI +#define SDSS 5 diff --git a/Marlin/src/pins/pins_FELIX2.h b/Marlin/src/pins/pins_FELIX2.h index 83c484574599..4080ac67462f 100644 --- a/Marlin/src/pins/pins_FELIX2.h +++ b/Marlin/src/pins/pins_FELIX2.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -49,7 +49,7 @@ // // LCD / Controller // -#if ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL) +#if BOTH(ULTRA_LCD, NEWPANEL) #define SD_DETECT_PIN 6 @@ -59,5 +59,5 @@ // M3/M4/M5 - Spindle/Laser Control // #undef SPINDLE_LASER_PWM_PIN // Definitions in pins_RAMPS.h are not valid with this board -#undef SPINDLE_LASER_ENABLE_PIN +#undef SPINDLE_LASER_ENA_PIN #undef SPINDLE_DIR_PIN diff --git a/Marlin/src/pins/pins_FORMBOT_RAPTOR.h b/Marlin/src/pins/pins_FORMBOT_RAPTOR.h index 7178b267d477..10a517aec4f6 100644 --- a/Marlin/src/pins/pins_FORMBOT_RAPTOR.h +++ b/Marlin/src/pins/pins_FORMBOT_RAPTOR.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 @@ -149,7 +149,11 @@ #define FAN_PIN 9 #endif -#if DISABLED(FILAMENT_RUNOUT_SENSOR) +#ifndef FIL_RUNOUT_PIN + #define FIL_RUNOUT_PIN 57 +#endif + +#if !HAS_FILAMENT_SENSOR #define FAN1_PIN 4 #endif @@ -169,22 +173,24 @@ #define PS_ON_PIN 12 #endif +#define CASE_LIGHT_PIN 5 + // // LCD / Controller // // Formbot only supports REPRAP_DISCOUNT_SMART_CONTROLLER // #if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) - #define LCD_PINS_RS 16 - #define LCD_PINS_ENABLE 17 - #define LCD_PINS_D4 23 - #define LCD_PINS_D5 25 - #define LCD_PINS_D6 27 - #define LCD_PINS_D7 29 #define BEEPER_PIN 37 #define BTN_EN1 31 #define BTN_EN2 33 #define BTN_ENC 35 #define SD_DETECT_PIN 49 #define KILL_PIN 41 + #define LCD_PINS_RS 16 + #define LCD_PINS_ENABLE 17 + #define LCD_PINS_D4 23 + #define LCD_PINS_D5 25 + #define LCD_PINS_D6 27 + #define LCD_PINS_D7 29 #endif diff --git a/Marlin/src/pins/pins_FORMBOT_RAPTOR2.h b/Marlin/src/pins/pins_FORMBOT_RAPTOR2.h index 5bd356428e08..733308f9736a 100644 --- a/Marlin/src/pins/pins_FORMBOT_RAPTOR2.h +++ b/Marlin/src/pins/pins_FORMBOT_RAPTOR2.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -28,28 +28,25 @@ #define BOARD_NAME "Formbot Raptor2" #define FAN_PIN 6 -#define SDSS 5 - -#include "pins_FORMBOT_RAPTOR.h" #ifndef FIL_RUNOUT_PIN #define FIL_RUNOUT_PIN 22 #endif -#define GREEDY_PANEL ( ENABLED(PANEL_ONE) || ENABLED(VIKI2) \ - || ENABLED(miniVIKI) || ENABLED(MINIPANEL) \ - || ENABLED(REPRAPWORLD_KEYPAD) ) +#include "pins_FORMBOT_RAPTOR.h" + +#define GREEDY_PANEL ANY(PANEL_ONE, VIKI2, miniVIKI, MINIPANEL, REPRAPWORLD_KEYPAD) // // M3/M4/M5 - Spindle/Laser Control // -#if ENABLED(SPINDLE_LASER_ENABLE) && !PIN_EXISTS(SPINDLE_LASER_ENABLE) +#if ENABLED(SPINDLE_LASER_ENABLE) && !PIN_EXISTS(SPINDLE_LASER_ENA) #if !NUM_SERVOS // Try to use servo connector first - #define SPINDLE_LASER_ENABLE_PIN 6 // Pin should have a pullup/pulldown! + #define SPINDLE_LASER_ENA_PIN 6 // Pin should have a pullup/pulldown! #define SPINDLE_LASER_PWM_PIN 4 // MUST BE HARDWARE PWM #define SPINDLE_DIR_PIN 5 #elif !GREEDY_PANEL // Try to use AUX2 - #define SPINDLE_LASER_ENABLE_PIN 40 // Pin should have a pullup/pulldown! + #define SPINDLE_LASER_ENA_PIN 40 // Pin should have a pullup/pulldown! #define SPINDLE_LASER_PWM_PIN 44 // MUST BE HARDWARE PWM #define SPINDLE_DIR_PIN 65 #endif @@ -65,6 +62,6 @@ #undef GREEDY_PANEL -#if ENABLED(CASE_LIGHT_ENABLE) && PIN_EXISTS(CASE_LIGHT) && (CASE_LIGHT_PIN == SPINDLE_LASER_ENABLE_PIN || CASE_LIGHT_PIN == SPINDLE_LASER_PWM_PIN) +#if ENABLED(CASE_LIGHT_ENABLE) && PIN_EXISTS(CASE_LIGHT) && (CASE_LIGHT_PIN == SPINDLE_LASER_ENA_PIN || CASE_LIGHT_PIN == SPINDLE_LASER_PWM_PIN) #error "CASE_LIGHT_PIN conflicts with a Spindle / Laser pin." #endif diff --git a/Marlin/src/pins/pins_FORMBOT_TREX2PLUS.h b/Marlin/src/pins/pins_FORMBOT_TREX2PLUS.h index b5d77c7214dc..16649e42b503 100644 --- a/Marlin/src/pins/pins_FORMBOT_TREX2PLUS.h +++ b/Marlin/src/pins/pins_FORMBOT_TREX2PLUS.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 @@ -144,7 +144,7 @@ #define FAN_PIN 9 -#if ENABLED(FILAMENT_RUNOUT_SENSOR) +#if HAS_FILAMENT_SENSOR #define FIL_RUNOUT_PIN 4 //#define FIL_RUNOUT2_PIN -1 #else @@ -155,9 +155,8 @@ // // Misc. Functions // -#define CASE_LIGHT_PIN 8 #define SDSS 53 -#ifndef ROXYs_TRex +#ifndef LED_PIN #define LED_PIN 13 // The Formbot v 1 board has almost no unassigned pins on it. The Board's LED #endif // is a good place to get a signal to control the Max7219 LED Matrix. @@ -168,24 +167,28 @@ #define PS_ON_PIN 12 #endif +#define CASE_LIGHT_PIN 8 + // // LCD / Controller // // Formbot only supports REPRAP_DISCOUNT_SMART_CONTROLLER // #if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) - #define LCD_PINS_RS 16 - #define LCD_PINS_ENABLE 17 - #define LCD_PINS_D4 23 - #define LCD_PINS_D5 25 - #define LCD_PINS_D6 27 - #define LCD_PINS_D7 29 + #ifndef BEEPER_PIN + #define BEEPER_PIN 37 + #endif #define BTN_EN1 31 #define BTN_EN2 33 #define BTN_ENC 35 #define SD_DETECT_PIN 49 - #ifndef ROXYs_TRex + #ifndef KILL_PIN #define KILL_PIN 41 - #define BEEPER_PIN 37 #endif + #define LCD_PINS_RS 16 + #define LCD_PINS_ENABLE 17 + #define LCD_PINS_D4 23 + #define LCD_PINS_D5 25 + #define LCD_PINS_D6 27 + #define LCD_PINS_D7 29 #endif diff --git a/Marlin/src/pins/pins_FORMBOT_TREX3.h b/Marlin/src/pins/pins_FORMBOT_TREX3.h index 622c2d50c262..8ff09f47c5b4 100644 --- a/Marlin/src/pins/pins_FORMBOT_TREX3.h +++ b/Marlin/src/pins/pins_FORMBOT_TREX3.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -109,7 +109,7 @@ // #define TEMP_0_PIN 13 // Analog Input #define TEMP_1_PIN 15 // Analog Input -#define TEMP_BED_PIN 3 // Analog Input +#define TEMP_BED_PIN 14 // Analog Input // SPI for Max6675 or Max31855 Thermocouple #if DISABLED(SDSUPPORT) @@ -118,22 +118,7 @@ #define MAX6675_SS_PIN 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present #endif -// -// 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 HOTENDS > 1 - #if TEMP_SENSOR_BED - #define IS_RAMPS_EEB - #else - #define IS_RAMPS_EEF - #endif - #elif TEMP_SENSOR_BED - #define IS_RAMPS_EFB - #else - #define IS_RAMPS_EFF - #endif -#endif + // // Heaters / Fans @@ -143,9 +128,10 @@ #define HEATER_BED_PIN 8 #define FAN_PIN 9 -//#define FAN1_PIN 4 +#define FAN1_PIN 12 -#define FIL_RUNOUT_PIN 23 +#define NUM_RUNOUT_SENSORS 2 +#define FIL_RUNOUT_PIN 22 #define FIL_RUNOUT2_PIN 21 // @@ -153,10 +139,13 @@ // #define CASE_LIGHT_PIN 5 #define SDSS 53 -#ifndef ROXYs_TRex +#ifndef LED_PIN #define LED_PIN 13 #endif +#define SPINDLE_LASER_PWM_PIN -1 // MUST BE HARDWARE PWM +#define SPINDLE_LASER_ENA_PIN 4 // Pin should have a pullup! + // Use the RAMPS 1.4 Analog input 5 on the AUX2 connector #define FILWIDTH_PIN 5 // Analog Input @@ -176,8 +165,10 @@ #define BTN_EN2 33 #define BTN_ENC 35 #define SD_DETECT_PIN 49 - #ifndef ROXYs_TRex + #ifndef KILL_PIN #define KILL_PIN 41 + #endif + #ifndef BEEPER_PIN #define BEEPER_PIN 37 #endif #endif diff --git a/Marlin/src/pins/pins_FYSETC_F6_13.h b/Marlin/src/pins/pins_FYSETC_F6_13.h index d343e82f5e01..d40abd1024a0 100644 --- a/Marlin/src/pins/pins_FYSETC_F6_13.h +++ b/Marlin/src/pins/pins_FYSETC_F6_13.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2018 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -28,8 +28,15 @@ #error "Oops! Select 'FYSETC F6' in 'Tools > Board.'" #endif +#if ENABLED(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 +#define SPI_FLASH_CS 83 + // // Servos // @@ -109,13 +116,6 @@ // the jumper next to the limit switch socket when using sensorless homing. // -#define X_TMC2130_DIAG -1 -#define Y_TMC2130_DIAG -1 -#define Z_TMC2130_DIAG -1 -#define E0_TMC2130_DIAG -1 -#define E1_TMC2130_DIAG -1 -#define E2_TMC2130_DIAG -1 - #if HAS_DRIVER(TMC2208) // Software serial #define X_SERIAL_RX_PIN 71 @@ -129,7 +129,7 @@ #define E1_SERIAL_RX_PIN 80 #define E1_SERIAL_TX_PIN 81 #define E2_SERIAL_RX_PIN 22 - #define E2_SERIAL_TX_PIN 83 + #define E2_SERIAL_TX_PIN 82 #endif // @@ -167,18 +167,16 @@ #define PS_ON_PIN SERVO1_PIN #endif -#ifndef RGB_LED_R_PIN - #define RGB_LED_R_PIN 3 -#endif -#ifndef RGB_LED_G_PIN - #define RGB_LED_G_PIN SERVO3_PIN -#endif -#ifndef RGB_LED_B_PIN - #define RGB_LED_B_PIN 9 -#endif -#ifndef RGB_LED_W_PIN - #define RGB_LED_W_PIN -1 -#endif +/** + * ----- ----- + * 5V/D41 | · · | GND 5V | · · | GND + * RESET | · · | D49 (SD_DETECT) (LCD_D7) D29 | · · | D27 (LCD_D6) + * (MOSI) D51 | · · | D33 (BTN_EN2) (LCD_D5) D25 | · · | D23 (LCD_D4) + * (SD_SS) D53 | · · | D31 (BTN_EN1) (LCD_RS) D16 | · · | D17 (LCD_EN) + * (SCK) D52 | · · | D50 (MISO) (BTN_ENC) D35 | · · | D37 (BEEPER) + * ----- ----- + * EXP2 EXP1 + */ // // LCDs and Controllers @@ -186,15 +184,79 @@ #define BEEPER_PIN 37 #define SD_DETECT_PIN 49 -#define LCD_PINS_RS 16 -#define LCD_PINS_ENABLE 17 -#define LCD_PINS_D4 23 -#define LCD_PINS_D5 25 -#define LCD_PINS_D6 27 -#define LCD_PINS_D7 29 +#if ENABLED(FYSETC_MINI_12864) + // + // See https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 + // + #define DOGLCD_A0 16 + #define DOGLCD_CS 17 + + #define LCD_BACKLIGHT_PIN -1 + #define KILL_PIN 41 + + #define LCD_RESET_PIN 23 // Must be high or open for LCD to operate normally. + // Seems to work best if left open. + + #define FYSETC_MINI_12864_REV_1_2 + //#define FYSETC_MINI_12864_REV_2_0 + //#define FYSETC_MINI_12864_REV_2_1 + #if EITHER(FYSETC_MINI_12864_REV_1_2, FYSETC_MINI_12864_REV_2_0) + #ifndef RGB_LED_R_PIN + #define RGB_LED_R_PIN 25 + #endif + #ifndef RGB_LED_G_PIN + #define RGB_LED_G_PIN 27 + #endif + #ifndef RGB_LED_B_PIN + #define RGB_LED_B_PIN 29 + #endif + #elif defined(FYSETC_MINI_12864_REV_2_1) + #define NEOPIXEL_LED + #define NEOPIXEL_TYPE NEO_GRB // NEO_GRBW / NEO_GRB - four/three channel driver type (defined in Adafruit_NeoPixel.h) + #define NEOPIXEL_PIN 25 // LED driving pin on motherboard 4 => D4 (EXP2-5 on Printrboard) / 30 => PC7 (EXP3-13 on Rumba) + #define NEOPIXEL_PIXELS 3 // 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 + #else + #error "Either FYSETC_MINI_12864_REV_1_2, FYSETC_MINI_12864_REV_2_0 or FYSETC_MINI_12864_REV_2_1 must be defined" + #endif + + #if !defined(LED_USER_PRESET_STARTUP) && EITHER(FYSETC_MINI_12864_REV_2_0, FYSETC_MINI_12864_REV_2_1) + #error "LED_USER_PRESET_STARTUP must be enabled when using FYSETC_MINI_12864 REV 2.0 and later" + #endif + +#elif HAS_GRAPHICAL_LCD + + #define LCD_PINS_RS 16 + #define LCD_PINS_ENABLE 17 + #define LCD_PINS_D4 23 + #define LCD_PINS_D5 25 + #define LCD_PINS_D6 27 + #define LCD_PINS_D7 29 + + #if ENABLED(MKS_MINI_12864) + #define DOGLCD_CS 25 + #define DOGLCD_A0 27 + #endif + +#endif #if ENABLED(NEWPANEL) #define BTN_EN1 31 #define BTN_EN2 33 #define BTN_ENC 35 #endif + +#ifndef RGB_LED_R_PIN + #define RGB_LED_R_PIN 3 +#endif +#ifndef RGB_LED_G_PIN + #define RGB_LED_G_PIN 4 +#endif +#ifndef RGB_LED_B_PIN + #define RGB_LED_B_PIN 9 +#endif +#ifndef RGB_LED_W_PIN + #define RGB_LED_W_PIN -1 +#endif diff --git a/Marlin/src/pins/pins_GEN3_MONOLITHIC.h b/Marlin/src/pins/pins_GEN3_MONOLITHIC.h index dc3a22fcd96e..ede97e5c6d6f 100644 --- a/Marlin/src/pins/pins_GEN3_MONOLITHIC.h +++ b/Marlin/src/pins/pins_GEN3_MONOLITHIC.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_GEN3_PLUS.h b/Marlin/src/pins/pins_GEN3_PLUS.h index e30fee2c3008..8b13fc38790d 100644 --- a/Marlin/src/pins/pins_GEN3_PLUS.h +++ b/Marlin/src/pins/pins_GEN3_PLUS.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_GEN6.h b/Marlin/src/pins/pins_GEN6.h index 437302d60f98..17124a596aa4 100644 --- a/Marlin/src/pins/pins_GEN6.h +++ b/Marlin/src/pins/pins_GEN6.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -114,6 +114,6 @@ // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_ENABLE_PIN 5 // Pin should have a pullup/pulldown! +#define SPINDLE_LASER_ENA_PIN 5 // Pin should have a pullup/pulldown! #define SPINDLE_LASER_PWM_PIN 16 // MUST BE HARDWARE PWM #define SPINDLE_DIR_PIN 6 diff --git a/Marlin/src/pins/pins_GEN6_DELUXE.h b/Marlin/src/pins/pins_GEN6_DELUXE.h index 5834068667de..08686a28953a 100644 --- a/Marlin/src/pins/pins_GEN6_DELUXE.h +++ b/Marlin/src/pins/pins_GEN6_DELUXE.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_GEN7_12.h b/Marlin/src/pins/pins_GEN7_12.h index 87bf70f32a56..d040738b1a7a 100644 --- a/Marlin/src/pins/pins_GEN7_12.h +++ b/Marlin/src/pins/pins_GEN7_12.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -140,7 +140,7 @@ // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_ENABLE_PIN 10 // Pin should have a pullup/pulldown! +#define SPINDLE_LASER_ENA_PIN 10 // Pin should have a pullup/pulldown! #define SPINDLE_DIR_PIN 11 #if GEN7_VERSION < 13 #define SPINDLE_LASER_PWM_PIN 16 // MUST BE HARDWARE PWM diff --git a/Marlin/src/pins/pins_GEN7_13.h b/Marlin/src/pins/pins_GEN7_13.h index 749a6c338963..9b1f0d242ed1 100644 --- a/Marlin/src/pins/pins_GEN7_13.h +++ b/Marlin/src/pins/pins_GEN7_13.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -24,7 +24,7 @@ * Gen7 v1.3 pin assignments */ - /** +/** * Rev B 26 DEC 2016 * * added pointer to a current Arduino IDE extension diff --git a/Marlin/src/pins/pins_GEN7_14.h b/Marlin/src/pins/pins_GEN7_14.h index 6a171a8376a3..b4ae7ffe10ce 100644 --- a/Marlin/src/pins/pins_GEN7_14.h +++ b/Marlin/src/pins/pins_GEN7_14.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -113,6 +113,6 @@ // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_ENABLE_PIN 20 // Pin should have a pullup/pulldown! +#define SPINDLE_LASER_ENA_PIN 20 // Pin should have a pullup/pulldown! #define SPINDLE_LASER_PWM_PIN 16 // MUST BE HARDWARE PWM #define SPINDLE_DIR_PIN 21 diff --git a/Marlin/src/pins/pins_GEN7_CUSTOM.h b/Marlin/src/pins/pins_GEN7_CUSTOM.h index 7d0f44d7f370..4d6a059df872 100644 --- a/Marlin/src/pins/pins_GEN7_CUSTOM.h +++ b/Marlin/src/pins/pins_GEN7_CUSTOM.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -63,68 +63,68 @@ // // Limit Switches // -#define X_STOP_PIN 0 -#define Y_STOP_PIN 1 -#define Z_STOP_PIN 2 +#define X_STOP_PIN 0 +#define Y_STOP_PIN 1 +#define Z_STOP_PIN 2 // // Steppers // -#define X_STEP_PIN 21 // different from standard GEN7 -#define X_DIR_PIN 20 // different from standard GEN7 -#define X_ENABLE_PIN 24 +#define X_STEP_PIN 21 // different from standard GEN7 +#define X_DIR_PIN 20 // different from standard GEN7 +#define X_ENABLE_PIN 24 -#define Y_STEP_PIN 23 -#define Y_DIR_PIN 22 -#define Y_ENABLE_PIN 24 +#define Y_STEP_PIN 23 +#define Y_DIR_PIN 22 +#define Y_ENABLE_PIN 24 -#define Z_STEP_PIN 26 -#define Z_DIR_PIN 25 -#define Z_ENABLE_PIN 24 +#define Z_STEP_PIN 26 +#define Z_DIR_PIN 25 +#define Z_ENABLE_PIN 24 -#define E0_STEP_PIN 28 -#define E0_DIR_PIN 27 -#define E0_ENABLE_PIN 24 +#define E0_STEP_PIN 28 +#define E0_DIR_PIN 27 +#define E0_ENABLE_PIN 24 // // Temperature Sensors // -#define TEMP_0_PIN 2 // Analog Input -#define TEMP_BED_PIN 1 // Analog Input (pin 34 bed) +#define TEMP_0_PIN 2 // Analog Input +#define TEMP_BED_PIN 1 // Analog Input (pin 34 bed) // // Heaters // -#define HEATER_0_PIN 4 -#define HEATER_BED_PIN 3 // (bed) +#define HEATER_0_PIN 4 +#define HEATER_BED_PIN 3 // (bed) // // Misc. Functions // -#define SDSS 31 // SCL pin of I2C header || CS Pin for SD Card support -#define PS_ON_PIN 19 -#define CASE_LIGHT_PIN 15 // MUST BE HARDWARE PWM +#define SDSS 31 // SCL pin of I2C header || CS Pin for SD Card support +#define PS_ON_PIN 19 +#define CASE_LIGHT_PIN 15 // MUST BE HARDWARE PWM // A pin for debugging -#define DEBUG_PIN -1 +#define DEBUG_PIN -1 // // LCD / Controller // -#define BEEPER_PIN -1 +#define BEEPER_PIN -1 // 4bit LCD Support -#define LCD_PINS_RS 18 -#define LCD_PINS_ENABLE 17 -#define LCD_PINS_D4 16 -#define LCD_PINS_D5 15 -#define LCD_PINS_D6 13 -#define LCD_PINS_D7 14 - -// Buttons are directly attached -#define BTN_EN1 11 -#define BTN_EN2 10 -#define BTN_ENC 12 +#define LCD_PINS_RS 18 +#define LCD_PINS_ENABLE 17 +#define LCD_PINS_D4 16 +#define LCD_PINS_D5 15 +#define LCD_PINS_D6 13 +#define LCD_PINS_D7 14 + +// Buttons are directly attached +#define BTN_EN1 11 +#define BTN_EN2 10 +#define BTN_ENC 12 // RS485 pins //#define TX_ENABLE_PIN 12 @@ -133,6 +133,6 @@ // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_ENABLE_PIN 5 // Pin should have a pullup/pulldown! +#define SPINDLE_LASER_ENA_PIN 5 // Pin should have a pullup/pulldown! #define SPINDLE_LASER_PWM_PIN 16 // MUST BE HARDWARE PWM #define SPINDLE_DIR_PIN 6 diff --git a/Marlin/src/pins/pins_GT2560_REV_A.h b/Marlin/src/pins/pins_GT2560_REV_A.h index 8805f5c22fef..e7b3481ad4cb 100644 --- a/Marlin/src/pins/pins_GT2560_REV_A.h +++ b/Marlin/src/pins/pins_GT2560_REV_A.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_GT2560_REV_A_PLUS.h b/Marlin/src/pins/pins_GT2560_REV_A_PLUS.h index 99399e34ba3f..e8778a8d8015 100644 --- a/Marlin/src/pins/pins_GT2560_REV_A_PLUS.h +++ b/Marlin/src/pins/pins_GT2560_REV_A_PLUS.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_GT2560_V3.h b/Marlin/src/pins/pins_GT2560_V3.h index 96ecd8e0b0a3..9ea31965c2cc 100644 --- a/Marlin/src/pins/pins_GT2560_V3.h +++ b/Marlin/src/pins/pins_GT2560_V3.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -20,7 +20,6 @@ * */ - /** * GT2560 V3.0 pin assignment */ @@ -33,6 +32,11 @@ #define BOARD_NAME "GT2560 V3.0" #endif +// +// Servos +// +#define SERVO0_PIN 11 //13 untested 3Dtouch + // // Limit Switches // @@ -50,6 +54,22 @@ #define Z_MIN_PROBE_PIN 32 #endif +// +// Runout Sensor +// +#ifndef FIL_RUNOUT_PIN + #define FIL_RUNOUT_PIN 66 +#endif +#ifndef FIL_RUNOUT2_PIN + #define FIL_RUNOUT2_PIN 67 +#endif + +// +// Power Recovery +// +#define POWER_LOSS_PIN 69 // Pin to detect power loss +#define POWER_LOSS_STATE LOW + // // Steppers // @@ -89,6 +109,8 @@ #define HEATER_2_PIN 1 #define HEATER_BED_PIN 4 #define FAN_PIN 9 +//#define FAN1_PIN 8 +//#define FAN2_PIN 7 // // Misc. Functions @@ -97,12 +119,10 @@ #define SDSS 53 #define LED_PIN 6 #define PS_ON_PIN 12 -#define SUICIDE_PIN 54 //PIN that has to be turned on right after start, to keep power flowing. -#define SERVO0_PIN 11 //13 untested 3Dtouch +#define SUICIDE_PIN 54 // This pin must be enabled at boot to keep power flowing #ifndef CASE_LIGHT_PIN - //#define CASE_LIGHT_PIN 21 - #define CASE_LIGHT_PIN 6 + #define CASE_LIGHT_PIN 6 // 21 #endif // diff --git a/Marlin/src/pins/pins_GT2560_V3_A20.h b/Marlin/src/pins/pins_GT2560_V3_A20.h new file mode 100644 index 000000000000..42e1a1c6969c --- /dev/null +++ b/Marlin/src/pins/pins_GT2560_V3_A20.h @@ -0,0 +1,45 @@ +/** + * 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 . + * + */ + +/** + * Geeetech A20M pin assignment + */ + +#include "pins_GT2560_V3.h" + +#undef LCD_PINS_RS +#undef LCD_PINS_ENABLE +#undef LCD_PINS_D4 +#undef LCD_PINS_D7 +#define LCD_PINS_RS 5 +#define LCD_PINS_ENABLE 36 +#define LCD_PINS_D4 21 +#define LCD_PINS_D7 6 + +#if ENABLED(NEWPANEL) + #undef BTN_EN1 + #undef BTN_EN2 + #undef BTN_ENC + #define BTN_EN1 16 + #define BTN_EN2 17 + #define BTN_ENC 19 +#endif diff --git a/Marlin/src/pins/pins_GT2560_V3_MC2.h b/Marlin/src/pins/pins_GT2560_V3_MC2.h index a0c9d96ccfea..42691f41610d 100644 --- a/Marlin/src/pins/pins_GT2560_V3_MC2.h +++ b/Marlin/src/pins/pins_GT2560_V3_MC2.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_GTM32_PRO_VB.h b/Marlin/src/pins/pins_GTM32_PRO_VB.h index 1914db0b43d6..bb46b32e75b9 100644 --- a/Marlin/src/pins/pins_GTM32_PRO_VB.h +++ b/Marlin/src/pins/pins_GTM32_PRO_VB.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -84,7 +84,7 @@ #define HEATER_2_PIN PB4 #define HEATER_BED_PIN PB1 -#define FAN0_PIN PB7 // TODO: Add functionality +#define FAN_PIN PB7 // TODO: Add functionality #define FAN1_PIN PB8 // TODO: Add functionality #define FAN2_PIN PB9 // TODO: Add functionality diff --git a/Marlin/src/pins/pins_K8200.h b/Marlin/src/pins/pins_K8200.h index cc3e73117296..530bb6be1502 100644 --- a/Marlin/src/pins/pins_K8200.h +++ b/Marlin/src/pins/pins_K8200.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_K8400.h b/Marlin/src/pins/pins_K8400.h index 3e2cd4b21285..3dd195bed771 100644 --- a/Marlin/src/pins/pins_K8400.h +++ b/Marlin/src/pins/pins_K8400.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -31,9 +31,8 @@ * - Second heater has moved pin */ -#define BOARD_NAME "K8400" #define DEFAULT_MACHINE_NAME "Vertex" -#define DEFAULT_SOURCE_CODE_URL "https://github.com/birkett/Vertex-K8400-Firmware" +#define BOARD_NAME "K8400" #include "pins_3DRAG.h" @@ -52,13 +51,13 @@ // Steppers // #undef E1_STEP_PIN -#define E1_STEP_PIN 32 +#define E1_STEP_PIN 32 // // Heaters / Fans // #undef HEATER_1_PIN -#define HEATER_1_PIN 11 +#define HEATER_1_PIN 11 // // Misc. Functions diff --git a/Marlin/src/pins/pins_K8800.h b/Marlin/src/pins/pins_K8800.h new file mode 100644 index 000000000000..8c959eb40980 --- /dev/null +++ b/Marlin/src/pins/pins_K8800.h @@ -0,0 +1,108 @@ +/** + * 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 . + * + */ + +/** + * Velleman K8800 (Vertex) + */ + +#if !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega2560__) + #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" +#endif + +#define DEFAULT_MACHINE_NAME "Vertex Delta" +#define BOARD_NAME "K8800" + +//#define LCD_SCREEN_ROT_180 + +// +// Limit Switches +// +#define X_STOP_PIN 3 +#define Y_STOP_PIN 14 +#define Z_MIN_PIN 68 // Used for bed leveling +#define Z_MAX_PIN 66 + +// +// Steppers +// +#define X_STEP_PIN 54 +#define X_DIR_PIN 55 +#define X_ENABLE_PIN 38 + +#define Y_STEP_PIN 60 +#define Y_DIR_PIN 61 +#define Y_ENABLE_PIN 56 + +#define Z_STEP_PIN 46 +#define Z_DIR_PIN 48 +#define Z_ENABLE_PIN 63 + +#define E0_STEP_PIN 26 +#define E0_DIR_PIN 28 +#define E0_ENABLE_PIN 24 + +#define E1_STEP_PIN 32 +#define E1_DIR_PIN 34 +#define E1_ENABLE_PIN 30 + +// +// Temperature Sensors +// +#define TEMP_0_PIN 13 + +// +// Heaters / Fans +// +#define HEATER_0_PIN 10 +#define FAN_PIN 8 +#define CONTROLLER_FAN_PIN 9 + +// +// Misc. Functions +// +#define SDSS 25 + +#define FIL_RUNOUT_PIN 69 // PK7 +#define KILL_PIN 20 // PD1 + +// +// LCD / Controller +// +#define SD_DETECT_PIN 21 // PD0 +#define LCD_SDSS 53 +#define BEEPER_PIN 6 + +#define DOGLCD_CS 29 +#define DOGLCD_A0 27 + +#define LCD_PINS_RS 27 +#define LCD_PINS_ENABLE 29 +#define LCD_PINS_D4 37 +#define LCD_PINS_D5 35 +#define LCD_PINS_D6 33 +#define LCD_PINS_D7 31 + +#if ENABLED(NEWPANEL) + #define BTN_EN1 17 + #define BTN_EN2 16 + #define BTN_ENC 23 +#endif diff --git a/Marlin/src/pins/pins_LEAPFROG.h b/Marlin/src/pins/pins_LEAPFROG.h index 946e20eef5d6..123bce065060 100644 --- a/Marlin/src/pins/pins_LEAPFROG.h +++ b/Marlin/src/pins/pins_LEAPFROG.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_MAKEBOARD_MINI.h b/Marlin/src/pins/pins_MAKEBOARD_MINI.h index 5dcf1e21803f..17b03ad6538a 100644 --- a/Marlin/src/pins/pins_MAKEBOARD_MINI.h +++ b/Marlin/src/pins/pins_MAKEBOARD_MINI.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_MALYAN_M200.h b/Marlin/src/pins/pins_MALYAN_M200.h index 97dffd1e27bf..fc61cdfddebe 100644 --- a/Marlin/src/pins/pins_MALYAN_M200.h +++ b/Marlin/src/pins/pins_MALYAN_M200.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_MEGACONTROLLER.h b/Marlin/src/pins/pins_MEGACONTROLLER.h index 71e3d8a01fd2..6c0f8cad3018 100644 --- a/Marlin/src/pins/pins_MEGACONTROLLER.h +++ b/Marlin/src/pins/pins_MEGACONTROLLER.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 @@ -162,5 +161,5 @@ // M3/M4/M5 - Spindle/Laser Control // #define SPINDLE_LASER_PWM_PIN 6 // MUST BE HARDWARE PWM -#define SPINDLE_LASER_ENABLE_PIN 7 // Pin should have a pullup! +#define SPINDLE_LASER_ENA_PIN 7 // Pin should have a pullup! #define SPINDLE_DIR_PIN 8 diff --git a/Marlin/src/pins/pins_MEGATRONICS.h b/Marlin/src/pins/pins_MEGATRONICS.h index 781529020d86..858fcb6e3446 100644 --- a/Marlin/src/pins/pins_MEGATRONICS.h +++ b/Marlin/src/pins/pins_MEGATRONICS.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 @@ -126,5 +126,5 @@ // M3/M4/M5 - Spindle/Laser Control // #define SPINDLE_LASER_PWM_PIN 3 // MUST BE HARDWARE PWM -#define SPINDLE_LASER_ENABLE_PIN 4 // Pin should have a pullup! +#define SPINDLE_LASER_ENA_PIN 4 // Pin should have a pullup! #define SPINDLE_DIR_PIN 11 diff --git a/Marlin/src/pins/pins_MEGATRONICS_2.h b/Marlin/src/pins/pins_MEGATRONICS_2.h index 2c98ea3f15b9..9f7f958e6889 100644 --- a/Marlin/src/pins/pins_MEGATRONICS_2.h +++ b/Marlin/src/pins/pins_MEGATRONICS_2.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -141,5 +141,5 @@ // M3/M4/M5 - Spindle/Laser Control // #define SPINDLE_LASER_PWM_PIN 3 // MUST BE HARDWARE PWM -#define SPINDLE_LASER_ENABLE_PIN 16 // Pin should have a pullup! +#define SPINDLE_LASER_ENA_PIN 16 // Pin should have a pullup! #define SPINDLE_DIR_PIN 11 diff --git a/Marlin/src/pins/pins_MEGATRONICS_3.h b/Marlin/src/pins/pins_MEGATRONICS_3.h index 51c5c6a8780e..38a0f8e7ef6d 100644 --- a/Marlin/src/pins/pins_MEGATRONICS_3.h +++ b/Marlin/src/pins/pins_MEGATRONICS_3.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -21,14 +21,16 @@ */ /** - * MegaTronics v3.0 / v3.1 pin assignments + * MegaTronics v3.0 / v3.1 / v3.2 pin assignments */ #ifndef __AVR_ATmega2560__ #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'" #endif -#if MB(MEGATRONICS_31) +#if MB(MEGATRONICS_32) + #define BOARD_NAME "Megatronics v3.2" +#elif MB(MEGATRONICS_31) #define BOARD_NAME "Megatronics v3.1" #else #define BOARD_NAME "Megatronics v3.0" @@ -161,7 +163,7 @@ #define SHIFT_OUT 34 #define SHIFT_EN 44 - #if MB(MEGATRONICS_31) + #if MB(MEGATRONICS_31) || MB(MEGATRONICS_32) #define SD_DETECT_PIN 56 #endif @@ -172,7 +174,7 @@ // #if DISABLED(REPRAPWORLD_KEYPAD) // try to use the keypad connector first #define SPINDLE_LASER_PWM_PIN 44 // MUST BE HARDWARE PWM - #define SPINDLE_LASER_ENABLE_PIN 43 // Pin should have a pullup! + #define SPINDLE_LASER_ENA_PIN 43 // Pin should have a pullup! #define SPINDLE_DIR_PIN 42 #elif EXTRUDERS <= 2 // Hijack the last extruder so that we can get the PWM signal off the Y breakout @@ -187,6 +189,6 @@ #define Y_STEP_PIN 22 #define Y_DIR_PIN 60 #define SPINDLE_LASER_PWM_PIN 4 // MUST BE HARDWARE PWM - #define SPINDLE_LASER_ENABLE_PIN 17 // Pin should have a pullup! + #define SPINDLE_LASER_ENA_PIN 17 // Pin should have a pullup! #define SPINDLE_DIR_PIN 5 #endif diff --git a/Marlin/src/pins/pins_MELZI.h b/Marlin/src/pins/pins_MELZI.h index 79042f61dcfe..e3886b710ec5 100644 --- a/Marlin/src/pins/pins_MELZI.h +++ b/Marlin/src/pins/pins_MELZI.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_MELZI_CREALITY.h b/Marlin/src/pins/pins_MELZI_CREALITY.h index 3c86dcbbaa93..9ab40187e6fa 100644 --- a/Marlin/src/pins/pins_MELZI_CREALITY.h +++ b/Marlin/src/pins/pins_MELZI_CREALITY.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_MELZI_MAKR3D.h b/Marlin/src/pins/pins_MELZI_MAKR3D.h index 1b20d2ae09b6..488445613a95 100644 --- a/Marlin/src/pins/pins_MELZI_MAKR3D.h +++ b/Marlin/src/pins/pins_MELZI_MAKR3D.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_MELZI_MALYAN.h b/Marlin/src/pins/pins_MELZI_MALYAN.h index a81526f065d1..4087b9f2c6fe 100644 --- a/Marlin/src/pins/pins_MELZI_MALYAN.h +++ b/Marlin/src/pins/pins_MELZI_MALYAN.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_MELZI_TRONXY.h b/Marlin/src/pins/pins_MELZI_TRONXY.h index 0da7934302c3..1a66a73599e0 100644 --- a/Marlin/src/pins/pins_MELZI_TRONXY.h +++ b/Marlin/src/pins/pins_MELZI_TRONXY.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_MIGHTYBOARD_REVE.h b/Marlin/src/pins/pins_MIGHTYBOARD_REVE.h index 8fb67c8419e5..d9def846c2ce 100644 --- a/Marlin/src/pins/pins_MIGHTYBOARD_REVE.h +++ b/Marlin/src/pins/pins_MIGHTYBOARD_REVE.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -22,23 +22,7 @@ /** * Mightyboard Rev.E pin assignments - */ - -/** - * - * This is a starting-point to support the Makerbot Replicator series of 3D printers. - * It's not functional because Marlin has limited support for some features. - * Marlin will need the following augmentations before it will be supportable: - * - * - Support for two or more MAX6675 thermocouples - * - Support for multiple i2c buses to control the MCP4018 digital pots - * - Support for one additional unidirectional SPI bus, to read the thermocouples - * - Support for an RGB LED that may work differently from BLINKM - * - * The MCP4018 requires separate I2C buses because it has a fixed address (0x2F << 1 = 0x5E) - * The thermocouples share the same SCK and DO pins, with their own CS pins. - * The controller interface port connects to a 3-wire shift-register display controller - * + * also works for Rev D boards. It's all rev E despite what the silk screen says */ /** @@ -48,7 +32,7 @@ * M3, M4 & M5 spindle control commands * case light * - * Corrected pin assignment for MOSFET_B_PIN pin. Changed it from 9 to 11. The port + * Corrected pin assignment for EX2_HEAT_PIN pin. Changed it from 9 to 11. The port * number (B5) agrees with the schematic but B5 is assigned to logical pin 11. */ @@ -119,12 +103,16 @@ #define DIGIPOTS_I2C_SDA_Z 65 // K3 #define DIGIPOTS_I2C_SDA_E0 27 // A5 #define DIGIPOTS_I2C_SDA_E1 77 // J6 -#define DIGIPOT_I2C_ADDRESS_A 0x2F // unshifted slave address (5E <- 2F << 1) + +#ifndef DIGIPOT_I2C_ADDRESS_A + #define DIGIPOT_I2C_ADDRESS_A 0x2F // unshifted slave address (5E <- 2F << 1) +#endif // // Temperature Sensors // -#define TEMP_BED_PIN 15 // K7 - 69 / ADC15 - 15 +// K7 - 69 / ADC15 - 15 +#define TEMP_BED_PIN 15 // SPI for Max6675 or Max31855 Thermocouple // Uses a separate SPI bus @@ -151,10 +139,14 @@ // 2 extruders or 1 extruder and a heated bed. // With no heated bed, an additional 24V fan is possible. // -#define MOSFET_A_PIN 6 // H3 -#define MOSFET_B_PIN 11 // B5 - Rev A of this file had this pin assigned to 9 -#define MOSFET_C_PIN 45 // L4 -#define MOSFET_D_PIN 44 // L5 + +// Labels from the schematic: +#define EX1_HEAT_PIN 6 // H3 +#define EX1_FAN_PIN 7 // H4 +#define EX2_HEAT_PIN 11 // B5 +#define EX2_FAN_PIN 12 // B6 +#define HBP_PIN 45 // L4 +#define EXTRA_FET_PIN 44 // L5 #if HOTENDS > 1 #if TEMP_SENSOR_BED @@ -171,34 +163,34 @@ // // Heaters / Fans (24V) // -#define HEATER_0_PIN MOSFET_A_PIN +#define HEATER_0_PIN EX1_HEAT_PIN #if ENABLED(IS_EFB) // Hotend, Fan, Bed - #define HEATER_BED_PIN MOSFET_C_PIN + #define HEATER_BED_PIN HBP_PIN #elif ENABLED(IS_EEF) // Hotend, Hotend, Fan - #define HEATER_1_PIN MOSFET_B_PIN + #define HEATER_1_PIN EX2_HEAT_PIN #elif ENABLED(IS_EEB) // Hotend, Hotend, Bed - #define HEATER_1_PIN MOSFET_B_PIN - #define HEATER_BED_PIN MOSFET_C_PIN + #define HEATER_1_PIN EX2_HEAT_PIN + #define HEATER_BED_PIN HBP_PIN #elif ENABLED(IS_EFF) // Hotend, Fan, Fan - #define FAN1_PIN MOSFET_C_PIN + #define FAN1_PIN HBP_PIN #endif #ifndef FAN_PIN - #if ENABLED(IS_EFB) || ENABLED(IS_EFF) // Hotend, Fan, Bed or Hotend, Fan, Fan - #define FAN_PIN MOSFET_B_PIN - #elif ENABLED(IS_EEF) || ENABLED(IS_SF) // Hotend, Hotend, Fan or Spindle, Fan - #define FAN_PIN MOSFET_C_PIN + #if EITHER(IS_EFB, IS_EFF) // Hotend, Fan, Bed or Hotend, Fan, Fan + #define FAN_PIN EX2_HEAT_PIN + #elif EITHER(IS_EEF, IS_SF) // Hotend, Hotend, Fan or Spindle, Fan + #define FAN_PIN HBP_PIN #else - #define FAN_PIN MOSFET_D_PIN + #define FAN_PIN EXTRA_FET_PIN #endif #endif // // Extruder Auto Fan Pins // -#define ORIG_E0_AUTO_FAN_PIN 7 // H4 -#define ORIG_E1_AUTO_FAN_PIN 12 // B6 +#define ORIG_E0_AUTO_FAN_PIN EX1_FAN_PIN +#define ORIG_E1_AUTO_FAN_PIN EX2_FAN_PIN // // Misc. Functions @@ -239,20 +231,24 @@ // Replicator uses a 3-wire SR controller with HD44780 // For now, pretend it's the SAV // + //#define FF_INTERFACEBOARD - #define SAV_3DLCD #define SR_DATA_PIN 34 // C3 #define SR_CLK_PIN 35 // C2 #define SR_STROBE_PIN 33 // C4 #define BTN_UP 75 // J4 - #define BTN_DOWN 73 // J3 - #define BTN_LEFT 72 // J2 - #define BTN_RIGHT 14 // J1 + #define BTN_DWN 73 // J3 + #define BTN_LFT 72 // J2 + #define BTN_RT 14 // J1 #define BTN_CENTER 15 // J0 #define BTN_ENC BTN_CENTER - #define BEEPER_PIN 4 // G5 + // Disable encoder + #undef BTN_EN1 + #undef BTN_EN2 + + #define BEEPER_PIN 4 // G5 #define STAT_LED_RED_PIN 32 // C5 #define STAT_LED_BLUE_PIN 31 // C6 (Actually green) @@ -264,13 +260,12 @@ // #define SDSS 53 // B0 #define SD_DETECT_PIN 9 // H6 - #define MAX_PIN THERMO_SCK_PIN // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_ENABLE_PIN 66 // K4 Pin should have a pullup! +#define SPINDLE_LASER_ENA_PIN 66 // K4 Pin should have a pullup! #define SPINDLE_LASER_PWM_PIN 8 // H5 MUST BE HARDWARE PWM #define SPINDLE_DIR_PIN 67 // K5 diff --git a/Marlin/src/pins/pins_MINIRAMBO.h b/Marlin/src/pins/pins_MINIRAMBO.h index 44fc4206ac17..1fbb52194a06 100644 --- a/Marlin/src/pins/pins_MINIRAMBO.h +++ b/Marlin/src/pins/pins_MINIRAMBO.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -125,7 +125,7 @@ // // use P1 connector for spindle pins #define SPINDLE_LASER_PWM_PIN 9 // MUST BE HARDWARE PWM -#define SPINDLE_LASER_ENABLE_PIN 18 // Pin should have a pullup! +#define SPINDLE_LASER_ENA_PIN 18 // Pin should have a pullup! #define SPINDLE_DIR_PIN 19 // diff --git a/Marlin/src/pins/pins_MINITRONICS.h b/Marlin/src/pins/pins_MINITRONICS.h index 7ebaf1c4a183..f54a4f85f3fc 100644 --- a/Marlin/src/pins/pins_MINITRONICS.h +++ b/Marlin/src/pins/pins_MINITRONICS.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -138,7 +138,7 @@ #define HEATER_BED_PIN 4 // won't compile #define TEMP_BED_PIN 50 #define TEMP_0_PIN 51 - #define SPINDLE_LASER_ENABLE_PIN 52 // using A6 because it already has a pullup + #define SPINDLE_LASER_ENA_PIN 52 // using A6 because it already has a pullup #define SPINDLE_LASER_PWM_PIN 3 // WARNING - LED & resistor pull up to +12/+24V stepper voltage #define SPINDLE_DIR_PIN 53 #endif diff --git a/Marlin/src/pins/pins_MKS_BASE.h b/Marlin/src/pins/pins_MKS_BASE.h index 90344c4084dd..8e5d0dd7bdb4 100644 --- a/Marlin/src/pins/pins_MKS_BASE.h +++ b/Marlin/src/pins/pins_MKS_BASE.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -44,7 +44,7 @@ // M3/M4/M5 - Spindle/Laser Control // #define SPINDLE_LASER_PWM_PIN 2 // MUST BE HARDWARE PWM -#define SPINDLE_LASER_ENABLE_PIN 15 // Pin should have a pullup! +#define SPINDLE_LASER_ENA_PIN 15 // Pin should have a pullup! #define SPINDLE_DIR_PIN 19 #include "pins_RAMPS.h" diff --git a/Marlin/src/pins/pins_MKS_BASE_14.h b/Marlin/src/pins/pins_MKS_BASE_14.h new file mode 100644 index 000000000000..d25c2c2e0112 --- /dev/null +++ b/Marlin/src/pins/pins_MKS_BASE_14.h @@ -0,0 +1,186 @@ +/** + * 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 . + * + */ + +/** + * MKS BASE v1.4 + */ + +#if HOTENDS > 2 || E_STEPPERS > 2 + #error "MKS BASE 1.4 only supports up to 2 hotends / E-steppers. Comment out this line to continue." +#endif + +#define BOARD_NAME "MKS BASE 1.4" + +// +// Heaters / Fans +// +#define MOSFET_D_PIN 7 // PH4 ** Pin16 ** PWM7 //E1 +#define FAN_PIN 9 // PH6 ** Pin18 ** PWM9 + +// Other Mods +#define CASE_LIGHT_PIN 11 // PB5 ** Pin24 ** PWM11 +#define SERVO3_PIN 12 // PB6 ** Pin25 ** D12 +#define PS_ON_PIN 2 // X+ // PE4 ** Pin6 ** PWM2 **MUST BE HARDWARE PWM +#define FILWIDTH_PIN 15 // Y+ // PJ0 ** Pin63 ** USART3_RX **Pin should have a pullup! +#define FIL_RUNOUT_PIN 19 // Z+ // PD2 ** Pin45 ** USART1_RX + +// +// M3/M4/M5 - Spindle/Laser Control +// +#define SPINDLE_LASER_PWM_PIN 2 // X+ // PE4 ** Pin6 ** PWM2 **MUST BE HARDWARE PWM +#define SPINDLE_LASER_ENA_PIN 15 // Y+ // PJ0 ** Pin63 ** USART3_RX **Pin should have a pullup! +#define SPINDLE_DIR_PIN 19 // Z+ // PD2 ** Pin45 ** USART1_RX + +// +// Microstepping pins +// +#define X_MS1_PIN 5 // PE3 ** Pin5 ** PWM5 +#define X_MS2_PIN 6 // PH3 ** Pin15 ** PWM6 +#define Y_MS1_PIN 59 // PF5 ** Pin92 ** A5 +#define Y_MS2_PIN 58 // PF4 ** Pin93 ** A4 +#define Z_MS1_PIN 22 // PA0 ** Pin78 ** D22 +#define Z_MS2_PIN 39 // PG2 ** Pin70 ** D39 +#define E0_MS1_PIN 64 // PK2 ** Pin87 ** A10 +#define E0_MS2_PIN 63 // PK1 ** Pin88 ** A9 +#define E1_MS1_PIN 57 // PF3 ** Pin94 ** A3 +#define E1_MS2_PIN 4 // PG5 ** Pin1 ** PWM4 + +#ifndef RGB_LED_R_PIN + #define RGB_LED_R_PIN 50 +#endif +#ifndef RGB_LED_R_PIN + #define RGB_LED_G_PIN 51 +#endif +#ifndef RGB_LED_R_PIN + #define RGB_LED_B_PIN 52 +#endif + +#include "pins_RAMPS.h" + +/* + Available connectors on MKS BASE v1.4 + + ======= + | GND | + |-----| E0 + | 10 | (10) PB4 ** Pin23 ** PWM10 + |-----| + | GND | + |-----| E1 + | 7 | ( 7) PH4 ** Pin16 ** PWM7 + |-----| + | GND | + |-----| FAN + | 9 | ( 9) PH6 ** Pin18 ** PWM9 + ======= + + ======= + | GND | + |-----| Heated Bed + | 8 | ( 8) PH5 ** Pin17 ** PWM8 + ======= + + ========== + | 12-24V | + |--------| Power + | GND | + ========== + + XS3 Connector + ================= + | 65 | GND | 5V | (65) PK3 ** Pin86 ** A11 + |----|-----|----| + | 66 | GND | 5V | (66) PK4 ** Pin85 ** A12 + ================= + + Servos Connector + ================= + | 11 | GND | 5V | (11) PB5 ** Pin24 ** PWM11 + |----|-----|----| + | 12 | GND | 5V | (12) PB6 ** Pin25 ** PWM12 + ================= + + ICSP + ================= + | 5V | 51 | GND | (51) PB2 ** Pin21 ** SPI_MOSI + |----|----|-----| + | 50 | 52 | RST | (50) PB3 ** Pin22 ** SPI_MISO + ================= (52) PB1 ** Pin20 ** SPI_SCK + + XS6/AUX-1 Connector + ====================== + | 5V | GND | NC | 20 | (20) PD1 ** Pin44 ** I2C_SDA + |----|-----|----|----| + | 50 | 51 | 52 | 21 | (50) PB3 ** Pin22 ** SPI_MISO + ====================== (51) PB2 ** Pin21 ** SPI_MOSI + (52) PB1 ** Pin20 ** SPI_SCK + (21) PD0 ** Pin43 ** I2C_SCL + + Temperature + ================================== + | GND | 69 | GND | 68 | GND | 67 | + ================================== + (69) PK7 ** Pin82 ** A15 + (68) PK6 ** Pin83 ** A14 + (67) PK5 ** Pin84 ** A13 + + Limit Switches + ============ + | 2 | GND | X+ ( 2) PE4 ** Pin6 ** PWM2 + |----|-----| + | 3 | GND | X- ( 3) PE5 ** Pin7 ** PWM3 + |----|-----| + | 15 | GND | Y+ (15) PJ0 ** Pin63 ** USART3_RX + |----|-----| + | 14 | GND | Y- (14) PJ1 ** Pin64 ** USART3_TX + |----|-----| + | 19 | GND | Z+ (19) PD2 ** Pin45 ** USART1_RX + |----|-----| + | 18 | GND | Z- (18) PD3 ** Pin46 ** USART1_TX + ============ + + EXP1 + ============ + | 37 | 35 | (37) PC0 ** Pin53 ** D37 + |-----|----| (35) PC2 ** Pin55 ** D35 + | 17 | 16 | (17) PH0 ** Pin12 ** USART2_RX + |-----|----| (16) PH1 ** Pin13 ** USART2_TX + | 23 | 25 | (23) PA1 ** Pin77 ** D23 + |-----|----| (25) PA3 ** Pin75 ** D25 + | 27 | 29 | (27) PA5 ** Pin73 ** D27 + |-----|----| (29) PA7 ** Pin71 ** D29 + | GND | 5V | + ============ + + EXP2 + ============ + | 50 | 52 | (50) PB3 ** Pin22 ** SPI_MISO + |-----|----| (52) PB1 ** Pin20 ** SPI_SCK + | 31 | 53 | (31) PC6 ** Pin59 ** D31 + |-----|----| (53) PB0 ** Pin19 ** SPI_SS + | 33 | 51 | (33) PC4 ** Pin57 ** D33 + |-----|----| (51) PB2 ** Pin21 ** SPI_MOSI + | 49 | 41 | (49) PL0 ** Pin35 ** D49 + |-----|----| (41) PG0 ** Pin51 ** D41 + | GND | NC | + ============ +*/ diff --git a/Marlin/src/pins/pins_MKS_BASE_15.h b/Marlin/src/pins/pins_MKS_BASE_15.h index e9f7050a1b43..d62f70d520d3 100644 --- a/Marlin/src/pins/pins_MKS_BASE_15.h +++ b/Marlin/src/pins/pins_MKS_BASE_15.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_MKS_BASE_HEROIC.h b/Marlin/src/pins/pins_MKS_BASE_HEROIC.h index 84f7280dfa91..394bdb869809 100644 --- a/Marlin/src/pins/pins_MKS_BASE_HEROIC.h +++ b/Marlin/src/pins/pins_MKS_BASE_HEROIC.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_MKS_GEN_13.h b/Marlin/src/pins/pins_MKS_GEN_13.h index 41e69d478a69..39ec95db5931 100644 --- a/Marlin/src/pins/pins_MKS_GEN_13.h +++ b/Marlin/src/pins/pins_MKS_GEN_13.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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_GEN_L.h b/Marlin/src/pins/pins_MKS_GEN_L.h index 59c5bcf48146..2fcb8f31fb2f 100644 --- a/Marlin/src/pins/pins_MKS_GEN_L.h +++ b/Marlin/src/pins/pins_MKS_GEN_L.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_MKS_ROBIN.h b/Marlin/src/pins/pins_MKS_ROBIN.h new file mode 100644 index 000000000000..430a7bf302e4 --- /dev/null +++ b/Marlin/src/pins/pins_MKS_ROBIN.h @@ -0,0 +1,125 @@ +/** + * 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 . + * + */ + +/** + * MKS Robin (STM32F130ZET6) board pin assignments + */ + +#ifndef __STM32F1__ + #error "Oops! Select an STM32F1 board in 'Tools > Board.'" +#endif + +#if HOTENDS > 2 || E_STEPPERS > 2 + #error "MKS Robin supports up to 2 hotends / E-steppers. Comment out this line to continue." +#endif + +#define BOARD_NAME "MKS Robin" + +// +// Release PB4 (Y_ENABLE_PIN) from JTAG NRST role +// +#define DISABLE_DEBUG + +// +// Servos +// +#define SERVO0_PIN PC3 // XS1 - 5 +#define SERVO1_PIN PA1 // XS1 - 6 +#define SERVO2_PIN PF9 // XS2 - 5 +#define SERVO3_PIN PF8 // XS2 - 6 + +// +// Limit Switches +// +#define X_MIN_PIN PB12 +#define X_MAX_PIN PB0 +#define Y_MIN_PIN PC5 +#define Y_MAX_PIN PC4 +#define Z_MIN_PIN PA4 +#define Z_MAX_PIN PF7 + +// +// Steppers +// +#define X_ENABLE_PIN PB9 +#define X_STEP_PIN PB8 +#define X_DIR_PIN PB5 + +#define Y_ENABLE_PIN PB4 +#define Y_STEP_PIN PG15 +#define Y_DIR_PIN PG10 + +#define Z_ENABLE_PIN PD7 +#define Z_STEP_PIN PD3 +#define Z_DIR_PIN PG14 + +#define E0_ENABLE_PIN PG13 +#define E0_STEP_PIN PG8 +#define E0_DIR_PIN PA15 + +#define E1_ENABLE_PIN PA12 +#define E1_STEP_PIN PA11 +#define E1_DIR_PIN PA8 + +// +// Temperature Sensors +// +#define TEMP_0_PIN PC1 // TH1 +#define TEMP_1_PIN PC2 // TH2 +#define TEMP_BED_PIN PC0 // TB1 + +// +// Heaters / Fans +// +#define HEATER_0_PIN PC7 // HEATER1 +#define HEATER_1_PIN PA6 // HEATER2 +#define HEATER_BED_PIN PC6 // HOT BED + +#define FAN_PIN PA7 // FAN + +/** + * Note: MKS Robin board is using SPI2 interface. Make sure your stm32duino library is configured accordingly + */ +//#define MAX6675_SS_PIN PE5 // TC1 - CS1 +//#define MAX6675_SS_PIN PE6 // TC2 - CS2 + +#define POWER_LOSS_PIN PA2 // PW_DET +#define PS_ON_PIN PA3 // PW_OFF +#define FIL_RUNOUT_PIN PF11 // MT_DET + +#define BEEPER_PIN PC13 +#define LED_PIN PB2 + +/** + * Note: MKS Robin TFT screens may have different TFT controllers + * If the screen stays white, disable 'LCD_RESET_PIN' to rely on the bootloader to do screen initialization. + * + * Enabling 'LCD_RESET_PIN' causes flickering when entering the LCD menu due to LCD controller reset. + * Reset feature was designed to "revive the LCD if static electricity killed it." + */ +//#define LCD_RESET_PIN PF6 +#define LCD_BACKLIGHT_PIN PG11 +#define FSMC_CS_PIN PG12 // NE4 +#define FSMC_RS_PIN PF0 // A0 + +#define SD_DETECT_PIN PF12 +#define SDSS -1 diff --git a/Marlin/src/pins/pins_MKS_SBASE.h b/Marlin/src/pins/pins_MKS_SBASE.h index 4784a8c2a088..a97bcd164dc8 100644 --- a/Marlin/src/pins/pins_MKS_SBASE.h +++ b/Marlin/src/pins/pins_MKS_SBASE.h @@ -1,7 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -29,8 +28,12 @@ #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." #endif -#define BOARD_NAME "MKS SBASE" -#define DEFAULT_WEBSITE_URL "https://github.com/makerbase-mks/MKS-SBASE" +#ifndef BOARD_NAME + #define BOARD_NAME "MKS SBASE" +#endif +#ifndef BOARD_WEBSITE_URL + #define BOARD_WEBSITE_URL "https://github.com/makerbase-mks/MKS-SBASE" +#endif #define LED_PIN P1_18 // Used as a status indicator #define LED2_PIN P1_19 @@ -55,6 +58,10 @@ #define Z_MIN_PIN P1_28 // The original Mks Sbase DIO19 has a 10k pullup to 3.3V or 5V, 1K series, so when using a Zprobe we must use DIO41 (J8 P1.22) #define Z_MAX_PIN P1_29 // 10k pullup to 3.3V, 1K series +#ifndef Z_MIN_PROBE_PIN + #define Z_MIN_PROBE_PIN P4_28 // Connector J8 +#endif + // // Steppers // @@ -119,10 +126,9 @@ #define PIN_P1_23 P1_23 // PWM Capable #define PIN_P2_12 P2_12 // Interrupt Capable #define PIN_P2_11 P2_11 // Interrupt Capable -#define PIN_P4_28 P4_28 // -// Prusa i3 MK2 Multi Material Multiplexer Support +// Průša i3 MK2 Multi Material Multiplexer Support // #if ENABLED(MK2_MULTIPLEXER) #define E_MUX0_PIN P1_23 // J8-3 @@ -152,23 +158,11 @@ #define ENET_TXD0 P1_00 // J12-11 #define ENET_TXD1 P1_01 // J12-12 -/** - * The SBase can share the on-board SD card with a PC via USB the following - * definitions control this feature: - */ -//#define USB_SD_DISABLED -#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device - -/** - * There are a number of configurations available for the SBase SD card reader. - * - A custom cable can be used to allow access to the LCD based SD card. - * - A standard cable can be used for access to the LCD SD card (but no SD detect). - * - The onboard SD card can be used and optionally shared with a PC via USB. - */ - -//#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD -//#define LPC_SD_LCD // Marlin uses the SD drive attached to the LCD -#define LPC_SD_ONBOARD // Marlin uses the SD drive attached to the control board +#if !ANY(LPC_SD_LCD, LPC_SD_ONBOARD, LPC_SD_CUSTOM_CABLE) + #undef USB_SD_DISABLED + #define USB_SD_ONBOARD + #define LPC_SD_ONBOARD +#endif #if ENABLED(LPC_SD_CUSTOM_CABLE) @@ -243,10 +237,45 @@ #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 + + #if ENABLED(FYSETC_MINI_12864) + /** + * The Fysetc display can NOT use the SCK and MOSI pins on EXP2, so a + * special cable is needed to go between EXP2 on the FYSETC and the + * controller board's EXP2 and J8. It also means that a software SPI + * is needed to drive those pins. + * + * The Fysetc requires mode 3 SPI interface. + * + * Pins 6, 7 & 8 on EXP2 are no connects. That means a second special + * cable will be needed if the RGB LEDs are to be active. + */ + #define DOGLCD_CS LCD_PINS_ENABLE // EXP1.3 (LCD_EN on Fysetc schematic) + #define DOGLCD_A0 LCD_PINS_RS // EXP1.4 (LCD_A0 on Fysetc schematic) + #define DOGLCD_SCK P2_11 // J8-5 (SCK on Fysetc schematic) + #define DOGLCD_MOSI P4_28 // J8-6 (MOSI on Fysetc schematic) + + #define RGB_LED + //#define RGBW_LED + #if EITHER(RGB_LED, RGBW_LED) + #define RGB_LED_R_PIN P2_12 // J8-4 (LCD_D6 on Fysetc schematic) + #define RGB_LED_G_PIN P1_23 // J8-3 (LCD_D5 on Fysetc schematic) + #define RGB_LED_B_PIN P1_22 // J8-2 (LCD_D7 on Fysetc schematic) + //#define RGB_LED_W_PIN -1 + #endif + + #elif ENABLED(MINIPANEL) + // GLCD features + // Uncomment screen orientation + //#define LCD_SCREEN_ROT_90 + //#define LCD_SCREEN_ROT_180 + //#define LCD_SCREEN_ROT_270 + #endif + #endif /** @@ -279,7 +308,7 @@ #endif #endif -#if HAS_DRIVER(TMC2208) +#if MB(MKS_SBASE) && HAS_DRIVER(TMC2208) // The shortage of pins becomes apparent. // Worst case you may have to give up the LCD // RX pins need to be interrupt capable diff --git a/Marlin/src/pins/pins_MKS_SGEN.h b/Marlin/src/pins/pins_MKS_SGEN.h new file mode 100644 index 000000000000..2aa6bcc551e3 --- /dev/null +++ b/Marlin/src/pins/pins_MKS_SGEN.h @@ -0,0 +1,60 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * MKS SGen pin assignments + */ + +#ifndef LPC1769 + #error "Oops! Make sure you have the LPC1769 environment selected in your IDE." +#endif + +#define BOARD_NAME "MKS SGEN" +#define BOARD_WEBSITE_URL "https://github.com/makerbase-mks/MKS-SGEN" + +#include "pins_MKS_SBASE.h" + +#undef E1_STEP_PIN +#undef E1_DIR_PIN +#undef E1_ENABLE_PIN + +//#undef BTN_EN1 +//#undef BTN_EN2 +//#define BTN_EN1 P1_23 // EXP2.5 +//#define BTN_EN2 P1_22 // EXP2.3 + +#if HAS_DRIVER(TMC2208) + // The shortage of pins becomes apparent. + // In the worst case you may have to give up the LCD. + // RX pins must be interrupt-capable. + #define X_SERIAL_TX_PIN P4_29 // J8-2 + #define X_SERIAL_RX_PIN P4_29 // J8-2 + + #define Y_SERIAL_TX_PIN P2_08 // J8-3 + #define Y_SERIAL_RX_PIN P2_08 // J8-3 + + #define Z_SERIAL_TX_PIN P2_11 // J8-4 + #define Z_SERIAL_RX_PIN P2_11 // J8-4 + #define E0_SERIAL_TX_PIN P2_13 // J8-5 + #define E0_SERIAL_RX_PIN P2_13 // J8-5 +#endif diff --git a/Marlin/src/pins/pins_MORPHEUS.h b/Marlin/src/pins/pins_MORPHEUS.h index e60f930d7d2b..85f8d0421551 100644 --- a/Marlin/src/pins/pins_MORPHEUS.h +++ b/Marlin/src/pins/pins_MORPHEUS.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_OMCA.h b/Marlin/src/pins/pins_OMCA.h index 85d8faa224e7..224bdf35a01e 100644 --- a/Marlin/src/pins/pins_OMCA.h +++ b/Marlin/src/pins/pins_OMCA.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_OMCA_A.h b/Marlin/src/pins/pins_OMCA_A.h index 19f0e43f926d..15dd42237a07 100644 --- a/Marlin/src/pins/pins_OMCA_A.h +++ b/Marlin/src/pins/pins_OMCA_A.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_PRINTRBOARD.h b/Marlin/src/pins/pins_PRINTRBOARD.h index a6193d64669f..1587c0fa3744 100644 --- a/Marlin/src/pins/pins_PRINTRBOARD.h +++ b/Marlin/src/pins/pins_PRINTRBOARD.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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_G2.h b/Marlin/src/pins/pins_PRINTRBOARD_G2.h new file mode 100644 index 000000000000..02f094498fec --- /dev/null +++ b/Marlin/src/pins/pins_PRINTRBOARD_G2.h @@ -0,0 +1,177 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016, 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 . + * + */ + +/** + * PRINTRBOARD_G2 + */ + +#ifndef __SAM3X8E__ + #error "Oops! Select 'Arduino Due' in 'Tools > Board.'" +#endif + +#ifndef BOARD_NAME + #define BOARD_NAME "PRINTRBOARD_G2" +#endif + +// +// Servos +// +//#define SERVO0_PIN -1 +//#define SERVO1_PIN -1 + +// +// Limit Switches +// +#define X_MIN_PIN 22 // PB26 +#define Y_MAX_PIN 18 // PA11 +#define Z_MIN_PIN 19 // PA10 + +// +// Z Probe (when not Z_MIN_PIN) +// +#ifndef Z_MIN_PROBE_PIN + #define Z_MIN_PROBE_PIN 22 +#endif + +#ifndef FIL_RUNOUT_PIN + //#define FIL_RUNOUT_PIN 57 // PA22 +#endif +#ifndef FIL_RUNOUT2_PIN + //#define FIL_RUNOUT2_PIN 21 // PB13 +#endif + + +// +// LED defines +// +//#define NEOPIXEL_TYPE NEO_GRBW // NEO_GRBW / NEO_GRB - four/three channel driver type (defined in Adafruit_NeoPixel.h) +//#define NEOPIXEL_PIN 20 // LED driving pin on motherboard +//#define NEOPIXEL_PIXELS 3 // Number of LEDs in the strip + + + +//#define SDA0 20 // PB12 NeoPixel pin I2C data +//#define SCL0 21 // PB13 I2C clock + +// D0_12 #REF! (INDICATOR_LED) +// B28 JTAG-CLK +// B31 JTAG_TMS /SWD_DIO +//A18 INTERRUPT_OUT +//A12 USART_RX not used +//A13 USART_TX not used +//A14 UART_RTS +//A15 UART_CTS +//PB2 Unassigned +//PB4 to PB9 Unassigned +//#define UART_RX_PIN 0 // PA8 "RX0" +//#define UART_TX_PIN 1 // PA9 "TX0" +//#define UART_RTS_PIN 23 // PA14 +//#define UART_CTS_PIN 24 // PA15 + +// +// Steppers +// +#define Z_STEP_PIN 73 // PA21 MOTOR 1 +#define Z_DIR_PIN 75 // PA26 +#define Z_ENABLE_PIN 74 // PA25 + +#define X_STEP_PIN 66 // PB15 MOTOR 2 +#define X_DIR_PIN 54 // PA16 +#define X_ENABLE_PIN 67 // PB16 + +#define Y_STEP_PIN 34 // PA29 MOTOR 3 +#define Y_DIR_PIN 35 // PB1 +#define Y_ENABLE_PIN 36 // PB0 + +#define E0_STEP_PIN 53 // PB14 MOTOR 4 +#define E0_DIR_PIN 78 // PB23 +#define E0_ENABLE_PIN 37 // PB22 + +// Microstepping mode pins +#define Z_MS1_PIN 52 // PB21 MODE0 MOTOR 1 +#define Z_MS2_PIN 52 // PB21 MODE1 +#define Z_MS3_PIN 65 // PB20 MODE2 + +#define X_MS1_PIN 43 // PA20 MODE0 MOTOR 2 +#define X_MS2_PIN 43 // PA20 MODE1 +#define X_MS3_PIN 42 // PA19 MODE2 + +#define Y_MS1_PIN 77 // PA28 MODE0 MOTOR 3 +#define Y_MS2_PIN 77 // PA28 MODE1 +#define Y_MS3_PIN 76 // PA27 MODE2 + +#define E0_MS1_PIN 38 // PB11 MODE0 MOTOR 4 +#define E0_MS2_PIN 38 // PB11 MODE1 +#define E0_MS3_PIN 39 // PB10 MODE2 + +// Motor current PWM pins +#define MOTOR_CURRENT_PWM_X_PIN 62 // PB17 MOTOR 1 +#define MOTOR_CURRENT_PWM_Z_PIN 63 // PB18 MOTOR 2 +#define MOTOR_CURRENT_PWM_Y_PIN 64 // PB19 MOTOR 3 +#define MOTOR_CURRENT_PWM_E_PIN 61 // PA2 MOTOR 4 + +//#define DEFAULT_PWM_MOTOR_CURRENT { 300, 400, 1000} // XY Z E0, 1000 = 1000mAh + +// +// Temperature Sensors +// +#define TEMP_0_PIN 2 // digital 56 PA23 +#define TEMP_BED_PIN 5 // digital 59 PA4 + +// +// Heaters / Fans +// +#define HEATER_0_PIN 40 // PA5 +#define HEATER_BED_PIN 41 // PB24 + +#ifndef FAN_PIN + #define FAN_PIN 13 // PB27 Fan1A +#endif +#define FAN1_PIN 58 // PA6 Fan1B + +#define FET_SAFETY_PIN 31 // PA7 must be pulsed low every 50 mS or FETs are turned off +#define FET_SAFETY_DELAY 50 // 50 mS delay between pulses +#define FET_SAFETY_INVERTED true // true - negative going pulse of 2 uS + +///////////////////////////////////////////////////////// + +#define MISO_PIN 68 // set to unused pins for now +#define MOSI_PIN 69 // set to unused pins for now +#define SCK_PIN 70 // set to unused pins for now +#define SDSS 71 // set to unused pins for now + +/** + * G2 uses 8 pins that are not available in the DUE environment: + * 34 PA29 - Y_STEP_PIN + * 35 PB1 - Y_DIR_PIN + * 36 PB0 - Y_ENABLE_PIN + * 37 PB22 - E0_ENABLE_PIN + * 38 PB11 - E0_MS1_PIN - normally used by the USB native port + * 39 PB10 - E0_MS3_PIN - normally used by the USB native port + * 40 PA5 - HEATER_0_PIN + * 41 PB24 - HEATER_BED_PIN + * + * None of these are in the arduino_due_x variant so digitalWrite and digitalRead can't be used on them. + * + * They can be accessed via FASTIO functions WRITE, READ, OUT_WRITE, OUTPUT, ... + * + */ diff --git a/Marlin/src/pins/pins_PRINTRBOARD_REVF.h b/Marlin/src/pins/pins_PRINTRBOARD_REVF.h index e7249702cc62..fb338e8d193a 100644 --- a/Marlin/src/pins/pins_PRINTRBOARD_REVF.h +++ b/Marlin/src/pins/pins_PRINTRBOARD_REVF.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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_RADDS.h b/Marlin/src/pins/pins_RADDS.h index 68f001aaedd7..473d69dffe5a 100644 --- a/Marlin/src/pins/pins_RADDS.h +++ b/Marlin/src/pins/pins_RADDS.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -247,7 +247,7 @@ #define SDSS 10 #define SD_DETECT_PIN 14 - #elif ENABLED(SSD1306_OLED_I2C_CONTROLLER) + #elif HAS_SSD1306_OLED_I2C #define BTN_EN1 50 #define BTN_EN2 52 diff --git a/Marlin/src/pins/pins_RAMBO.h b/Marlin/src/pins/pins_RAMBO.h index ab759101c3eb..b6890d9537c8 100644 --- a/Marlin/src/pins/pins_RAMBO.h +++ b/Marlin/src/pins/pins_RAMBO.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -148,8 +148,8 @@ // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_PWM_PIN 45 -#define SPINDLE_LASER_ENABLE_PIN 31 +#define SPINDLE_LASER_PWM_PIN 45 // MUST BE HARDWARE PWM +#define SPINDLE_LASER_ENA_PIN 31 // Pin should have a pullup! #define SPINDLE_DIR_PIN 32 // @@ -157,7 +157,7 @@ // #define E_MUX0_PIN 17 #define E_MUX1_PIN 16 -#define E_MUX2_PIN 84 +#define E_MUX2_PIN 84 // 84 in MK2 Firmware // // LCD / Controller @@ -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 @@ -189,14 +189,14 @@ #define BTN_EN2 84 #define BTN_ENC 83 - #define SD_DETECT_PIN -1 + #define SD_DETECT_PIN -1 // Pin 72 if using easy adapter board #define STAT_LED_RED_PIN 22 #define STAT_LED_BLUE_PIN 32 #else // !VIKI2 && !miniVIKI - #define BEEPER_PIN 79 + #define BEEPER_PIN 79 // AUX-4 // AUX-2 #define BTN_EN1 76 diff --git a/Marlin/src/pins/pins_RAMPS.h b/Marlin/src/pins/pins_RAMPS.h index 6b9bd1114848..a705e3e194ed 100644 --- a/Marlin/src/pins/pins_RAMPS.h +++ b/Marlin/src/pins/pins_RAMPS.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 @@ -131,71 +133,6 @@ #define E1_CS_PIN 44 #endif -/** - * Default pins for TMC software SPI - */ -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI 66 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO 44 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK 64 - #endif -#endif - -#if HAS_DRIVER(TMC2208) - /** - * TMC2208 stepper drivers - * - * Hardware serial communication ports. - * If undefined software serial is used according to the pins below - */ - //#define X_HARDWARE_SERIAL Serial1 - //#define X2_HARDWARE_SERIAL Serial1 - //#define Y_HARDWARE_SERIAL Serial1 - //#define Y2_HARDWARE_SERIAL Serial1 - //#define Z_HARDWARE_SERIAL Serial1 - //#define Z2_HARDWARE_SERIAL Serial1 - //#define E0_HARDWARE_SERIAL Serial1 - //#define E1_HARDWARE_SERIAL Serial1 - //#define E2_HARDWARE_SERIAL Serial1 - //#define E3_HARDWARE_SERIAL Serial1 - //#define E4_HARDWARE_SERIAL Serial1 - - /** - * Software serial - */ - - #define X_SERIAL_TX_PIN 40 - #define X_SERIAL_RX_PIN 63 - #define X2_SERIAL_TX_PIN -1 - #define X2_SERIAL_RX_PIN -1 - - #define Y_SERIAL_TX_PIN 59 - #define Y_SERIAL_RX_PIN 64 - #define Y2_SERIAL_TX_PIN -1 - #define Y2_SERIAL_RX_PIN -1 - - #define Z_SERIAL_TX_PIN 42 - #define Z_SERIAL_RX_PIN 65 - #define Z2_SERIAL_TX_PIN -1 - #define Z2_SERIAL_RX_PIN -1 - - #define E0_SERIAL_TX_PIN 44 - #define E0_SERIAL_RX_PIN 66 - #define E1_SERIAL_TX_PIN -1 - #define E1_SERIAL_RX_PIN -1 - #define E2_SERIAL_TX_PIN -1 - #define E2_SERIAL_RX_PIN -1 - #define E3_SERIAL_TX_PIN -1 - #define E3_SERIAL_RX_PIN -1 - #define E4_SERIAL_TX_PIN -1 - #define E4_SERIAL_RX_PIN -1 -#endif - // // Temperature Sensors // @@ -213,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 @@ -264,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 @@ -285,7 +222,7 @@ #define FILWIDTH_PIN 5 // Analog Input on AUX2 #endif -// define digital pin 4 for the filament runout sensor. Use the RAMPS 1.4 digital input 4 on the servos connector +// RAMPS 1.4 DIO 4 on the servos connector #ifndef FIL_RUNOUT_PIN #define FIL_RUNOUT_PIN 4 #endif @@ -294,11 +231,12 @@ #define PS_ON_PIN 12 #endif -#if ENABLED(CASE_LIGHT_ENABLE) && !defined(CASE_LIGHT_PIN) && !defined(SPINDLE_LASER_ENABLE_PIN) +#define AUX2_PINS_FREE !( BOTH(ULTRA_LCD, NEWPANEL) && ANY(PANEL_ONE, VIKI2, miniVIKI, MINIPANEL, REPRAPWORLD_KEYPAD) ) + +#if ENABLED(CASE_LIGHT_ENABLE) && !defined(CASE_LIGHT_PIN) && !defined(SPINDLE_LASER_ENA_PIN) #if NUM_SERVOS <= 1 // try to use servo connector first #define CASE_LIGHT_PIN 6 // MUST BE HARDWARE PWM - #elif !(ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL) \ - && (ENABLED(PANEL_ONE) || ENABLED(VIKI2) || ENABLED(miniVIKI) || ENABLED(MINIPANEL) || ENABLED(REPRAPWORLD_KEYPAD))) // try to use AUX 2 + #elif AUX2_PINS_FREE #define CASE_LIGHT_PIN 44 // MUST BE HARDWARE PWM #endif #endif @@ -306,19 +244,85 @@ // // M3/M4/M5 - Spindle/Laser Control // -#if ENABLED(SPINDLE_LASER_ENABLE) && !PIN_EXISTS(SPINDLE_LASER_ENABLE) +#if ENABLED(SPINDLE_LASER_ENABLE) && !PIN_EXISTS(SPINDLE_LASER_ENA) #if !defined(NUM_SERVOS) || NUM_SERVOS == 0 // try to use servo connector first - #define SPINDLE_LASER_ENABLE_PIN 4 // Pin should have a pullup/pulldown! + #define SPINDLE_LASER_ENA_PIN 4 // Pin should have a pullup/pulldown! #define SPINDLE_LASER_PWM_PIN 6 // MUST BE HARDWARE PWM #define SPINDLE_DIR_PIN 5 - #elif !(ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL) \ - && (ENABLED(PANEL_ONE) || ENABLED(VIKI2) || ENABLED(miniVIKI) || ENABLED(MINIPANEL) || ENABLED(REPRAPWORLD_KEYPAD))) // try to use AUX 2 - #define SPINDLE_LASER_ENABLE_PIN 40 // Pin should have a pullup/pulldown! + #elif AUX2_PINS_FREE + #define SPINDLE_LASER_ENA_PIN 40 // Pin should have a pullup/pulldown! #define SPINDLE_LASER_PWM_PIN 44 // MUST BE HARDWARE PWM #define SPINDLE_DIR_PIN 65 #endif #endif +#undef AUX2_PINS_FREE + +// +// TMC software SPI +// +#if ENABLED(TMC_USE_SW_SPI) + #ifndef TMC_SW_MOSI + #define TMC_SW_MOSI 66 + #endif + #ifndef TMC_SW_MISO + #define TMC_SW_MISO 44 + #endif + #ifndef TMC_SW_SCK + #define TMC_SW_SCK 64 + #endif +#endif + +#if HAS_DRIVER(TMC2208) + /** + * TMC2208 stepper drivers + * + * Hardware serial communication ports. + * If undefined software serial is used according to the pins below + */ + //#define X_HARDWARE_SERIAL Serial1 + //#define X2_HARDWARE_SERIAL Serial1 + //#define Y_HARDWARE_SERIAL Serial1 + //#define Y2_HARDWARE_SERIAL Serial1 + //#define Z_HARDWARE_SERIAL Serial1 + //#define Z2_HARDWARE_SERIAL Serial1 + //#define E0_HARDWARE_SERIAL Serial1 + //#define E1_HARDWARE_SERIAL Serial1 + //#define E2_HARDWARE_SERIAL Serial1 + //#define E3_HARDWARE_SERIAL Serial1 + //#define E4_HARDWARE_SERIAL Serial1 + + // + // Software serial + // + + #define X_SERIAL_TX_PIN 40 + #define X_SERIAL_RX_PIN 63 + #define X2_SERIAL_TX_PIN -1 + #define X2_SERIAL_RX_PIN -1 + + #define Y_SERIAL_TX_PIN 59 + #define Y_SERIAL_RX_PIN 64 + #define Y2_SERIAL_TX_PIN -1 + #define Y2_SERIAL_RX_PIN -1 + + #define Z_SERIAL_TX_PIN 42 + #define Z_SERIAL_RX_PIN 65 + #define Z2_SERIAL_TX_PIN -1 + #define Z2_SERIAL_RX_PIN -1 + + #define E0_SERIAL_TX_PIN 44 + #define E0_SERIAL_RX_PIN 66 + #define E1_SERIAL_TX_PIN -1 + #define E1_SERIAL_RX_PIN -1 + #define E2_SERIAL_TX_PIN -1 + #define E2_SERIAL_RX_PIN -1 + #define E3_SERIAL_TX_PIN -1 + #define E3_SERIAL_RX_PIN -1 + #define E4_SERIAL_TX_PIN -1 + #define E4_SERIAL_RX_PIN -1 +#endif + // // Průša i3 MK2 Multiplexer Support // @@ -347,7 +351,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 +383,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 +467,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 +506,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 +520,53 @@ #define BTN_ENC 35 #define SD_DETECT_PIN 49 - #define KILL_PIN 64 + #define KILL_PIN 41 + + #elif ENABLED(FYSETC_MINI_12864) // Added in Marlin 1.1.9+ + + // From https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 + #define BEEPER_PIN 37 + + #define DOGLCD_A0 16 + #define DOGLCD_CS 17 + + #define BTN_EN1 31 + #define BTN_EN2 33 + #define BTN_ENC 35 + + #define SD_DETECT_PIN 49 + + #define LCD_RESET_PIN 23 // Must be high or open for LCD to operate normally. + // Seems to work best if left open. + + #define FYSETC_MINI_12864_REV_1_2 + //#define FYSETC_MINI_12864_REV_2_0 + //#define FYSETC_MINI_12864_REV_2_1 + #if EITHER(FYSETC_MINI_12864_REV_1_2, FYSETC_MINI_12864_REV_2_0) + #ifndef RGB_LED_R_PIN + #define RGB_LED_R_PIN 25 + #endif + #ifndef RGB_LED_G_PIN + #define RGB_LED_G_PIN 27 + #endif + #ifndef RGB_LED_B_PIN + #define RGB_LED_B_PIN 29 + #endif + #elif defined(FYSETC_MINI_12864_REV_2_1) + #define NEOPIXEL_LED + #define NEOPIXEL_TYPE NEO_GRB // NEO_GRBW / NEO_GRB - four/three channel driver type (defined in Adafruit_NeoPixel.h) + #define NEOPIXEL_PIN 25 // LED driving pin on motherboard 4 => D4 (EXP2-5 on Printrboard) / 30 => PC7 (EXP3-13 on Rumba) + #define NEOPIXEL_PIXELS 3 // 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 + #else + #error "Either FYSETC_MINI_12864_REV_1_2, FYSETC_MINI_12864_REV_2_0 or FYSETC_MINI_12864_REV_2_1 must be defined" + #endif + + #if !defined(LED_USER_PRESET_STARTUP) && EITHER(FYSETC_MINI_12864_REV_2_0, FYSETC_MINI_12864_REV_2_1) + #error "LED_USER_PRESET_STARTUP must be enabled when using FYSETC_MINI_12864 REV 2.0 and later" + #endif #elif ENABLED(MINIPANEL) @@ -529,7 +578,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_RAMPS4DUE.h b/Marlin/src/pins/pins_RAMPS4DUE.h index dc56d814dc18..4967c4a92c1d 100644 --- a/Marlin/src/pins/pins_RAMPS4DUE.h +++ b/Marlin/src/pins/pins_RAMPS4DUE.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_RAMPS_13.h b/Marlin/src/pins/pins_RAMPS_13.h index effce907064f..d6f1e2528c29 100644 --- a/Marlin/src/pins/pins_RAMPS_13.h +++ b/Marlin/src/pins/pins_RAMPS_13.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_RAMPS_CREALITY.h b/Marlin/src/pins/pins_RAMPS_CREALITY.h index 1365c29f5472..7d637bb1ef6a 100644 --- a/Marlin/src/pins/pins_RAMPS_CREALITY.h +++ b/Marlin/src/pins/pins_RAMPS_CREALITY.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_RAMPS_DUO.h b/Marlin/src/pins/pins_RAMPS_DUO.h index efbd647edd4c..7573ef404b8c 100644 --- a/Marlin/src/pins/pins_RAMPS_DUO.h +++ b/Marlin/src/pins/pins_RAMPS_DUO.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 96e5dab2bc4c..8d14bddc4a67 100755 --- a/Marlin/src/pins/pins_RAMPS_ENDER_4.h +++ b/Marlin/src/pins/pins_RAMPS_ENDER_4.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 88df3fdae717..78e75d9116bc 100644 --- a/Marlin/src/pins/pins_RAMPS_FD_V1.h +++ b/Marlin/src/pins/pins_RAMPS_FD_V1.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -150,28 +150,70 @@ #if ENABLED(NEWPANEL) #define LCD_PINS_RS 16 #define LCD_PINS_ENABLE 17 + #endif + + #if ENABLED(FYSETC_MINI_12864) + #define DOGLCD_CS LCD_PINS_ENABLE + #define DOGLCD_A0 LCD_PINS_RS + + //#define FORCE_SOFT_SPI // Use this if default of hardware SPI causes problems + + #define LCD_RESET_PIN 23 // Must be high or open for LCD to operate normally. + // Seems to work best if left open. + + #define FYSETC_MINI_12864_REV_1_2 + //#define FYSETC_MINI_12864_REV_2_0 + //#define FYSETC_MINI_12864_REV_2_1 + #if EITHER(FYSETC_MINI_12864_REV_1_2, FYSETC_MINI_12864_REV_2_0) + #ifndef RGB_LED_R_PIN + #define RGB_LED_R_PIN 25 + #endif + #ifndef RGB_LED_G_PIN + #define RGB_LED_G_PIN 27 + #endif + #ifndef RGB_LED_B_PIN + #define RGB_LED_B_PIN 29 + #endif + #elif defined(FYSETC_MINI_12864_REV_2_1) + #define NEOPIXEL_LED + #define NEOPIXEL_TYPE NEO_GRB // NEO_GRBW / NEO_GRB - four/three channel driver type (defined in Adafruit_NeoPixel.h) + #define NEOPIXEL_PIN 25 // LED driving pin on motherboard 4 => D4 (EXP2-5 on Printrboard) / 30 => PC7 (EXP3-13 on Rumba) + #define NEOPIXEL_PIXELS 3 // 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 + #else + #error "Either FYSETC_MINI_12864_REV_1_2, FYSETC_MINI_12864_REV_2_0 or FYSETC_MINI_12864_REV_2_1 must be defined" + #endif + + #if !defined(LED_USER_PRESET_STARTUP) && EITHER(FYSETC_MINI_12864_REV_2_0, FYSETC_MINI_12864_REV_2_1) + #error "LED_USER_PRESET_STARTUP must be enabled when using FYSETC_MINI_12864 REV 2.0 and later" + #endif + + #elif ENABLED(NEWPANEL) + #define LCD_PINS_D4 23 #define LCD_PINS_D5 25 #define LCD_PINS_D6 27 #define LCD_PINS_D7 29 - #endif - #if ENABLED(MINIPANEL) - #define DOGLCD_CS 25 - #define DOGLCD_A0 27 - #endif + #if ENABLED(MINIPANEL) + #define DOGLCD_CS 25 + #define DOGLCD_A0 27 + #endif - #if ENABLED(VIKI2) || ENABLED(miniVIKI) - #define DOGLCD_A0 16 - #define KILL_PIN 51 - #define STAT_LED_BLUE_PIN 29 - #define STAT_LED_RED_PIN 23 - #define DOGLCD_CS 17 - #define DOGLCD_SCK 76 // SCK_PIN - These are required for DUE Hardware SPI - #define DOGLCD_MOSI 75 // MOSI_PIN - #define DOGLCD_MISO 74 // MISO_PIN #endif + #if ANY(VIKI2, miniVIKI) + #define DOGLCD_A0 16 + #define KILL_PIN 51 + #define STAT_LED_BLUE_PIN 29 + #define STAT_LED_RED_PIN 23 + #define DOGLCD_CS 17 + #define DOGLCD_SCK 76 // SCK_PIN - Required for DUE Hardware SPI + #define DOGLCD_MOSI 75 // MOSI_PIN + #define DOGLCD_MISO 74 // MISO_PIN + #endif #endif // ULTRA_LCD @@ -198,10 +240,8 @@ // // M3/M4/M5 - Spindle/Laser Control // -#if ENABLED(SPINDLE_LASER_ENABLE) && !PIN_EXISTS(SPINDLE_LASER_ENABLE) - #if HOTENDS < 3 - #define SPINDLE_LASER_ENABLE_PIN 45 // Use E2 ENA - #define SPINDLE_LASER_PWM_PIN 12 // MUST BE HARDWARE PWM - #define SPINDLE_DIR_PIN 47 // Use E2 DIR - #endif +#if HOTENDS < 3 && ENABLED(SPINDLE_LASER_ENABLE) && !PIN_EXISTS(SPINDLE_LASER_ENA) + #define SPINDLE_LASER_ENA_PIN 45 // Use E2 ENA + #define SPINDLE_LASER_PWM_PIN 12 // MUST BE HARDWARE PWM + #define SPINDLE_DIR_PIN 47 // Use E2 DIR #endif diff --git a/Marlin/src/pins/pins_RAMPS_FD_V2.h b/Marlin/src/pins/pins_RAMPS_FD_V2.h index d4d7012557bc..4aa5f3017008 100644 --- a/Marlin/src/pins/pins_RAMPS_FD_V2.h +++ b/Marlin/src/pins/pins_RAMPS_FD_V2.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_RAMPS_LINUX.h b/Marlin/src/pins/pins_RAMPS_LINUX.h new file mode 100644 index 000000000000..7db43fbab315 --- /dev/null +++ b/Marlin/src/pins/pins_RAMPS_LINUX.h @@ -0,0 +1,568 @@ +/** + * 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 with RAMPS v1.4 (or v1.3) pin assignments + * + * Applies to the following boards: + * + * RAMPS_14_EFB (Hotend, Fan, Bed) + * RAMPS_14_EEB (Hotend0, Hotend1, Bed) + * RAMPS_14_EFF (Hotend, Fan0, Fan1) + * RAMPS_14_EEF (Hotend0, Hotend1, Fan) + * RAMPS_14_SF (Spindle, Controller Fan) + * + * RAMPS_13_EFB (Hotend, Fan, Bed) + * RAMPS_13_EEB (Hotend0, Hotend1, Bed) + * RAMPS_13_EFF (Hotend, Fan0, Fan1) + * RAMPS_13_EEF (Hotend0, Hotend1, Fan) + * RAMPS_13_SF (Spindle, Controller Fan) + * + * Other pins_MYBOARD.h files may override these defaults + * + * Differences between + * RAMPS_13 | RAMPS_14 + * 7 | 11 + */ + +#ifndef BOARD_NAME + #define BOARD_NAME "RAMPS 1.4" +#endif + +#define IS_RAMPS_EFB + +// +// 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 +#endif +#define SERVO1_PIN 6 +#define SERVO2_PIN 5 +#ifndef SERVO3_PIN + #define SERVO3_PIN 4 +#endif + +// +// Limit Switches +// +#define X_MIN_PIN 3 +#ifndef X_MAX_PIN + #define X_MAX_PIN 2 +#endif +#define Y_MIN_PIN 14 +#define Y_MAX_PIN 15 +#define Z_MIN_PIN 18 +#define Z_MAX_PIN 19 + +// +// Z Probe (when not Z_MIN_PIN) +// +#ifndef Z_MIN_PROBE_PIN + #define Z_MIN_PROBE_PIN 32 +#endif + +// +// Steppers +// +#define X_STEP_PIN 54 +#define X_DIR_PIN 55 +#define X_ENABLE_PIN 38 +#ifndef X_CS_PIN + #define X_CS_PIN 53 +#endif + +#define Y_STEP_PIN 60 +#define Y_DIR_PIN 61 +#define Y_ENABLE_PIN 56 +#ifndef Y_CS_PIN + #define Y_CS_PIN 49 +#endif + +#define Z_STEP_PIN 46 +#define Z_DIR_PIN 48 +#define Z_ENABLE_PIN 62 +#ifndef Z_CS_PIN + #define Z_CS_PIN 40 +#endif + +#define E0_STEP_PIN 26 +#define E0_DIR_PIN 28 +#define E0_ENABLE_PIN 24 +#ifndef E0_CS_PIN + #define E0_CS_PIN 42 +#endif + +#define E1_STEP_PIN 36 +#define E1_DIR_PIN 34 +#define E1_ENABLE_PIN 30 +#ifndef E1_CS_PIN + #define E1_CS_PIN 44 +#endif + +// +// Temperature Sensors +// +#define TEMP_0_PIN 0 // Analog Input +#define TEMP_1_PIN 1 // Analog Input +#define TEMP_BED_PIN 2 // Analog Input + +// SPI for Max6675 or Max31855 Thermocouple +#if DISABLED(SDSUPPORT) + #define MAX6675_SS_PIN 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card +#else + #define MAX6675_SS_PIN 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present +#endif + +// +// Augmentation for auto-assigning RAMPS plugs +// +#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 + #else + #define IS_RAMPS_EEF + #endif + #elif TEMP_SENSOR_BED + #define IS_RAMPS_EFB + #else + #define IS_RAMPS_EFF + #endif +#endif + +// +// Heaters / Fans +// +#ifndef MOSFET_D_PIN + #define MOSFET_D_PIN -1 +#endif +#ifndef RAMPS_D8_PIN + #define RAMPS_D8_PIN 8 +#endif +#ifndef RAMPS_D9_PIN + #define RAMPS_D9_PIN 9 +#endif +#ifndef RAMPS_D10_PIN + #define RAMPS_D10_PIN 10 +#endif + +#define HEATER_0_PIN RAMPS_D10_PIN + +#if ENABLED(IS_RAMPS_EFB) // Hotend, Fan, Bed + #define FAN_PIN RAMPS_D9_PIN + #define HEATER_BED_PIN RAMPS_D8_PIN +#elif ENABLED(IS_RAMPS_EEF) // Hotend, Hotend, Fan + #define HEATER_1_PIN RAMPS_D9_PIN + #define FAN_PIN RAMPS_D8_PIN +#elif ENABLED(IS_RAMPS_EEB) // Hotend, Hotend, Bed + #define HEATER_1_PIN RAMPS_D9_PIN + #define HEATER_BED_PIN RAMPS_D8_PIN +#elif ENABLED(IS_RAMPS_EFF) // Hotend, Fan, Fan + #define FAN_PIN RAMPS_D9_PIN + #define FAN1_PIN RAMPS_D8_PIN +#elif ENABLED(IS_RAMPS_SF) // Spindle, Fan + #define FAN_PIN RAMPS_D8_PIN +#else // Non-specific are "EFB" (i.e., "EFBF" or "EFBE") + #define FAN_PIN RAMPS_D9_PIN + #define HEATER_BED_PIN RAMPS_D8_PIN + #if HOTENDS == 1 + #define FAN1_PIN MOSFET_D_PIN + #else + #define HEATER_1_PIN MOSFET_D_PIN + #endif +#endif + +#ifndef FAN_PIN + #define FAN_PIN 4 // IO pin. Buffer needed +#endif + +// +// Misc. Functions +// +#define SDSS 53 +#define LED_PIN 13 + +#ifndef FILWIDTH_PIN + #define FILWIDTH_PIN 5 // Analog Input on AUX2 +#endif + +// define digital pin 4 for the filament runout sensor. Use the RAMPS 1.4 digital input 4 on the servos connector +#ifndef FIL_RUNOUT_PIN + #define FIL_RUNOUT_PIN 4 +#endif + +#ifndef PS_ON_PIN + #define PS_ON_PIN 12 +#endif + +#if ENABLED(CASE_LIGHT_ENABLE) && !defined(CASE_LIGHT_PIN) && !defined(SPINDLE_LASER_ENA_PIN) + #if NUM_SERVOS <= 1 // try to use servo connector first + #define CASE_LIGHT_PIN 6 // MUST BE HARDWARE PWM + #elif !(BOTH(ULTRA_LCD, NEWPANEL) && ANY(PANEL_ONE, VIKI2, miniVIKI, MINIPANEL, REPRAPWORLD_KEYPAD)) // try to use AUX 2 + #define CASE_LIGHT_PIN 44 // MUST BE HARDWARE PWM + #endif +#endif + +// +// M3/M4/M5 - Spindle/Laser Control +// +#if ENABLED(SPINDLE_LASER_ENABLE) && !PIN_EXISTS(SPINDLE_LASER_ENA) + #if !defined(NUM_SERVOS) || NUM_SERVOS == 0 // try to use servo connector first + #define SPINDLE_LASER_ENA_PIN 4 // Pin should have a pullup/pulldown! + #define SPINDLE_LASER_PWM_PIN 6 // MUST BE HARDWARE PWM + #define SPINDLE_DIR_PIN 5 + #elif !(BOTH(ULTRA_LCD, NEWPANEL) && ANY(PANEL_ONE, VIKI2, miniVIKI, MINIPANEL, REPRAPWORLD_KEYPAD)) // try to use AUX 2 + #define SPINDLE_LASER_ENA_PIN 40 // Pin should have a pullup/pulldown! + #define SPINDLE_LASER_PWM_PIN 44 // MUST BE HARDWARE PWM + #define SPINDLE_DIR_PIN 65 + #endif +#endif + +// +// Průša i3 MK2 Multiplexer Support +// +#ifndef E_MUX0_PIN + #define E_MUX0_PIN 40 // Z_CS_PIN +#endif +#ifndef E_MUX1_PIN + #define E_MUX1_PIN 42 // E0_CS_PIN +#endif +#ifndef E_MUX2_PIN + #define E_MUX2_PIN 44 // E1_CS_PIN +#endif + +/** + * Default pins for TMC software SPI + */ +#if ENABLED(TMC_USE_SW_SPI) + #ifndef TMC_SW_MOSI + #define TMC_SW_MOSI 66 + #endif + #ifndef TMC_SW_MISO + #define TMC_SW_MISO 44 + #endif + #ifndef TMC_SW_SCK + #define TMC_SW_SCK 64 + #endif +#endif + +#if ENABLED(HAVE_TMC2208) + /** + * TMC2208 stepper drivers + * + * Hardware serial communication ports. + * If undefined software serial is used according to the pins below + */ + //#define X_HARDWARE_SERIAL Serial1 + //#define X2_HARDWARE_SERIAL Serial1 + //#define Y_HARDWARE_SERIAL Serial1 + //#define Y2_HARDWARE_SERIAL Serial1 + //#define Z_HARDWARE_SERIAL Serial1 + //#define Z2_HARDWARE_SERIAL Serial1 + //#define E0_HARDWARE_SERIAL Serial1 + //#define E1_HARDWARE_SERIAL Serial1 + //#define E2_HARDWARE_SERIAL Serial1 + //#define E3_HARDWARE_SERIAL Serial1 + //#define E4_HARDWARE_SERIAL Serial1 + + /** + * Software serial + */ + + #define X_SERIAL_TX_PIN 40 + #define X_SERIAL_RX_PIN 63 + #define X2_SERIAL_TX_PIN -1 + #define X2_SERIAL_RX_PIN -1 + + #define Y_SERIAL_TX_PIN 59 + #define Y_SERIAL_RX_PIN 64 + #define Y2_SERIAL_TX_PIN -1 + #define Y2_SERIAL_RX_PIN -1 + + #define Z_SERIAL_TX_PIN 42 + #define Z_SERIAL_RX_PIN 65 + #define Z2_SERIAL_TX_PIN -1 + #define Z2_SERIAL_RX_PIN -1 + + #define E0_SERIAL_TX_PIN 44 + #define E0_SERIAL_RX_PIN 66 + #define E1_SERIAL_TX_PIN -1 + #define E1_SERIAL_RX_PIN -1 + #define E2_SERIAL_TX_PIN -1 + #define E2_SERIAL_RX_PIN -1 + #define E3_SERIAL_TX_PIN -1 + #define E3_SERIAL_RX_PIN -1 + #define E4_SERIAL_TX_PIN -1 + #define E4_SERIAL_RX_PIN -1 +#endif + +////////////////////////// +// LCDs and Controllers // +////////////////////////// + +#if ENABLED(ULTRA_LCD) + + // + // LCD Display output pins + // + #if ENABLED(REPRAPWORLD_GRAPHICAL_LCD) + + #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 BOTH(NEWPANEL, PANEL_ONE) + + #define LCD_PINS_RS 40 + #define LCD_PINS_ENABLE 42 + #define LCD_PINS_D4 65 + #define LCD_PINS_D5 66 + #define LCD_PINS_D6 44 + #define LCD_PINS_D7 64 + + #else + + #if ENABLED(CR10_STOCKDISPLAY) + + #define LCD_PINS_RS 27 + #define LCD_PINS_ENABLE 29 + #define LCD_PINS_D4 25 + + #if DISABLED(NEWPANEL) + #define BEEPER_PIN 37 + #endif + + #elif ENABLED(ZONESTAR_LCD) + + #define LCD_PINS_RS 64 + #define LCD_PINS_ENABLE 44 + #define LCD_PINS_D4 63 + #define LCD_PINS_D5 40 + #define LCD_PINS_D6 42 + #define LCD_PINS_D7 65 + + #else + + #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 + #define DOGLCD_CS 16 + #define DOGLCD_MOSI 17 + #define DOGLCD_SCK 23 + #define DOGLCD_A0 LCD_PINS_DC + #else + #define LCD_PINS_RS 16 + #define LCD_PINS_ENABLE 17 + #define LCD_PINS_D4 23 + #define LCD_PINS_D5 25 + #define LCD_PINS_D6 27 + #endif + + #define LCD_PINS_D7 29 + + #if DISABLED(NEWPANEL) + #define BEEPER_PIN 33 + #endif + + #endif + + #if DISABLED(NEWPANEL) + // Buttons are attached to a shift register + // Not wired yet + //#define SHIFT_CLK 38 + //#define SHIFT_LD 42 + //#define SHIFT_OUT 40 + //#define SHIFT_EN 17 + #endif + + #endif + + // + // LCD Display input pins + // + #if ENABLED(NEWPANEL) + + #if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) + + #define BEEPER_PIN 37 + + #if ENABLED(CR10_STOCKDISPLAY) + #define BTN_EN1 17 + #define BTN_EN2 23 + #else + #define BTN_EN1 31 + #define BTN_EN2 33 + #endif + + #define BTN_ENC 35 + #define SD_DETECT_PIN 49 + #define KILL_PIN 41 + + #if ENABLED(BQ_LCD_SMART_CONTROLLER) + #define LCD_BACKLIGHT_PIN 39 + #endif + + #elif ENABLED(REPRAPWORLD_GRAPHICAL_LCD) + + #define BTN_EN1 64 + #define BTN_EN2 59 + #define BTN_ENC 63 + #define SD_DETECT_PIN 42 + + #elif ENABLED(LCD_I2C_PANELOLU2) + + #define BTN_EN1 47 + #define BTN_EN2 43 + #define BTN_ENC 32 + #define LCD_SDSS SDSS + #define KILL_PIN 41 + + #elif ENABLED(LCD_I2C_VIKI) + + #define BTN_EN1 22 // http://files.panucatt.com/datasheets/viki_wiring_diagram.pdf explains 40/42. + #define BTN_EN2 7 // 22/7 are unused on RAMPS_14. 22 is unused and 7 the SERVO0_PIN on RAMPS_13. + #define BTN_ENC -1 + + #define LCD_SDSS SDSS + #define SD_DETECT_PIN 49 + + #elif ANY(VIKI2, miniVIKI) + + #define DOGLCD_CS 45 + #define DOGLCD_A0 44 + #define LCD_SCREEN_ROT_180 + + #define BEEPER_PIN 33 + #define STAT_LED_RED_PIN 32 + #define STAT_LED_BLUE_PIN 35 + + #define BTN_EN1 22 + #define BTN_EN2 7 + #define BTN_ENC 39 + + #define SD_DETECT_PIN -1 // Pin 49 for display sd interface, 72 for easy adapter board + #define KILL_PIN 31 + + #elif ENABLED(ELB_FULL_GRAPHIC_CONTROLLER) + + #define DOGLCD_CS 29 + #define DOGLCD_A0 27 + + #define BEEPER_PIN 23 + #define LCD_BACKLIGHT_PIN 33 + + #define BTN_EN1 35 + #define BTN_EN2 37 + #define BTN_ENC 31 + + #define LCD_SDSS SDSS + #define SD_DETECT_PIN 49 + #define KILL_PIN 41 + + #elif ENABLED(MKS_MINI_12864) // Added in Marlin 1.1.6 + + #define DOGLCD_A0 27 + #define DOGLCD_CS 25 + + // GLCD features + // Uncomment screen orientation + //#define LCD_SCREEN_ROT_90 + //#define LCD_SCREEN_ROT_180 + //#define LCD_SCREEN_ROT_270 + + #define BEEPER_PIN 37 + // not connected to a pin + #define LCD_BACKLIGHT_PIN 65 // backlight LED on A11/D65 + + #define BTN_EN1 31 + #define BTN_EN2 33 + #define BTN_ENC 35 + + #define SD_DETECT_PIN 49 + #define KILL_PIN 64 + + #elif ENABLED(MINIPANEL) + + #define BEEPER_PIN 42 + // not connected to a pin + #define LCD_BACKLIGHT_PIN 65 // backlight LED on A11/D65 + + #define DOGLCD_A0 44 + #define DOGLCD_CS 66 + + // GLCD features + // Uncomment screen orientation + //#define LCD_SCREEN_ROT_90 + //#define LCD_SCREEN_ROT_180 + //#define LCD_SCREEN_ROT_270 + + #define BTN_EN1 40 + #define BTN_EN2 63 + #define BTN_ENC 59 + + #define SD_DETECT_PIN 49 + #define KILL_PIN 64 + + #elif ENABLED(ZONESTAR_LCD) + + #define ADC_KEYPAD_PIN 12 + + #elif ENABLED(AZSMZ_12864) + + // Pins only defined for RAMPS_SMART currently + + #else + + // Beeper on AUX-4 + #define BEEPER_PIN 33 + + // Buttons are directly attached using AUX-2 + #if ENABLED(REPRAPWORLD_KEYPAD) + #define SHIFT_OUT 40 + #define SHIFT_CLK 44 + #define SHIFT_LD 42 + #define BTN_EN1 64 + #define BTN_EN2 59 + #define BTN_ENC 63 + #elif ENABLED(PANEL_ONE) + #define BTN_EN1 59 // AUX2 PIN 3 + #define BTN_EN2 63 // AUX2 PIN 4 + #define BTN_ENC 49 // AUX3 PIN 7 + #else + #define BTN_EN1 37 + #define BTN_EN2 35 + #define BTN_ENC 31 + #endif + + #if ENABLED(G3D_PANEL) + #define SD_DETECT_PIN 49 + #define KILL_PIN 41 + #endif + + #endif + #endif // NEWPANEL + +#endif // ULTRA_LCD diff --git a/Marlin/src/pins/pins_RAMPS_OLD.h b/Marlin/src/pins/pins_RAMPS_OLD.h index 3181d0f7521e..bbcd4f38d33d 100644 --- a/Marlin/src/pins/pins_RAMPS_OLD.h +++ b/Marlin/src/pins/pins_RAMPS_OLD.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -110,6 +110,6 @@ // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_ENABLE_PIN 41 // Pin should have a pullup/pulldown! +#define SPINDLE_LASER_ENA_PIN 41 // Pin should have a pullup/pulldown! #define SPINDLE_LASER_PWM_PIN 45 // MUST BE HARDWARE PWM #define SPINDLE_DIR_PIN 43 diff --git a/Marlin/src/pins/pins_RAMPS_PLUS.h b/Marlin/src/pins/pins_RAMPS_PLUS.h index 3a945353cc8e..795830bd6378 100644 --- a/Marlin/src/pins/pins_RAMPS_PLUS.h +++ b/Marlin/src/pins/pins_RAMPS_PLUS.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 29f31fc630e2..5871b80d153b 100644 --- a/Marlin/src/pins/pins_RAMPS_RE_ARM.h +++ b/Marlin/src/pins/pins_RAMPS_RE_ARM.h @@ -1,7 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -123,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 @@ -174,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 @@ -197,7 +196,11 @@ #define PS_ON_PIN P2_12 // (12) -#if ENABLED(CASE_LIGHT_ENABLE) && !PIN_EXISTS(CASE_LIGHT) && !defined(SPINDLE_LASER_ENABLE_PIN) +#if !defined(MAX6675_SS_PIN) && DISABLED(USE_ZMAX_PLUG) + #define MAX6675_SS_PIN P1_28 +#endif + +#if ENABLED(CASE_LIGHT_ENABLE) && !PIN_EXISTS(CASE_LIGHT) && !defined(SPINDLE_LASER_ENA_PIN) #if !defined(NUM_SERVOS) || NUM_SERVOS < 4 // Try to use servo connector #define CASE_LIGHT_PIN P1_18 // (4) MUST BE HARDWARE PWM #endif @@ -207,11 +210,11 @@ // M3/M4/M5 - Spindle/Laser Control // Use servo pins, if available // -#if ENABLED(SPINDLE_LASER_ENABLE) && !PIN_EXISTS(SPINDLE_LASER_ENABLE) +#if ENABLED(SPINDLE_LASER_ENABLE) && !PIN_EXISTS(SPINDLE_LASER_ENA) #if NUM_SERVOS > 1 #error "SPINDLE_LASER_ENABLE requires 3 free servo pins." #endif - #define SPINDLE_LASER_ENABLE_PIN SERVO1_PIN // (6) Pin should have a pullup/pulldown! + #define SPINDLE_LASER_ENA_PIN SERVO1_PIN // (6) Pin should have a pullup/pulldown! #define SPINDLE_LASER_PWM_PIN SERVO3_PIN // (4) MUST BE HARDWARE PWM #define SPINDLE_DIR_PIN SERVO2_PIN // (5) #endif @@ -266,11 +269,21 @@ #elif ENABLED(ULTRA_LCD) - #define BEEPER_PIN P1_30 // (37) not 5V tolerant + //#define SCK_PIN P0_15 // (52) system defined J3-9 & AUX-3 + //#define MISO_PIN P0_17 // (50) system defined J3-10 & AUX-3 + //#define MOSI_PIN P0_18 // (51) system defined J3-10 & AUX-3 + //#define SS_PIN P1_23 // (53) system defined J3-5 & AUX-3 (Sometimes called SDSS) + + #if ENABLED(FYSETC_MINI_12864) + #define BEEPER_PIN P1_01 + #define BTN_ENC P1_04 + #else + #define BEEPER_PIN P1_30 // (37) not 5V tolerant + #define BTN_ENC P2_11 // (35) J3-3 & AUX-4 + #endif #define BTN_EN1 P3_26 // (31) J3-2 & AUX-4 #define BTN_EN2 P3_25 // (33) J3-4 & AUX-4 - #define BTN_ENC P2_11 // (35) J3-3 & AUX-4 #define SD_DETECT_PIN P1_31 // (49) J3-1 & AUX-3 (NOT 5V tolerant) #define KILL_PIN P1_22 // (41) J5-4 & AUX-4 @@ -290,16 +303,9 @@ //#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 - #define BTN_EN2 P3_25 // (33) J3-4 & AUX-4 - #define BTN_ENC P2_11 // (35) J3-3 & AUX-4 - - #define SD_DETECT_PIN P1_31 // (49) J3-1 & AUX-3 (NOT 5V tolerant) - #define KILL_PIN P1_22 // (41) J5-4 & AUX-4 - #define DOGLCD_CS P0_16 // (16) #define DOGLCD_A0 P2_06 // (59) J3-8 & AUX-2 #define DOGLCD_SCK SCK_PIN @@ -308,8 +314,18 @@ #define STAT_LED_BLUE_PIN P0_26 //(63) may change if cable changes #define STAT_LED_RED_PIN P1_21 // ( 6) may change if cable changes #else - #define DOGLCD_CS P0_26 // (63) J5-3 & AUX-2 - #define DOGLCD_A0 P2_06 // (59) J3-8 & AUX-2 + + #if ENABLED(FYSETC_MINI_12864) + #define DOGLCD_SCK P0_15 + #define DOGLCD_MOSI P0_18 + #define DOGLCD_CS P1_09 // use Ethernet connector for EXP1 cable signals + #define DOGLCD_A0 P1_14 + #define FORCE_SOFT_SPI // required on a Re-ARM system + #else + #define DOGLCD_CS P0_26 // (63) J5-3 & AUX-2 + #define DOGLCD_A0 P2_06 // (59) J3-8 & AUX-2 + #endif + #define LCD_BACKLIGHT_PIN P0_16 //(16) J3-7 & AUX-4 - only used on DOGLCD controllers #define LCD_PINS_ENABLE P0_18 // (51) (MOSI) J3-10 & AUX-3 #define LCD_PINS_D4 P0_15 // (52) (SCK) J3-9 & AUX-3 @@ -320,14 +336,8 @@ #endif #endif - //#define MISO_PIN P0_17 // (50) system defined J3-10 & AUX-3 - //#define MOSI_PIN P0_18 // (51) system defined J3-10 & AUX-3 - //#define SCK_PIN P0_15 // (52) system defined J3-9 & AUX-3 - //#define SS_PIN P1_23 // (53) system defined J3-5 & AUX-3 (Sometimes called SDSS) - #if ENABLED(MINIPANEL) // GLCD features - //#define LCD_CONTRAST 190 // Uncomment screen orientation //#define LCD_SCREEN_ROT_90 //#define LCD_SCREEN_ROT_180 @@ -352,18 +362,21 @@ #define ENET_TXD0 P1_00 // (78) J12-11 #define ENET_TXD1 P1_01 // (79) J12-12 -//#define USB_SD_DISABLED -#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device - -//#define LPC_SD_LCD // Marlin uses the SD drive attached to the LCD -#define LPC_SD_ONBOARD // Marlin uses the SD drive on the control board +// +// SD Support +// +#if !ANY(LPC_SD_LCD, LPC_SD_ONBOARD, LPC_SD_CUSTOM_CABLE) + #undef USB_SD_DISABLED + #define USB_SD_ONBOARD + #define LPC_SD_ONBOARD +#endif #if ENABLED(LPC_SD_LCD) - #define SCK_PIN P0_15 - #define MISO_PIN P0_17 - #define MOSI_PIN P0_18 - #define SS_PIN P1_23 // Chip select for SD card used by Marlin + #define SCK_PIN P0_15 // (52) system defined J3-9 & AUX-3 + #define MISO_PIN P0_17 // (50) system defined J3-10 & AUX-3 + #define MOSI_PIN P0_18 // (51) system defined J3-10 & AUX-3 + #define SS_PIN P1_23 // (53) system defined J3-5 & AUX-3 (Sometimes called SDSS) - CS used by Marlin #define ONBOARD_SD_CS P0_06 // Chip select for "System" SD card #elif ENABLED(LPC_SD_ONBOARD) diff --git a/Marlin/src/pins/pins_RAMPS_SMART.h b/Marlin/src/pins/pins_RAMPS_SMART.h index 851117cad52f..dc4989daca42 100644 --- a/Marlin/src/pins/pins_RAMPS_SMART.h +++ b/Marlin/src/pins/pins_RAMPS_SMART.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_REMRAM_V1.h b/Marlin/src/pins/pins_REMRAM_V1.h index 78c796a7bd82..3a9e25334b24 100644 --- a/Marlin/src/pins/pins_REMRAM_V1.h +++ b/Marlin/src/pins/pins_REMRAM_V1.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_RIGIDBOARD.h b/Marlin/src/pins/pins_RIGIDBOARD.h index 4247ace87cc0..bf778cd3fab0 100644 --- a/Marlin/src/pins/pins_RIGIDBOARD.h +++ b/Marlin/src/pins/pins_RIGIDBOARD.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_RIGIDBOARD_V2.h b/Marlin/src/pins/pins_RIGIDBOARD_V2.h index 2075892ab89a..7458977838d7 100644 --- a/Marlin/src/pins/pins_RIGIDBOARD_V2.h +++ b/Marlin/src/pins/pins_RIGIDBOARD_V2.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_RL200.h b/Marlin/src/pins/pins_RL200.h new file mode 100644 index 000000000000..f42793f35b9a --- /dev/null +++ b/Marlin/src/pins/pins_RL200.h @@ -0,0 +1,55 @@ +/** + * 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 . + * + */ + +/** + * Rapide Lite 200 v1 (RUMBA clone) pin assignments. Has slightly different assignment for + * extruder motors due to dual Z motors. Pinout therefore based on pins_RUMBA.h. + */ + +#define DEFAULT_MACHINE_NAME "Rapide Lite 200" +#define BOARD_NAME "RL200" + +#if HOTENDS > 2 || E_STEPPERS > 2 + #error "RL200v1 supports up to 2 hotends / E-steppers. Comment out this line to continue." +#endif + +#if DISABLED(Z_DUAL_STEPPER_DRIVERS) + #error "RL200 uses dual Z stepper motors. Update Configuration_adv.h or comment out this line to continue." +#endif + +#if !(AXIS_DRIVER_TYPE_X(DRV8825) && AXIS_DRIVER_TYPE_Y(DRV8825) && AXIS_DRIVER_TYPE_Z(DRV8825) && AXIS_DRIVER_TYPE_Z2(DRV8825) && AXIS_DRIVER_TYPE_E0(DRV8825)) + #error "You must set ([XYZ]|Z2|E0)_DRIVER_TYPE to DRV8825 in Configuration.h for RL200." +#endif + +#define E0_STEP_PIN 26 // (RUMBA E1 pins) +#define E0_DIR_PIN 25 +#define E0_ENABLE_PIN 27 + +#define E1_STEP_PIN 29 // (RUMBA E2 pins) +#define E1_DIR_PIN 28 +#define E1_ENABLE_PIN 39 + +#define Z2_STEP_PIN 23 // (RUMBA E0 pins) +#define Z2_DIR_PIN 22 +#define Z2_ENABLE_PIN 24 + +#include "pins_RUMBA.h" diff --git a/Marlin/src/pins/pins_RUMBA.h b/Marlin/src/pins/pins_RUMBA.h index e40f16577926..e0bed70e2287 100644 --- a/Marlin/src/pins/pins_RUMBA.h +++ b/Marlin/src/pins/pins_RUMBA.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -76,17 +76,23 @@ #define Z_DIR_PIN 56 #define Z_ENABLE_PIN 62 -#define E0_STEP_PIN 23 -#define E0_DIR_PIN 22 -#define E0_ENABLE_PIN 24 +#ifndef E0_STEP_PIN + #define E0_STEP_PIN 23 + #define E0_DIR_PIN 22 + #define E0_ENABLE_PIN 24 +#endif -#define E1_STEP_PIN 26 -#define E1_DIR_PIN 25 -#define E1_ENABLE_PIN 27 +#ifndef E1_STEP_PIN + #define E1_STEP_PIN 26 + #define E1_DIR_PIN 25 + #define E1_ENABLE_PIN 27 +#endif -#define E2_STEP_PIN 29 -#define E2_DIR_PIN 28 -#define E2_ENABLE_PIN 39 +#if E1_STEP_PIN != 29 + #define E2_STEP_PIN 29 + #define E2_DIR_PIN 28 + #define E2_ENABLE_PIN 39 +#endif // // Temperature Sensors @@ -140,7 +146,6 @@ // // Misc. Functions // -#define SDSS 53 #define LED_PIN 13 #define PS_ON_PIN 45 #define KILL_PIN 46 @@ -152,8 +157,8 @@ #ifndef SPINDLE_LASER_PWM_PIN #define SPINDLE_LASER_PWM_PIN 4 // MUST BE HARDWARE PWM. Pin 4 interrupts OC0* and OC1* always in use? #endif -#ifndef SPINDLE_LASER_ENABLE_PIN - #define SPINDLE_LASER_ENABLE_PIN 14 // Pin should have a pullup! +#ifndef SPINDLE_LASER_ENA_PIN + #define SPINDLE_LASER_ENA_PIN 14 // Pin should have a pullup! #endif #ifndef SPINDLE_DIR_PIN #define SPINDLE_DIR_PIN 15 @@ -162,14 +167,7 @@ // // LCD / Controller // -#define SD_DETECT_PIN 49 -#define BEEPER_PIN 44 -#define LCD_PINS_D7 40 -#define BTN_EN1 11 -#define BTN_EN2 12 -#define BTN_ENC 43 - -#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 @@ -184,3 +182,22 @@ #define LCD_PINS_D5 38 #define LCD_PINS_D6 41 #endif + +#define LCD_PINS_D7 40 + +// +// Beeper, SD Card, Encoder +// +#define BEEPER_PIN 44 + +#if ENABLED(SDSUPPORT) + #define SDPOWER -1 + #define SDSS 53 + #define SD_DETECT_PIN 49 +#endif + +#if ENABLED(NEWPANEL) + #define BTN_EN1 11 + #define BTN_EN2 12 + #define BTN_ENC 43 +#endif diff --git a/Marlin/src/pins/pins_RUMBA32.h b/Marlin/src/pins/pins_RUMBA32.h new file mode 100644 index 000000000000..eccfc92ffb0e --- /dev/null +++ b/Marlin/src/pins/pins_RUMBA32.h @@ -0,0 +1,132 @@ +/** + * 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 . + * + */ + +#ifndef STM32F4 + #error "Oops! Select an STM32F4 board in 'Tools > Board.'" +#endif + +#define RUMBA32_V1_0 +#define DEFAULT_MACHINE_NAME "RUMBA32" +#define BOARD_NAME "RUMBA32" + +//#define I2C_EEPROM + +#define E2END 0xFFF // EEPROM end address (4kB) + +#if HOTENDS > 3 || E_STEPPERS > 3 + #error "RUMBA32 supports up to 3 hotends / E-steppers." +#endif + +// +// Limit Switches +// +#define X_MIN_PIN PB12 +#define X_MAX_PIN PB13 +#define Y_MIN_PIN PB15 +#define Y_MAX_PIN PD8 +#define Z_MIN_PIN PD9 +#define Z_MAX_PIN PD10 + +// +// Steppers +// +#define X_STEP_PIN PA0 +#define X_DIR_PIN PC15 +#define X_ENABLE_PIN PC11 +#define X_CS_PIN PC14 + +#define Y_STEP_PIN PE5 +#define Y_DIR_PIN PE6 +#define Y_ENABLE_PIN PE3 +#define Y_CS_PIN PE4 + +#define Z_STEP_PIN PE1 +#define Z_DIR_PIN PE2 +#define Z_ENABLE_PIN PB7 +#define Z_CS_PIN PE0 + +#define E0_STEP_PIN PB5 +#define E0_DIR_PIN PB6 +#define E0_ENABLE_PIN PC12 +#define E0_CS_PIN PC13 + +#define E1_STEP_PIN PD6 +#define E1_DIR_PIN PD7 +#define E1_ENABLE_PIN PD4 +#define E1_CS_PIN PD5 + +#define E2_STEP_PIN PD2 +#define E2_DIR_PIN PD3 +#define E2_ENABLE_PIN PD0 +#define E2_CS_PIN PD1 + +// +// Temperature Sensors +// +#define TEMP_0_PIN PC4 +#define TEMP_1_PIN PC3 +#define TEMP_2_PIN PC2 +#define TEMP_3_PIN PC1 +#define TEMP_BED_PIN PC0 + +// +// Heaters / Fans +// +#define HEATER_0_PIN PC6 +#define HEATER_1_PIN PC7 +#define HEATER_2_PIN PC8 +#define HEATER_BED_PIN PA1 + +#define FAN_PIN PC9 +#define FAN1_PIN PA8 + +// +// I2C +// +#define SCK_PIN PA5 +#define MISO_PIN PA6 +#define MOSI_PIN PA7 + +// +// Misc. Functions +// +#define LED_PIN PB14 +#define BTN_PIN PC10 +#define PS_ON_PIN PE11 +#define KILL_PIN PC5 + +#define SDSS PA2 +#define SD_DETECT_PIN PB0 +#define BEEPER_PIN PE8 + +// +// LCD / Controller +// +#define LCD_PINS_RS PE10 +#define LCD_PINS_ENABLE PE9 +#define LCD_PINS_D4 PE12 +#define LCD_PINS_D5 PE13 +#define LCD_PINS_D6 PE14 +#define LCD_PINS_D7 PE15 +#define BTN_EN1 PB1 +#define BTN_EN2 PB2 +#define BTN_ENC PE7 diff --git a/Marlin/src/pins/pins_RUMBA_RAISE3D.h b/Marlin/src/pins/pins_RUMBA_RAISE3D.h index 80d7c76ed755..656ac0705f7f 100644 --- a/Marlin/src/pins/pins_RUMBA_RAISE3D.h +++ b/Marlin/src/pins/pins_RUMBA_RAISE3D.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_RURAMPS4D_11.h b/Marlin/src/pins/pins_RURAMPS4D_11.h index 0785085cc571..718e44651e91 100644 --- a/Marlin/src/pins/pins_RURAMPS4D_11.h +++ b/Marlin/src/pins/pins_RURAMPS4D_11.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -118,11 +118,11 @@ //#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 -#if ENABLED(FILAMENT_RUNOUT_SENSOR) +#if HAS_FILAMENT_SENSOR #ifndef FIL_RUNOUT_PIN #define FIL_RUNOUT_PIN Y_MIN_PIN #endif @@ -202,48 +202,82 @@ // #if ENABLED(ULTRA_LCD) - #if ENABLED(RADDS_DISPLAY) || ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) - + #if ANY(RADDS_DISPLAY, REPRAP_DISCOUNT_SMART_CONTROLLER, REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) #define BEEPER_PIN 62 - - #define LCD_PINS_RS 63 - #define LCD_PINS_ENABLE 64 #define LCD_PINS_D4 48 #define LCD_PINS_D5 50 #define LCD_PINS_D6 52 #define LCD_PINS_D7 53 - #define SD_DETECT_PIN 51 + #endif - #elif ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) + #if EITHER(RADDS_DISPLAY, REPRAP_DISCOUNT_SMART_CONTROLLER) - #define BEEPER_PIN 62 + #define LCD_PINS_RS 63 + #define LCD_PINS_ENABLE 64 + + #elif ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) #define LCD_PINS_RS 52 #define LCD_PINS_ENABLE 53 - #define LCD_PINS_D4 48 - #define LCD_PINS_D5 50 - #define LCD_PINS_D6 52 - #define LCD_PINS_D7 53 - #define SD_DETECT_PIN 51 - - #elif ENABLED(SSD1306_OLED_I2C_CONTROLLER) + #elif HAS_SSD1306_OLED_I2C #define BEEPER_PIN 62 #define LCD_SDSS 10 #define SD_DETECT_PIN 51 + #elif ENABLED(FYSETC_MINI_12864) + + #define BEEPER_PIN 62 + #define DOGLCD_CS 64 + #define DOGLCD_A0 63 + + //#define FORCE_SOFT_SPI // Use this if default of hardware SPI causes problems + + #define LCD_RESET_PIN 48 // Must be high or open for LCD to operate normally. + // Seems to work best if left open. + + #define FYSETC_MINI_12864_REV_1_2 + //#define FYSETC_MINI_12864_REV_2_0 + //#define FYSETC_MINI_12864_REV_2_1 + #if EITHER(FYSETC_MINI_12864_REV_1_2, FYSETC_MINI_12864_REV_2_0) + #define RGB_LED + #ifndef RGB_LED_R_PIN + #define RGB_LED_R_PIN 50 // D5 + #endif + #ifndef RGB_LED_G_PIN + #define RGB_LED_G_PIN 52 // D6 + #endif + #ifndef RGB_LED_B_PIN + #define RGB_LED_B_PIN 53 // D7 + #endif + #elif defined(FYSETC_MINI_12864_REV_2_1) + #define NEOPIXEL_LED + #define NEOPIXEL_TYPE NEO_GRB // NEO_GRBW / NEO_GRB - four/three channel driver type (defined in Adafruit_NeoPixel.h) + #define NEOPIXEL_PIN 50 // LED driving pin on motherboard 4 => D4 (EXP2-5 on Printrboard) / 30 => PC7 (EXP3-13 on Rumba) + #define NEOPIXEL_PIXELS 3 // 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 + #else + #error "Either FYSETC_MINI_12864_REV_1_2, FYSETC_MINI_12864_REV_2_0 or FYSETC_MINI_12864_REV_2_1 must be defined" + #endif + + #if !defined(LED_USER_PRESET_STARTUP) && EITHER(FYSETC_MINI_12864_REV_2_0, FYSETC_MINI_12864_REV_2_1) + #error "LED_USER_PRESET_STARTUP must be enabled when using FYSETC_MINI_12864 REV 2.0 and later" + #endif + #elif ENABLED(SPARK_FULL_GRAPHICS) //http://doku.radds.org/dokumentation/other-electronics/sparklcd/ #error "Oops! SPARK_FULL_GRAPHICS not supported with RURAMPS4D." - //#define LCD_PINS_D4 29//? - //#define LCD_PINS_ENABLE 27//? - //#define LCD_PINS_RS 25//? - //#define BTN_EN1 35//? - //#define BTN_EN2 33//? - //#define BTN_ENC 37//? + //#define LCD_PINS_D4 29 //? + //#define LCD_PINS_ENABLE 27 //? + //#define LCD_PINS_RS 25 //? + //#define BTN_EN1 35 //? + //#define BTN_EN2 33 //? + //#define BTN_ENC 37 //? #endif // SPARK_FULL_GRAPHICS diff --git a/Marlin/src/pins/pins_RURAMPS4D_13.h b/Marlin/src/pins/pins_RURAMPS4D_13.h index 629e61da1f59..ddae87c24509 100644 --- a/Marlin/src/pins/pins_RURAMPS4D_13.h +++ b/Marlin/src/pins/pins_RURAMPS4D_13.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -106,11 +106,11 @@ #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 -#if ENABLED(FILAMENT_RUNOUT_SENSOR) +#if HAS_FILAMENT_SENSOR #ifndef FIL_RUNOUT_PIN #define FIL_RUNOUT_PIN Y_MIN_PIN #endif @@ -161,11 +161,11 @@ // MKS TFT / Nextion Use internal USART-1 #define TFT_LCD_MODULE_COM 1 -#define TFT_LCD_MODULE_BAUDRATE 115600 +#define TFT_LCD_MODULE_BAUDRATE 115200 // ESP WiFi Use internal USART-2 #define ESP_WIFI_MODULE_COM 2 -#define ESP_WIFI_MODULE_BAUDRATE 115600 +#define ESP_WIFI_MODULE_BAUDRATE 115200 #define ESP_WIFI_MODULE_RESET_PIN -1 #define PIGGY_GPIO_PIN -1 @@ -188,38 +188,72 @@ // #if ENABLED(ULTRA_LCD) - #if ENABLED(RADDS_DISPLAY) || ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) - + #if ANY(RADDS_DISPLAY, REPRAP_DISCOUNT_SMART_CONTROLLER, REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) #define BEEPER_PIN 62 - - #define LCD_PINS_RS 63 - #define LCD_PINS_ENABLE 64 #define LCD_PINS_D4 48 #define LCD_PINS_D5 50 #define LCD_PINS_D6 52 #define LCD_PINS_D7 53 - #define SD_DETECT_PIN 51 + #endif - #elif ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) + #if EITHER(RADDS_DISPLAY, REPRAP_DISCOUNT_SMART_CONTROLLER) - #define BEEPER_PIN 62 + #define LCD_PINS_RS 63 + #define LCD_PINS_ENABLE 64 + + #elif ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) #define LCD_PINS_RS 52 #define LCD_PINS_ENABLE 53 - #define LCD_PINS_D4 48 - #define LCD_PINS_D5 50 - #define LCD_PINS_D6 52 - #define LCD_PINS_D7 53 - #define SD_DETECT_PIN 51 - - #elif ENABLED(SSD1306_OLED_I2C_CONTROLLER) + #elif HAS_SSD1306_OLED_I2C #define BEEPER_PIN 62 #define LCD_SDSS 10 #define SD_DETECT_PIN 51 + #elif ENABLED(FYSETC_MINI_12864) + + #define BEEPER_PIN 62 + #define DOGLCD_CS 64 + #define DOGLCD_A0 63 + + //#define FORCE_SOFT_SPI // Use this if default of hardware SPI causes problems + + #define LCD_RESET_PIN 48 // Must be high or open for LCD to operate normally. + // Seems to work best if left open. + + #define FYSETC_MINI_12864_REV_1_2 + //#define FYSETC_MINI_12864_REV_2_0 + //#define FYSETC_MINI_12864_REV_2_1 + #if EITHER(FYSETC_MINI_12864_REV_1_2, FYSETC_MINI_12864_REV_2_0) + #define RGB_LED + #ifndef RGB_LED_R_PIN + #define RGB_LED_R_PIN 50 // D5 + #endif + #ifndef RGB_LED_G_PIN + #define RGB_LED_G_PIN 52 // D6 + #endif + #ifndef RGB_LED_B_PIN + #define RGB_LED_B_PIN 53 // D7 + #endif + #elif defined(FYSETC_MINI_12864_REV_2_1) + #define NEOPIXEL_LED + #define NEOPIXEL_TYPE NEO_GRB // NEO_GRBW / NEO_GRB - four/three channel driver type (defined in Adafruit_NeoPixel.h) + #define NEOPIXEL_PIN 50 // LED driving pin on motherboard 4 => D4 (EXP2-5 on Printrboard) / 30 => PC7 (EXP3-13 on Rumba) + #define NEOPIXEL_PIXELS 3 // 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 + #else + #error "Either FYSETC_MINI_12864_REV_1_2, FYSETC_MINI_12864_REV_2_0 or FYSETC_MINI_12864_REV_2_1 must be defined" + #endif + + #if !defined(LED_USER_PRESET_STARTUP) && EITHER(FYSETC_MINI_12864_REV_2_0, FYSETC_MINI_12864_REV_2_1) + #error "LED_USER_PRESET_STARTUP must be enabled when using FYSETC_MINI_12864 REV 2.0 and later" + #endif + #elif ENABLED(MKS_MINI_12864) #define ORIG_BEEPER_PIN 62 diff --git a/Marlin/src/pins/pins_SAINSMART_2IN1.h b/Marlin/src/pins/pins_SAINSMART_2IN1.h index 53d1a3e95b0e..2c92dfa8b3a8 100644 --- a/Marlin/src/pins/pins_SAINSMART_2IN1.h +++ b/Marlin/src/pins/pins_SAINSMART_2IN1.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_SANGUINOLOLU_11.h b/Marlin/src/pins/pins_SANGUINOLOLU_11.h index 802f79dd9d21..42f624af3940 100644 --- a/Marlin/src/pins/pins_SANGUINOLOLU_11.h +++ b/Marlin/src/pins/pins_SANGUINOLOLU_11.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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,9 +277,9 @@ // 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_ENA_PIN 10 // Pin should have a pullup/pulldown! #define SPINDLE_LASER_PWM_PIN 4 // MUST BE HARDWARE PWM #define SPINDLE_DIR_PIN 11 @@ -308,7 +307,7 @@ * /RESET O| |O 1A * /SLEEP O| |O 1B * SPINDLE_LASER_PWM_PIN STEP O| |O VDD - * SPINDLE_LASER_ENABLE_PIN DIR O| |O GND + * SPINDLE_LASER_ENA_PIN DIR O| |O GND * ------- * * Note: Socket names vary from vendor to vendor. @@ -320,7 +319,7 @@ #define X_ENABLE_PIN 14 #define X_STEP_PIN 1 #define SPINDLE_LASER_PWM_PIN 15 // MUST BE HARDWARE PWM - #define SPINDLE_LASER_ENABLE_PIN 21 // Pin should have a pullup! + #define SPINDLE_LASER_ENA_PIN 21 // Pin should have a pullup! #define SPINDLE_DIR_PIN -1 // No pin available on the socket for the direction pin #endif #endif // SPINDLE_LASER_ENABLE diff --git a/Marlin/src/pins/pins_SANGUINOLOLU_12.h b/Marlin/src/pins/pins_SANGUINOLOLU_12.h index f648dce085df..469a5f368b2d 100644 --- a/Marlin/src/pins/pins_SANGUINOLOLU_12.h +++ b/Marlin/src/pins/pins_SANGUINOLOLU_12.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_SAV_MKI.h b/Marlin/src/pins/pins_SAV_MKI.h index c9039736e5e6..521918b5badf 100644 --- a/Marlin/src/pins/pins_SAV_MKI.h +++ b/Marlin/src/pins/pins_SAV_MKI.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 @@ -176,7 +176,7 @@ // M3/M4/M5 - Spindle/Laser Control // #define SPINDLE_LASER_PWM_PIN 24 // B4 PWM2A - #define SPINDLE_LASER_ENABLE_PIN 39 // F1 Pin should have a pullup! + #define SPINDLE_LASER_ENA_PIN 39 // F1 Pin should have a pullup! #define SPINDLE_DIR_PIN 40 // F2 #define CASE_LIGHT_PIN 0 // D0 PWM0B diff --git a/Marlin/src/pins/pins_SCOOVO_X9H.h b/Marlin/src/pins/pins_SCOOVO_X9H.h index e061aec52e9a..95c1a588547e 100644 --- a/Marlin/src/pins/pins_SCOOVO_X9H.h +++ b/Marlin/src/pins/pins_SCOOVO_X9H.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -33,125 +33,125 @@ // // Servos // -#define SERVO0_PIN 22 // Motor header MX1 -#define SERVO1_PIN 23 // Motor header MX2 -#define SERVO2_PIN 24 // Motor header MX3 -#define SERVO3_PIN 5 // PWM header pin 5 +#define SERVO0_PIN 22 // Motor header MX1 +#define SERVO1_PIN 23 // Motor header MX2 +#define SERVO2_PIN 24 // Motor header MX3 +#define SERVO3_PIN 5 // PWM header pin 5 // // Limit Switches // -#define X_MIN_PIN 12 -#define X_MAX_PIN 24 -#define Y_MIN_PIN 11 -#define Y_MAX_PIN 23 -#define Z_MIN_PIN 10 -#define Z_MAX_PIN 30 +#define X_MIN_PIN 12 +#define X_MAX_PIN 24 +#define Y_MIN_PIN 11 +#define Y_MAX_PIN 23 +#define Z_MIN_PIN 10 +#define Z_MAX_PIN 30 // -// Z Probe (when not Z_MIN_PIN) +// Z Probe (when not Z_MIN_IN) // #ifndef Z_MIN_PROBE_PIN - #define Z_MIN_PROBE_PIN 30 + #define Z_MIN_PROBE_PIN 30 #endif // // Steppers // -#define X_STEP_PIN 37 -#define X_DIR_PIN 48 -#define X_ENABLE_PIN 29 +#define X_STEP_PIN 37 +#define X_DIR_PIN 48 +#define X_ENABLE_PIN 29 -#define Y_STEP_PIN 36 -#define Y_DIR_PIN 49 -#define Y_ENABLE_PIN 28 +#define Y_STEP_PIN 36 +#define Y_DIR_PIN 49 +#define Y_ENABLE_PIN 28 -#define Z_STEP_PIN 35 -#define Z_DIR_PIN 47 -#define Z_ENABLE_PIN 27 +#define Z_STEP_PIN 35 +#define Z_DIR_PIN 47 +#define Z_ENABLE_PIN 27 -#define E0_STEP_PIN 34 -#define E0_DIR_PIN 43 -#define E0_ENABLE_PIN 26 +#define E0_STEP_PIN 34 +#define E0_DIR_PIN 43 +#define E0_ENABLE_PIN 26 -#define E1_STEP_PIN 33 -#define E1_DIR_PIN 42 -#define E1_ENABLE_PIN 25 +#define E1_STEP_PIN 33 +#define E1_DIR_PIN 42 +#define E1_ENABLE_PIN 25 // Microstepping pins - Mapping not from fastio.h (?) -#define X_MS1_PIN 40 -#define X_MS2_PIN 41 -#define Y_MS1_PIN 69 -#define Y_MS2_PIN 39 -#define Z_MS1_PIN 68 -#define Z_MS2_PIN 67 -#define E0_MS1_PIN 65 -#define E0_MS2_PIN 66 -#define E1_MS1_PIN 63 -#define E1_MS2_PIN 64 - -#define DIGIPOTSS_PIN 38 +#define X_MS1_PIN 40 +#define X_MS2_PIN 41 +#define Y_MS1_PIN 69 +#define Y_MS2_PIN 39 +#define Z_MS1_PIN 68 +#define Z_MS2_PIN 67 +#define E0_MS1_PIN 65 +#define E0_MS2_PIN 66 +#define E1_MS1_PIN 63 +#define E1_MS2_PIN 64 + +#define DIGIPOTSS_PIN 38 #define DIGIPOT_CHANNELS {4,5,3,0,1} // X Y Z E0 E1 digipot channels to stepper driver mapping // // Temperature Sensors // -#define TEMP_0_PIN 0 // Analog Input -#define TEMP_BED_PIN 7 // Analog Input +#define TEMP_0_PIN 0 // Analog Input +#define TEMP_BED_PIN 7 // Analog Input // // Heaters / Fans // -#define HEATER_0_PIN 9 -#define HEATER_1_PIN 7 -#define HEATER_BED_PIN 3 +#define HEATER_0_PIN 9 +#define HEATER_1_PIN 7 +#define HEATER_BED_PIN 3 #ifndef FAN_PIN - #define FAN_PIN 8 + #define FAN_PIN 8 #endif -#define FAN1_PIN 6 -#define FAN2_PIN 2 +#define FAN1_PIN 6 +#define FAN2_PIN 2 // // Misc. Functions // -#define SDSS 53 -#define LED_PIN 13 -#define PS_ON_PIN 4 +#define SDSS 53 +#define LED_PIN 13 +#define PS_ON_PIN 4 #ifndef FILWIDTH_PIN - #define FILWIDTH_PIN 3 // Analog Input + #define FILWIDTH_PIN 3 // Analog Input #endif // // LCD / Controller // -#define LCD_PINS_RS 70 // Ext2_5 -#define LCD_PINS_ENABLE 71 // Ext2_7 -#define LCD_PINS_D4 72 // Ext2_9 ? -#define LCD_PINS_D5 73 // Ext2_11 ? -#define LCD_PINS_D6 74 // Ext2_13 -#define LCD_PINS_D7 75 // Ext2_15 ? -#define BEEPER_PIN -1 - -#define BTN_HOME 80 // Ext_16 -#define BTN_CENTER 81 // Ext_14 -#define BTN_ENC BTN_CENTER -#define BTN_RIGHT 82 // Ext_12 -#define BTN_LEFT 83 // Ext_10 -#define BTN_UP 84 // Ext2_8 -#define BTN_DOWN 85 // Ext2_6 - -#define HOME_PIN BTN_HOME - -#if ENABLED(VIKI2) || ENABLED(miniVIKI) - #define BEEPER_PIN 44 +#define LCD_PINS_RS 70 // Ext2_5 +#define LCD_PINS_ENABLE 71 // Ext2_7 +#define LCD_PINS_D4 72 // Ext2_9 ? +#define LCD_PINS_D5 73 // Ext2_11 ? +#define LCD_PINS_D6 74 // Ext2_13 +#define LCD_PINS_D7 75 // Ext2_15 ? +#define BEEPER_PIN -1 + +#define BTN_HOME 80 // Ext_16 +#define BTN_CENTER 81 // Ext_14 +#define BTN_ENC BTN_CENTER +#define BTN_RIGHT 82 // Ext_12 +#define BTN_LEFT 83 // Ext_10 +#define BTN_UP 84 // Ext2_8 +#define BTN_DOWN 85 // Ext2_6 + +#define HOME_PIN BTN_HOME + +#if ANY(VIKI2, miniVIKI) + #define BEEPER_PIN 44 // Pins for DOGM SPI LCD Support - #define DOGLCD_A0 70 - #define DOGLCD_CS 71 + #define DOGLCD_A0 70 + #define DOGLCD_CS 71 #define LCD_SCREEN_ROT_180 - #define SD_DETECT_PIN -1 // Pin 72 if using easy adapter board + #define SD_DETECT_PIN -1 // Pin 72 if using easy adapter board #define STAT_LED_RED_PIN 22 #define STAT_LED_BLUE_PIN 32 diff --git a/Marlin/src/pins/pins_SELENA_COMPACT.h b/Marlin/src/pins/pins_SELENA_COMPACT.h index ce2324c30e2b..01cc164a9e93 100644 --- a/Marlin/src/pins/pins_SELENA_COMPACT.h +++ b/Marlin/src/pins/pins_SELENA_COMPACT.h @@ -1,7 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -29,8 +28,8 @@ #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." #endif -#define BOARD_NAME "Selena Compact" -#define DEFAULT_WEBSITE_URL "https://github.com/Ales2-k/Selena" +#define BOARD_NAME "Selena Compact" +#define BOARD_WEBSITE_URL "https://github.com/Ales2-k/Selena" // // Limit Switches diff --git a/Marlin/src/pins/pins_SETHI.h b/Marlin/src/pins/pins_SETHI.h index 270d1514fe76..4da61d1b5864 100644 --- a/Marlin/src/pins/pins_SETHI.h +++ b/Marlin/src/pins/pins_SETHI.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_SILVER_GATE.h b/Marlin/src/pins/pins_SILVER_GATE.h index 09bd33024cce..62862e53d769 100644 --- a/Marlin/src/pins/pins_SILVER_GATE.h +++ b/Marlin/src/pins/pins_SILVER_GATE.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_SMOOTHIEBOARD.h b/Marlin/src/pins/pins_SMOOTHIEBOARD.h index 7e12ec66f200..d6c4a129ea85 100644 --- a/Marlin/src/pins/pins_SMOOTHIEBOARD.h +++ b/Marlin/src/pins/pins_SMOOTHIEBOARD.h @@ -1,7 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -25,12 +24,12 @@ * Smoothieboard pin assignments */ -#ifndef TARGET_LPC1768 - #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." +#ifndef LPC1769 + #error "Oops! Make sure you have the LPC1769 environment selected in your IDE." #endif -#define BOARD_NAME "Smoothieboard" -#define DEFAULT_WEBSITE_URL "http://smoothieware.org/smoothieboard" +#define BOARD_NAME "Smoothieboard" +#define BOARD_WEBSITE_URL "http://smoothieware.org/smoothieboard" #undef F_CPU #define F_CPU 120000000 @@ -38,40 +37,40 @@ // // Servos // -#define SERVO0_PIN P1_23 +#define SERVO0_PIN P1_23 // // Limit Switches // -#define X_MIN_PIN P1_24 -#define X_MAX_PIN P1_25 -#define Y_MIN_PIN P1_26 -#define Y_MAX_PIN P1_27 -#define Z_MIN_PIN P1_28 -#define Z_MAX_PIN P1_29 +#define X_MIN_PIN P1_24 +#define X_MAX_PIN P1_25 +#define Y_MIN_PIN P1_26 +#define Y_MAX_PIN P1_27 +#define Z_MIN_PIN P1_28 +#define Z_MAX_PIN P1_29 // // Steppers // -#define X_STEP_PIN P2_00 -#define X_DIR_PIN P0_05 -#define X_ENABLE_PIN P0_04 +#define X_STEP_PIN P2_00 +#define X_DIR_PIN P0_05 +#define X_ENABLE_PIN P0_04 -#define Y_STEP_PIN P2_01 -#define Y_DIR_PIN P0_11 -#define Y_ENABLE_PIN P0_10 +#define Y_STEP_PIN P2_01 +#define Y_DIR_PIN P0_11 +#define Y_ENABLE_PIN P0_10 -#define Z_STEP_PIN P2_02 -#define Z_DIR_PIN P0_20 -#define Z_ENABLE_PIN P0_19 +#define Z_STEP_PIN P2_02 +#define Z_DIR_PIN P0_20 +#define Z_ENABLE_PIN P0_19 -#define E0_STEP_PIN P2_03 -#define E0_DIR_PIN P0_22 -#define E0_ENABLE_PIN P0_21 +#define E0_STEP_PIN P2_03 +#define E0_DIR_PIN P0_22 +#define E0_ENABLE_PIN P0_21 -#define E1_STEP_PIN P2_08 -#define E1_DIR_PIN P2_13 -#define E1_ENABLE_PIN P4_29 +#define E1_STEP_PIN P2_08 +#define E1_DIR_PIN P2_13 +#define E1_ENABLE_PIN P4_29 // // Temperature Sensors @@ -85,29 +84,35 @@ // // Heaters / Fans // -#define HEATER_BED_PIN P2_05 -#define HEATER_0_PIN P2_07 -#define HEATER_1_PIN P1_23 +#define HEATER_BED_PIN P2_05 +#define HEATER_0_PIN P2_07 +#define HEATER_1_PIN P1_23 #ifndef FAN_PIN - #define FAN_PIN P2_06 + #define FAN_PIN P2_06 #endif -#define FAN1_PIN P2_04 +#define FAN1_PIN P2_04 // -// Display +// LCD / Controller // -#if ENABLED(VIKI2) || ENABLED(miniVIKI) - #define BEEPER_PIN P1_31 - //#define DOGLCD_A0 P2_06 - #define DOGLCD_CS P0_16 +#if ANY(VIKI2, miniVIKI) - #define BTN_EN1 P3_25 - #define BTN_EN2 P3_26 - #define BTN_ENC P2_11 + #define BEEPER_PIN P1_31 + #define DOGLCD_A0 P2_11 + #define DOGLCD_CS P0_16 - #define SD_DETECT_PIN P1_18 - #define SDSS P1_21 + #define BTN_EN1 P3_25 + #define BTN_EN2 P3_26 + #define BTN_ENC P1_30 + + #define SD_DETECT_PIN P1_18 + #define SDSS P1_21 #define STAT_LED_RED_PIN P1_19 #define STAT_LED_BLUE_PIN P1_20 + +#elif HAS_SPI_LCD + + #error "Marlin's Smoothieboard support cannot drive your LCD." + #endif diff --git a/Marlin/src/pins/pins_STB_11.h b/Marlin/src/pins/pins_STB_11.h index de769fcb6851..49271fb777db 100644 --- a/Marlin/src/pins/pins_STB_11.h +++ b/Marlin/src/pins/pins_STB_11.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_STEVAL.h b/Marlin/src/pins/pins_STEVAL.h new file mode 100644 index 000000000000..45ec2330261c --- /dev/null +++ b/Marlin/src/pins/pins_STEVAL.h @@ -0,0 +1,149 @@ +/** + * 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 . + * + */ + +#ifndef STM32F4 + #error "Oops! Select an STM32F4 board in 'Tools > Board.'" +#endif + +#ifndef MACHINE_NAME + #define MACHINE_NAME "STEVAL-3DP001V1" +#endif + +#undef TEMP_TIMER +#define TEMP_TIMER 9 // the Marlin default of timer 7 doesn't exist on the STM32MF401 series + +// +// Limit Switches +// +#define X_MIN_PIN 38 // PD8 X_STOP +#define X_MAX_PIN -1 +#define Y_MIN_PIN 39 // PD9 Y_STOP +#define Y_MAX_PIN -1 +#define Z_MIN_PIN 40 // PD10 Z_STOP +#define Z_MAX_PIN -1 + +// +// Z Probe (when not Z_MIN_PIN) +// +// #ifndef Z_MIN_PROBE_PIN +// #define Z_MIN_PROBE_PIN 11 // PA4 +// #endif + +#define SCK_PIN 16 // PB13 SPI_S +#define MISO_PIN 17 // PB14 SPI_M +#define MOSI_PIN 18 // PB15 SPI_M + +// +// Steppers +// + +#define X_STEP_PIN 60 // PE14 X_PWM +#define X_DIR_PIN 61 // PE15 X_DIR +#define X_ENABLE_PIN 59 // PE13 X_RES +#define X_CS_PIN 11 // PA4 SPI_CS + +#define Y_STEP_PIN 62 // PB10 Y_PWM +#define Y_DIR_PIN 63 // PE9 Y_DIR +#define Y_ENABLE_PIN 64 // PE10 Y_RES +#define Y_CS_PIN 11 // PA4 SPI_CS + +#define Z_STEP_PIN 66 // PC6 Z_PWM +#define Z_DIR_PIN 67 // PC0 Z_DIR +#define Z_ENABLE_PIN 65 // PC15 Z_RES +#define Z_CS_PIN 11 // PA4 SPI_CS + +#define E0_STEP_PIN 70 // PD12 E1_PW +#define E0_DIR_PIN 68 // PC13 E1_DIR +#define E0_ENABLE_PIN 69 // PC14 E1_RE +#define E0_CS_PIN 11 // PA4 SPI_CS + +#define E1_STEP_PIN 72 // PE5 E2_PWM +#define E1_DIR_PIN 73 // PE6 E2_DIR +#define E1_ENABLE_PIN 71 // PE4 E2_RESE +#define E1_CS_PIN 11 // PA4 SPI_CS + +#define E2_STEP_PIN 76 // PB8 E3_PWM +#define E2_DIR_PIN 74 // PE2 E3_DIR +#define E2_ENABLE_PIN 75 // PE3 E3_RESE +#define E2_CS_PIN 11 // PA4 SPI_CS + + +// +// Temperature Sensors +// +#define TEMP_0_PIN 52 // PA0 E1_THER +#define TEMP_1_PIN 53 // PA1 E2_THER +#define TEMP_BED_PIN 50 // PC2 BED_THE + +// +// Heaters / Fans +// +#define HEATER_0_PIN 52 // PA0 E1_THER +#define HEATER_1_PIN 53 // PA1 E2_THER +#define HEATER_BED_PIN 50 // PC2 BED_THE + +#define FAN_PIN 56 // PC4 E1_FAN PWM pin, Part cooling fan +#define FAN1_PIN 57 // PC5 E2_FAN PWM pin, Extruder fan +#define FAN2_PIN 58 // PE8 E3_FAN PWM pin, Controller fan + +// +// Misc functions +// +#define SDSS 11 // PA4 SPI_CS +#define LED_PIN -1 // Heart beat +#define PS_ON_PIN -1 +#define KILL_PIN -1 +#define PWR_LOSS -1 // Power loss / nAC_FAULT + +// +// LCD / Controller +// +//#define SD_DETECT_PIN 24 // PA15 SD_CA +//#define BEEPER_PIN 23 // PC9 SDIO_D1 +//#define LCD_PINS_RS 63 // PE9 Y_DIR +//#define LCD_PINS_ENABLE 58 // PE8 E3_FAN +//#define LCD_PINS_D4 15 // PB12 SPI_C +//#define LCD_PINS_D5 16 // PB13 SPI_S +//#define LCD_PINS_D6 17 // PB14 SPI_M +//#define LCD_PINS_D7 18 // PB15 SPI_M +//#define BTN_EN1 56 // PC4 E1_FAN +//#define BTN_EN2 57 // PC5 E2_FAN +//#define BTN_ENC 51 // PC3 BED_THE + +// +// Filament runout detection +// +//#define FIL_RUNOUT_PIN 55 // PA3 BED_THE + +// +// Extension pins +// +//#define EXT0_PIN 48 // PB0 E2_HEAT +//#define EXT1_PIN 49 // PB1 E3_HEAT +//#define EXT2_PIN // PB2 +//#define EXT3_PIN 38 // PD8 X_STOP +//#define EXT4_PIN 39 // PD9 Y_STOP +//#define EXT5_PIN 40 // PD10 Z_STOP +//#define EXT6_PIN 41 // PD11 +//#define EXT7_PIN 70 // PD12 E1_PW +//#define EXT8_PIN 62 // PB10 Y_PWM +//#define EXT9_PIN // PB11 diff --git a/Marlin/src/pins/pins_STM32F1R.h b/Marlin/src/pins/pins_STM32F1R.h index 74cfa37f772f..0e124f5c54a5 100644 --- a/Marlin/src/pins/pins_STM32F1R.h +++ b/Marlin/src/pins/pins_STM32F1R.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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_STM32F4.h b/Marlin/src/pins/pins_STM32F4.h index fba82a872167..e11723cd123e 100644 --- a/Marlin/src/pins/pins_STM32F4.h +++ b/Marlin/src/pins/pins_STM32F4.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -132,7 +132,7 @@ //#define NEOPIXEL_PIN PF13 // -// Prusa i3 MK2 Multi Material Multiplexer Support +// Průša i3 MK2 Multi Material Multiplexer Support // //#define E_MUX0_PIN PG3 diff --git a/Marlin/src/pins/pins_STM3R_MINI.h b/Marlin/src/pins/pins_STM3R_MINI.h index 31ce268290a7..bf1a08513964 100644 --- a/Marlin/src/pins/pins_STM3R_MINI.h +++ b/Marlin/src/pins/pins_STM3R_MINI.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -108,7 +108,7 @@ // Laser control #if ENABLED(SPINDLE_LASER_ENABLE) #define SPINDLE_LASER_PWM_PIN PB8 - #define SPINDLE_LASER_ENABLE_PIN PD5 + #define SPINDLE_LASER_ENA_PIN PD5 #endif // @@ -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_TEENSY2.h b/Marlin/src/pins/pins_TEENSY2.h index beb7ca001189..c867769ecc0f 100644 --- a/Marlin/src/pins/pins_TEENSY2.h +++ b/Marlin/src/pins/pins_TEENSY2.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -179,6 +179,6 @@ // // M3/M4/M5 - Spindle/Laser Control // -#define SPINDLE_LASER_ENABLE_PIN 5 // D5 Pin should have a pullup! +#define SPINDLE_LASER_ENA_PIN 5 // D5 Pin should have a pullup! #define SPINDLE_LASER_PWM_PIN 0 // D0 PWM0B MUST BE HARDWARE PWM #define SPINDLE_DIR_PIN 7 // D7 diff --git a/Marlin/src/pins/pins_TEENSY31_32.h b/Marlin/src/pins/pins_TEENSY31_32.h index 7b86e10daa0a..90c8914d7045 100644 --- a/Marlin/src/pins/pins_TEENSY31_32.h +++ b/Marlin/src/pins/pins_TEENSY31_32.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_TEENSY35_36.h b/Marlin/src/pins/pins_TEENSY35_36.h index 9d81d3c0bc42..8a28ceda40ba 100644 --- a/Marlin/src/pins/pins_TEENSY35_36.h +++ b/Marlin/src/pins/pins_TEENSY35_36.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_TEENSYLU.h b/Marlin/src/pins/pins_TEENSYLU.h index 13002607ac5f..87a241116ff1 100755 --- a/Marlin/src/pins/pins_TEENSYLU.h +++ b/Marlin/src/pins/pins_TEENSYLU.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -82,76 +82,76 @@ // // Limit Switch definitions that match the SCHEMATIC // -//#define X_STOP_PIN 25 // B5 -//#define Y_STOP_PIN 26 // B6 -//#define Z_STOP_PIN 27 // B7 -//#define E_STOP_PIN 36 // E4 +//#define X_STOP_PIN 25 // B5 +//#define Y_STOP_PIN 26 // B6 +//#define Z_STOP_PIN 27 // B7 +//#define E_STOP_PIN 36 // E4 // // Limit Switch definitions that match the SILKSCREEN // -#define X_STOP_PIN 26 // B6 -#define Y_STOP_PIN 27 // B7 -#define Z_STOP_PIN 36 // E4 -//#define E_STOP_PIN 25 // B5 +#define X_STOP_PIN 26 // B6 +#define Y_STOP_PIN 27 // B7 +#define Z_STOP_PIN 36 // E4 +//#define E_STOP_PIN 25 // B5 // // Steppers // -#define X_STEP_PIN 28 // A0 -#define X_DIR_PIN 29 // A1 -#define X_ENABLE_PIN 19 // E7 +#define X_STEP_PIN 28 // A0 +#define X_DIR_PIN 29 // A1 +#define X_ENABLE_PIN 19 // E7 -#define Y_STEP_PIN 30 // A2 -#define Y_DIR_PIN 31 // A3 -#define Y_ENABLE_PIN 18 // E6 +#define Y_STEP_PIN 30 // A2 +#define Y_DIR_PIN 31 // A3 +#define Y_ENABLE_PIN 18 // E6 -#define Z_STEP_PIN 32 // A4 -#define Z_DIR_PIN 33 // A5 -#define Z_ENABLE_PIN 17 // C7 +#define Z_STEP_PIN 32 // A4 +#define Z_DIR_PIN 33 // A5 +#define Z_ENABLE_PIN 17 // C7 -#define E0_STEP_PIN 34 // A6 -#define E0_DIR_PIN 35 // A7 -#define E0_ENABLE_PIN 13 // C3 +#define E0_STEP_PIN 34 // A6 +#define E0_DIR_PIN 35 // A7 +#define E0_ENABLE_PIN 13 // C3 // // Temperature Sensors // -#define TEMP_0_PIN 7 // Analog Input (Extruder) -#define TEMP_BED_PIN 6 // Analog Input (Bed) +#define TEMP_0_PIN 7 // Analog Input (Extruder) +#define TEMP_BED_PIN 6 // Analog Input (Bed) // // Heaters / Fans // -#define HEATER_0_PIN 15 // C5 PWM3B - Extruder -#define HEATER_BED_PIN 14 // C4 PWM3C +#define HEATER_0_PIN 15 // C5 PWM3B - Extruder +#define HEATER_BED_PIN 14 // C4 PWM3C #ifndef FAN_PIN - #define FAN_PIN 16 // C6 PWM3A + #define FAN_PIN 16 // C6 PWM3A #endif // // Misc. Functions // -#define SDSS 20 // B0 JP31-6 -#define CASE_LIGHT_PIN 0 // D0 IO-14 PWM0B +#define SDSS 20 // B0 JP31-6 +#define CASE_LIGHT_PIN 0 // D0 IO-14 PWM0B // // LCD / Controller // -#if ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL) +#if BOTH(ULTRA_LCD, NEWPANEL) - #define BEEPER_PIN -1 + #define BEEPER_PIN -1 #if ENABLED(LCD_I2C_PANELOLU2) - #define BTN_EN1 3 // D3 IO-8 - #define BTN_EN2 2 // D2 IO-10 - #define BTN_ENC 41 // F3 IO-7 - #define SDSS 38 // F0 IO-13 use SD card on Panelolu2 + #define BTN_EN1 3 // D3 IO-8 + #define BTN_EN2 2 // D2 IO-10 + #define BTN_ENC 41 // F3 IO-7 + #define SDSS 38 // F0 IO-13 use SD card on Panelolu2 #endif - #define SD_DETECT_PIN -1 + #define SD_DETECT_PIN -1 #endif // ULTRA_LCD && NEWPANEL @@ -159,5 +159,5 @@ // M3/M4/M5 - Spindle/Laser Control // #define SPINDLE_LASER_PWM_PIN 24 // B4 IO-3 PWM2A - MUST BE HARDWARE PWM -#define SPINDLE_LASER_ENABLE_PIN 39 // F1 IO-11 - Pin should have a pullup! +#define SPINDLE_LASER_ENA_PIN 39 // F1 IO-11 - Pin should have a pullup! #define SPINDLE_DIR_PIN 40 // F2 IO-9 diff --git a/Marlin/src/pins/pins_THE_BORG.h b/Marlin/src/pins/pins_THE_BORG.h index e75f13b42d7c..5b8c71857617 100644 --- a/Marlin/src/pins/pins_THE_BORG.h +++ b/Marlin/src/pins/pins_THE_BORG.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -142,7 +142,7 @@ //#define NEOPIXEL_PIN PF13 // -// Prusa i3 MK2 Multi Material Multiplexer Support +// Průša i3 MK2 Multi Material Multiplexer Support // #define E_MUX0_PIN PG3 diff --git a/Marlin/src/pins/pins_TRIGORILLA_13.h b/Marlin/src/pins/pins_TRIGORILLA_13.h index ee0687439e52..29e31a3e3163 100644 --- a/Marlin/src/pins/pins_TRIGORILLA_13.h +++ b/Marlin/src/pins/pins_TRIGORILLA_13.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/pins/pins_TRIGORILLA_14.h b/Marlin/src/pins/pins_TRIGORILLA_14.h index 5e9b58be7d9e..7d231b32da5b 100644 --- a/Marlin/src/pins/pins_TRIGORILLA_14.h +++ b/Marlin/src/pins/pins_TRIGORILLA_14.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 000000000000..91fabb329ba9 --- /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_ULTIMAIN_2.h b/Marlin/src/pins/pins_ULTIMAIN_2.h index 8516781cf226..821494d129ec 100644 --- a/Marlin/src/pins/pins_ULTIMAIN_2.h +++ b/Marlin/src/pins/pins_ULTIMAIN_2.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -97,6 +97,8 @@ #define FAN_PIN 7 #endif +#define ORIG_E0_AUTO_FAN_PIN 77 + // // Misc. Functions // @@ -129,7 +131,7 @@ #if ENABLED(SPINDLE_LASER_ENABLE) // use the LED_PIN for spindle speed control or case light #undef LED_PIN #define SPINDLE_DIR_PIN 16 - #define SPINDLE_LASER_ENABLE_PIN 17 // Pin should have a pullup! + #define SPINDLE_LASER_ENA_PIN 17 // Pin should have a pullup! #define SPINDLE_LASER_PWM_PIN 8 // MUST BE HARDWARE PWM #else #undef LED_PIN diff --git a/Marlin/src/pins/pins_ULTIMAKER.h b/Marlin/src/pins/pins_ULTIMAKER.h index 63c953587af6..ca177f2ac096 100644 --- a/Marlin/src/pins/pins_ULTIMAKER.h +++ b/Marlin/src/pins/pins_ULTIMAKER.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -160,5 +160,5 @@ // M3/M4/M5 - Spindle/Laser Control // #define SPINDLE_LASER_PWM_PIN 9 // MUST BE HARDWARE PWM -#define SPINDLE_LASER_ENABLE_PIN 10 // Pin should have a pullup! +#define SPINDLE_LASER_ENA_PIN 10 // Pin should have a pullup! #define SPINDLE_DIR_PIN 11 // use the EXP3 PWM header diff --git a/Marlin/src/pins/pins_ULTIMAKER_OLD.h b/Marlin/src/pins/pins_ULTIMAKER_OLD.h index 7b546661bf6f..3b6a2dc067a6 100644 --- a/Marlin/src/pins/pins_ULTIMAKER_OLD.h +++ b/Marlin/src/pins/pins_ULTIMAKER_OLD.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 @@ -220,13 +221,13 @@ #define SPINDLE_DIR_PIN 10 // SW4 #define SPINDLE_LASER_PWM_PIN 9 // SW5 MUST BE HARDWARE PWM - #define SPINDLE_LASER_ENABLE_PIN 8 // SW6 Pin should have a pullup! + #define SPINDLE_LASER_ENA_PIN 8 // SW6 Pin should have a pullup! #elif ENABLED(board_rev_1_5) // use the same pins - but now they are on a different connector #define SPINDLE_DIR_PIN 10 // EXP3-6 (silkscreen says 10) #define SPINDLE_LASER_PWM_PIN 9 // EXP3-7 (silkscreen says 9) MUST BE HARDWARE PWM - #define SPINDLE_LASER_ENABLE_PIN 8 // EXP3-8 (silkscreen says 8) Pin should have a pullup! + #define SPINDLE_LASER_ENA_PIN 8 // EXP3-8 (silkscreen says 8) Pin should have a pullup! #elif ENABLED(board_rev_1_1_TO_1_3) @@ -250,12 +251,12 @@ #define E0_ENABLE_PIN 48 #define SPINDLE_DIR_PIN 43 #define SPINDLE_LASER_PWM_PIN 45 // MUST BE HARDWARE PWM - #define SPINDLE_LASER_ENABLE_PIN 41 // Pin should have a pullup! + #define SPINDLE_LASER_ENA_PIN 41 // Pin should have a pullup! #elif TEMP_SENSOR_BED == 0 // Can't use E0 so see if HEATER_BED_PIN is available #undef HEATER_BED_PIN #define SPINDLE_DIR_PIN 38 // Probably pin 4 on 10 pin connector closest to the E0 socket #define SPINDLE_LASER_PWM_PIN 4 // MUST BE HARDWARE PWM - Special precautions usually needed. - #define SPINDLE_LASER_ENABLE_PIN 40 // Pin should have a pullup! (Probably pin 6 on the 10-pin + #define SPINDLE_LASER_ENA_PIN 40 // Pin should have a pullup! (Probably pin 6 on the 10-pin // connector closest to the E0 socket) #endif #endif @@ -266,7 +267,7 @@ * * spindle signal socket name socket name * ------- - * SPINDLE_LASER_ENABLE_PIN /ENABLE *| |O VMOT + * SPINDLE_LASER_ENA_PIN /ENABLE *| |O VMOT * MS1 O| |O GND * MS2 O| |O 2B * MS3 O| |O 2A diff --git a/Marlin/src/pins/pins_ULTRATRONICS_PRO.h b/Marlin/src/pins/pins_ULTRATRONICS_PRO.h index 699d472586c7..68603866fe07 100644 --- a/Marlin/src/pins/pins_ULTRATRONICS_PRO.h +++ b/Marlin/src/pins/pins_ULTRATRONICS_PRO.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -56,30 +56,51 @@ #define X_STEP_PIN 35 #define X_DIR_PIN 34 #define X_ENABLE_PIN 37 +#ifndef X_CS_PIN + #define X_CS_PIN 18 +#endif #define Y_STEP_PIN 22 #define Y_DIR_PIN 23 #define Y_ENABLE_PIN 33 +#ifndef Y_CS_PIN + #define Y_CS_PIN 19 +#endif #define Z_STEP_PIN 25 #define Z_DIR_PIN 26 #define Z_ENABLE_PIN 24 +#ifndef Z_CS_PIN + #define Z_CS_PIN 16 +#endif #define E0_STEP_PIN 47 #define E0_DIR_PIN 46 #define E0_ENABLE_PIN 48 +#ifndef E0_CS_PIN + #define E0_CS_PIN 17 +#endif #define E1_STEP_PIN 44 #define E1_DIR_PIN 36 #define E1_ENABLE_PIN 45 +#ifndef E1_CS_PIN + #define E1_CS_PIN -1 +#endif #define E2_STEP_PIN 42 #define E2_DIR_PIN 41 #define E2_ENABLE_PIN 43 +#ifndef E2_CS_PIN + #define E2_CS_PIN -1 +#endif #define E3_STEP_PIN 39 #define E3_DIR_PIN 38 #define E3_ENABLE_PIN 40 +#ifndef E3_CS_PIN + #define E3_CS_PIN -1 +#endif // // Temperature Sensors diff --git a/Marlin/src/pins/pins_VORON.h b/Marlin/src/pins/pins_VORON.h new file mode 100644 index 000000000000..d5a581025432 --- /dev/null +++ b/Marlin/src/pins/pins_VORON.h @@ -0,0 +1,46 @@ +/** + * 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 . + * + */ + +/** + * VORON Design v2 pin assignments + * See https://github.com/mzbotreprap/VORON/blob/master/Firmware/Marlin/pins_RAMPS_VORON.h + */ + +#define BOARD_NAME "VORON Design v2" + +#define RAMPS_D8_PIN 11 + +#include "pins_RAMPS.h" + +// +// Heaters / Fans +// +#undef FAN_PIN +#define FAN_PIN 5 // Using the pin for the controller fan since controller fan is always on. +#define CONTROLLER_FAN_PIN 8 +#define ORIG_E0_AUTO_FAN_PIN 6 // Servo pin 6 for E3D Fan +#define ORIG_E1_AUTO_FAN_PIN 6 // Servo pin 6 for E3D Fan (same pin for both extruders since it's the same fan) + +// +// LCDs and Controllers +// +#undef BEEPER_PIN diff --git a/Marlin/src/pins/pins_ZRIB_V20.h b/Marlin/src/pins/pins_ZRIB_V20.h index 94a083dd4021..83b614501e79 100644 --- a/Marlin/src/pins/pins_ZRIB_V20.h +++ b/Marlin/src/pins/pins_ZRIB_V20.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -21,19 +21,48 @@ */ /** - * ZRIB V2.0 pin assignments + * ZRIB V2.0 & V3.0 pin assignments + * V2 and V3 Boards only differ in USB controller, nothing affecting the pins. */ -#define ZRIB_V20_D6_PIN 6 -#define ZRIB_V20_D9_PIN 9 -#define RAMPS_D9_PIN ZRIB_V20_D6_PIN -#define ORIG_E0_AUTO_FAN_PIN ZRIB_V20_D9_PIN -#define ORIG_E1_AUTO_FAN_PIN ZRIB_V20_D9_PIN -#define ORIG_E2_AUTO_FAN_PIN ZRIB_V20_D9_PIN -#define ORIG_E3_AUTO_FAN_PIN ZRIB_V20_D9_PIN +#include "pins_MKS_GEN_13.h" + +#define ZRIB_V20_D6_PIN 6 // Fan +#define ZRIB_V20_D9_PIN 9 // Fan2 +#define ZRIB_V20_A10_PIN 10 +#define ZRIB_V20_D16_PIN 16 +#define ZRIB_V20_D17_PIN 17 +#define ZRIB_V20_D23_PIN 23 +#define ZRIB_V20_D25_PIN 25 +#define ZRIB_V20_D27_PIN 27 +#define ZRIB_V20_D29_PIN 29 +#define ZRIB_V20_D37_PIN 37 + +#define ORIG_E0_AUTO_FAN_PIN ZRIB_V20_D6_PIN +#define ORIG_E1_AUTO_FAN_PIN ZRIB_V20_D6_PIN +#define ORIG_E2_AUTO_FAN_PIN ZRIB_V20_D6_PIN +#define ORIG_E3_AUTO_FAN_PIN ZRIB_V20_D6_PIN #ifndef FILWIDTH_PIN - #define FILWIDTH_PIN 11 // Analog Input + #define FILWIDTH_PIN 11 // Analog Input #endif -#include "pins_MKS_GEN_13.h" +#if ENABLED(ZONESTAR_LCD) + #undef LCD_PINS_RS + #undef LCD_PINS_ENABLE + #undef LCD_PINS_D4 + #undef LCD_PINS_D5 + #undef LCD_PINS_D6 + #undef LCD_PINS_D7 + #undef ADC_KEYPAD_PIN + #undef BEEPER_PIN + + #define LCD_PINS_RS ZRIB_V20_D16_PIN + #define LCD_PINS_ENABLE ZRIB_V20_D17_PIN + #define LCD_PINS_D4 ZRIB_V20_D23_PIN + #define LCD_PINS_D5 ZRIB_V20_D25_PIN + #define LCD_PINS_D6 ZRIB_V20_D27_PIN + #define LCD_PINS_D7 ZRIB_V20_D29_PIN + #define ADC_KEYPAD_PIN ZRIB_V20_A10_PIN + #define BEEPER_PIN ZRIB_V20_D37_PIN +#endif diff --git a/Marlin/src/pins/sensitive_pins.h b/Marlin/src/pins/sensitive_pins.h index 8b885bb0b611..e23960c8ad6c 100644 --- a/Marlin/src/pins/sensitive_pins.h +++ b/Marlin/src/pins/sensitive_pins.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -35,7 +35,7 @@ #else #define _X_MAX #endif -#if PIN_EXISTS(X_CS) +#if PIN_EXISTS(X_CS) && AXIS_HAS_SPI(X) #define _X_CS X_CS_PIN, #else #define _X_CS @@ -68,7 +68,7 @@ #else #define _Y_MAX #endif -#if PIN_EXISTS(Y_CS) +#if PIN_EXISTS(Y_CS) && AXIS_HAS_SPI(Y) #define _Y_CS Y_CS_PIN, #else #define _Y_CS @@ -101,7 +101,7 @@ #else #define _Z_MAX #endif -#if PIN_EXISTS(Z_CS) +#if PIN_EXISTS(Z_CS) && AXIS_HAS_SPI(Z) #define _Z_CS Z_CS_PIN, #else #define _Z_CS @@ -131,27 +131,30 @@ // 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) -#if PIN_EXISTS(E0_CS) - #define _E0_CS E0_CS_PIN, -#else - #define _E0_CS -#endif -#if PIN_EXISTS(E0_MS1) - #define _E0_MS1 E0_MS1_PIN, -#else - #define _E0_MS1 -#endif -#if PIN_EXISTS(E0_MS2) - #define _E0_MS2 E0_MS2_PIN, -#else - #define _E0_MS2 -#endif -#if PIN_EXISTS(E0_MS3) - #define _E0_MS3 E0_MS3_PIN, -#else - #define _E0_MS3 +#define _E0_CS +#define _E0_MS1 +#define _E0_MS2 +#define _E0_MS3 + +#if E_NEEDED(0) + #if PIN_EXISTS(E0_CS) && AXIS_HAS_SPI(E0) + #undef _E0_CS + #define _E0_CS E0_CS_PIN, + #endif + #if PIN_EXISTS(E0_MS1) + #undef _E0_MS1 + #define _E0_MS1 E0_MS1_PIN, + #endif + #if PIN_EXISTS(E0_MS2) + #undef _E0_MS2 + #define _E0_MS2 E0_MS2_PIN, + #endif + #if PIN_EXISTS(E0_MS3) + #undef _E0_MS3 + #define _E0_MS3 E0_MS3_PIN, + #endif #endif #define _E1_CS @@ -160,7 +163,7 @@ #define _E1_MS3 #if E_NEEDED(1) - #if PIN_EXISTS(E1_CS) + #if PIN_EXISTS(E1_CS) && AXIS_HAS_SPI(E1) #undef _E1_CS #define _E1_CS E1_CS_PIN, #endif @@ -184,7 +187,7 @@ #define _E2_MS3 #if E_NEEDED(2) - #if PIN_EXISTS(E2_CS) + #if PIN_EXISTS(E2_CS) && AXIS_HAS_SPI(E2) #undef _E2_CS #define _E2_CS E2_CS_PIN, #endif @@ -208,7 +211,7 @@ #define _E3_MS3 #if E_NEEDED(3) - #if PIN_EXISTS(E3_CS) + #if PIN_EXISTS(E3_CS) && AXIS_HAS_SPI(E3) #undef _E3_CS #define _E3_CS E3_CS_PIN, #endif @@ -232,7 +235,7 @@ #define _E4_MS3 #if E_NEEDED(4) - #if PIN_EXISTS(E4_CS) + #if PIN_EXISTS(E4_CS) && AXIS_HAS_SPI(E4) #undef _E4_CS #define _E4_CS E4_CS_PIN, #endif @@ -256,7 +259,7 @@ #define _E5_MS3 #if E_NEEDED(5) - #if PIN_EXISTS(E5_CS) + #if PIN_EXISTS(E5_CS) && AXIS_HAS_SPI(E5) #undef _E5_CS #define _E5_CS E5_CS_PIN, #endif @@ -278,13 +281,18 @@ // E Steppers // -#define _E0_PINS E0_STEP_PIN, E0_DIR_PIN, E0_ENABLE_PIN, _E0_CS _E0_MS1 _E0_MS2 _E0_MS3 +#define _E0_PINS #define _E1_PINS #define _E2_PINS #define _E3_PINS #define _E4_PINS #define _E5_PINS +#if EXTRUDERS + #undef _E0_PINS + #define _E0_PINS E0_STEP_PIN, E0_DIR_PIN, E0_ENABLE_PIN, _E0_CS _E0_MS1 _E0_MS2 _E0_MS3 +#endif + #if ENABLED(SWITCHING_EXTRUDER) // Tools 0 and 1 use E0 #if EXTRUDERS > 2 // Tools 2 and 3 use E1 @@ -320,33 +328,37 @@ // Heaters, Fans, Temp Sensors // -#define _H0_PINS HEATER_0_PIN, E0_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_0_PIN), +#define _H0_PINS #define _H1_PINS #define _H2_PINS #define _H3_PINS #define _H4_PINS #define _H5_PINS -#if HOTENDS > 1 - #undef _H1_PINS - #define _H1_PINS HEATER_1_PIN, E1_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_1_PIN), - #if HOTENDS > 2 - #undef _H2_PINS - #define _H2_PINS HEATER_2_PIN, E2_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_2_PIN), - #if HOTENDS > 3 - #undef _H3_PINS - #define _H3_PINS HEATER_3_PIN, E3_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_3_PIN), - #if HOTENDS > 4 - #undef _H4_PINS - #define _H4_PINS HEATER_4_PIN, E4_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_4_PIN), - #if HOTENDS > 5 - #undef _H5_PINS - #define _H5_PINS HEATER_5_PIN, E5_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_5_PIN), - #endif // HOTENDS > 5 - #endif // HOTENDS > 4 - #endif // HOTENDS > 3 - #endif // HOTENDS > 2 -#endif // HOTENDS > 1 +#if HOTENDS + #undef _H0_PINS + #define _H0_PINS HEATER_0_PIN, E0_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_0_PIN), + #if HOTENDS > 1 + #undef _H1_PINS + #define _H1_PINS HEATER_1_PIN, E1_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_1_PIN), + #if HOTENDS > 2 + #undef _H2_PINS + #define _H2_PINS HEATER_2_PIN, E2_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_2_PIN), + #if HOTENDS > 3 + #undef _H3_PINS + #define _H3_PINS HEATER_3_PIN, E3_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_3_PIN), + #if HOTENDS > 4 + #undef _H4_PINS + #define _H4_PINS HEATER_4_PIN, E4_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_4_PIN), + #if HOTENDS > 5 + #undef _H5_PINS + #define _H5_PINS HEATER_5_PIN, E5_AUTO_FAN_PIN, analogInputToDigitalPin(TEMP_5_PIN), + #endif // HOTENDS > 5 + #endif // HOTENDS > 4 + #endif // HOTENDS > 3 + #endif // HOTENDS > 2 + #endif // HOTENDS > 1 +#endif // HOTENDS #define _BED_PINS HEATER_BED_PIN, analogInputToDigitalPin(TEMP_BED_PIN), @@ -355,8 +367,8 @@ // Chip Select and Digital Micro-stepping // -#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(X_DUAL_STEPPER_DRIVERS) - #if PIN_EXISTS(X2_CS) +#if EITHER(DUAL_X_CARRIAGE, X_DUAL_STEPPER_DRIVERS) + #if PIN_EXISTS(X2_CS) && AXIS_HAS_SPI(X2) #define _X2_CS X2_CS_PIN, #else #define _X2_CS @@ -382,7 +394,7 @@ #endif #if ENABLED(Y_DUAL_STEPPER_DRIVERS) - #if PIN_EXISTS(Y2_CS) + #if PIN_EXISTS(Y2_CS) && AXIS_HAS_SPI(Y2) #define _Y2_CS Y2_CS_PIN, #else #define _Y2_CS @@ -408,7 +420,7 @@ #endif #if Z_MULTI_STEPPER_DRIVERS - #if PIN_EXISTS(Z2_CS) + #if PIN_EXISTS(Z2_CS) && AXIS_HAS_SPI(Z2) #define _Z2_CS Z2_CS_PIN, #else #define _Z2_CS @@ -434,7 +446,7 @@ #endif #if ENABLED(Z_TRIPLE_STEPPER_DRIVERS) - #if PIN_EXISTS(Z3_CS) + #if PIN_EXISTS(Z3_CS) && AXIS_HAS_SPI(Z3) #define _Z3_CS Z3_CS_PIN, #else #define _Z3_CS diff --git a/Marlin/src/sd/Sd2Card.cpp b/Marlin/src/sd/Sd2Card.cpp index d1116cdb3564..0abc8142a057 100644 --- a/Marlin/src/sd/Sd2Card.cpp +++ b/Marlin/src/sd/Sd2Card.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -30,7 +30,7 @@ #include "../inc/MarlinConfig.h" -#if ENABLED(SDSUPPORT) && DISABLED(USB_FLASH_DRIVE_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 */ @@ -65,7 +65,7 @@ static uint8_t CRC7(const uint8_t* data, uint8_t n) { uint8_t crc = 0; - while ( n > 0 ) { + while (n > 0) { crc = pgm_read_byte(&crctab7[ (crc << 1) ^ *data++ ]); n--; } @@ -87,44 +87,42 @@ #endif #endif -// send command and return error code. Return zero for OK -uint8_t Sd2Card::cardCommand(uint8_t cmd, uint32_t arg) { - // select card +// Send command and return error code. Return zero for OK +uint8_t Sd2Card::cardCommand(const uint8_t cmd, const uint32_t arg) { + // Select card chipSelect(); - // wait up to 300 ms if busy - waitNotBusy( SD_WRITE_TIMEOUT ); + // Wait up to 300 ms if busy + waitNotBusy(SD_WRITE_TIMEOUT); uint8_t *pa = (uint8_t *)(&arg); -#if ENABLED(SD_CHECK_AND_RETRY) + #if ENABLED(SD_CHECK_AND_RETRY) - // form message - uint8_t d[6] = {(uint8_t) (cmd | 0x40), pa[3], pa[2], pa[1], pa[0] }; + // Form message + uint8_t d[6] = {(uint8_t) (cmd | 0x40), pa[3], pa[2], pa[1], pa[0] }; - // add crc - d[5] = CRC7(d, 5); + // Add crc + d[5] = CRC7(d, 5); - // send message - for (uint8_t k = 0; k < 6; k++ ) - spiSend( d[k] ); + // Send message + for (uint8_t k = 0; k < 6; k++) spiSend(d[k]); -#else - // send command - spiSend(cmd | 0x40); + #else + // Send command + spiSend(cmd | 0x40); - // send argument - for( int8_t i = 3; i >= 0; i-- ) - spiSend( pa[i] ); + // Send argument + for (int8_t i = 3; i >= 0; i--) spiSend(pa[i]); - // send CRC - correct for CMD0 with arg zero or CMD8 with arg 0X1AA - spiSend( cmd == CMD0 ? 0X95 : 0X87 ); -#endif + // Send CRC - correct for CMD0 with arg zero or CMD8 with arg 0X1AA + spiSend(cmd == CMD0 ? 0X95 : 0X87); + #endif - // skip stuff byte for stop read + // Skip stuff byte for stop read if (cmd == CMD12) spiRec(); - // wait for response + // Wait for response for (uint8_t i = 0; ((status_ = spiRec()) & 0x80) && i != 0xFF; i++) { /* Intentionally left empty */ } return status_; } @@ -158,15 +156,13 @@ uint32_t Sd2Card::cardSize() { } void Sd2Card::chipDeselect() { - digitalWrite(chipSelectPin_, HIGH); - - // insure MISO goes high impedance - spiSend( 0xFF ); + extDigitalWrite(chipSelectPin_, HIGH); + spiSend(0xFF); // Ensure MISO goes high impedance } void Sd2Card::chipSelect() { spiInit(spiRate_); - digitalWrite(chipSelectPin_, LOW); + extDigitalWrite(chipSelectPin_, LOW); } /** @@ -195,13 +191,8 @@ bool Sd2Card::erase(uint32_t firstBlock, uint32_t lastBlock) { goto FAIL; } } - if (type_ != SD_CARD_TYPE_SDHC) { - firstBlock <<= 9; - lastBlock <<= 9; - } - if (cardCommand(CMD32, firstBlock) - || cardCommand(CMD33, lastBlock) - || cardCommand(CMD38, 0)) { + if (type_ != SD_CARD_TYPE_SDHC) { firstBlock <<= 9; lastBlock <<= 9; } + if (cardCommand(CMD32, firstBlock) || cardCommand(CMD33, lastBlock) || cardCommand(CMD38, 0)) { error(SD_CARD_ERROR_ERASE); goto FAIL; } @@ -236,7 +227,7 @@ bool Sd2Card::eraseSingleBlockEnable() { * \return true for success, false for failure. * The reason for failure can be determined by calling errorCode() and errorData(). */ -bool Sd2Card::init(uint8_t sckRateID, pin_t chipSelectPin) { +bool Sd2Card::init(const uint8_t sckRateID/*=0*/, const pin_t chipSelectPin/*=SD_CHIP_SELECT_PIN*/) { errorCode_ = type_ = 0; chipSelectPin_ = chipSelectPin; // 16-bit init start time allows over a minute @@ -250,8 +241,8 @@ bool Sd2Card::init(uint8_t sckRateID, pin_t chipSelectPin) { #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 @@ -308,23 +299,23 @@ bool Sd2Card::init(uint8_t sckRateID, pin_t chipSelectPin) { watchdog_reset(); #endif - // initialize card and send host supports SDHC if SD2 + // Initialize card and send host supports SDHC if SD2 arg = type() == SD_CARD_TYPE_SD2 ? 0x40000000 : 0; while ((status_ = cardAcmd(ACMD41, arg)) != R1_READY_STATE) { - // check for timeout + // Check for timeout if (ELAPSED(millis(), init_timeout)) { error(SD_CARD_ERROR_ACMD41); goto FAIL; } } - // if SD2 read OCR register to check for SDHC card + // If SD2 read OCR register to check for SDHC card if (type() == SD_CARD_TYPE_SD2) { if (cardCommand(CMD58, 0)) { error(SD_CARD_ERROR_CMD58); goto FAIL; } if ((spiRec() & 0xC0) == 0xC0) type(SD_CARD_TYPE_SDHC); - // discard rest of ocr - contains allowed voltage range + // Discard rest of ocr - contains allowed voltage range for (uint8_t i = 0; i < 3; i++) spiRec(); } chipDeselect(); @@ -344,12 +335,11 @@ bool Sd2Card::init(uint8_t sckRateID, pin_t chipSelectPin) { * \return true for success, false for failure. */ bool Sd2Card::readBlock(uint32_t blockNumber, uint8_t* dst) { - // use address if not SDHC card - if (type() != SD_CARD_TYPE_SDHC) blockNumber <<= 9; + if (type() != SD_CARD_TYPE_SDHC) blockNumber <<= 9; // Use address if not SDHC card #if ENABLED(SD_CHECK_AND_RETRY) uint8_t retryCnt = 3; - for(;;) { + for (;;) { if (cardCommand(CMD17, blockNumber)) error(SD_CARD_ERROR_CMD17); else if (readData(dst, 512)) @@ -447,44 +437,39 @@ bool Sd2Card::readData(uint8_t* dst) { #endif #endif // SD_CHECK_AND_RETRY -bool Sd2Card::readData(uint8_t* dst, uint16_t count) { - // wait for start block token +bool Sd2Card::readData(uint8_t* dst, const uint16_t count) { + bool success = false; + const millis_t read_timeout = millis() + SD_READ_TIMEOUT; - while ((status_ = spiRec()) == 0xFF) { + while ((status_ = spiRec()) == 0xFF) { // Wait for start block token if (ELAPSED(millis(), read_timeout)) { error(SD_CARD_ERROR_READ_TIMEOUT); goto FAIL; } } - if (status_ != DATA_START_BLOCK) { - error(SD_CARD_ERROR_READ); - goto FAIL; - } - // transfer data - spiRead(dst, count); -#if ENABLED(SD_CHECK_AND_RETRY) - { - uint16_t recvCrc = (spiRec() << 8) | spiRec(); - if (crcSupported && recvCrc != CRC_CCITT(dst, count)) { - error(SD_CARD_ERROR_READ_CRC); - goto FAIL; - } + if (status_ == DATA_START_BLOCK) { + spiRead(dst, count); // Transfer data + + const uint16_t recvCrc = (spiRec() << 8) | spiRec(); + #if ENABLED(SD_CHECK_AND_RETRY) + success = !crcSupported || recvCrc == CRC_CCITT(dst, count); + if (!success) error(SD_CARD_ERROR_READ_CRC); + #else + success = true; + UNUSED(recvCrc); + #endif } -#else - // discard CRC - spiRec(); - spiRec(); -#endif - chipDeselect(); - return true; + else + error(SD_CARD_ERROR_READ); + FAIL: chipDeselect(); - return false; + return success; } /** read CID or CSR register */ -bool Sd2Card::readRegister(uint8_t cmd, void* buf) { +bool Sd2Card::readRegister(const uint8_t cmd, void* buf) { uint8_t* dst = reinterpret_cast(buf); if (cardCommand(cmd, 0)) { error(SD_CARD_ERROR_READ_REG); @@ -506,13 +491,11 @@ bool Sd2Card::readRegister(uint8_t cmd, void* buf) { */ bool Sd2Card::readStart(uint32_t blockNumber) { if (type() != SD_CARD_TYPE_SDHC) blockNumber <<= 9; - if (cardCommand(CMD18, blockNumber)) { - error(SD_CARD_ERROR_CMD18); - chipDeselect(); - return false; - } + + const bool success = !cardCommand(CMD18, blockNumber); + if (!success) error(SD_CARD_ERROR_CMD18); chipDeselect(); - return true; + return success; } /** @@ -522,13 +505,10 @@ bool Sd2Card::readStart(uint32_t blockNumber) { */ bool Sd2Card::readStop() { chipSelect(); - if (cardCommand(CMD12, 0)) { - error(SD_CARD_ERROR_CMD12); - chipDeselect(); - return false; - } + const bool success = !cardCommand(CMD12, 0); + if (!success) error(SD_CARD_ERROR_CMD12); chipDeselect(); - return true; + return success; } /** @@ -543,55 +523,49 @@ bool Sd2Card::readStop() { * \return The value one, true, is returned for success and the value zero, * false, is returned for an invalid value of \a sckRateID. */ -bool Sd2Card::setSckRate(uint8_t sckRateID) { - if (sckRateID > 6) { - error(SD_CARD_ERROR_SCK_RATE); - return false; - } - spiRate_ = sckRateID; - return true; +bool Sd2Card::setSckRate(const uint8_t sckRateID) { + const bool success = (sckRateID <= 6); + if (success) spiRate_ = sckRateID; else error(SD_CARD_ERROR_SCK_RATE); + return success; } -// wait for card to go not busy +/** + * Wait for card to become not-busy + * \param[in] timeout_ms Timeout to abort. + * \return true for success, false for timeout. + */ bool Sd2Card::waitNotBusy(const millis_t timeout_ms) { const millis_t wait_timeout = millis() + timeout_ms; - while (spiRec() != 0xFF) - if (ELAPSED(millis(), wait_timeout)) return false; - + while (spiRec() != 0xFF) if (ELAPSED(millis(), wait_timeout)) return false; return true; } /** - * Writes a 512 byte block to an SD card. + * Write a 512 byte block to an SD card. * * \param[in] blockNumber Logical block to be written. * \param[in] src Pointer to the location of the data to be written. * \return true for success, false for failure. */ bool Sd2Card::writeBlock(uint32_t blockNumber, const uint8_t* src) { - // use address if not SDHC card - if (type() != SD_CARD_TYPE_SDHC) blockNumber <<= 9; - if (cardCommand(CMD24, blockNumber)) { - error(SD_CARD_ERROR_CMD24); - goto FAIL; + if (type() != SD_CARD_TYPE_SDHC) blockNumber <<= 9; // Use address if not SDHC card + + bool success = false; + if (!cardCommand(CMD24, blockNumber)) { + if (writeData(DATA_START_BLOCK, src)) { + if (waitNotBusy(SD_WRITE_TIMEOUT)) { // Wait for flashing to complete + success = !(cardCommand(CMD13, 0) || spiRec()); // Response is r2 so get and check two bytes for nonzero + if (!success) error(SD_CARD_ERROR_WRITE_PROGRAMMING); + } + else + error(SD_CARD_ERROR_WRITE_TIMEOUT); + } } - if (!writeData(DATA_START_BLOCK, src)) goto FAIL; + else + error(SD_CARD_ERROR_CMD24); - // wait for flash programming to complete - if (!waitNotBusy(SD_WRITE_TIMEOUT)) { - error(SD_CARD_ERROR_WRITE_TIMEOUT); - goto FAIL; - } - // response is r2 so get and check two bytes for nonzero - if (cardCommand(CMD13, 0) || spiRec()) { - error(SD_CARD_ERROR_WRITE_PROGRAMMING); - goto FAIL; - } chipDeselect(); - return true; - FAIL: - chipDeselect(); - return false; + return success; } /** @@ -600,28 +574,30 @@ bool Sd2Card::writeBlock(uint32_t blockNumber, const uint8_t* src) { * \return true for success, false for failure. */ bool Sd2Card::writeData(const uint8_t* src) { + bool success = true; chipSelect(); - // wait for previous write to finish + // Wait for previous write to finish if (!waitNotBusy(SD_WRITE_TIMEOUT) || !writeData(WRITE_MULTIPLE_TOKEN, src)) { error(SD_CARD_ERROR_WRITE_MULTIPLE); - chipDeselect(); - return false; + success = false; } chipDeselect(); - return true; + return success; } -// send one block of data for write block or write multiple blocks -bool Sd2Card::writeData(uint8_t token, const uint8_t* src) { +// Send one block of data for write block or write multiple blocks +bool Sd2Card::writeData(const uint8_t token, const uint8_t* src) { -#if ENABLED(SD_CHECK_AND_RETRY) - uint16_t crc = CRC_CCITT( src, 512 ); -#else // ENABLED(SD_CHECK_AND_RETRY) - uint16_t crc = 0xFFFF; -#endif // ENABLED(SD_CHECK_AND_RETRY) - spiSendBlock( token, src ); - spiSend( crc >> 8 ); - spiSend( crc & 0XFF ); + uint16_t crc = + #if ENABLED(SD_CHECK_AND_RETRY) + CRC_CCITT(src, 512) + #else + 0xFFFF + #endif + ; + spiSendBlock(token, src); + spiSend(crc >> 8); + spiSend(crc & 0xFF); status_ = spiRec(); if ((status_ & DATA_RES_MASK) != DATA_RES_ACCEPTED) { @@ -643,23 +619,18 @@ bool Sd2Card::writeData(uint8_t token, const uint8_t* src) { * * \return true for success, false for failure. */ -bool Sd2Card::writeStart(uint32_t blockNumber, uint32_t eraseCount) { - // send pre-erase count - if (cardAcmd(ACMD23, eraseCount)) { - error(SD_CARD_ERROR_ACMD23); - goto FAIL; - } - // use address if not SDHC card - if (type() != SD_CARD_TYPE_SDHC) blockNumber <<= 9; - if (cardCommand(CMD25, blockNumber)) { - error(SD_CARD_ERROR_CMD25); - goto FAIL; +bool Sd2Card::writeStart(uint32_t blockNumber, const uint32_t eraseCount) { + bool success = false; + if (!cardAcmd(ACMD23, eraseCount)) { // Send pre-erase count + if (type() != SD_CARD_TYPE_SDHC) blockNumber <<= 9; // Use address if not SDHC card + success = !cardCommand(CMD25, blockNumber); + if (!success) error(SD_CARD_ERROR_CMD25); } + else + error(SD_CARD_ERROR_ACMD23); + chipDeselect(); - return true; - FAIL: - chipDeselect(); - return false; + return success; } /** @@ -668,16 +639,17 @@ bool Sd2Card::writeStart(uint32_t blockNumber, uint32_t eraseCount) { * \return true for success, false for failure. */ bool Sd2Card::writeStop() { + bool success = false; chipSelect(); - if (!waitNotBusy(SD_WRITE_TIMEOUT)) goto FAIL; - spiSend(STOP_TRAN_TOKEN); - if (!waitNotBusy(SD_WRITE_TIMEOUT)) goto FAIL; - chipDeselect(); - return true; - FAIL: - error(SD_CARD_ERROR_STOP_TRAN); + if (waitNotBusy(SD_WRITE_TIMEOUT)) { + spiSend(STOP_TRAN_TOKEN); + success = waitNotBusy(SD_WRITE_TIMEOUT); + } + else + error(SD_CARD_ERROR_STOP_TRAN); + chipDeselect(); - return false; + return success; } #endif // SDSUPPORT diff --git a/Marlin/src/sd/Sd2Card.h b/Marlin/src/sd/Sd2Card.h index 8f14073df804..b25baee66c1f 100644 --- a/Marlin/src/sd/Sd2Card.h +++ b/Marlin/src/sd/Sd2Card.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -112,7 +112,7 @@ uint8_t const SD_CARD_TYPE_SD1 = 1, // Standard capacity V1 * \brief Raw access to SD and SDHC flash memory cards. */ class Sd2Card { - public: +public: Sd2Card() : errorCode_(SD_CARD_ERROR_INIT_NOT_CALLED), type_(0) {} @@ -124,15 +124,15 @@ class Sd2Card { * Set SD error code. * \param[in] code value for error code. */ - void error(uint8_t code) {errorCode_ = code;} + inline void error(const uint8_t code) { errorCode_ = code; } /** * \return error code for last error. See Sd2Card.h for a list of error codes. */ - int errorCode() const {return errorCode_;} + inline int errorCode() const { return errorCode_; } /** \return error data for last error. */ - int errorData() const {return status_;} + inline int errorData() const { return status_; } /** * Initialize an SD flash memory card with default clock rate and chip @@ -140,8 +140,8 @@ class Sd2Card { * * \return true for success or false for failure. */ - bool init(uint8_t sckRateID = SPI_FULL_SPEED, - pin_t chipSelectPin = SD_CHIP_SELECT_PIN); + bool init(const uint8_t sckRateID=SPI_FULL_SPEED, const pin_t chipSelectPin=SD_CHIP_SELECT_PIN); + bool readBlock(uint32_t block, uint8_t* dst); /** @@ -163,12 +163,13 @@ class Sd2Card { * * \return true for success or false for failure. */ - bool readCSD(csd_t* csd) { return readRegister(CMD9, csd); } + inline bool readCSD(csd_t* csd) { return readRegister(CMD9, csd); } bool readData(uint8_t* dst); bool readStart(uint32_t blockNumber); bool readStop(); - bool setSckRate(uint8_t sckRateID); + bool setSckRate(const uint8_t sckRateID); + /** * Return the card type: SD V1, SD V2 or SDHC * \return 0 - SD V1, 1 - SD V2, or 3 - SDHC. @@ -176,10 +177,10 @@ class Sd2Card { int type() const {return type_;} bool writeBlock(uint32_t blockNumber, const uint8_t* src); bool writeData(const uint8_t* src); - bool writeStart(uint32_t blockNumber, uint32_t eraseCount); + bool writeStart(uint32_t blockNumber, const uint32_t eraseCount); bool writeStop(); - private: +private: uint8_t chipSelectPin_, errorCode_, spiRate_, @@ -187,17 +188,17 @@ class Sd2Card { type_; // private functions - uint8_t cardAcmd(uint8_t cmd, uint32_t arg) { + inline uint8_t cardAcmd(const uint8_t cmd, const uint32_t arg) { cardCommand(CMD55, 0); return cardCommand(cmd, arg); } - uint8_t cardCommand(uint8_t cmd, uint32_t arg); + uint8_t cardCommand(const uint8_t cmd, const uint32_t arg); - bool readData(uint8_t* dst, uint16_t count); - bool readRegister(uint8_t cmd, void* buf); + bool readData(uint8_t* dst, const uint16_t count); + bool readRegister(const uint8_t cmd, void* buf); void chipDeselect(); void chipSelect(); - void type(uint8_t value) { type_ = value; } + inline void type(const uint8_t value) { type_ = value; } bool waitNotBusy(const millis_t timeout_ms); - bool writeData(uint8_t token, const uint8_t* src); + bool writeData(const uint8_t token, const uint8_t* src); }; diff --git a/Marlin/src/sd/Sd2Card_sdio.h b/Marlin/src/sd/Sd2Card_sdio.h new file mode 100644 index 000000000000..dd56b7d0a519 --- /dev/null +++ b/Marlin/src/sd/Sd2Card_sdio.h @@ -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 . + * + */ +#pragma once + +#include "../inc/MarlinConfig.h" + +#if ENABLED(SDIO_SUPPORT) + +bool SDIO_Init(void); +bool SDIO_ReadBlock(uint32_t block, uint8_t *dst); +bool SDIO_WriteBlock(uint32_t block, const uint8_t *src); + +class Sd2Card { + public: + bool init(uint8_t sckRateID = 0, uint8_t chipSelectPin = 0) { return SDIO_Init(); } + bool readBlock(uint32_t block, uint8_t *dst) { return SDIO_ReadBlock(block, dst); } + bool writeBlock(uint32_t block, const uint8_t *src) { return SDIO_WriteBlock(block, src); } +}; + +#endif // SDIO_SUPPORT diff --git a/Marlin/src/sd/SdBaseFile.cpp b/Marlin/src/sd/SdBaseFile.cpp index 63e0740f62f3..c0e91f85c910 100644 --- a/Marlin/src/sd/SdBaseFile.cpp +++ b/Marlin/src/sd/SdBaseFile.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -905,7 +905,7 @@ int SdBaseFile::peek() { // print uint8_t with width 2 static void print2u(const uint8_t v) { if (v < 10) SERIAL_CHAR('0'); - SERIAL_ECHO_F(v, DEC); + SERIAL_ECHO(int(v)); } /** diff --git a/Marlin/src/sd/SdBaseFile.h b/Marlin/src/sd/SdBaseFile.h index 8fa91a650fe5..87490807a718 100644 --- a/Marlin/src/sd/SdBaseFile.h +++ b/Marlin/src/sd/SdBaseFile.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -108,7 +108,7 @@ static inline uint16_t FAT_YEAR(uint16_t fatDate) { return 1980 + (fatDate >> 9) * * \return Extracted month [1,12] */ -static inline uint8_t FAT_MONTH(uint16_t fatDate) { return (fatDate >> 5) & 0XF; } +static inline uint8_t FAT_MONTH(uint16_t fatDate) { return (fatDate >> 5) & 0xF; } /** * day part of FAT directory date field diff --git a/Marlin/src/sd/SdFatConfig.h b/Marlin/src/sd/SdFatConfig.h index d203aa38ae4c..1501ae6d7713 100644 --- a/Marlin/src/sd/SdFatConfig.h +++ b/Marlin/src/sd/SdFatConfig.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/sd/SdFatStructs.h b/Marlin/src/sd/SdFatStructs.h index eaf7a03ea313..62cffb1b5646 100644 --- a/Marlin/src/sd/SdFatStructs.h +++ b/Marlin/src/sd/SdFatStructs.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/sd/SdFatUtil.cpp b/Marlin/src/sd/SdFatUtil.cpp index b06ee74a5dc8..3509ee874f87 100644 --- a/Marlin/src/sd/SdFatUtil.cpp +++ b/Marlin/src/sd/SdFatUtil.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/sd/SdFatUtil.h b/Marlin/src/sd/SdFatUtil.h index e510ee8e1381..1ce8ec25fc37 100644 --- a/Marlin/src/sd/SdFatUtil.h +++ b/Marlin/src/sd/SdFatUtil.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/sd/SdFile.cpp b/Marlin/src/sd/SdFile.cpp index 18b032400125..cdc08815c9b3 100644 --- a/Marlin/src/sd/SdFile.cpp +++ b/Marlin/src/sd/SdFile.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/sd/SdFile.h b/Marlin/src/sd/SdFile.h index e555797c759e..b94d515a0cd3 100644 --- a/Marlin/src/sd/SdFile.h +++ b/Marlin/src/sd/SdFile.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/sd/SdInfo.h b/Marlin/src/sd/SdInfo.h index 62a445d06df9..d4b58365c824 100644 --- a/Marlin/src/sd/SdInfo.h +++ b/Marlin/src/sd/SdInfo.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/sd/SdVolume.cpp b/Marlin/src/sd/SdVolume.cpp index a872eb19d841..f022afe1768a 100644 --- a/Marlin/src/sd/SdVolume.cpp +++ b/Marlin/src/sd/SdVolume.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/sd/SdVolume.h b/Marlin/src/sd/SdVolume.h index 0f3839362ff1..8166e753c3ba 100644 --- a/Marlin/src/sd/SdVolume.h +++ b/Marlin/src/sd/SdVolume.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -35,6 +35,8 @@ #if ENABLED(USB_FLASH_DRIVE_SUPPORT) #include "usb_flashdrive/Sd2Card_FlashDrive.h" +#elif ENABLED(SDIO_SUPPORT) + #include "Sd2Card_sdio.h" #else #include "Sd2Card.h" #endif diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index d8508ad70b42..7ac21b975be9 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -51,10 +51,8 @@ card_flags_t CardReader::flag; char CardReader::filename[FILENAME_LENGTH], CardReader::longFilename[LONG_FILENAME_LENGTH]; int8_t CardReader::autostart_index; -#if ENABLED(FAST_FILE_TRANSFER) - #if NUM_SERIAL > 1 - uint8_t CardReader::transfer_port; - #endif +#if ENABLED(BINARY_FILE_TRANSFER) && NUM_SERIAL > 1 + int8_t CardReader::transfer_port_index; #endif // private: @@ -124,7 +122,7 @@ CardReader::CardReader() { //sort_reverse = false; #endif #endif - flag.sdprinting = flag.cardOK = flag.saving = flag.logging = false; + flag.sdprinting = flag.detected = flag.saving = flag.logging = false; filesize = sdpos = 0; file_subcall_ctr = 0; @@ -160,11 +158,7 @@ char *createFilename(char *buffer, const dir_t &p) { uint16_t nrFile_index; -void CardReader::lsDive(const char *prepend, SdFile parent, const char * const match/*=NULL*/ - #if NUM_SERIAL > 1 - , const int8_t port/*= -1*/ - #endif -) { +void CardReader::lsDive(const char *prepend, SdFile parent, const char * const match/*=NULL*/) { dir_t p; uint8_t cnt = 0; @@ -197,16 +191,12 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m SdFile dir; if (!dir.open(&parent, dosFilename, O_READ)) { if (lsAction == LS_SerialPrint) { - SERIAL_ECHO_START_P(port); - SERIAL_ECHOPGM_P(port, MSG_SD_CANT_OPEN_SUBDIR); - SERIAL_ECHOLN_P(port, dosFilename); + SERIAL_ECHO_START(); + SERIAL_ECHOPGM(MSG_SD_CANT_OPEN_SUBDIR); + SERIAL_ECHOLN(dosFilename); } } - lsDive(path, dir - #if NUM_SERIAL > 1 - , NULL, port - #endif - ); + lsDive(path, dir); // close() is done automatically by destructor of SdFile } else { @@ -228,10 +218,10 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m case LS_SerialPrint: createFilename(filename, p); - if (prepend) SERIAL_PROTOCOL_P(port, prepend); - SERIAL_PROTOCOL_P(port, filename); - SERIAL_PROTOCOLCHAR_P(port, ' '); - SERIAL_PROTOCOLLN_P(port, p.fileSize); + if (prepend) SERIAL_ECHO(prepend); + SERIAL_ECHO(filename); + SERIAL_CHAR(' '); + SERIAL_ECHOLN(p.fileSize); break; case LS_GetFilename: @@ -248,18 +238,10 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m } // while readDir } -void CardReader::ls( - #if NUM_SERIAL > 1 - const int8_t port - #endif -) { +void CardReader::ls() { lsAction = LS_SerialPrint; root.rewind(); - lsDive(NULL, root - #if NUM_SERIAL > 1 - , NULL, port - #endif - ); + lsDive(NULL, root); } #if ENABLED(LONG_FILENAME_HOST_SUPPORT) @@ -267,16 +249,12 @@ void CardReader::ls( /** * Get a long pretty path based on a DOS 8.3 path */ - void CardReader::printLongPath(char *path - #if NUM_SERIAL > 1 - , const int8_t port/*= -1*/ - #endif - ) { + void CardReader::printLongPath(char *path) { lsAction = LS_GetFilename; int i, pathLen = strlen(path); - // SERIAL_ECHOPGM_P(port, "Full Path: "); SERIAL_ECHOLN_P(port, path); + // SERIAL_ECHOPGM("Full Path: "); SERIAL_ECHOLN(path); // Zero out slashes to make segments for (i = 0; i < pathLen; i++) if (path[i] == '/') path[i] = '\0'; @@ -294,32 +272,28 @@ void CardReader::ls( // Go to the next segment while (path[++i]) { } - // SERIAL_ECHOPGM_P(port, "Looking for segment: "); SERIAL_ECHOLN_P(port, segment); + // SERIAL_ECHOPGM("Looking for segment: "); SERIAL_ECHOLN(segment); // Find the item, setting the long filename diveDir.rewind(); - lsDive(NULL, diveDir, segment - #if NUM_SERIAL > 1 - , port - #endif - ); + lsDive(NULL, diveDir, segment); // Print /LongNamePart to serial output - SERIAL_PROTOCOLCHAR_P(port, '/'); - SERIAL_PROTOCOL_P(port, longFilename[0] ? longFilename : "???"); + SERIAL_CHAR('/'); + SERIAL_ECHO(longFilename[0] ? longFilename : "???"); // If the filename was printed then that's it if (!flag.filenameIsDir) break; - // SERIAL_ECHOPGM_P(port, "Opening dir: "); SERIAL_ECHOLN_P(port, segment); + // SERIAL_ECHOPGM("Opening dir: "); SERIAL_ECHOLN(segment); // Open the sub-item as the new dive parent SdFile dir; if (!dir.open(&diveDir, segment, O_READ)) { - SERIAL_EOL_P(port); - SERIAL_ECHO_START_P(port); - SERIAL_ECHOPGM_P(port, MSG_SD_CANT_OPEN_SUBDIR); - SERIAL_ECHO_P(port, segment); + SERIAL_EOL(); + SERIAL_ECHO_START(); + SERIAL_ECHOPGM(MSG_SD_CANT_OPEN_SUBDIR); + SERIAL_ECHO(segment); break; } @@ -328,7 +302,7 @@ void CardReader::ls( } // while i 1 - const int8_t port/*= -1*/ - #endif -) { +void CardReader::printFilename() { if (file.isOpen()) { char dosFilename[FILENAME_LENGTH]; file.getFilename(dosFilename); - SERIAL_ECHO_P(port, dosFilename); + SERIAL_ECHO(dosFilename); #if ENABLED(LONG_FILENAME_HOST_SUPPORT) getfilename(0, dosFilename); if (longFilename[0]) { - SERIAL_ECHO_P(port, ' '); - SERIAL_ECHO_P(port, longFilename); + SERIAL_ECHO(' '); + SERIAL_ECHO(longFilename); } #endif } else - SERIAL_ECHOPGM_P(port, "(no file)"); + SERIAL_ECHOPGM("(no file)"); - SERIAL_EOL_P(port); + SERIAL_EOL(); } void CardReader::initsd() { - flag.cardOK = false; + flag.detected = false; if (root.isOpen()) root.close(); #ifndef SPI_SPEED @@ -373,28 +343,24 @@ void CardReader::initsd() { #endif ) { //if (!sd2card.init(SPI_HALF_SPEED,SDSS)) - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM(MSG_SD_INIT_FAIL); - } - else if (!volume.init(&sd2card)) { - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM(MSG_SD_VOL_INIT_FAIL); - } - else if (!root.openRoot(&volume)) { - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM(MSG_SD_OPENROOT_FAIL); + SERIAL_ECHO_MSG(MSG_SD_INIT_FAIL); } + else if (!volume.init(&sd2card)) + SERIAL_ERROR_MSG(MSG_SD_VOL_INIT_FAIL); + else if (!root.openRoot(&volume)) + SERIAL_ERROR_MSG(MSG_SD_OPENROOT_FAIL); else { - flag.cardOK = true; - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM(MSG_SD_CARD_OK); + flag.detected = true; + SERIAL_ECHO_MSG(MSG_SD_CARD_OK); } setroot(); + + ui.refresh(); } void CardReader::release() { stopSDPrint(); - flag.cardOK = false; + flag.detected = false; } void CardReader::openAndPrintFile(const char *name) { @@ -406,7 +372,7 @@ void CardReader::openAndPrintFile(const char *name) { } void CardReader::startFileprint() { - if (flag.cardOK) { + if (isDetected()) { flag.sdprinting = true; #if SD_RESORT flush_presort(); @@ -456,15 +422,13 @@ void CardReader::getAbsFilename(char *t) { void CardReader::openFile(char * const path, const bool read, const bool subcall/*=false*/) { - if (!flag.cardOK) return; + if (!isDetected()) return; uint8_t doing = 0; if (isFileOpen()) { // Replacing current file or doing a subroutine if (subcall) { if (file_subcall_ctr > SD_PROCEDURE_DEPTH - 1) { - SERIAL_ERROR_START(); - SERIAL_ERRORPGM("trying to call sub-gcode files with too many levels. MAX level is:"); - SERIAL_ERRORLN((int)SD_PROCEDURE_DEPTH); + SERIAL_ERROR_MSG("trying to call sub-gcode files with too many levels. MAX level is:" STRINGIFY(SD_PROCEDURE_DEPTH)); kill(); return; } @@ -474,18 +438,14 @@ 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 doing = 1; } - else if (subcall) { // Returning from a subcall? - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM("END SUBROUTINE"); - } + else if (subcall) // Returning from a subcall? + SERIAL_ECHO_MSG("END SUBROUTINE"); else { // Opening fresh file doing = 2; file_subcall_ctr = 0; // Reset procedure depth in case user cancels print while in procedure @@ -508,42 +468,35 @@ 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_PROTOCOLPAIR(MSG_SD_FILE_OPENED, fname); - SERIAL_PROTOCOLLNPAIR(MSG_SD_SIZE, filesize); - SERIAL_PROTOCOLLNPGM(MSG_SD_FILE_SELECTED); + SERIAL_ECHOLNPAIR(MSG_SD_FILE_OPENED, fname, MSG_SD_SIZE, filesize); + SERIAL_ECHOLNPGM(MSG_SD_FILE_SELECTED); getfilename(0, fname); ui.set_status(longFilename[0] ? longFilename : fname); //if (longFilename[0]) { - // SERIAL_PROTOCOLPAIR(MSG_SD_FILE_LONG_NAME, longFilename); + // SERIAL_ECHOPAIR(MSG_SD_FILE_LONG_NAME, longFilename); //} } - else { - SERIAL_PROTOCOLPAIR(MSG_SD_OPEN_FILE_FAIL, fname); - SERIAL_PROTOCOLCHAR('.'); - 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_PROTOCOLPAIR(MSG_SD_OPEN_FILE_FAIL, fname); - SERIAL_PROTOCOLCHAR('.'); - 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); #if ENABLED(EMERGENCY_PARSER) emergency_parser.disable(); #endif - SERIAL_PROTOCOLLNPAIR(MSG_SD_WRITE_TO_FILE, fname); + SERIAL_ECHOLNPAIR(MSG_SD_WRITE_TO_FILE, fname); ui.set_status(fname); } } } void CardReader::removeFile(const char * const name) { - if (!flag.cardOK) return; + if (!isDetected()) return; //stopSDPrint(); @@ -552,33 +505,25 @@ void CardReader::removeFile(const char * const name) { if (!fname) return; if (file.remove(curDir, fname)) { - SERIAL_PROTOCOLPGM("File deleted:"); - SERIAL_PROTOCOLLN(fname); + SERIAL_ECHOLNPAIR("File deleted:", fname); sdpos = 0; #if ENABLED(SDCARD_SORT_ALPHA) presort(); #endif } - else { - SERIAL_PROTOCOLPGM("Deletion failed, File: "); - SERIAL_PROTOCOL(fname); - SERIAL_PROTOCOLCHAR('.'); - } + else + SERIAL_ECHOLNPAIR("Deletion failed, File: ", fname, "."); } -void CardReader::getStatus( - #if NUM_SERIAL > 1 - const int8_t port/*= -1*/ - #endif -) { - if (flag.cardOK && flag.sdprinting) { - SERIAL_PROTOCOLPGM_P(port, MSG_SD_PRINTING_BYTE); - SERIAL_PROTOCOL_P(port, sdpos); - SERIAL_PROTOCOLCHAR_P(port, '/'); - SERIAL_PROTOCOLLN_P(port, filesize); +void CardReader::report_status() { + if (isPrinting()) { + SERIAL_ECHOPGM(MSG_SD_PRINTING_BYTE); + SERIAL_ECHO(sdpos); + SERIAL_CHAR('/'); + SERIAL_ECHOLN(filesize); } else - SERIAL_PROTOCOLLNPGM_P(port, MSG_SD_NOT_PRINTING); + SERIAL_ECHOLNPGM(MSG_SD_NOT_PRINTING); } void CardReader::write_command(char *buf) { @@ -595,10 +540,8 @@ void CardReader::write_command(char *buf) { end[2] = '\n'; end[3] = '\0'; file.write(begin); - if (file.writeError) { - SERIAL_ERROR_START(); - SERIAL_ERRORLNPGM(MSG_SD_ERR_WRITE_TO_FILE); - } + + if (file.writeError) SERIAL_ERROR_MSG(MSG_SD_ERR_WRITE_TO_FILE); } // @@ -612,9 +555,9 @@ void CardReader::checkautostart() { if (autostart_index < 0 || flag.sdprinting) return; - if (!flag.cardOK) initsd(); + if (!isDetected()) initsd(); - if (flag.cardOK + if (isDetected() #if ENABLED(POWER_LOSS_RECOVERY) && !recovery.valid() // Don't run auto#.g when a resume file exists #endif @@ -715,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_PROTOCOLPAIR(MSG_SD_OPEN_FILE_FAIL, dosSubdirname); - SERIAL_PROTOCOLCHAR('.'); - SERIAL_EOL(); + SERIAL_ECHOLNPAIR(MSG_SD_OPEN_FILE_FAIL, dosSubdirname, "."); return NULL; } curDir = &myDir; @@ -740,8 +681,7 @@ void CardReader::chdir(const char * relpath) { } else { SERIAL_ECHO_START(); - SERIAL_ECHOPGM(MSG_SD_CANT_ENTER_SUBDIR); - SERIAL_ECHOLN(relpath); + SERIAL_ECHOLNPAIR(MSG_SD_CANT_ENTER_SUBDIR, relpath); } } @@ -873,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); @@ -960,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); @@ -1027,15 +969,20 @@ void CardReader::printingHasFinished() { #if ENABLED(SD_FINISHED_STEPPERRELEASE) && defined(SD_FINISHED_RELEASECOMMAND) planner.finish_and_disable(); #endif + print_job_timer.stop(); - if (print_job_timer.duration() > 60) - enqueue_and_echo_commands_P(PSTR("M31")); + if (print_job_timer.duration() > 60) enqueue_and_echo_commands_P(PSTR("M31")); + #if ENABLED(SDCARD_SORT_ALPHA) presort(); #endif - #if ENABLED(ULTRA_LCD) && ENABLED(LCD_SET_PROGRESS_MANUALLY) + + #if EITHER(ULTRA_LCD, EXTENSIBLE_UI) && ENABLED(LCD_SET_PROGRESS_MANUALLY) ui.progress_bar_percent = 0; #endif + + ui.reset_status(); + #if ENABLED(SD_REPRINT_LAST_SELECTED_FILE) ui.reselect_last_file(); #endif @@ -1046,25 +993,22 @@ void CardReader::printingHasFinished() { uint8_t CardReader::auto_report_sd_interval = 0; millis_t CardReader::next_sd_report_ms; #if NUM_SERIAL > 1 - int8_t CardReader::serialport; + int8_t CardReader::auto_report_port; #endif void CardReader::auto_report_sd_status() { millis_t current_ms = millis(); if (auto_report_sd_interval && ELAPSED(current_ms, next_sd_report_ms)) { next_sd_report_ms = current_ms + 1000UL * auto_report_sd_interval; - getStatus( - #if NUM_SERIAL > 1 - serialport - #endif - ); + PORT_REDIRECT(auto_report_port); + report_status(); } } #endif // AUTO_REPORT_SD_STATUS #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); @@ -1073,15 +1017,12 @@ void CardReader::printingHasFinished() { } void CardReader::openJobRecoveryFile(const bool read) { - if (!flag.cardOK) return; + 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_PROTOCOLPAIR(MSG_SD_OPEN_FILE_FAIL, job_recovery_file_name); - SERIAL_PROTOCOLCHAR('.'); - 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_PROTOCOLLNPAIR(MSG_SD_WRITE_TO_FILE, job_recovery_file_name); + SERIAL_ECHOLNPAIR(MSG_SD_WRITE_TO_FILE, job_recovery_file_name); } // Removing the job recovery file currently requires closing @@ -1089,10 +1030,10 @@ void CardReader::printingHasFinished() { // be zeroed and written instead of deleted. void CardReader::removeJobRecoveryFile() { if (jobRecoverFileExists()) { - //closefile(); + recovery.init(); removeFile(job_recovery_file_name); #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) - SERIAL_PROTOCOLPGM("Power-loss file delete"); + SERIAL_ECHOPGM("Power-loss file delete"); serialprintPGM(jobRecoverFileExists() ? PSTR(" failed.\n") : PSTR("d.\n")); #endif } diff --git a/Marlin/src/sd/cardreader.h b/Marlin/src/sd/cardreader.h index b9c71875c8e1..9faf0505743b 100644 --- a/Marlin/src/sd/cardreader.h +++ b/Marlin/src/sd/cardreader.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 @@ -39,10 +39,10 @@ typedef struct { bool saving:1, logging:1, sdprinting:1, - cardOK:1, + detected:1, filenameIsDir:1, abort_sd_printing:1 - #if ENABLED(FAST_FILE_TRANSFER) + #if ENABLED(BINARY_FILE_TRANSFER) , binary_mode:1 #endif ; @@ -70,24 +70,12 @@ class CardReader { const bool re_sort=false #endif ); - static void getStatus( - #if NUM_SERIAL > 1 - const int8_t port = -1 - #endif - ); + static void report_status(); static void printingHasFinished(); - static void printFilename( - #if NUM_SERIAL > 1 - const int8_t port = -1 - #endif - ); + static void printFilename(); #if ENABLED(LONG_FILENAME_HOST_SUPPORT) - static void printLongPath(char *path - #if NUM_SERIAL > 1 - , const int8_t port = -1 - #endif - ); + static void printLongPath(char *path); #endif static void getfilename(uint16_t nr, const char* const match=NULL); @@ -95,11 +83,7 @@ class CardReader { static void getAbsFilename(char *t); - static void ls( - #if NUM_SERIAL > 1 - const int8_t port = -1 - #endif - ); + static void ls(); static void chdir(const char *relpath); static int8_t updir(); static void setroot(); @@ -127,7 +111,10 @@ class CardReader { #endif static inline void pauseSDPrint() { flag.sdprinting = false; } - static inline bool isFileOpen() { return file.isOpen(); } + static inline bool isDetected() { return flag.detected; } + static inline bool isFileOpen() { return isDetected() && file.isOpen(); } + static inline bool isPaused() { return isFileOpen() && !flag.sdprinting; } + static inline bool isPrinting() { return flag.sdprinting; } static inline bool eof() { return sdpos >= filesize; } static inline int16_t get() { sdpos = file.curPosition(); return (int16_t)file.read(); } static inline void setIndex(const uint32_t index) { sdpos = index; file.seekSet(index); } @@ -141,13 +128,9 @@ class CardReader { #if ENABLED(AUTO_REPORT_SD_STATUS) static void auto_report_sd_status(void); - static inline void set_auto_report_interval(uint8_t v - #if NUM_SERIAL > 1 - , int8_t port - #endif - ) { + static inline void set_auto_report_interval(uint8_t v) { #if NUM_SERIAL > 1 - serialport = port; + auto_report_port = serial_port_index; #endif NOMORE(v, 60); auto_report_sd_interval = v; @@ -162,11 +145,11 @@ class CardReader { static char filename[FILENAME_LENGTH], longFilename[LONG_FILENAME_LENGTH]; static int8_t autostart_index; - #if ENABLED(FAST_FILE_TRANSFER) + #if ENABLED(BINARY_FILE_TRANSFER) #if NUM_SERIAL > 1 - static uint8_t transfer_port; + static int8_t transfer_port_index; #else - static constexpr uint8_t transfer_port = 0; + static constexpr int8_t transfer_port_index = 0; #endif #endif @@ -190,7 +173,7 @@ class CardReader { 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 @@ -241,11 +224,7 @@ class CardReader { static LsAction lsAction; //stored for recursion. static uint16_t nrFiles; //counter for the files in the current directory and recycled as position counter for getting the nrFiles'th name in the directory. static char *diveDirName; - static void lsDive(const char *prepend, SdFile parent, const char * const match=NULL - #if NUM_SERIAL > 1 - , const int8_t port = -1 - #endif - ); + static void lsDive(const char *prepend, SdFile parent, const char * const match=NULL); #if ENABLED(SDCARD_SORT_ALPHA) static void flush_presort(); @@ -255,7 +234,7 @@ class CardReader { static uint8_t auto_report_sd_interval; static millis_t next_sd_report_ms; #if NUM_SERIAL > 1 - static int8_t serialport; + static int8_t auto_report_port; #endif #endif }; diff --git a/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp b/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp index f4fda4b3c9b3..8de27cb319a8 100644 --- a/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp +++ b/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -31,6 +31,10 @@ #include "Sd2Card_FlashDrive.h" +#if EITHER(ULTRA_LCD, EXTENSIBLE_UI) + #include "../../lcd/ultralcd.h" +#endif + USB usb; BulkOnly bulk(&usb); @@ -46,25 +50,27 @@ void Sd2Card::idle() { switch (state) { case USB_HOST_DELAY_INIT: - next_retry = millis() + 10000; + next_retry = millis() + 2000; state = USB_HOST_WAITING; break; case USB_HOST_WAITING: if (ELAPSED(millis(), next_retry)) { - next_retry = millis() + 10000; + next_retry = millis() + 2000; state = USB_HOST_UNINITIALIZED; } break; case USB_HOST_UNINITIALIZED: - SERIAL_ECHOLNPGM("Starting USB host"); + SERIAL_ECHOPGM("Starting USB host..."); if (!usb.start()) { - SERIAL_ECHOLNPGM("USB host failed to start. Will retry in 10 seconds."); + SERIAL_ECHOPGM(" Failed. Retrying in 2s."); + #if EITHER(ULTRA_LCD, EXTENSIBLE_UI) + LCD_MESSAGEPGM("USB start failed"); + #endif state = USB_HOST_DELAY_INIT; } - else { - SERIAL_ECHOLNPGM("USB host initialized"); + else state = USB_HOST_INITIALIZED; - } + SERIAL_EOL(); break; case USB_HOST_INITIALIZED: const uint8_t lastUsbTaskState = usb.getUsbTaskState(); @@ -91,10 +97,10 @@ void Sd2Card::idle() { // This is equivalent to polling the SD_DETECT when using SD cards. bool Sd2Card::isInserted() { return usb.getUsbTaskState() == USB_STATE_RUNNING; -}; +} // Marlin calls this to initialize an SD card once it is inserted. -bool Sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin) { +bool Sd2Card::init(const uint8_t sckRateID/*=0*/, const pin_t chipSelectPin/*=SD_CHIP_SELECT_PIN*/) { if (!ready()) return false; if (!bulk.LUNIsGood(0)) { @@ -104,7 +110,7 @@ bool Sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin) { const uint32_t sectorSize = bulk.GetSectorSize(0); if (sectorSize != 512) { - SERIAL_ECHOLNPAIR("Expecting sector size of 512, got:", sectorSize); + SERIAL_ECHOLNPAIR("Expecting sector size of 512. Got: ", sectorSize); return false; } @@ -121,7 +127,7 @@ uint32_t Sd2Card::cardSize() { #ifndef USB_DEBUG const uint32_t #endif - lun0_capacity = bulk.GetCapacity(0); + lun0_capacity = bulk.GetCapacity(0); return lun0_capacity; } diff --git a/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.h b/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.h index ee044a19b645..6e7cc82ff103 100644 --- a/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.h +++ b/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -32,7 +32,6 @@ */ //#define USB_DEBUG 1 - #include "../SdFatConfig.h" #include "../SdInfo.h" @@ -61,11 +60,11 @@ class Sd2Card { private: - typedef enum { - USB_HOST_DELAY_INIT, - USB_HOST_WAITING, + typedef enum : uint8_t { USB_HOST_UNINITIALIZED, - USB_HOST_INITIALIZED + USB_HOST_INITIALIZED, + USB_HOST_DELAY_INIT, + USB_HOST_WAITING } state_t; static state_t state; @@ -75,21 +74,20 @@ class Sd2Card { uint32_t lun0_capacity; #endif - static inline bool ready() {return state == USB_HOST_INITIALIZED;} + static inline bool ready() { return state == USB_HOST_INITIALIZED; } public: - bool init(uint8_t sckRateID = 0, uint8_t chipSelectPin = SD_CHIP_SELECT_PIN); + bool init(const uint8_t sckRateID=0, const pin_t chipSelectPin=SD_CHIP_SELECT_PIN); static void idle(); - bool readStart(uint32_t block) { pos = block; return ready(); } - bool readData(uint8_t* dst) { return readBlock(pos++, dst); } - bool readStop() { return true; } - - bool writeStart(uint32_t block, uint32_t eraseCount) { pos = block; return ready(); } - bool writeData(uint8_t* src) { return writeBlock(pos++, src); } - bool writeStop() { return true; } + inline bool readStart(const uint32_t block) { pos = block; return ready(); } + inline bool readData(uint8_t* dst) { return readBlock(pos++, dst); } + inline bool readStop() const { return true; } + inline bool writeStart(const uint32_t block, const uint32_t eraseCount) { UNUSED(eraseCount); pos = block; return ready(); } + inline bool writeData(uint8_t* src) { return writeBlock(pos++, src); } + inline bool writeStop() const { return true; } bool readBlock(uint32_t block, uint8_t* dst); bool writeBlock(uint32_t blockNumber, const uint8_t* src); diff --git a/Marlin/src/sd/usb_flashdrive/lib/Usb.cpp b/Marlin/src/sd/usb_flashdrive/lib/Usb.cpp index 55774fb04534..6d0f920697ef 100644 --- a/Marlin/src/sd/usb_flashdrive/lib/Usb.cpp +++ b/Marlin/src/sd/usb_flashdrive/lib/Usb.cpp @@ -1,25 +1,26 @@ -/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Contact information -------------------- - -Circuits At Home, LTD -Web : http://www.circuitsathome.com -e-mail : support@circuitsathome.com +/** + * Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Contact information + * ------------------- + * + * Circuits At Home, LTD + * Web : http://www.circuitsathome.com + * e-mail : support@circuitsathome.com */ /* USB functions */ @@ -34,98 +35,98 @@ static uint8_t usb_task_state; /* constructor */ USB::USB() : bmHubPre(0) { - usb_task_state = USB_DETACHED_SUBSTATE_INITIALIZE; //set up state machine - init(); + usb_task_state = USB_DETACHED_SUBSTATE_INITIALIZE; //set up state machine + init(); } /* Initialize data structures */ void USB::init() { - //devConfigIndex = 0; - bmHubPre = 0; + //devConfigIndex = 0; + bmHubPre = 0; } uint8_t USB::getUsbTaskState(void) { - return ( usb_task_state); + return ( usb_task_state); } void USB::setUsbTaskState(uint8_t state) { - usb_task_state = state; + usb_task_state = state; } EpInfo* USB::getEpInfoEntry(uint8_t addr, uint8_t ep) { - UsbDevice *p = addrPool.GetUsbDevicePtr(addr); + UsbDevice *p = addrPool.GetUsbDevicePtr(addr); - if(!p || !p->epinfo) - return NULL; + if (!p || !p->epinfo) + return NULL; - EpInfo *pep = p->epinfo; + EpInfo *pep = p->epinfo; - for(uint8_t i = 0; i < p->epcount; i++) { - if((pep)->epAddr == ep) - return pep; + for (uint8_t i = 0; i < p->epcount; i++) { + if ((pep)->epAddr == ep) + return pep; - pep++; - } - return NULL; + pep++; + } + return NULL; } /* set device table entry */ /* each device is different and has different number of endpoints. This function plugs endpoint record structure, defined in application, to devtable */ uint8_t USB::setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo* eprecord_ptr) { - if(!eprecord_ptr) - return USB_ERROR_INVALID_ARGUMENT; + if (!eprecord_ptr) + return USB_ERROR_INVALID_ARGUMENT; - UsbDevice *p = addrPool.GetUsbDevicePtr(addr); + UsbDevice *p = addrPool.GetUsbDevicePtr(addr); - if(!p) - return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL; + if (!p) + return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL; - p->address.devAddress = addr; - p->epinfo = eprecord_ptr; - p->epcount = epcount; + p->address.devAddress = addr; + p->epinfo = eprecord_ptr; + p->epcount = epcount; - return 0; + return 0; } uint8_t USB::SetAddress(uint8_t addr, uint8_t ep, EpInfo **ppep, uint16_t *nak_limit) { - UsbDevice *p = addrPool.GetUsbDevicePtr(addr); + UsbDevice *p = addrPool.GetUsbDevicePtr(addr); - if(!p) - return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL; + if (!p) + return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL; - if(!p->epinfo) - return USB_ERROR_EPINFO_IS_NULL; + if (!p->epinfo) + return USB_ERROR_EPINFO_IS_NULL; - *ppep = getEpInfoEntry(addr, ep); + *ppep = getEpInfoEntry(addr, ep); - if(!*ppep) - return USB_ERROR_EP_NOT_FOUND_IN_TBL; + if (!*ppep) + return USB_ERROR_EP_NOT_FOUND_IN_TBL; - *nak_limit = (0x0001UL << (((*ppep)->bmNakPower > USB_NAK_MAX_POWER) ? USB_NAK_MAX_POWER : (*ppep)->bmNakPower)); - (*nak_limit)--; - /* - USBTRACE2("\r\nAddress: ", addr); - USBTRACE2(" EP: ", ep); - USBTRACE2(" NAK Power: ",(*ppep)->bmNakPower); - USBTRACE2(" NAK Limit: ", nak_limit); - USBTRACE("\r\n"); - */ - regWr(rPERADDR, addr); //set peripheral address + *nak_limit = (0x0001UL << (((*ppep)->bmNakPower > USB_NAK_MAX_POWER) ? USB_NAK_MAX_POWER : (*ppep)->bmNakPower)); + (*nak_limit)--; + /* + USBTRACE2("\r\nAddress: ", addr); + USBTRACE2(" EP: ", ep); + USBTRACE2(" NAK Power: ",(*ppep)->bmNakPower); + USBTRACE2(" NAK Limit: ", nak_limit); + USBTRACE("\r\n"); + */ + regWr(rPERADDR, addr); //set peripheral address - uint8_t mode = regRd(rMODE); + uint8_t mode = regRd(rMODE); - //Serial.print("\r\nMode: "); - //Serial.println( mode, HEX); - //Serial.print("\r\nLS: "); - //Serial.println(p->lowspeed, HEX); + //Serial.print("\r\nMode: "); + //Serial.println( mode, HEX); + //Serial.print("\r\nLS: "); + //Serial.println(p->lowspeed, HEX); - // Set bmLOWSPEED and bmHUBPRE in case of low-speed device, reset them otherwise - regWr(rMODE, (p->lowspeed) ? mode | bmLOWSPEED | bmHubPre : mode & ~(bmHUBPRE | bmLOWSPEED)); + // Set bmLOWSPEED and bmHUBPRE in case of low-speed device, reset them otherwise + regWr(rMODE, (p->lowspeed) ? mode | bmLOWSPEED | bmHubPre : mode & ~(bmHUBPRE | bmLOWSPEED)); - return 0; + return 0; } /* Control transfer. Sets address, endpoint, fills control packet with necessary data, dispatches control packet, and initiates bulk IN transfer, */ @@ -135,166 +136,152 @@ uint8_t USB::SetAddress(uint8_t addr, uint8_t ep, EpInfo **ppep, uint16_t *nak_l /* 01-0f = non-zero HRSLT */ uint8_t USB::ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, - uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t* dataptr, USBReadParser *p) { - bool direction = false; //request direction, IN or OUT - uint8_t rcode; - SETUP_PKT setup_pkt; - - EpInfo *pep = NULL; - uint16_t nak_limit = 0; - - rcode = SetAddress(addr, ep, &pep, &nak_limit); - - if(rcode) - return rcode; - - direction = ((bmReqType & 0x80) > 0); - - /* fill in setup packet */ - setup_pkt.ReqType_u.bmRequestType = bmReqType; - setup_pkt.bRequest = bRequest; - setup_pkt.wVal_u.wValueLo = wValLo; - setup_pkt.wVal_u.wValueHi = wValHi; - setup_pkt.wIndex = wInd; - setup_pkt.wLength = total; - - bytesWr(rSUDFIFO, 8, (uint8_t*) & setup_pkt); //transfer to setup packet FIFO - - rcode = dispatchPkt(tokSETUP, ep, nak_limit); //dispatch packet - - if(rcode) //return HRSLT if not zero - return ( rcode); - - if(dataptr != NULL) //data stage, if present - { - if(direction) //IN transfer - { - uint16_t left = total; - - pep->bmRcvToggle = 1; //bmRCVTOG1; - - while(left) { - // Bytes read into buffer - uint16_t read = nbytes; - //uint16_t read = (leftbmRcvToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 0 : 1; - continue; - } - - if(rcode) - return rcode; - - // Invoke callback function if inTransfer completed successfully and callback function pointer is specified - if(!rcode && p) - ((USBReadParser*)p)->Parse(read, dataptr, total - left); - - left -= read; - - if(read < nbytes) - break; - } - } else //OUT transfer - { - pep->bmSndToggle = 1; //bmSNDTOG1; - rcode = OutTransfer(pep, nak_limit, nbytes, dataptr); - } - if(rcode) //return error - return ( rcode); + uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t* dataptr, USBReadParser *p) { + bool direction = false; //request direction, IN or OUT + uint8_t rcode; + SETUP_PKT setup_pkt; + + EpInfo *pep = NULL; + uint16_t nak_limit = 0; + + rcode = SetAddress(addr, ep, &pep, &nak_limit); + if (rcode) return rcode; + + direction = ((bmReqType & 0x80) > 0); + + /* fill in setup packet */ + setup_pkt.ReqType_u.bmRequestType = bmReqType; + setup_pkt.bRequest = bRequest; + setup_pkt.wVal_u.wValueLo = wValLo; + setup_pkt.wVal_u.wValueHi = wValHi; + setup_pkt.wIndex = wInd; + setup_pkt.wLength = total; + + bytesWr(rSUDFIFO, 8, (uint8_t*) & setup_pkt); //transfer to setup packet FIFO + + rcode = dispatchPkt(tokSETUP, ep, nak_limit); //dispatch packet + if (rcode) return rcode; // Return HRSLT if not zero + + if (dataptr != NULL) { //data stage, if present + if (direction) { //IN transfer + uint16_t left = total; + pep->bmRcvToggle = 1; //bmRCVTOG1; + + while (left) { + // Bytes read into buffer + uint16_t read = nbytes; + //uint16_t read = (leftbmRcvToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 0 : 1; + continue; } - // Status stage - return dispatchPkt((direction) ? tokOUTHS : tokINHS, ep, nak_limit); //GET if direction + + if (rcode) return rcode; + + // Invoke callback function if inTransfer completed successfully and callback function pointer is specified + if (!rcode && p) ((USBReadParser*)p)->Parse(read, dataptr, total - left); + + left -= read; + + if (read < nbytes) break; + } + } + else { //OUT transfer + pep->bmSndToggle = 1; //bmSNDTOG1; + rcode = OutTransfer(pep, nak_limit, nbytes, dataptr); + } + if (rcode) return rcode; // return error + } + // Status stage + return dispatchPkt((direction) ? tokOUTHS : tokINHS, ep, nak_limit); //GET if direction } /* IN transfer to arbitrary endpoint. Assumes PERADDR is set. Handles multiple packets if necessary. Transfers 'nbytes' bytes. */ /* Keep sending INs and writes data to memory area pointed by 'data' */ /* rcode 0 if no errors. rcode 01-0f is relayed from dispatchPkt(). Rcode f0 means RCVDAVIRQ error, - fe USB xfer timeout */ + fe USB xfer timeout */ uint8_t USB::inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t* data, uint8_t bInterval /*= 0*/) { - EpInfo *pep = NULL; - uint16_t nak_limit = 0; - - uint8_t rcode = SetAddress(addr, ep, &pep, &nak_limit); - - if(rcode) { - USBTRACE3("(USB::InTransfer) SetAddress Failed ", rcode, 0x81); - USBTRACE3("(USB::InTransfer) addr requested ", addr, 0x81); - USBTRACE3("(USB::InTransfer) ep requested ", ep, 0x81); - return rcode; - } - return InTransfer(pep, nak_limit, nbytesptr, data, bInterval); + EpInfo *pep = NULL; + uint16_t nak_limit = 0; + + uint8_t rcode = SetAddress(addr, ep, &pep, &nak_limit); + if (rcode) { + USBTRACE3("(USB::InTransfer) SetAddress Failed ", rcode, 0x81); + USBTRACE3("(USB::InTransfer) addr requested ", addr, 0x81); + USBTRACE3("(USB::InTransfer) ep requested ", ep, 0x81); + return rcode; + } + return InTransfer(pep, nak_limit, nbytesptr, data, bInterval); } uint8_t USB::InTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t *nbytesptr, uint8_t* data, uint8_t bInterval /*= 0*/) { - uint8_t rcode = 0; - uint8_t pktsize; - - uint16_t nbytes = *nbytesptr; - //printf("Requesting %i bytes ", nbytes); - uint8_t maxpktsize = pep->maxPktSize; - - *nbytesptr = 0; - regWr(rHCTL, (pep->bmRcvToggle) ? bmRCVTOG1 : bmRCVTOG0); //set toggle value - - // use a 'break' to exit this loop - while(1) { - rcode = dispatchPkt(tokIN, pep->epAddr, nak_limit); //IN packet to EP-'endpoint'. Function takes care of NAKS. - if(rcode == hrTOGERR) { - // yes, we flip it wrong here so that next time it is actually correct! - pep->bmRcvToggle = (regRd(rHRSL) & bmRCVTOGRD) ? 0 : 1; - regWr(rHCTL, (pep->bmRcvToggle) ? bmRCVTOG1 : bmRCVTOG0); //set toggle value - continue; - } - if(rcode) { - //printf(">>>>>>>> Problem! dispatchPkt %2.2x\r\n", rcode); - break; //should be 0, indicating ACK. Else return error code. - } - /* check for RCVDAVIRQ and generate error if not present */ - /* the only case when absence of RCVDAVIRQ makes sense is when toggle error occurred. Need to add handling for that */ - if((regRd(rHIRQ) & bmRCVDAVIRQ) == 0) { - //printf(">>>>>>>> Problem! NO RCVDAVIRQ!\r\n"); - rcode = 0xf0; //receive error - break; - } - pktsize = regRd(rRCVBC); //number of received bytes - //printf("Got %i bytes \r\n", pktsize); - // This would be OK, but... - //assert(pktsize <= nbytes); - if(pktsize > nbytes) { - // This can happen. Use of assert on Arduino locks up the Arduino. - // So I will trim the value, and hope for the best. - //printf(">>>>>>>> Problem! Wanted %i bytes but got %i.\r\n", nbytes, pktsize); - pktsize = nbytes; - } - - int16_t mem_left = (int16_t)nbytes - *((int16_t*)nbytesptr); - - if(mem_left < 0) - mem_left = 0; - - data = bytesRd(rRCVFIFO, ((pktsize > mem_left) ? mem_left : pktsize), data); - - regWr(rHIRQ, bmRCVDAVIRQ); // Clear the IRQ & free the buffer - *nbytesptr += pktsize; // add this packet's byte count to total transfer length - - /* The transfer is complete under two conditions: */ - /* 1. The device sent a short packet (L.T. maxPacketSize) */ - /* 2. 'nbytes' have been transferred. */ - if((pktsize < maxpktsize) || (*nbytesptr >= nbytes)) // have we transferred 'nbytes' bytes? - { - // Save toggle value - pep->bmRcvToggle = ((regRd(rHRSL) & bmRCVTOGRD)) ? 1 : 0; - //printf("\r\n"); - rcode = 0; - break; - } else if(bInterval > 0) - delay(bInterval); // Delay according to polling interval - } //while( 1 ) - return ( rcode); + uint8_t rcode = 0; + uint8_t pktsize; + + uint16_t nbytes = *nbytesptr; + //printf("Requesting %i bytes ", nbytes); + uint8_t maxpktsize = pep->maxPktSize; + + *nbytesptr = 0; + regWr(rHCTL, (pep->bmRcvToggle) ? bmRCVTOG1 : bmRCVTOG0); //set toggle value + + // use a 'break' to exit this loop + for (;;) { + rcode = dispatchPkt(tokIN, pep->epAddr, nak_limit); //IN packet to EP-'endpoint'. Function takes care of NAKS. + if (rcode == hrTOGERR) { + // yes, we flip it wrong here so that next time it is actually correct! + pep->bmRcvToggle = (regRd(rHRSL) & bmRCVTOGRD) ? 0 : 1; + regWr(rHCTL, (pep->bmRcvToggle) ? bmRCVTOG1 : bmRCVTOG0); //set toggle value + continue; + } + if (rcode) { + //printf(">>>>>>>> Problem! dispatchPkt %2.2x\r\n", rcode); + break; //should be 0, indicating ACK. Else return error code. + } + /* check for RCVDAVIRQ and generate error if not present */ + /* the only case when absence of RCVDAVIRQ makes sense is when toggle error occurred. Need to add handling for that */ + if ((regRd(rHIRQ) & bmRCVDAVIRQ) == 0) { + //printf(">>>>>>>> Problem! NO RCVDAVIRQ!\r\n"); + rcode = 0xF0; //receive error + break; + } + pktsize = regRd(rRCVBC); //number of received bytes + //printf("Got %i bytes \r\n", pktsize); + // This would be OK, but... + //assert(pktsize <= nbytes); + if (pktsize > nbytes) { + // This can happen. Use of assert on Arduino locks up the Arduino. + // So I will trim the value, and hope for the best. + //printf(">>>>>>>> Problem! Wanted %i bytes but got %i.\r\n", nbytes, pktsize); + pktsize = nbytes; + } + + int16_t mem_left = (int16_t)nbytes - *((int16_t*)nbytesptr); + if (mem_left < 0) mem_left = 0; + + data = bytesRd(rRCVFIFO, ((pktsize > mem_left) ? mem_left : pktsize), data); + + regWr(rHIRQ, bmRCVDAVIRQ); // Clear the IRQ & free the buffer + *nbytesptr += pktsize; // add this packet's byte count to total transfer length + + /* The transfer is complete under two conditions: */ + /* 1. The device sent a short packet (L.T. maxPacketSize) */ + /* 2. 'nbytes' have been transferred. */ + if (pktsize < maxpktsize || *nbytesptr >= nbytes) { // Transferred 'nbytes' bytes? + // Save toggle value + pep->bmRcvToggle = ((regRd(rHRSL) & bmRCVTOGRD)) ? 1 : 0; + //printf("\r\n"); + rcode = 0; + break; + } + else if (bInterval > 0) + delay(bInterval); // Delay according to polling interval + } + return rcode; } /* OUT transfer to arbitrary endpoint. Handles multiple packets if necessary. Transfers 'nbytes' bytes. */ @@ -302,336 +289,324 @@ uint8_t USB::InTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t *nbytesptr, ui /* rcode 0 if no errors. rcode 01-0f is relayed from HRSL */ uint8_t USB::outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* data) { - EpInfo *pep = NULL; - uint16_t nak_limit = 0; - - uint8_t rcode = SetAddress(addr, ep, &pep, &nak_limit); + EpInfo *pep = NULL; + uint16_t nak_limit = 0; - if(rcode) - return rcode; + uint8_t rcode = SetAddress(addr, ep, &pep, &nak_limit); + if (rcode) return rcode; - return OutTransfer(pep, nak_limit, nbytes, data); + return OutTransfer(pep, nak_limit, nbytes, data); } uint8_t USB::OutTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t nbytes, uint8_t *data) { - uint8_t rcode = hrSUCCESS, retry_count; - uint8_t *data_p = data; //local copy of the data pointer - uint16_t bytes_tosend, nak_count; - uint16_t bytes_left = nbytes; - - uint8_t maxpktsize = pep->maxPktSize; - - if(maxpktsize < 1 || maxpktsize > 64) - return USB_ERROR_INVALID_MAX_PKT_SIZE; - - uint32_t timeout = (uint32_t)millis() + USB_XFER_TIMEOUT; - - regWr(rHCTL, (pep->bmSndToggle) ? bmSNDTOG1 : bmSNDTOG0); //set toggle value - - while(bytes_left) { - retry_count = 0; - nak_count = 0; - bytes_tosend = (bytes_left >= maxpktsize) ? maxpktsize : bytes_left; - bytesWr(rSNDFIFO, bytes_tosend, data_p); //filling output FIFO - regWr(rSNDBC, bytes_tosend); //set number of bytes - regWr(rHXFR, (tokOUT | pep->epAddr)); //dispatch packet - while(!(regRd(rHIRQ) & bmHXFRDNIRQ)); //wait for the completion IRQ - regWr(rHIRQ, bmHXFRDNIRQ); //clear IRQ - rcode = (regRd(rHRSL) & 0x0f); - - while(rcode && ((int32_t)((uint32_t)millis() - timeout) < 0L)) { - switch(rcode) { - case hrNAK: - nak_count++; - if(nak_limit && (nak_count == nak_limit)) - goto breakout; - //return ( rcode); - break; - case hrTIMEOUT: - retry_count++; - if(retry_count == USB_RETRY_LIMIT) - goto breakout; - //return ( rcode); - break; - case hrTOGERR: - // yes, we flip it wrong here so that next time it is actually correct! - pep->bmSndToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 0 : 1; - regWr(rHCTL, (pep->bmSndToggle) ? bmSNDTOG1 : bmSNDTOG0); //set toggle value - break; - default: - goto breakout; - }//switch( rcode - - /* process NAK according to Host out NAK bug */ - regWr(rSNDBC, 0); - regWr(rSNDFIFO, *data_p); - regWr(rSNDBC, bytes_tosend); - regWr(rHXFR, (tokOUT | pep->epAddr)); //dispatch packet - while(!(regRd(rHIRQ) & bmHXFRDNIRQ)); //wait for the completion IRQ - regWr(rHIRQ, bmHXFRDNIRQ); //clear IRQ - rcode = (regRd(rHRSL) & 0x0f); - }//while( rcode && .... - bytes_left -= bytes_tosend; - data_p += bytes_tosend; - }//while( bytes_left... + uint8_t rcode = hrSUCCESS, retry_count; + uint8_t *data_p = data; //local copy of the data pointer + uint16_t bytes_tosend, nak_count; + uint16_t bytes_left = nbytes; + + uint8_t maxpktsize = pep->maxPktSize; + + if (maxpktsize < 1 || maxpktsize > 64) + return USB_ERROR_INVALID_MAX_PKT_SIZE; + + uint32_t timeout = (uint32_t)millis() + USB_XFER_TIMEOUT; + + regWr(rHCTL, (pep->bmSndToggle) ? bmSNDTOG1 : bmSNDTOG0); //set toggle value + + while (bytes_left) { + retry_count = 0; + nak_count = 0; + bytes_tosend = (bytes_left >= maxpktsize) ? maxpktsize : bytes_left; + bytesWr(rSNDFIFO, bytes_tosend, data_p); //filling output FIFO + regWr(rSNDBC, bytes_tosend); //set number of bytes + regWr(rHXFR, (tokOUT | pep->epAddr)); //dispatch packet + while (!(regRd(rHIRQ) & bmHXFRDNIRQ)); //wait for the completion IRQ + regWr(rHIRQ, bmHXFRDNIRQ); //clear IRQ + rcode = (regRd(rHRSL) & 0x0F); + + while (rcode && ((int32_t)((uint32_t)millis() - timeout) < 0L)) { + switch (rcode) { + case hrNAK: + nak_count++; + if (nak_limit && (nak_count == nak_limit)) + goto breakout; + //return ( rcode); + break; + case hrTIMEOUT: + retry_count++; + if (retry_count == USB_RETRY_LIMIT) + goto breakout; + //return ( rcode); + break; + case hrTOGERR: + // yes, we flip it wrong here so that next time it is actually correct! + pep->bmSndToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 0 : 1; + regWr(rHCTL, (pep->bmSndToggle) ? bmSNDTOG1 : bmSNDTOG0); //set toggle value + break; + default: + goto breakout; + } + + /* process NAK according to Host out NAK bug */ + regWr(rSNDBC, 0); + regWr(rSNDFIFO, *data_p); + regWr(rSNDBC, bytes_tosend); + regWr(rHXFR, (tokOUT | pep->epAddr)); //dispatch packet + while (!(regRd(rHIRQ) & bmHXFRDNIRQ)); //wait for the completion IRQ + regWr(rHIRQ, bmHXFRDNIRQ); //clear IRQ + rcode = (regRd(rHRSL) & 0x0F); + } // while rcode && .... + bytes_left -= bytes_tosend; + data_p += bytes_tosend; + } // while bytes_left... breakout: - pep->bmSndToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 1 : 0; //bmSNDTOG1 : bmSNDTOG0; //update toggle - return ( rcode); //should be 0 in all cases + pep->bmSndToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 1 : 0; //bmSNDTOG1 : bmSNDTOG0; //update toggle + return ( rcode); //should be 0 in all cases } + /* dispatch USB packet. Assumes peripheral address is set and relevant buffer is loaded/empty */ /* If NAK, tries to re-send up to nak_limit times */ /* If nak_limit == 0, do not count NAKs, exit after timeout */ /* If bus timeout, re-sends up to USB_RETRY_LIMIT times */ -/* return codes 0x00-0x0f are HRSLT( 0x00 being success ), 0xff means timeout */ +/* return codes 0x00-0x0F are HRSLT( 0x00 being success ), 0xFF means timeout */ uint8_t USB::dispatchPkt(uint8_t token, uint8_t ep, uint16_t nak_limit) { - uint32_t timeout = (uint32_t)millis() + USB_XFER_TIMEOUT; - uint8_t tmpdata; - uint8_t rcode = hrSUCCESS; - uint8_t retry_count = 0; - uint16_t nak_count = 0; - - while((int32_t)((uint32_t)millis() - timeout) < 0L) { -#if defined(ESP8266) || defined(ESP32) - yield(); // needed in order to reset the watchdog timer on the ESP8266 -#endif - regWr(rHXFR, (token | ep)); //launch the transfer - rcode = USB_ERROR_TRANSFER_TIMEOUT; - - while((int32_t)((uint32_t)millis() - timeout) < 0L) //wait for transfer completion - { -#if defined(ESP8266) || defined(ESP32) - yield(); // needed in order to reset the watchdog timer on the ESP8266 -#endif - tmpdata = regRd(rHIRQ); - - if(tmpdata & bmHXFRDNIRQ) { - regWr(rHIRQ, bmHXFRDNIRQ); //clear the interrupt - rcode = 0x00; - break; - }//if( tmpdata & bmHXFRDNIRQ - - }//while ( millis() < timeout - - //if (rcode != 0x00) //exit if timeout - // return ( rcode); - - rcode = (regRd(rHRSL) & 0x0f); //analyze transfer result - - switch(rcode) { - case hrNAK: - nak_count++; - if(nak_limit && (nak_count == nak_limit)) - return (rcode); - break; - case hrTIMEOUT: - retry_count++; - if(retry_count == USB_RETRY_LIMIT) - return (rcode); - break; - default: - return (rcode); - }//switch( rcode - - }//while( timeout > millis() - return ( rcode); + uint32_t timeout = (uint32_t)millis() + USB_XFER_TIMEOUT; + uint8_t tmpdata; + uint8_t rcode = hrSUCCESS; + uint8_t retry_count = 0; + uint16_t nak_count = 0; + + while ((int32_t)((uint32_t)millis() - timeout) < 0L) { + #if defined(ESP8266) || defined(ESP32) + yield(); // needed in order to reset the watchdog timer on the ESP8266 + #endif + regWr(rHXFR, (token | ep)); //launch the transfer + rcode = USB_ERROR_TRANSFER_TIMEOUT; + + while ((int32_t)((uint32_t)millis() - timeout) < 0L) { //wait for transfer completion + #if defined(ESP8266) || defined(ESP32) + yield(); // needed to reset the watchdog timer on the ESP8266 + #endif + tmpdata = regRd(rHIRQ); + + if (tmpdata & bmHXFRDNIRQ) { + regWr(rHIRQ, bmHXFRDNIRQ); //clear the interrupt + rcode = 0x00; + break; + } + + } // while millis() < timeout + + //if (rcode != 0x00) //exit if timeout + // return ( rcode); + + rcode = (regRd(rHRSL) & 0x0F); //analyze transfer result + + switch (rcode) { + case hrNAK: + nak_count++; + if (nak_limit && (nak_count == nak_limit)) + return (rcode); + break; + case hrTIMEOUT: + retry_count++; + if (retry_count == USB_RETRY_LIMIT) + return (rcode); + break; + default: + return (rcode); + } + + } // while timeout > millis() + return rcode; } /* USB main task. Performs enumeration/cleanup */ -void USB::Task(void) //USB state machine -{ - uint8_t rcode; - uint8_t tmpdata; - static uint32_t delay = 0; - //USB_DEVICE_DESCRIPTOR buf; - bool lowspeed = false; - - MAX3421E::Task(); - - tmpdata = getVbusState(); - - /* modify USB task state if Vbus changed */ - switch(tmpdata) { - case SE1: //illegal state - usb_task_state = USB_DETACHED_SUBSTATE_ILLEGAL; - lowspeed = false; - break; - case SE0: //disconnected - if((usb_task_state & USB_STATE_MASK) != USB_STATE_DETACHED) - usb_task_state = USB_DETACHED_SUBSTATE_INITIALIZE; - lowspeed = false; - break; - case LSHOST: - - lowspeed = true; - //intentional fallthrough - case FSHOST: //attached - if((usb_task_state & USB_STATE_MASK) == USB_STATE_DETACHED) { - delay = (uint32_t)millis() + USB_SETTLE_DELAY; - usb_task_state = USB_ATTACHED_SUBSTATE_SETTLE; - } - break; - }// switch( tmpdata - - for(uint8_t i = 0; i < USB_NUMDEVICES; i++) - if(devConfig[i]) - rcode = devConfig[i]->Poll(); - - switch(usb_task_state) { - case USB_DETACHED_SUBSTATE_INITIALIZE: - init(); - - for(uint8_t i = 0; i < USB_NUMDEVICES; i++) - if(devConfig[i]) - rcode = devConfig[i]->Release(); - - usb_task_state = USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE; - break; - case USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE: //just sit here - break; - case USB_DETACHED_SUBSTATE_ILLEGAL: //just sit here - break; - case USB_ATTACHED_SUBSTATE_SETTLE: //settle time for just attached device - if((int32_t)((uint32_t)millis() - delay) >= 0L) - usb_task_state = USB_ATTACHED_SUBSTATE_RESET_DEVICE; - else break; // don't fall through - case USB_ATTACHED_SUBSTATE_RESET_DEVICE: - regWr(rHCTL, bmBUSRST); //issue bus reset - usb_task_state = USB_ATTACHED_SUBSTATE_WAIT_RESET_COMPLETE; - break; - case USB_ATTACHED_SUBSTATE_WAIT_RESET_COMPLETE: - if((regRd(rHCTL) & bmBUSRST) == 0) { - tmpdata = regRd(rMODE) | bmSOFKAENAB; //start SOF generation - regWr(rMODE, tmpdata); - usb_task_state = USB_ATTACHED_SUBSTATE_WAIT_SOF; - //delay = (uint32_t)millis() + 20; //20ms wait after reset per USB spec - } - break; - case USB_ATTACHED_SUBSTATE_WAIT_SOF: //todo: change check order - if(regRd(rHIRQ) & bmFRAMEIRQ) { - //when first SOF received _and_ 20ms has passed we can continue - /* - if (delay < (uint32_t)millis()) //20ms passed - usb_task_state = USB_STATE_CONFIGURING; - */ - usb_task_state = USB_ATTACHED_SUBSTATE_WAIT_RESET; - delay = (uint32_t)millis() + 20; - } - break; - case USB_ATTACHED_SUBSTATE_WAIT_RESET: - if((int32_t)((uint32_t)millis() - delay) >= 0L) usb_task_state = USB_STATE_CONFIGURING; - else break; // don't fall through - case USB_STATE_CONFIGURING: - - //Serial.print("\r\nConf.LS: "); - //Serial.println(lowspeed, HEX); - - rcode = Configuring(0, 0, lowspeed); - - if(rcode) { - if(rcode != USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE) { - usb_error = rcode; - usb_task_state = USB_STATE_ERROR; - } - } else - usb_task_state = USB_STATE_RUNNING; - break; - case USB_STATE_RUNNING: - break; - case USB_STATE_ERROR: - //MAX3421E::Init(); - break; - } // switch( usb_task_state ) +void USB::Task(void) { //USB state machine + uint8_t rcode; + uint8_t tmpdata; + static uint32_t delay = 0; + //USB_DEVICE_DESCRIPTOR buf; + bool lowspeed = false; + + MAX3421E::Task(); + + tmpdata = getVbusState(); + + /* modify USB task state if Vbus changed */ + switch (tmpdata) { + case SE1: //illegal state + usb_task_state = USB_DETACHED_SUBSTATE_ILLEGAL; + lowspeed = false; + break; + case SE0: //disconnected + if ((usb_task_state & USB_STATE_MASK) != USB_STATE_DETACHED) + usb_task_state = USB_DETACHED_SUBSTATE_INITIALIZE; + lowspeed = false; + break; + case LSHOST: + lowspeed = true; + //intentional fallthrough + case FSHOST: //attached + if ((usb_task_state & USB_STATE_MASK) == USB_STATE_DETACHED) { + delay = (uint32_t)millis() + USB_SETTLE_DELAY; + usb_task_state = USB_ATTACHED_SUBSTATE_SETTLE; + } + break; + } + + for (uint8_t i = 0; i < USB_NUMDEVICES; i++) + if (devConfig[i]) rcode = devConfig[i]->Poll(); + + switch (usb_task_state) { + case USB_DETACHED_SUBSTATE_INITIALIZE: + init(); + + for (uint8_t i = 0; i < USB_NUMDEVICES; i++) + if (devConfig[i]) + rcode = devConfig[i]->Release(); + + usb_task_state = USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE; + break; + case USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE: //just sit here + break; + case USB_DETACHED_SUBSTATE_ILLEGAL: //just sit here + break; + case USB_ATTACHED_SUBSTATE_SETTLE: //settle time for just attached device + if ((int32_t)((uint32_t)millis() - delay) >= 0L) + usb_task_state = USB_ATTACHED_SUBSTATE_RESET_DEVICE; + else break; // don't fall through + case USB_ATTACHED_SUBSTATE_RESET_DEVICE: + regWr(rHCTL, bmBUSRST); //issue bus reset + usb_task_state = USB_ATTACHED_SUBSTATE_WAIT_RESET_COMPLETE; + break; + case USB_ATTACHED_SUBSTATE_WAIT_RESET_COMPLETE: + if ((regRd(rHCTL) & bmBUSRST) == 0) { + tmpdata = regRd(rMODE) | bmSOFKAENAB; //start SOF generation + regWr(rMODE, tmpdata); + usb_task_state = USB_ATTACHED_SUBSTATE_WAIT_SOF; + //delay = (uint32_t)millis() + 20; //20ms wait after reset per USB spec + } + break; + case USB_ATTACHED_SUBSTATE_WAIT_SOF: //todo: change check order + if (regRd(rHIRQ) & bmFRAMEIRQ) { + //when first SOF received _and_ 20ms has passed we can continue + /* + if (delay < (uint32_t)millis()) //20ms passed + usb_task_state = USB_STATE_CONFIGURING; + */ + usb_task_state = USB_ATTACHED_SUBSTATE_WAIT_RESET; + delay = (uint32_t)millis() + 20; + } + break; + case USB_ATTACHED_SUBSTATE_WAIT_RESET: + if ((int32_t)((uint32_t)millis() - delay) >= 0L) usb_task_state = USB_STATE_CONFIGURING; + else break; // don't fall through + case USB_STATE_CONFIGURING: + + //Serial.print("\r\nConf.LS: "); + //Serial.println(lowspeed, HEX); + + rcode = Configuring(0, 0, lowspeed); + + if (!rcode) + usb_task_state = USB_STATE_RUNNING; + else if (rcode != USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE) { + usb_error = rcode; + usb_task_state = USB_STATE_ERROR; + } + break; + case USB_STATE_RUNNING: + break; + case USB_STATE_ERROR: + //MAX3421E::Init(); + break; + } } uint8_t USB::DefaultAddressing(uint8_t parent, uint8_t port, bool lowspeed) { - //uint8_t buf[12]; - uint8_t rcode; - UsbDevice *p0 = NULL, *p = NULL; - - // Get pointer to pseudo device with address 0 assigned - p0 = addrPool.GetUsbDevicePtr(0); - - if(!p0) - return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL; - - if(!p0->epinfo) - return USB_ERROR_EPINFO_IS_NULL; - - p0->lowspeed = (lowspeed) ? true : false; + //uint8_t buf[12]; + uint8_t rcode; + UsbDevice *p0 = NULL, *p = NULL; - // Allocate new address according to device class - uint8_t bAddress = addrPool.AllocAddress(parent, false, port); + // Get pointer to pseudo device with address 0 assigned + p0 = addrPool.GetUsbDevicePtr(0); + if (!p0) return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL; + if (!p0->epinfo) return USB_ERROR_EPINFO_IS_NULL; - if(!bAddress) - return USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL; + p0->lowspeed = lowspeed; - p = addrPool.GetUsbDevicePtr(bAddress); + // Allocate new address according to device class + uint8_t bAddress = addrPool.AllocAddress(parent, false, port); + if (!bAddress) return USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL; - if(!p) - return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL; + p = addrPool.GetUsbDevicePtr(bAddress); + if (!p) return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL; - p->lowspeed = lowspeed; + p->lowspeed = lowspeed; - // Assign new address to the device - rcode = setAddr(0, 0, bAddress); - - if(rcode) { - addrPool.FreeAddress(bAddress); - bAddress = 0; - return rcode; - } - return 0; -}; + // Assign new address to the device + rcode = setAddr(0, 0, bAddress); + if (rcode) { + addrPool.FreeAddress(bAddress); + bAddress = 0; + } + return rcode; +} uint8_t USB::AttemptConfig(uint8_t driver, uint8_t parent, uint8_t port, bool lowspeed) { - //printf("AttemptConfig: parent = %i, port = %i\r\n", parent, port); - uint8_t retries = 0; + //printf("AttemptConfig: parent = %i, port = %i\r\n", parent, port); + uint8_t retries = 0; again: - uint8_t rcode = devConfig[driver]->ConfigureDevice(parent, port, lowspeed); - if(rcode == USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET) { - if(parent == 0) { - // Send a bus reset on the root interface. - regWr(rHCTL, bmBUSRST); //issue bus reset - delay(102); // delay 102ms, compensate for clock inaccuracy. - } else { - // reset parent port - devConfig[parent]->ResetHubPort(port); - } - } else if(rcode == hrJERR && retries < 3) { // Some devices returns this when plugged in - trying to initialize the device again usually works - delay(100); - retries++; - goto again; - } else if(rcode) - return rcode; - - rcode = devConfig[driver]->Init(parent, port, lowspeed); - if(rcode == hrJERR && retries < 3) { // Some devices returns this when plugged in - trying to initialize the device again usually works - delay(100); - retries++; - goto again; - } - if(rcode) { - // Issue a bus reset, because the device may be in a limbo state - if(parent == 0) { - // Send a bus reset on the root interface. - regWr(rHCTL, bmBUSRST); //issue bus reset - delay(102); // delay 102ms, compensate for clock inaccuracy. - } else { - // reset parent port - devConfig[parent]->ResetHubPort(port); - } - } - return rcode; + uint8_t rcode = devConfig[driver]->ConfigureDevice(parent, port, lowspeed); + if (rcode == USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET) { + if (parent == 0) { + // Send a bus reset on the root interface. + regWr(rHCTL, bmBUSRST); //issue bus reset + delay(102); // delay 102ms, compensate for clock inaccuracy. + } + else { + // reset parent port + devConfig[parent]->ResetHubPort(port); + } + } + else if (rcode == hrJERR && retries < 3) { // Some devices returns this when plugged in - trying to initialize the device again usually works + delay(100); + retries++; + goto again; + } + else if (rcode) + return rcode; + + rcode = devConfig[driver]->Init(parent, port, lowspeed); + if (rcode == hrJERR && retries < 3) { // Some devices returns this when plugged in - trying to initialize the device again usually works + delay(100); + retries++; + goto again; + } + + if (rcode) { + // Issue a bus reset, because the device may be in a limbo state + if (parent == 0) { + // Send a bus reset on the root interface. + regWr(rHCTL, bmBUSRST); //issue bus reset + delay(102); // delay 102ms, compensate for clock inaccuracy. + } + else { + // reset parent port + devConfig[parent]->ResetHubPort(port); + } + } + return rcode; } -/* - * This is broken. We need to enumerate differently. +/** + * This is broken. It needs to enumerate differently. * It causes major problems with several devices if detected in an unexpected order. * - * * Oleg - I wouldn't do anything before the newly connected device is considered sane. * i.e.(delays are not indicated for brevity): * 1. reset @@ -648,7 +623,7 @@ uint8_t USB::AttemptConfig(uint8_t driver, uint8_t parent, uint8_t port, bool lo * 4: set address * 5: pUsb->setEpInfoEntry(bAddress, 1, epInfo), exit on fail * 6: while (configurations) { - * for(each configuration) { + * for (each configuration) { * for (each driver) { * 6a: Ask device if it likes configuration. Returns 0 on OK. * If successful, the driver configured device. @@ -662,170 +637,161 @@ uint8_t USB::AttemptConfig(uint8_t driver, uint8_t parent, uint8_t port, bool lo * } * } * } - * 7: for(each driver) { + * 7: for (each driver) { * 7a: Ask device if it knows this VID/PID. Acts exactly like 6a, but using VID/PID * 8: if we get here, no driver likes the device plugged in, so exit failure. * */ uint8_t USB::Configuring(uint8_t parent, uint8_t port, bool lowspeed) { - //uint8_t bAddress = 0; - //printf("Configuring: parent = %i, port = %i\r\n", parent, port); - uint8_t devConfigIndex; - uint8_t rcode = 0; - uint8_t buf[sizeof (USB_DEVICE_DESCRIPTOR)]; - USB_DEVICE_DESCRIPTOR *udd = reinterpret_cast(buf); - UsbDevice *p = NULL; - EpInfo *oldep_ptr = NULL; - EpInfo epInfo; - - epInfo.epAddr = 0; - epInfo.maxPktSize = 8; - epInfo.bmSndToggle = 0; - epInfo.bmRcvToggle = 0; - epInfo.bmNakPower = USB_NAK_MAX_POWER; - - //delay(2000); - AddressPool &addrPool = GetAddressPool(); - // Get pointer to pseudo device with address 0 assigned - p = addrPool.GetUsbDevicePtr(0); - if(!p) { - //printf("Configuring error: USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL\r\n"); - return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL; - } - - // Save old pointer to EP_RECORD of address 0 - oldep_ptr = p->epinfo; - - // Temporary assign new pointer to epInfo to p->epinfo in order to - // avoid toggle inconsistence - - p->epinfo = &epInfo; - - p->lowspeed = lowspeed; - // Get device descriptor - rcode = getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf); - - // Restore p->epinfo - p->epinfo = oldep_ptr; - - if(rcode) { - //printf("Configuring error: Can't get USB_DEVICE_DESCRIPTOR\r\n"); - return rcode; - } - - // to-do? - // Allocate new address according to device class - //bAddress = addrPool.AllocAddress(parent, false, port); - - uint16_t vid = udd->idVendor; - uint16_t pid = udd->idProduct; - uint8_t klass = udd->bDeviceClass; - uint8_t subklass = udd->bDeviceSubClass; - // Attempt to configure if VID/PID or device class matches with a driver - // Qualify with subclass too. - // - // VID/PID & class tests default to false for drivers not yet ported - // subclass defaults to true, so you don't have to define it if you don't have to. - // - for(devConfigIndex = 0; devConfigIndex < USB_NUMDEVICES; devConfigIndex++) { - if(!devConfig[devConfigIndex]) continue; // no driver - if(devConfig[devConfigIndex]->GetAddress()) continue; // consumed - if(devConfig[devConfigIndex]->DEVSUBCLASSOK(subklass) && (devConfig[devConfigIndex]->VIDPIDOK(vid, pid) || devConfig[devConfigIndex]->DEVCLASSOK(klass))) { - rcode = AttemptConfig(devConfigIndex, parent, port, lowspeed); - if(rcode != USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED) - break; - } - } - - if(devConfigIndex < USB_NUMDEVICES) { - return rcode; - } - - - // blindly attempt to configure - for(devConfigIndex = 0; devConfigIndex < USB_NUMDEVICES; devConfigIndex++) { - if(!devConfig[devConfigIndex]) continue; - if(devConfig[devConfigIndex]->GetAddress()) continue; // consumed - if(devConfig[devConfigIndex]->DEVSUBCLASSOK(subklass) && (devConfig[devConfigIndex]->VIDPIDOK(vid, pid) || devConfig[devConfigIndex]->DEVCLASSOK(klass))) continue; // If this is true it means it must have returned USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED above - rcode = AttemptConfig(devConfigIndex, parent, port, lowspeed); - - //printf("ERROR ENUMERATING %2.2x\r\n", rcode); - if(!(rcode == USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED || rcode == USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE)) { - // in case of an error dev_index should be reset to 0 - // in order to start from the very beginning the - // next time the program gets here - //if (rcode != USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE) - // devConfigIndex = 0; - return rcode; - } - } - // if we get here that means that the device class is not supported by any of registered classes - rcode = DefaultAddressing(parent, port, lowspeed); - - return rcode; + //uint8_t bAddress = 0; + //printf("Configuring: parent = %i, port = %i\r\n", parent, port); + uint8_t devConfigIndex; + uint8_t rcode = 0; + uint8_t buf[sizeof (USB_DEVICE_DESCRIPTOR)]; + USB_DEVICE_DESCRIPTOR *udd = reinterpret_cast(buf); + UsbDevice *p = NULL; + EpInfo *oldep_ptr = NULL; + EpInfo epInfo; + + epInfo.epAddr = 0; + epInfo.maxPktSize = 8; + epInfo.bmSndToggle = 0; + epInfo.bmRcvToggle = 0; + epInfo.bmNakPower = USB_NAK_MAX_POWER; + + //delay(2000); + AddressPool &addrPool = GetAddressPool(); + // Get pointer to pseudo device with address 0 assigned + p = addrPool.GetUsbDevicePtr(0); + if (!p) { + //printf("Configuring error: USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL\r\n"); + return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL; + } + + // Save old pointer to EP_RECORD of address 0 + oldep_ptr = p->epinfo; + + // Temporary assign new pointer to epInfo to p->epinfo in order to + // avoid toggle inconsistence + + p->epinfo = &epInfo; + + p->lowspeed = lowspeed; + // Get device descriptor + rcode = getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf); + + // Restore p->epinfo + p->epinfo = oldep_ptr; + + if (rcode) { + //printf("Configuring error: Can't get USB_DEVICE_DESCRIPTOR\r\n"); + return rcode; + } + + // to-do? + // Allocate new address according to device class + //bAddress = addrPool.AllocAddress(parent, false, port); + + uint16_t vid = udd->idVendor, pid = udd->idProduct; + uint8_t klass = udd->bDeviceClass, subklass = udd->bDeviceSubClass; + + // Attempt to configure if VID/PID or device class matches with a driver + // Qualify with subclass too. + // + // VID/PID & class tests default to false for drivers not yet ported + // subclass defaults to true, so you don't have to define it if you don't have to. + // + for (devConfigIndex = 0; devConfigIndex < USB_NUMDEVICES; devConfigIndex++) { + if (!devConfig[devConfigIndex]) continue; // no driver + if (devConfig[devConfigIndex]->GetAddress()) continue; // consumed + if (devConfig[devConfigIndex]->DEVSUBCLASSOK(subklass) && (devConfig[devConfigIndex]->VIDPIDOK(vid, pid) || devConfig[devConfigIndex]->DEVCLASSOK(klass))) { + rcode = AttemptConfig(devConfigIndex, parent, port, lowspeed); + if (rcode != USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED) + break; + } + } + + if (devConfigIndex < USB_NUMDEVICES) return rcode; + + // blindly attempt to configure + for (devConfigIndex = 0; devConfigIndex < USB_NUMDEVICES; devConfigIndex++) { + if (!devConfig[devConfigIndex]) continue; + if (devConfig[devConfigIndex]->GetAddress()) continue; // consumed + if (devConfig[devConfigIndex]->DEVSUBCLASSOK(subklass) && (devConfig[devConfigIndex]->VIDPIDOK(vid, pid) || devConfig[devConfigIndex]->DEVCLASSOK(klass))) continue; // If this is true it means it must have returned USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED above + rcode = AttemptConfig(devConfigIndex, parent, port, lowspeed); + + //printf("ERROR ENUMERATING %2.2x\r\n", rcode); + if (!(rcode == USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED || rcode == USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE)) { + // in case of an error dev_index should be reset to 0 + // in order to start from the very beginning the + // next time the program gets here + //if (rcode != USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE) + // devConfigIndex = 0; + return rcode; + } + } + // Arriving here means the device class is unsupported by registered classes + return DefaultAddressing(parent, port, lowspeed); } uint8_t USB::ReleaseDevice(uint8_t addr) { - if(!addr) - return 0; - - for(uint8_t i = 0; i < USB_NUMDEVICES; i++) { - if(!devConfig[i]) continue; - if(devConfig[i]->GetAddress() == addr) - return devConfig[i]->Release(); - } - return 0; + if (addr) { + for (uint8_t i = 0; i < USB_NUMDEVICES; i++) { + if (!devConfig[i]) continue; + if (devConfig[i]->GetAddress() == addr) + return devConfig[i]->Release(); + } + } + return 0; } #if 1 //!defined(USB_METHODS_INLINE) //get device descriptor uint8_t USB::getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr) { - return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, 0x00, USB_DESCRIPTOR_DEVICE, 0x0000, nbytes, nbytes, dataptr, NULL)); + return ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, 0x00, USB_DESCRIPTOR_DEVICE, 0x0000, nbytes, nbytes, dataptr, NULL); } //get configuration descriptor uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr) { - return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, conf, USB_DESCRIPTOR_CONFIGURATION, 0x0000, nbytes, nbytes, dataptr, NULL)); + return ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, conf, USB_DESCRIPTOR_CONFIGURATION, 0x0000, nbytes, nbytes, dataptr, NULL); } /* Requests Configuration Descriptor. Sends two Get Conf Descr requests. The first one gets the total length of all descriptors, then the second one requests this total length. The length of the first request can be shorter ( 4 bytes ), however, there are devices which won't work unless this length is set to 9 */ uint8_t USB::getConfDescr(uint8_t addr, uint8_t ep, uint8_t conf, USBReadParser *p) { - const uint8_t bufSize = 64; - uint8_t buf[bufSize]; - USB_CONFIGURATION_DESCRIPTOR *ucd = reinterpret_cast(buf); - - uint8_t ret = getConfDescr(addr, ep, 9, conf, buf); + const uint8_t bufSize = 64; + uint8_t buf[bufSize]; + USB_CONFIGURATION_DESCRIPTOR *ucd = reinterpret_cast(buf); - if(ret) - return ret; + uint8_t ret = getConfDescr(addr, ep, 9, conf, buf); + if (ret) return ret; - uint16_t total = ucd->wTotalLength; + uint16_t total = ucd->wTotalLength; - //USBTRACE2("\r\ntotal conf.size:", total); + //USBTRACE2("\r\ntotal conf.size:", total); - return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, conf, USB_DESCRIPTOR_CONFIGURATION, 0x0000, total, bufSize, buf, p)); + return ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, conf, USB_DESCRIPTOR_CONFIGURATION, 0x0000, total, bufSize, buf, p); } //get string descriptor uint8_t USB::getStrDescr(uint8_t addr, uint8_t ep, uint16_t ns, uint8_t index, uint16_t langid, uint8_t* dataptr) { - return ( ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, index, USB_DESCRIPTOR_STRING, langid, ns, ns, dataptr, NULL)); + return ctrlReq(addr, ep, bmREQ_GET_DESCR, USB_REQUEST_GET_DESCRIPTOR, index, USB_DESCRIPTOR_STRING, langid, ns, ns, dataptr, NULL); } //set address uint8_t USB::setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr) { - uint8_t rcode = ctrlReq(oldaddr, ep, bmREQ_SET, USB_REQUEST_SET_ADDRESS, newaddr, 0x00, 0x0000, 0x0000, 0x0000, NULL, NULL); - //delay(2); //per USB 2.0 sect.9.2.6.3 - delay(300); // Older spec says you should wait at least 200ms - return rcode; - //return ( ctrlReq(oldaddr, ep, bmREQ_SET, USB_REQUEST_SET_ADDRESS, newaddr, 0x00, 0x0000, 0x0000, 0x0000, NULL, NULL)); + uint8_t rcode = ctrlReq(oldaddr, ep, bmREQ_SET, USB_REQUEST_SET_ADDRESS, newaddr, 0x00, 0x0000, 0x0000, 0x0000, NULL, NULL); + //delay(2); //per USB 2.0 sect.9.2.6.3 + delay(300); // Older spec says you should wait at least 200ms + return rcode; + //return ctrlReq(oldaddr, ep, bmREQ_SET, USB_REQUEST_SET_ADDRESS, newaddr, 0x00, 0x0000, 0x0000, 0x0000, NULL, NULL); } //set configuration uint8_t USB::setConf(uint8_t addr, uint8_t ep, uint8_t conf_value) { - return ( ctrlReq(addr, ep, bmREQ_SET, USB_REQUEST_SET_CONFIGURATION, conf_value, 0x00, 0x0000, 0x0000, 0x0000, NULL, NULL)); + return ctrlReq(addr, ep, bmREQ_SET, USB_REQUEST_SET_CONFIGURATION, conf_value, 0x00, 0x0000, 0x0000, 0x0000, NULL, NULL); } #endif // defined(USB_METHODS_INLINE) diff --git a/Marlin/src/sd/usb_flashdrive/lib/Usb.h b/Marlin/src/sd/usb_flashdrive/lib/Usb.h index fef7b814a3b5..5880f9de0015 100644 --- a/Marlin/src/sd/usb_flashdrive/lib/Usb.h +++ b/Marlin/src/sd/usb_flashdrive/lib/Usb.h @@ -1,28 +1,30 @@ -/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Contact information -------------------- - -Circuits At Home, LTD -Web : http://www.circuitsathome.com -e-mail : support@circuitsathome.com +/** + * Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Contact information + * ------------------- + * + * Circuits At Home, LTD + * Web : http://www.circuitsathome.com + * e-mail : support@circuitsathome.com */ +#pragma once + /* USB functions */ -#ifndef _usb_h_ #define _usb_h_ #include "../../../inc/MarlinConfigPre.h" @@ -49,4 +51,4 @@ e-mail : support@circuitsathome.com #include "parsetools.h" #include "confdescparser.h" -#endif //_usb_h_ +#undef _usb_h_ diff --git a/Marlin/src/sd/usb_flashdrive/lib/UsbCore.h b/Marlin/src/sd/usb_flashdrive/lib/UsbCore.h index 5bd60a680373..06443ffcd672 100644 --- a/Marlin/src/sd/usb_flashdrive/lib/UsbCore.h +++ b/Marlin/src/sd/usb_flashdrive/lib/UsbCore.h @@ -1,25 +1,26 @@ -/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Contact information -------------------- - -Circuits At Home, LTD -Web : http://www.circuitsathome.com -e-mail : support@circuitsathome.com +/** + * Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Contact information + * ------------------- + * + * Circuits At Home, LTD + * Web : http://www.circuitsathome.com + * e-mail : support@circuitsathome.com */ #ifndef _usb_h_ @@ -230,8 +231,8 @@ class USB : public MAX3421E { }; uint8_t RegisterDeviceClass(USBDeviceConfig *pdev) { - for(uint8_t i = 0; i < USB_NUMDEVICES; i++) { - if(!devConfig[i]) { + for (uint8_t i = 0; i < USB_NUMDEVICES; i++) { + if (!devConfig[i]) { devConfig[i] = pdev; return 0; } diff --git a/Marlin/src/sd/usb_flashdrive/lib/address.h b/Marlin/src/sd/usb_flashdrive/lib/address.h index 0cc0ab16e5c4..d55d896cc29c 100644 --- a/Marlin/src/sd/usb_flashdrive/lib/address.h +++ b/Marlin/src/sd/usb_flashdrive/lib/address.h @@ -1,33 +1,32 @@ -/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Contact information -------------------- - -Circuits At Home, LTD -Web : http://www.circuitsathome.com -e-mail : support@circuitsathome.com +/** + * Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Contact information + * ------------------- + * + * Circuits At Home, LTD + * Web : http://www.circuitsathome.com + * e-mail : support@circuitsathome.com */ +#pragma once -#if !defined(_usb_h_) || defined(__ADDRESS_H__) -#error "Never include address.h directly; include Usb.h instead" -#else -#define __ADDRESS_H__ - - +#ifndef _usb_h_ + #error "Never include address.h directly; include Usb.h instead" +#endif /* NAK powers. To save space in endpoint data structure, amount of retries before giving up and returning 0x4 is stored in */ /* bmNakPower as a power of 2. The actual nak_limit is then calculated as nak_limit = ( 2^bmNakPower - 1) */ @@ -37,18 +36,18 @@ e-mail : support@circuitsathome.com #define USB_NAK_NONAK 0 //Do not count NAKs, stop retrying after USB Timeout struct EpInfo { - uint8_t epAddr; // Endpoint address - uint8_t maxPktSize; // Maximum packet size - - union { - uint8_t epAttribs; - - struct { - uint8_t bmSndToggle : 1; // Send toggle, when zero bmSNDTOG0, bmSNDTOG1 otherwise - uint8_t bmRcvToggle : 1; // Send toggle, when zero bmRCVTOG0, bmRCVTOG1 otherwise - uint8_t bmNakPower : 6; // Binary order for NAK_LIMIT value - } __attribute__((packed)); - }; + uint8_t epAddr; // Endpoint address + uint8_t maxPktSize; // Maximum packet size + + union { + uint8_t epAttribs; + + struct { + uint8_t bmSndToggle : 1; // Send toggle, when zero bmSNDTOG0, bmSNDTOG1 otherwise + uint8_t bmRcvToggle : 1; // Send toggle, when zero bmRCVTOG0, bmRCVTOG1 otherwise + uint8_t bmNakPower : 6; // Binary order for NAK_LIMIT value + } __attribute__((packed)); + }; } __attribute__((packed)); // 7 6 5 4 3 2 1 0 @@ -62,17 +61,15 @@ struct EpInfo { // struct UsbDeviceAddress { - - union { - - struct { - uint8_t bmAddress : 3; // device address/port number - uint8_t bmParent : 3; // parent hub address - uint8_t bmHub : 1; // hub flag - uint8_t bmReserved : 1; // reserved, must be zero - } __attribute__((packed)); - uint8_t devAddress; - }; + union { + struct { + uint8_t bmAddress : 3; // device address/port number + uint8_t bmParent : 3; // parent hub address + uint8_t bmHub : 1; // hub flag + uint8_t bmReserved : 1; // reserved, must be zero + } __attribute__((packed)); + uint8_t devAddress; + }; } __attribute__((packed)); #define bmUSB_DEV_ADDR_ADDRESS 0x07 @@ -80,18 +77,18 @@ struct UsbDeviceAddress { #define bmUSB_DEV_ADDR_HUB 0x40 struct UsbDevice { - EpInfo *epinfo; // endpoint info pointer - UsbDeviceAddress address; - uint8_t epcount; // number of endpoints - bool lowspeed; // indicates if a device is the low speed one - // uint8_t devclass; // device class + EpInfo *epinfo; // endpoint info pointer + UsbDeviceAddress address; + uint8_t epcount; // number of endpoints + bool lowspeed; // indicates if a device is the low speed one + // uint8_t devclass; // device class } __attribute__((packed)); class AddressPool { -public: - virtual UsbDevice* GetUsbDevicePtr(uint8_t addr) = 0; - virtual uint8_t AllocAddress(uint8_t parent, bool is_hub = false, uint8_t port = 0) = 0; - virtual void FreeAddress(uint8_t addr) = 0; + public: + virtual UsbDevice* GetUsbDevicePtr(uint8_t addr) = 0; + virtual uint8_t AllocAddress(uint8_t parent, bool is_hub = false, uint8_t port = 0) = 0; + virtual void FreeAddress(uint8_t addr) = 0; }; typedef void (*UsbDeviceHandleFunc)(UsbDevice *pdev); @@ -101,190 +98,174 @@ typedef void (*UsbDeviceHandleFunc)(UsbDevice *pdev); template class AddressPoolImpl : public AddressPool { - EpInfo dev0ep; //Endpoint data structure used during enumeration for uninitialized device + EpInfo dev0ep; //Endpoint data structure used during enumeration for uninitialized device + + uint8_t hubCounter; // hub counter is kept + // in order to avoid hub address duplication - uint8_t hubCounter; // hub counter is kept - // in order to avoid hub address duplication + UsbDevice thePool[MAX_DEVICES_ALLOWED]; - UsbDevice thePool[MAX_DEVICES_ALLOWED]; + // Initialize address pool entry - // Initializes address pool entry + void InitEntry(uint8_t index) { + thePool[index].address.devAddress = 0; + thePool[index].epcount = 1; + thePool[index].lowspeed = 0; + thePool[index].epinfo = &dev0ep; + } - void InitEntry(uint8_t index) { - thePool[index].address.devAddress = 0; - thePool[index].epcount = 1; - thePool[index].lowspeed = 0; - thePool[index].epinfo = &dev0ep; - }; + // Return thePool index for a given address - // Returns thePool index for a given address + uint8_t FindAddressIndex(uint8_t address = 0) { + for (uint8_t i = 1; i < MAX_DEVICES_ALLOWED; i++) + if (thePool[i].address.devAddress == address) + return i; - uint8_t FindAddressIndex(uint8_t address = 0) { - for(uint8_t i = 1; i < MAX_DEVICES_ALLOWED; i++) { - if(thePool[i].address.devAddress == address) - return i; - } - return 0; - }; + return 0; + } - // Returns thePool child index for a given parent + // Return thePool child index for a given parent - uint8_t FindChildIndex(UsbDeviceAddress addr, uint8_t start = 1) { - for(uint8_t i = (start < 1 || start >= MAX_DEVICES_ALLOWED) ? 1 : start; i < MAX_DEVICES_ALLOWED; i++) { - if(thePool[i].address.bmParent == addr.bmAddress) - return i; - } - return 0; - }; + uint8_t FindChildIndex(UsbDeviceAddress addr, uint8_t start = 1) { + for (uint8_t i = (start < 1 || start >= MAX_DEVICES_ALLOWED) ? 1 : start; i < MAX_DEVICES_ALLOWED; i++) { + if (thePool[i].address.bmParent == addr.bmAddress) + return i; + } + return 0; + } - // Frees address entry specified by index parameter + // Frees address entry specified by index parameter - void FreeAddressByIndex(uint8_t index) { - // Zero field is reserved and should not be affected - if(index == 0) - return; + void FreeAddressByIndex(uint8_t index) { + // Zero field is reserved and should not be affected + if (index == 0) return; - UsbDeviceAddress uda = thePool[index].address; - // If a hub was switched off all port addresses should be freed - if(uda.bmHub == 1) { - for(uint8_t i = 1; (i = FindChildIndex(uda, i));) - FreeAddressByIndex(i); + UsbDeviceAddress uda = thePool[index].address; + // If a hub was switched off all port addresses should be freed + if (uda.bmHub == 1) { + for (uint8_t i = 1; (i = FindChildIndex(uda, i));) + FreeAddressByIndex(i); - // If the hub had the last allocated address, hubCounter should be decremented - if(hubCounter == uda.bmAddress) - hubCounter--; - } - InitEntry(index); - } + // If the hub had the last allocated address, hubCounter should be decremented + if (hubCounter == uda.bmAddress) hubCounter--; + } + InitEntry(index); + } - // Initializes the whole address pool at once + // Initialize the whole address pool at once - void InitAllAddresses() { - for(uint8_t i = 1; i < MAX_DEVICES_ALLOWED; i++) - InitEntry(i); + void InitAllAddresses() { + for (uint8_t i = 1; i < MAX_DEVICES_ALLOWED; i++) + InitEntry(i); - hubCounter = 0; - }; + hubCounter = 0; + } public: - AddressPoolImpl() : hubCounter(0) { - // Zero address is reserved - InitEntry(0); - - thePool[0].address.devAddress = 0; - thePool[0].epinfo = &dev0ep; - dev0ep.epAddr = 0; - dev0ep.maxPktSize = 8; - dev0ep.bmSndToggle = 0; // Set DATA0/1 toggles to 0 - dev0ep.bmRcvToggle = 0; - dev0ep.bmNakPower = USB_NAK_MAX_POWER; - - InitAllAddresses(); - }; - - // Returns a pointer to a specified address entry - - virtual UsbDevice* GetUsbDevicePtr(uint8_t addr) { - if(!addr) - return thePool; - - uint8_t index = FindAddressIndex(addr); - - return (!index) ? NULL : thePool + index; - }; - - // Performs an operation specified by pfunc for each addressed device - - void ForEachUsbDevice(UsbDeviceHandleFunc pfunc) { - if(!pfunc) - return; - - for(uint8_t i = 1; i < MAX_DEVICES_ALLOWED; i++) - if(thePool[i].address.devAddress) - pfunc(thePool + i); - }; - - // Allocates new address - - virtual uint8_t AllocAddress(uint8_t parent, bool is_hub = false, uint8_t port = 0) { - /* if (parent != 0 && port == 0) - USB_HOST_SERIAL.println("PRT:0"); */ - UsbDeviceAddress _parent; - _parent.devAddress = parent; - if(_parent.bmReserved || port > 7) - //if(parent > 127 || port > 7) - return 0; - - if(is_hub && hubCounter == 7) - return 0; - - // finds first empty address entry starting from one - uint8_t index = FindAddressIndex(0); - - if(!index) // if empty entry is not found - return 0; - - if(_parent.devAddress == 0) { - if(is_hub) { - thePool[index].address.devAddress = 0x41; - hubCounter++; - } else - thePool[index].address.devAddress = 1; - - return thePool[index].address.devAddress; - } - - UsbDeviceAddress addr; - addr.devAddress = 0; // Ensure all bits are zero - addr.bmParent = _parent.bmAddress; - if(is_hub) { - addr.bmHub = 1; - addr.bmAddress = ++hubCounter; - } else { - addr.bmHub = 0; - addr.bmAddress = port; - } - thePool[index].address = addr; - /* - USB_HOST_SERIAL.print("Addr:"); - USB_HOST_SERIAL.print(addr.bmHub, HEX); - USB_HOST_SERIAL.print("."); - USB_HOST_SERIAL.print(addr.bmParent, HEX); - USB_HOST_SERIAL.print("."); - USB_HOST_SERIAL.println(addr.bmAddress, HEX); - */ - return thePool[index].address.devAddress; - }; - - // Empties pool entry - - virtual void FreeAddress(uint8_t addr) { - // if the root hub is disconnected all the addresses should be initialized - if(addr == 0x41) { - InitAllAddresses(); - return; - } - uint8_t index = FindAddressIndex(addr); - FreeAddressByIndex(index); - }; - - // Returns number of hubs attached - // It can be rather helpfull to find out if there are hubs attached than getting the exact number of hubs. - //uint8_t GetNumHubs() - //{ - // return hubCounter; - //}; - //uint8_t GetNumDevices() - //{ - // uint8_t counter = 0; - - // for (uint8_t i=1; i 7) + //if(parent > 127 || port > 7) + return 0; + + if (is_hub && hubCounter == 7) return 0; + + // finds first empty address entry starting from one + uint8_t index = FindAddressIndex(0); + + if (!index) return 0; // if empty entry is not found + + if (_parent.devAddress == 0) { + if (is_hub) { + thePool[index].address.devAddress = 0x41; + hubCounter++; + } + else + thePool[index].address.devAddress = 1; + + return thePool[index].address.devAddress; + } + + UsbDeviceAddress addr; + addr.devAddress = 0; // Ensure all bits are zero + addr.bmParent = _parent.bmAddress; + if (is_hub) { + addr.bmHub = 1; + addr.bmAddress = ++hubCounter; + } + else { + addr.bmHub = 0; + addr.bmAddress = port; + } + thePool[index].address = addr; + /* + USB_HOST_SERIAL.print("Addr:"); + USB_HOST_SERIAL.print(addr.bmHub, HEX); + USB_HOST_SERIAL.print("."); + USB_HOST_SERIAL.print(addr.bmParent, HEX); + USB_HOST_SERIAL.print("."); + USB_HOST_SERIAL.println(addr.bmAddress, HEX); + */ + return thePool[index].address.devAddress; + } + + // Empty the pool entry + + virtual void FreeAddress(uint8_t addr) { + // if the root hub is disconnected all the addresses should be initialized + if (addr == 0x41) { + InitAllAddresses(); + return; + } + FreeAddressByIndex(FindAddressIndex(addr)); + } + + // Return number of hubs attached + // It can be helpful to find out if hubs are attached when getting the exact number of hubs. + //uint8_t GetNumHubs() { return hubCounter; } + //uint8_t GetNumDevices() { + // uint8_t counter = 0; + // for (uint8_t i = 1; i < MAX_DEVICES_ALLOWED; i++) + // if (thePool[i].address != 0); counter++; + // return counter; + //} }; - -#endif // __ADDRESS_H__ diff --git a/Marlin/src/sd/usb_flashdrive/lib/confdescparser.h b/Marlin/src/sd/usb_flashdrive/lib/confdescparser.h index 540535455d3a..69f2a96457de 100644 --- a/Marlin/src/sd/usb_flashdrive/lib/confdescparser.h +++ b/Marlin/src/sd/usb_flashdrive/lib/confdescparser.h @@ -1,217 +1,201 @@ -/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Contact information -------------------- - -Circuits At Home, LTD -Web : http://www.circuitsathome.com -e-mail : support@circuitsathome.com +/** + * Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Contact information + * ------------------- + * + * Circuits At Home, LTD + * Web : http://www.circuitsathome.com + * e-mail : support@circuitsathome.com */ -#if !defined(_usb_h_) || defined(__CONFDESCPARSER_H__) -#error "Never include confdescparser.h directly; include Usb.h instead" -#else +#pragma once -#define __CONFDESCPARSER_H__ +#ifndef _usb_h_ + #error "Never include confdescparser.h directly; include Usb.h instead" +#endif class UsbConfigXtracter { public: - //virtual void ConfigXtract(const USB_CONFIGURATION_DESCRIPTOR *conf) = 0; - //virtual void InterfaceXtract(uint8_t conf, const USB_INTERFACE_DESCRIPTOR *iface) = 0; + //virtual void ConfigXtract(const USB_CONFIGURATION_DESCRIPTOR *conf) = 0; + //virtual void InterfaceXtract(uint8_t conf, const USB_INTERFACE_DESCRIPTOR *iface) = 0; - virtual void EndpointXtract(uint8_t conf __attribute__((unused)), uint8_t iface __attribute__((unused)), uint8_t alt __attribute__((unused)), uint8_t proto __attribute__((unused)), const USB_ENDPOINT_DESCRIPTOR *ep __attribute__((unused))) { - }; + virtual void EndpointXtract(uint8_t conf __attribute__((unused)), uint8_t iface __attribute__((unused)), uint8_t alt __attribute__((unused)), uint8_t proto __attribute__((unused)), const USB_ENDPOINT_DESCRIPTOR *ep __attribute__((unused))) { + } }; -#define CP_MASK_COMPARE_CLASS 1 -#define CP_MASK_COMPARE_SUBCLASS 2 -#define CP_MASK_COMPARE_PROTOCOL 4 -#define CP_MASK_COMPARE_ALL 7 +#define CP_MASK_COMPARE_CLASS 1 +#define CP_MASK_COMPARE_SUBCLASS 2 +#define CP_MASK_COMPARE_PROTOCOL 4 +#define CP_MASK_COMPARE_ALL 7 // Configuration Descriptor Parser Class Template template class ConfigDescParser : public USBReadParser { - UsbConfigXtracter *theXtractor; - MultiValueBuffer theBuffer; - MultiByteValueParser valParser; - ByteSkipper theSkipper; - uint8_t varBuffer[16 /*sizeof(USB_CONFIGURATION_DESCRIPTOR)*/]; + UsbConfigXtracter *theXtractor; + MultiValueBuffer theBuffer; + MultiByteValueParser valParser; + ByteSkipper theSkipper; + uint8_t varBuffer[16 /*sizeof(USB_CONFIGURATION_DESCRIPTOR)*/]; - uint8_t stateParseDescr; // ParseDescriptor state + uint8_t stateParseDescr; // ParseDescriptor state - uint8_t dscrLen; // Descriptor length - uint8_t dscrType; // Descriptor type + uint8_t dscrLen; // Descriptor length + uint8_t dscrType; // Descriptor type - bool isGoodInterface; // Apropriate interface flag - uint8_t confValue; // Configuration value - uint8_t protoValue; // Protocol value - uint8_t ifaceNumber; // Interface number - uint8_t ifaceAltSet; // Interface alternate settings + bool isGoodInterface; // Apropriate interface flag + uint8_t confValue; // Configuration value + uint8_t protoValue; // Protocol value + uint8_t ifaceNumber; // Interface number + uint8_t ifaceAltSet; // Interface alternate settings - bool UseOr; - bool ParseDescriptor(uint8_t **pp, uint16_t *pcntdn); - void PrintHidDescriptor(const USB_HID_DESCRIPTOR *pDesc); + bool UseOr; + bool ParseDescriptor(uint8_t **pp, uint16_t *pcntdn); + void PrintHidDescriptor(const USB_HID_DESCRIPTOR *pDesc); public: - void SetOR(void) { - UseOr = true; - } - ConfigDescParser(UsbConfigXtracter *xtractor); - void Parse(const uint16_t len, const uint8_t *pbuf, const uint16_t &offset); + void SetOR(void) { UseOr = true; } + ConfigDescParser(UsbConfigXtracter *xtractor); + void Parse(const uint16_t len, const uint8_t *pbuf, const uint16_t &offset); }; template ConfigDescParser::ConfigDescParser(UsbConfigXtracter *xtractor) : -theXtractor(xtractor), -stateParseDescr(0), -dscrLen(0), -dscrType(0), -UseOr(false) { - theBuffer.pValue = varBuffer; - valParser.Initialize(&theBuffer); - theSkipper.Initialize(&theBuffer); -}; + theXtractor(xtractor), + stateParseDescr(0), + dscrLen(0), + dscrType(0), + UseOr(false) { + theBuffer.pValue = varBuffer; + valParser.Initialize(&theBuffer); + theSkipper.Initialize(&theBuffer); + }; template void ConfigDescParser::Parse(const uint16_t len, const uint8_t *pbuf, const uint16_t &offset __attribute__((unused))) { - uint16_t cntdn = (uint16_t)len; - uint8_t *p = (uint8_t*)pbuf; - - while(cntdn) - if(!ParseDescriptor(&p, &cntdn)) - return; + uint16_t cntdn = (uint16_t)len; + uint8_t *p = (uint8_t*)pbuf; + while (cntdn) if (!ParseDescriptor(&p, &cntdn)) return; } /* Parser for the configuration descriptor. Takes values for class, subclass, protocol fields in interface descriptor and compare masks for them. When the match is found, calls EndpointXtract passing buffer containing endpoint descriptor */ template bool ConfigDescParser::ParseDescriptor(uint8_t **pp, uint16_t *pcntdn) { - USB_CONFIGURATION_DESCRIPTOR* ucd = reinterpret_cast(varBuffer); - USB_INTERFACE_DESCRIPTOR* uid = reinterpret_cast(varBuffer); - switch(stateParseDescr) { - case 0: - theBuffer.valueSize = 2; - valParser.Initialize(&theBuffer); - stateParseDescr = 1; - case 1: - if(!valParser.Parse(pp, pcntdn)) - return false; - dscrLen = *((uint8_t*)theBuffer.pValue); - dscrType = *((uint8_t*)theBuffer.pValue + 1); - stateParseDescr = 2; - case 2: - // This is a sort of hack. Assuming that two bytes are all ready in the buffer - // the pointer is positioned two bytes ahead in order for the rest of descriptor - // to be read right after the size and the type fields. - // This should be used carefully. varBuffer should be used directly to handle data - // in the buffer. - theBuffer.pValue = varBuffer + 2; - stateParseDescr = 3; - case 3: - switch(dscrType) { - case USB_DESCRIPTOR_INTERFACE: - isGoodInterface = false; - break; - case USB_DESCRIPTOR_CONFIGURATION: - case USB_DESCRIPTOR_ENDPOINT: - case HID_DESCRIPTOR_HID: - break; - } - theBuffer.valueSize = dscrLen - 2; - valParser.Initialize(&theBuffer); - stateParseDescr = 4; - case 4: - switch(dscrType) { - case USB_DESCRIPTOR_CONFIGURATION: - if(!valParser.Parse(pp, pcntdn)) - return false; - confValue = ucd->bConfigurationValue; - break; - case USB_DESCRIPTOR_INTERFACE: - if(!valParser.Parse(pp, pcntdn)) - return false; - if((MASK & CP_MASK_COMPARE_CLASS) && uid->bInterfaceClass != CLASS_ID) - break; - if((MASK & CP_MASK_COMPARE_SUBCLASS) && uid->bInterfaceSubClass != SUBCLASS_ID) - break; - if(UseOr) { - if((!((MASK & CP_MASK_COMPARE_PROTOCOL) && uid->bInterfaceProtocol))) - break; - } else { - if((MASK & CP_MASK_COMPARE_PROTOCOL) && uid->bInterfaceProtocol != PROTOCOL_ID) - break; - } - isGoodInterface = true; - ifaceNumber = uid->bInterfaceNumber; - ifaceAltSet = uid->bAlternateSetting; - protoValue = uid->bInterfaceProtocol; - break; - case USB_DESCRIPTOR_ENDPOINT: - if(!valParser.Parse(pp, pcntdn)) - return false; - if(isGoodInterface) - if(theXtractor) - theXtractor->EndpointXtract(confValue, ifaceNumber, ifaceAltSet, protoValue, (USB_ENDPOINT_DESCRIPTOR*)varBuffer); - break; - //case HID_DESCRIPTOR_HID: - // if (!valParser.Parse(pp, pcntdn)) - // return false; - // PrintHidDescriptor((const USB_HID_DESCRIPTOR*)varBuffer); - // break; - default: - if(!theSkipper.Skip(pp, pcntdn, dscrLen - 2)) - return false; - } - theBuffer.pValue = varBuffer; - stateParseDescr = 0; - } - return true; + USB_CONFIGURATION_DESCRIPTOR* ucd = reinterpret_cast(varBuffer); + USB_INTERFACE_DESCRIPTOR* uid = reinterpret_cast(varBuffer); + switch (stateParseDescr) { + case 0: + theBuffer.valueSize = 2; + valParser.Initialize(&theBuffer); + stateParseDescr = 1; + case 1: + if (!valParser.Parse(pp, pcntdn)) return false; + dscrLen = *((uint8_t*)theBuffer.pValue); + dscrType = *((uint8_t*)theBuffer.pValue + 1); + stateParseDescr = 2; + case 2: + // This is a sort of hack. Assuming that two bytes are all ready in the buffer + // the pointer is positioned two bytes ahead in order for the rest of descriptor + // to be read right after the size and the type fields. + // This should be used carefully. varBuffer should be used directly to handle data + // in the buffer. + theBuffer.pValue = varBuffer + 2; + stateParseDescr = 3; + case 3: + switch (dscrType) { + case USB_DESCRIPTOR_INTERFACE: + isGoodInterface = false; + break; + case USB_DESCRIPTOR_CONFIGURATION: + case USB_DESCRIPTOR_ENDPOINT: + case HID_DESCRIPTOR_HID: + break; + } + theBuffer.valueSize = dscrLen - 2; + valParser.Initialize(&theBuffer); + stateParseDescr = 4; + case 4: + switch (dscrType) { + case USB_DESCRIPTOR_CONFIGURATION: + if (!valParser.Parse(pp, pcntdn)) return false; + confValue = ucd->bConfigurationValue; + break; + case USB_DESCRIPTOR_INTERFACE: + if (!valParser.Parse(pp, pcntdn)) return false; + if ((MASK & CP_MASK_COMPARE_CLASS) && uid->bInterfaceClass != CLASS_ID) + break; + if ((MASK & CP_MASK_COMPARE_SUBCLASS) && uid->bInterfaceSubClass != SUBCLASS_ID) + break; + if (UseOr) { + if ((!((MASK & CP_MASK_COMPARE_PROTOCOL) && uid->bInterfaceProtocol))) break; + } + else if ((MASK & CP_MASK_COMPARE_PROTOCOL) && uid->bInterfaceProtocol != PROTOCOL_ID) + break; + isGoodInterface = true; + ifaceNumber = uid->bInterfaceNumber; + ifaceAltSet = uid->bAlternateSetting; + protoValue = uid->bInterfaceProtocol; + break; + case USB_DESCRIPTOR_ENDPOINT: + if (!valParser.Parse(pp, pcntdn)) return false; + if (isGoodInterface && theXtractor) + theXtractor->EndpointXtract(confValue, ifaceNumber, ifaceAltSet, protoValue, (USB_ENDPOINT_DESCRIPTOR*)varBuffer); + break; + //case HID_DESCRIPTOR_HID: + // if (!valParser.Parse(pp, pcntdn)) return false; + // PrintHidDescriptor((const USB_HID_DESCRIPTOR*)varBuffer); + // break; + default: + if (!theSkipper.Skip(pp, pcntdn, dscrLen - 2)) return false; + } + theBuffer.pValue = varBuffer; + stateParseDescr = 0; + } + return true; } template void ConfigDescParser::PrintHidDescriptor(const USB_HID_DESCRIPTOR *pDesc) { - Notify(PSTR("\r\n\r\nHID Descriptor:\r\n"), 0x80); - Notify(PSTR("bDescLength:\t\t"), 0x80); - PrintHex (pDesc->bLength, 0x80); + Notify(PSTR("\r\n\r\nHID Descriptor:\r\n"), 0x80); + Notify(PSTR("bDescLength:\t\t"), 0x80); + PrintHex (pDesc->bLength, 0x80); - Notify(PSTR("\r\nbDescriptorType:\t"), 0x80); - PrintHex (pDesc->bDescriptorType, 0x80); + Notify(PSTR("\r\nbDescriptorType:\t"), 0x80); + PrintHex (pDesc->bDescriptorType, 0x80); - Notify(PSTR("\r\nbcdHID:\t\t\t"), 0x80); - PrintHex (pDesc->bcdHID, 0x80); + Notify(PSTR("\r\nbcdHID:\t\t\t"), 0x80); + PrintHex (pDesc->bcdHID, 0x80); - Notify(PSTR("\r\nbCountryCode:\t\t"), 0x80); - PrintHex (pDesc->bCountryCode, 0x80); + Notify(PSTR("\r\nbCountryCode:\t\t"), 0x80); + PrintHex (pDesc->bCountryCode, 0x80); - Notify(PSTR("\r\nbNumDescriptors:\t"), 0x80); - PrintHex (pDesc->bNumDescriptors, 0x80); + Notify(PSTR("\r\nbNumDescriptors:\t"), 0x80); + PrintHex (pDesc->bNumDescriptors, 0x80); - for(uint8_t i = 0; i < pDesc->bNumDescriptors; i++) { - HID_CLASS_DESCRIPTOR_LEN_AND_TYPE *pLT = (HID_CLASS_DESCRIPTOR_LEN_AND_TYPE*)&(pDesc->bDescrType); + for (uint8_t i = 0; i < pDesc->bNumDescriptors; i++) { + HID_CLASS_DESCRIPTOR_LEN_AND_TYPE *pLT = (HID_CLASS_DESCRIPTOR_LEN_AND_TYPE*)&(pDesc->bDescrType); - Notify(PSTR("\r\nbDescrType:\t\t"), 0x80); - PrintHex (pLT[i].bDescrType, 0x80); + Notify(PSTR("\r\nbDescrType:\t\t"), 0x80); + PrintHex (pLT[i].bDescrType, 0x80); - Notify(PSTR("\r\nwDescriptorLength:\t"), 0x80); - PrintHex (pLT[i].wDescriptorLength, 0x80); - } - Notify(PSTR("\r\n"), 0x80); + Notify(PSTR("\r\nwDescriptorLength:\t"), 0x80); + PrintHex (pLT[i].wDescriptorLength, 0x80); + } + Notify(PSTR("\r\n"), 0x80); } - - -#endif // __CONFDESCPARSER_H__ diff --git a/Marlin/src/sd/usb_flashdrive/lib/hexdump.h b/Marlin/src/sd/usb_flashdrive/lib/hexdump.h index 3cdb9e2a115b..59c3b48f67b5 100644 --- a/Marlin/src/sd/usb_flashdrive/lib/hexdump.h +++ b/Marlin/src/sd/usb_flashdrive/lib/hexdump.h @@ -1,69 +1,68 @@ -/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Contact information -------------------- - -Circuits At Home, LTD -Web : http://www.circuitsathome.com -e-mail : support@circuitsathome.com +/** + * Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Contact information + * ------------------- + * + * Circuits At Home, LTD + * Web : http://www.circuitsathome.com + * e-mail : support@circuitsathome.com */ +#pragma once -#if !defined(_usb_h_) || defined(__HEXDUMP_H__) -#error "Never include hexdump.h directly; include Usb.h instead" -#else -#define __HEXDUMP_H__ +#ifndef _usb_h_ + #error "Never include hexdump.h directly; include Usb.h instead" +#endif extern int UsbDEBUGlvl; template class HexDumper : public BASE_CLASS { - uint8_t byteCount; - OFFSET_TYPE byteTotal; + uint8_t byteCount; + OFFSET_TYPE byteTotal; public: - HexDumper() : byteCount(0), byteTotal(0) { - }; + HexDumper() : byteCount(0), byteTotal(0) { + }; - void Initialize() { - byteCount = 0; - byteTotal = 0; - }; + void Initialize() { + byteCount = 0; + byteTotal = 0; + }; - void Parse(const LEN_TYPE len, const uint8_t *pbuf, const OFFSET_TYPE &offset); + void Parse(const LEN_TYPE len, const uint8_t *pbuf, const OFFSET_TYPE &offset); }; template void HexDumper::Parse(const LEN_TYPE len, const uint8_t *pbuf, const OFFSET_TYPE &offset __attribute__((unused))) { - if(UsbDEBUGlvl >= 0x80) { // Fully bypass this block of code if we do not debug. - for(LEN_TYPE j = 0; j < len; j++, byteCount++, byteTotal++) { - if(!byteCount) { - PrintHex (byteTotal, 0x80); - E_Notify(PSTR(": "), 0x80); - } - PrintHex (pbuf[j], 0x80); - E_Notify(PSTR(" "), 0x80); + if (UsbDEBUGlvl >= 0x80) { // Fully bypass this block of code if we do not debug. + for (LEN_TYPE j = 0; j < len; j++, byteCount++, byteTotal++) { + if (!byteCount) { + PrintHex (byteTotal, 0x80); + E_Notify(PSTR(": "), 0x80); + } + PrintHex (pbuf[j], 0x80); + E_Notify(PSTR(" "), 0x80); - if(byteCount == 15) { - E_Notify(PSTR("\r\n"), 0x80); - byteCount = 0xFF; - } - } - } + if (byteCount == 15) { + E_Notify(PSTR("\r\n"), 0x80); + byteCount = 0xFF; + } + } + } } - -#endif // __HEXDUMP_H__ diff --git a/Marlin/src/sd/usb_flashdrive/lib/macros.h b/Marlin/src/sd/usb_flashdrive/lib/macros.h index f5517904ca80..0fb5c02ff112 100644 --- a/Marlin/src/sd/usb_flashdrive/lib/macros.h +++ b/Marlin/src/sd/usb_flashdrive/lib/macros.h @@ -1,33 +1,33 @@ -/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Contact information -------------------- - -Circuits At Home, LTD -Web : http://www.circuitsathome.com -e-mail : support@circuitsathome.com +/** + * Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Contact information + * ------------------- + * + * Circuits At Home, LTD + * Web : http://www.circuitsathome.com + * e-mail : support@circuitsathome.com */ +#pragma once #ifndef _usb_h_ #error "Never include macros.h directly; include Usb.h instead" #endif -#pragma once - //////////////////////////////////////////////////////////////////////////////// // HANDY MACROS //////////////////////////////////////////////////////////////////////////////// @@ -35,7 +35,7 @@ e-mail : support@circuitsathome.com #define VALUE_BETWEEN(v,l,h) (((v)>(l)) && ((v)<(h))) #define VALUE_WITHIN(v,l,h) (((v)>=(l)) && ((v)<=(h))) #define output_pgm_message(wa,fp,mp,el) wa = &mp, fp((char *)pgm_read_pointer(wa), el) -#define output_if_between(v,l,h,wa,fp,mp,el) if(VALUE_BETWEEN(v,l,h)) output_pgm_message(wa,fp,mp[v-(l+1)],el); +#define output_if_between(v,l,h,wa,fp,mp,el) if (VALUE_BETWEEN(v,l,h)) output_pgm_message(wa,fp,mp[v-(l+1)],el); #define SWAP(a, b) (((a) ^= (b)), ((b) ^= (a)), ((a) ^= (b))) #ifndef __BYTE_GRABBING_DEFINED__ diff --git a/Marlin/src/sd/usb_flashdrive/lib/masstorage.cpp b/Marlin/src/sd/usb_flashdrive/lib/masstorage.cpp index e139febf3d75..eac4bebe54a8 100644 --- a/Marlin/src/sd/usb_flashdrive/lib/masstorage.cpp +++ b/Marlin/src/sd/usb_flashdrive/lib/masstorage.cpp @@ -1,25 +1,26 @@ -/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Contact information -------------------- - -Circuits At Home, LTD -Web : http://www.circuitsathome.com -e-mail : support@circuitsathome.com +/** + * Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Contact information + * ------------------- + * + * Circuits At Home, LTD + * Web : http://www.circuitsathome.com + * e-mail : support@circuitsathome.com */ #include "../../../inc/MarlinConfigPre.h" @@ -33,9 +34,7 @@ const uint8_t BulkOnly::epDataOutIndex = 2; const uint8_t BulkOnly::epInterruptInIndex = 3; //////////////////////////////////////////////////////////////////////////////// - // Interface code - //////////////////////////////////////////////////////////////////////////////// /** @@ -45,9 +44,7 @@ const uint8_t BulkOnly::epInterruptInIndex = 3; * @return media capacity */ uint32_t BulkOnly::GetCapacity(uint8_t lun) { - if(LUNOk[lun]) - return CurrentCapacity[lun]; - return 0LU; + return LUNOk[lun] ? CurrentCapacity[lun] : 0UL; } /** @@ -57,9 +54,7 @@ uint32_t BulkOnly::GetCapacity(uint8_t lun) { * @return media sector size */ uint16_t BulkOnly::GetSectorSize(uint8_t lun) { - if(LUNOk[lun]) - return CurrentSectorSize[lun]; - return 0U; + return LUNOk[lun] ? CurrentSectorSize[lun] : 0U; } /** @@ -68,9 +63,7 @@ uint16_t BulkOnly::GetSectorSize(uint8_t lun) { * @param lun Logical Unit Number * @return true if LUN is ready for use */ -bool BulkOnly::LUNIsGood(uint8_t lun) { - return LUNOk[lun]; -} +bool BulkOnly::LUNIsGood(uint8_t lun) { return LUNOk[lun]; } /** * Test if LUN is write protected @@ -78,9 +71,7 @@ bool BulkOnly::LUNIsGood(uint8_t lun) { * @param lun Logical Unit Number * @return cached status of write protect switch */ -bool BulkOnly::WriteProtected(uint8_t lun) { - return WriteOk[lun]; -} +bool BulkOnly::WriteProtected(uint8_t lun) { return WriteOk[lun]; } /** * Wrap and execute a SCSI CDB with length of 6 @@ -92,10 +83,10 @@ bool BulkOnly::WriteProtected(uint8_t lun) { * @return */ uint8_t BulkOnly::SCSITransaction6(CDB6_t *cdb, uint16_t buf_size, void *buf, uint8_t dir) { - // promote buf_size to 32bits. - CommandBlockWrapper cbw = CommandBlockWrapper(++dCBWTag, (uint32_t)buf_size, cdb, dir); - //SetCurLUN(cdb->LUN); - return (HandleSCSIError(Transaction(&cbw, buf_size, buf))); + // promote buf_size to 32bits. + CommandBlockWrapper cbw = CommandBlockWrapper(++dCBWTag, (uint32_t)buf_size, cdb, dir); + //SetCurLUN(cdb->LUN); + return (HandleSCSIError(Transaction(&cbw, buf_size, buf))); } /** @@ -108,10 +99,10 @@ uint8_t BulkOnly::SCSITransaction6(CDB6_t *cdb, uint16_t buf_size, void *buf, ui * @return */ uint8_t BulkOnly::SCSITransaction10(CDB10_t *cdb, uint16_t buf_size, void *buf, uint8_t dir) { - // promote buf_size to 32bits. - CommandBlockWrapper cbw = CommandBlockWrapper(++dCBWTag, (uint32_t)buf_size, cdb, dir); - //SetCurLUN(cdb->LUN); - return (HandleSCSIError(Transaction(&cbw, buf_size, buf))); + // promote buf_size to 32bits. + CommandBlockWrapper cbw = CommandBlockWrapper(++dCBWTag, (uint32_t)buf_size, cdb, dir); + //SetCurLUN(cdb->LUN); + return (HandleSCSIError(Transaction(&cbw, buf_size, buf))); } /** @@ -123,11 +114,11 @@ uint8_t BulkOnly::SCSITransaction10(CDB10_t *cdb, uint16_t buf_size, void *buf, * @return */ uint8_t BulkOnly::LockMedia(uint8_t lun, uint8_t lock) { - Notify(PSTR("\r\nLockMedia\r\n"), 0x80); - Notify(PSTR("---------\r\n"), 0x80); + Notify(PSTR("\r\nLockMedia\r\n"), 0x80); + Notify(PSTR("---------\r\n"), 0x80); - CDB6_t cdb = CDB6_t(SCSI_CMD_PREVENT_REMOVAL, lun, (uint8_t)0, lock); - return SCSITransaction6(&cdb, (uint16_t)0, NULL, (uint8_t)MASS_CMD_DIR_IN); + CDB6_t cdb = CDB6_t(SCSI_CMD_PREVENT_REMOVAL, lun, (uint8_t)0, lock); + return SCSITransaction6(&cdb, (uint16_t)0, NULL, (uint8_t)MASS_CMD_DIR_IN); } /** @@ -139,17 +130,18 @@ uint8_t BulkOnly::LockMedia(uint8_t lun, uint8_t lock) { * @return 0 on success */ uint8_t BulkOnly::MediaCTL(uint8_t lun, uint8_t ctl) { - Notify(PSTR("\r\nMediaCTL\r\n"), 0x80); - Notify(PSTR("-----------------\r\n"), 0x80); - - uint8_t rcode = MASS_ERR_UNIT_NOT_READY; - if(bAddress) { - CDB6_t cdb = CDB6_t(SCSI_CMD_START_STOP_UNIT, lun, ctl & 0x03, 0); - rcode = SCSITransaction6(&cdb, (uint16_t)0, NULL, (uint8_t)MASS_CMD_DIR_OUT); - } else { - SetCurLUN(lun); - } - return rcode; + Notify(PSTR("\r\nMediaCTL\r\n"), 0x80); + Notify(PSTR("-----------------\r\n"), 0x80); + + uint8_t rcode = MASS_ERR_UNIT_NOT_READY; + if (bAddress) { + CDB6_t cdb = CDB6_t(SCSI_CMD_START_STOP_UNIT, lun, ctl & 0x03, 0); + rcode = SCSITransaction6(&cdb, (uint16_t)0, NULL, (uint8_t)MASS_CMD_DIR_OUT); + } + else + SetCurLUN(lun); + + return rcode; } /** @@ -163,27 +155,27 @@ uint8_t BulkOnly::MediaCTL(uint8_t lun, uint8_t ctl) { * @return 0 on success */ uint8_t BulkOnly::Read(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, uint8_t *buf) { - if(!LUNOk[lun]) return MASS_ERR_NO_MEDIA; - Notify(PSTR("\r\nRead LUN:\t"), 0x80); - D_PrintHex (lun, 0x90); - Notify(PSTR("\r\nLBA:\t\t"), 0x90); - D_PrintHex (addr, 0x90); - Notify(PSTR("\r\nblocks:\t\t"), 0x90); - D_PrintHex (blocks, 0x90); - Notify(PSTR("\r\nblock size:\t"), 0x90); - D_PrintHex (bsize, 0x90); - Notify(PSTR("\r\n---------\r\n"), 0x80); - CDB10_t cdb = CDB10_t(SCSI_CMD_READ_10, lun, blocks, addr); + if (!LUNOk[lun]) return MASS_ERR_NO_MEDIA; + Notify(PSTR("\r\nRead LUN:\t"), 0x80); + D_PrintHex (lun, 0x90); + Notify(PSTR("\r\nLBA:\t\t"), 0x90); + D_PrintHex (addr, 0x90); + Notify(PSTR("\r\nblocks:\t\t"), 0x90); + D_PrintHex (blocks, 0x90); + Notify(PSTR("\r\nblock size:\t"), 0x90); + D_PrintHex (bsize, 0x90); + Notify(PSTR("\r\n---------\r\n"), 0x80); + CDB10_t cdb = CDB10_t(SCSI_CMD_READ_10, lun, blocks, addr); again: - uint8_t er = SCSITransaction10(&cdb, ((uint16_t)bsize * blocks), buf, (uint8_t)MASS_CMD_DIR_IN); - - if(er == MASS_ERR_STALL) { - MediaCTL(lun, 1); - delay(150); - if(!TestUnitReady(lun)) goto again; - } - return er; + uint8_t er = SCSITransaction10(&cdb, ((uint16_t)bsize * blocks), buf, (uint8_t)MASS_CMD_DIR_IN); + + if (er == MASS_ERR_STALL) { + MediaCTL(lun, 1); + delay(150); + if (!TestUnitReady(lun)) goto again; + } + return er; } /** @@ -197,37 +189,35 @@ uint8_t BulkOnly::Read(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t block * @return 0 on success */ uint8_t BulkOnly::Write(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, const uint8_t * buf) { - if(!LUNOk[lun]) return MASS_ERR_NO_MEDIA; - if(!WriteOk[lun]) return MASS_ERR_WRITE_PROTECTED; - Notify(PSTR("\r\nWrite LUN:\t"), 0x80); - D_PrintHex (lun, 0x90); - Notify(PSTR("\r\nLBA:\t\t"), 0x90); - D_PrintHex (addr, 0x90); - Notify(PSTR("\r\nblocks:\t\t"), 0x90); - D_PrintHex (blocks, 0x90); - Notify(PSTR("\r\nblock size:\t"), 0x90); - D_PrintHex (bsize, 0x90); - Notify(PSTR("\r\n---------\r\n"), 0x80); - CDB10_t cdb = CDB10_t(SCSI_CMD_WRITE_10, lun, blocks, addr); + if (!LUNOk[lun]) return MASS_ERR_NO_MEDIA; + if (!WriteOk[lun]) return MASS_ERR_WRITE_PROTECTED; + Notify(PSTR("\r\nWrite LUN:\t"), 0x80); + D_PrintHex (lun, 0x90); + Notify(PSTR("\r\nLBA:\t\t"), 0x90); + D_PrintHex (addr, 0x90); + Notify(PSTR("\r\nblocks:\t\t"), 0x90); + D_PrintHex (blocks, 0x90); + Notify(PSTR("\r\nblock size:\t"), 0x90); + D_PrintHex (bsize, 0x90); + Notify(PSTR("\r\n---------\r\n"), 0x80); + CDB10_t cdb = CDB10_t(SCSI_CMD_WRITE_10, lun, blocks, addr); again: - uint8_t er = SCSITransaction10(&cdb, ((uint16_t)bsize * blocks), (void*)buf, (uint8_t)MASS_CMD_DIR_OUT); - - if(er == MASS_ERR_WRITE_STALL) { - MediaCTL(lun, 1); - delay(150); - if(!TestUnitReady(lun)) goto again; - } - return er; + uint8_t er = SCSITransaction10(&cdb, ((uint16_t)bsize * blocks), (void*)buf, (uint8_t)MASS_CMD_DIR_OUT); + + if (er == MASS_ERR_WRITE_STALL) { + MediaCTL(lun, 1); + delay(150); + if (!TestUnitReady(lun)) goto again; + } + return er; } // End of user functions, the remaining code below is driver internals. // Only developer serviceable parts below! //////////////////////////////////////////////////////////////////////////////// - // Main driver code - //////////////////////////////////////////////////////////////////////////////// BulkOnly::BulkOnly(USB *p) : @@ -239,10 +229,9 @@ qNextPollTime(0), bPollEnable(false), //dCBWTag(0), bLastUsbError(0) { - ClearAllEP(); - dCBWTag = 0; - if(pUsb) - pUsb->RegisterDeviceClass(this); + ClearAllEP(); + dCBWTag = 0; + if (pUsb) pUsb->RegisterDeviceClass(this); } /** @@ -261,285 +250,274 @@ bLastUsbError(0) { */ uint8_t BulkOnly::ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed) { - const uint8_t constBufSize = sizeof (USB_DEVICE_DESCRIPTOR); + const uint8_t constBufSize = sizeof (USB_DEVICE_DESCRIPTOR); - uint8_t buf[constBufSize]; - USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast(buf); - uint8_t rcode; - UsbDevice *p = NULL; - EpInfo *oldep_ptr = NULL; - USBTRACE("MS ConfigureDevice\r\n"); - ClearAllEP(); - AddressPool &addrPool = pUsb->GetAddressPool(); + uint8_t buf[constBufSize]; + USB_DEVICE_DESCRIPTOR * udd = reinterpret_cast(buf); + uint8_t rcode; + UsbDevice *p = NULL; + EpInfo *oldep_ptr = NULL; + USBTRACE("MS ConfigureDevice\r\n"); + ClearAllEP(); + AddressPool &addrPool = pUsb->GetAddressPool(); + if (bAddress) return USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE; - if(bAddress) - return USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE; + // + // Get pointer to pseudo device with address 0 assigned + p = addrPool.GetUsbDevicePtr(0); + if (!p) return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL; - // - // Get pointer to pseudo device with address 0 assigned - p = addrPool.GetUsbDevicePtr(0); - if(!p) { - return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL; - } + if (!p->epinfo) { + USBTRACE("epinfo\r\n"); + return USB_ERROR_EPINFO_IS_NULL; + } - if(!p->epinfo) { - USBTRACE("epinfo\r\n"); - return USB_ERROR_EPINFO_IS_NULL; - } + // Save old pointer to EP_RECORD of address 0 + oldep_ptr = p->epinfo; - // Save old pointer to EP_RECORD of address 0 - oldep_ptr = p->epinfo; + // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence + p->epinfo = epInfo; - // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence - p->epinfo = epInfo; + p->lowspeed = lowspeed; + // Get device descriptor + rcode = pUsb->getDevDescr(0, 0, constBufSize, (uint8_t*)buf); - p->lowspeed = lowspeed; - // Get device descriptor - rcode = pUsb->getDevDescr(0, 0, constBufSize, (uint8_t*)buf); + // Restore p->epinfo + p->epinfo = oldep_ptr; - // Restore p->epinfo - p->epinfo = oldep_ptr; + if (rcode) goto FailGetDevDescr; - if(rcode) { - goto FailGetDevDescr; - } - // Allocate new address according to device class - bAddress = addrPool.AllocAddress(parent, false, port); + // Allocate new address according to device class + bAddress = addrPool.AllocAddress(parent, false, port); - if(!bAddress) - return USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL; + if (!bAddress) return USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL; - // Extract Max Packet Size from the device descriptor - epInfo[0].maxPktSize = udd->bMaxPacketSize0; - // Steal and abuse from epInfo structure to save on memory. - epInfo[1].epAddr = udd->bNumConfigurations; - // - return USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET; + // Extract Max Packet Size from the device descriptor + epInfo[0].maxPktSize = udd->bMaxPacketSize0; + // Steal and abuse from epInfo structure to save on memory. + epInfo[1].epAddr = udd->bNumConfigurations; + // + return USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET; FailGetDevDescr: -#ifdef DEBUG_USB_HOST - NotifyFailGetDevDescr(rcode); -#endif - rcode = USB_ERROR_FailGetDevDescr; - Release(); - return rcode; -}; + #ifdef DEBUG_USB_HOST + NotifyFailGetDevDescr(rcode); + #endif + rcode = USB_ERROR_FailGetDevDescr; + + Release(); + return rcode; +} /** - * * @param parent (not used) * @param port (not used) * @param lowspeed true if device is low speed * @return 0 for success */ uint8_t BulkOnly::Init(uint8_t parent __attribute__((unused)), uint8_t port __attribute__((unused)), bool lowspeed) { - uint8_t rcode; - uint8_t num_of_conf = epInfo[1].epAddr; // number of configurations - epInfo[1].epAddr = 0; - USBTRACE("MS Init\r\n"); - - AddressPool &addrPool = pUsb->GetAddressPool(); - UsbDevice *p = addrPool.GetUsbDevicePtr(bAddress); - - if(!p) - return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL; - - // Assign new address to the device - delay(2000); - rcode = pUsb->setAddr(0, 0, bAddress); - - if(rcode) { - p->lowspeed = false; - addrPool.FreeAddress(bAddress); - bAddress = 0; - USBTRACE2("setAddr:", rcode); - return rcode; - } - - USBTRACE2("Addr:", bAddress); - - p->lowspeed = false; - - p = addrPool.GetUsbDevicePtr(bAddress); - - if(!p) - return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL; - - p->lowspeed = lowspeed; - - // Assign epInfo to epinfo pointer - rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo); + uint8_t rcode; + uint8_t num_of_conf = epInfo[1].epAddr; // number of configurations + epInfo[1].epAddr = 0; + USBTRACE("MS Init\r\n"); - if(rcode) - goto FailSetDevTblEntry; - - USBTRACE2("NC:", num_of_conf); - - for(uint8_t i = 0; i < num_of_conf; i++) { - ConfigDescParser< USB_CLASS_MASS_STORAGE, - MASS_SUBCLASS_SCSI, - MASS_PROTO_BBB, - CP_MASK_COMPARE_CLASS | - CP_MASK_COMPARE_SUBCLASS | - CP_MASK_COMPARE_PROTOCOL > BulkOnlyParser(this); - - rcode = pUsb->getConfDescr(bAddress, 0, i, &BulkOnlyParser); - - if(rcode) - goto FailGetConfDescr; - - if(bNumEP > 1) - break; + AddressPool &addrPool = pUsb->GetAddressPool(); + UsbDevice *p = addrPool.GetUsbDevicePtr(bAddress); + + if (!p) return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL; + + // Assign new address to the device + delay(2000); + rcode = pUsb->setAddr(0, 0, bAddress); + + if (rcode) { + p->lowspeed = false; + addrPool.FreeAddress(bAddress); + bAddress = 0; + USBTRACE2("setAddr:", rcode); + return rcode; + } + + USBTRACE2("Addr:", bAddress); + + p->lowspeed = false; + + p = addrPool.GetUsbDevicePtr(bAddress); + + if (!p) return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL; + + p->lowspeed = lowspeed; + + // Assign epInfo to epinfo pointer + rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo); + + if (rcode) goto FailSetDevTblEntry; + + USBTRACE2("NC:", num_of_conf); + + for (uint8_t i = 0; i < num_of_conf; i++) { + ConfigDescParser< USB_CLASS_MASS_STORAGE, + MASS_SUBCLASS_SCSI, + MASS_PROTO_BBB, + CP_MASK_COMPARE_CLASS | + CP_MASK_COMPARE_SUBCLASS | + CP_MASK_COMPARE_PROTOCOL > BulkOnlyParser(this); + + rcode = pUsb->getConfDescr(bAddress, 0, i, &BulkOnlyParser); + + if (rcode) goto FailGetConfDescr; + + if (bNumEP > 1) break; + } + + if (bNumEP < 3) return USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED; + + // Assign epInfo to epinfo pointer + pUsb->setEpInfoEntry(bAddress, bNumEP, epInfo); + + USBTRACE2("Conf:", bConfNum); + + // Set Configuration Value + rcode = pUsb->setConf(bAddress, 0, bConfNum); + + if (rcode) goto FailSetConfDescr; + + //Linux does a 1sec delay after this. + delay(1000); + + rcode = GetMaxLUN(&bMaxLUN); + if (rcode) goto FailGetMaxLUN; + + if (bMaxLUN >= MASS_MAX_SUPPORTED_LUN) bMaxLUN = MASS_MAX_SUPPORTED_LUN - 1; + ErrorMessage (PSTR("MaxLUN"), bMaxLUN); + + delay(1000); // Delay a bit for slow firmware. + + for (uint8_t lun = 0; lun <= bMaxLUN; lun++) { + InquiryResponse response; + rcode = Inquiry(lun, sizeof (InquiryResponse), (uint8_t*) & response); + if (rcode) { + ErrorMessage (PSTR("Inquiry"), rcode); + } + else { + #if 0 + printf("LUN %i `", lun); + uint8_t *buf = response.VendorID; + for (int i = 0; i < 28; i++) printf("%c", buf[i]); + printf("'\r\nQualifier %1.1X ", response.PeripheralQualifier); + printf("Device type %2.2X ", response.DeviceType); + printf("RMB %1.1X ", response.Removable); + printf("SSCS %1.1X ", response.SCCS); + uint8_t sv = response.Version; + printf("SCSI version %2.2X\r\nDevice conforms to ", sv); + switch (sv) { + case 0: + printf("No specific"); + break; + case 1: + printf("ANSI X3.131-1986 (ANSI 1)"); + break; + case 2: + printf("ANSI X3.131-1994 (ANSI 2)"); + break; + case 3: + printf("ANSI INCITS 301-1997 (SPC)"); + break; + case 4: + printf("ANSI INCITS 351-2001 (SPC-2)"); + break; + case 5: + printf("ANSI INCITS 408-2005 (SPC-4)"); + break; + case 6: + printf("T10/1731-D (SPC-4)"); + break; + default: printf("unknown"); } - - if(bNumEP < 3) - return USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED; - - // Assign epInfo to epinfo pointer - pUsb->setEpInfoEntry(bAddress, bNumEP, epInfo); - - USBTRACE2("Conf:", bConfNum); - - // Set Configuration Value - rcode = pUsb->setConf(bAddress, 0, bConfNum); - - if(rcode) - goto FailSetConfDescr; - - //Linux does a 1sec delay after this. + printf(" standards.\r\n"); + #endif + + uint8_t tries = 0xf0; + while ((rcode = TestUnitReady(lun))) { + if (rcode == 0x08) break; // break on no media, this is OK to do. + // try to lock media and spin up + if (tries < 14) { + LockMedia(lun, 1); + MediaCTL(lun, 1); // I actually have a USB stick that needs this! + } else + delay(2 * (tries + 1)); + tries++; + if (!tries) break; + } + if (!rcode) { delay(1000); + LUNOk[lun] = CheckLUN(lun); + if (!LUNOk[lun]) LUNOk[lun] = CheckLUN(lun); + } + } + } - rcode = GetMaxLUN(&bMaxLUN); - if(rcode) - goto FailGetMaxLUN; - - if(bMaxLUN >= MASS_MAX_SUPPORTED_LUN) bMaxLUN = MASS_MAX_SUPPORTED_LUN - 1; - ErrorMessage (PSTR("MaxLUN"), bMaxLUN); - - delay(1000); // Delay a bit for slow firmware. - - for(uint8_t lun = 0; lun <= bMaxLUN; lun++) { - InquiryResponse response; - rcode = Inquiry(lun, sizeof (InquiryResponse), (uint8_t*) & response); - if(rcode) { - ErrorMessage (PSTR("Inquiry"), rcode); - } else { -#if 0 - printf("LUN %i `", lun); - uint8_t *buf = response.VendorID; - for(int i = 0; i < 28; i++) printf("%c", buf[i]); - printf("'\r\nQualifier %1.1X ", response.PeripheralQualifier); - printf("Device type %2.2X ", response.DeviceType); - printf("RMB %1.1X ", response.Removable); - printf("SSCS %1.1X ", response.SCCS); - uint8_t sv = response.Version; - printf("SCSI version %2.2X\r\nDevice conforms to ", sv); - switch(sv) { - case 0: - printf("No specific"); - break; - case 1: - printf("ANSI X3.131-1986 (ANSI 1)"); - break; - case 2: - printf("ANSI X3.131-1994 (ANSI 2)"); - break; - case 3: - printf("ANSI INCITS 301-1997 (SPC)"); - break; - case 4: - printf("ANSI INCITS 351-2001 (SPC-2)"); - break; - case 5: - printf("ANSI INCITS 408-2005 (SPC-4)"); - break; - case 6: - printf("T10/1731-D (SPC-4)"); - break; - default: - printf("unknown"); - } - printf(" standards.\r\n"); -#endif - uint8_t tries = 0xf0; - while((rcode = TestUnitReady(lun))) { - if(rcode == 0x08) break; // break on no media, this is OK to do. - // try to lock media and spin up - if(tries < 14) { - LockMedia(lun, 1); - MediaCTL(lun, 1); // I actually have a USB stick that needs this! - } else delay(2 * (tries + 1)); - tries++; - if(!tries) break; - } - if(!rcode) { - delay(1000); - LUNOk[lun] = CheckLUN(lun); - if(!LUNOk[lun]) LUNOk[lun] = CheckLUN(lun); - } - } - } + CheckMedia(); + rcode = OnInit(); - CheckMedia(); + if (rcode) goto FailOnInit; - rcode = OnInit(); + #ifdef DEBUG_USB_HOST + USBTRACE("MS configured\r\n\r\n"); + #endif - if(rcode) - goto FailOnInit; + bPollEnable = true; -#ifdef DEBUG_USB_HOST - USBTRACE("MS configured\r\n\r\n"); -#endif + //USBTRACE("Poll enabled\r\n"); + return 0; - bPollEnable = true; + FailSetConfDescr: - //USBTRACE("Poll enabled\r\n"); - return 0; + #ifdef DEBUG_USB_HOST + NotifyFailSetConfDescr(); + goto Fail; + #endif -FailSetConfDescr: -#ifdef DEBUG_USB_HOST - NotifyFailSetConfDescr(); - goto Fail; -#endif + FailOnInit: -FailOnInit: -#ifdef DEBUG_USB_HOST - USBTRACE("OnInit:"); - goto Fail; -#endif + #ifdef DEBUG_USB_HOST + USBTRACE("OnInit:"); + goto Fail; + #endif -FailGetMaxLUN: -#ifdef DEBUG_USB_HOST - USBTRACE("GetMaxLUN:"); - goto Fail; -#endif + FailGetMaxLUN: - //#ifdef DEBUG_USB_HOST - //FailInvalidSectorSize: - // USBTRACE("Sector Size is NOT VALID: "); - // goto Fail; - //#endif + #ifdef DEBUG_USB_HOST + USBTRACE("GetMaxLUN:"); + goto Fail; + #endif -FailSetDevTblEntry: -#ifdef DEBUG_USB_HOST - NotifyFailSetDevTblEntry(); - goto Fail; -#endif + //#ifdef DEBUG_USB_HOST + // FailInvalidSectorSize: + // USBTRACE("Sector Size is NOT VALID: "); + // goto Fail; + //#endif -FailGetConfDescr: -#ifdef DEBUG_USB_HOST - NotifyFailGetConfDescr(); -#endif + FailSetDevTblEntry: + #ifdef DEBUG_USB_HOST + NotifyFailSetDevTblEntry(); + goto Fail; + #endif -#ifdef DEBUG_USB_HOST -Fail: - NotifyFail(rcode); -#endif - Release(); - return rcode; + FailGetConfDescr: + #ifdef DEBUG_USB_HOST + NotifyFailGetConfDescr(); + #endif + + #ifdef DEBUG_USB_HOST + Fail: + NotifyFail(rcode); + #endif + Release(); + return rcode; } /** @@ -552,46 +530,45 @@ uint8_t BulkOnly::Init(uint8_t parent __attribute__((unused)), uint8_t port __at * @param pep */ void BulkOnly::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto __attribute__((unused)), const USB_ENDPOINT_DESCRIPTOR * pep) { - ErrorMessage (PSTR("Conf.Val"), conf); - ErrorMessage (PSTR("Iface Num"), iface); - ErrorMessage (PSTR("Alt.Set"), alt); - - bConfNum = conf; - - uint8_t index; - -#if 1 - if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_BULK) { - index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex; - // Fill in the endpoint info structure - epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F); - epInfo[index].maxPktSize = (uint8_t)pep->wMaxPacketSize; - epInfo[index].bmSndToggle = 0; - epInfo[index].bmRcvToggle = 0; - - bNumEP++; - - PrintEndpointDescriptor(pep); - - } -#else - if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_INTERRUPT && (pep->bEndpointAddress & 0x80) == 0x80) - index = epInterruptInIndex; - else if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_BULK) - index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex; - else - return; - - // Fill in the endpoint info structure - epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F); - epInfo[index].maxPktSize = (uint8_t)pep->wMaxPacketSize; - epInfo[index].bmSndToggle = 0; - epInfo[index].bmRcvToggle = 0; - - bNumEP++; - - PrintEndpointDescriptor(pep); -#endif + ErrorMessage (PSTR("Conf.Val"), conf); + ErrorMessage (PSTR("Iface Num"), iface); + ErrorMessage (PSTR("Alt.Set"), alt); + + bConfNum = conf; + + uint8_t index; + + #if 1 + if ((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_BULK) { + index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex; + // Fill in the endpoint info structure + epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F); + epInfo[index].maxPktSize = (uint8_t)pep->wMaxPacketSize; + epInfo[index].bmSndToggle = 0; + epInfo[index].bmRcvToggle = 0; + + bNumEP++; + + PrintEndpointDescriptor(pep); + } + #else + if ((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_INTERRUPT && (pep->bEndpointAddress & 0x80) == 0x80) + index = epInterruptInIndex; + else if ((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_BULK) + index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex; + else + return; + + // Fill in the endpoint info structure + epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F); + epInfo[index].maxPktSize = (uint8_t)pep->wMaxPacketSize; + epInfo[index].bmSndToggle = 0; + epInfo[index].bmRcvToggle = 0; + + bNumEP++; + + PrintEndpointDescriptor(pep); + #endif } /** @@ -600,9 +577,9 @@ void BulkOnly::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t * @return */ uint8_t BulkOnly::Release() { - ClearAllEP(); - pUsb->GetAddressPool().FreeAddress(bAddress); - return 0; + ClearAllEP(); + pUsb->GetAddressPool().FreeAddress(bAddress); + return 0; } /** @@ -612,38 +589,37 @@ uint8_t BulkOnly::Release() { * @return true if LUN is ready for use. */ bool BulkOnly::CheckLUN(uint8_t lun) { - uint8_t rcode; - Capacity capacity; - for(uint8_t i = 0; i < 8; i++) capacity.data[i] = 0; - - rcode = ReadCapacity10(lun, (uint8_t*)capacity.data); - if(rcode) { - //printf(">>>>>>>>>>>>>>>>ReadCapacity returned %i\r\n", rcode); - return false; - } - ErrorMessage (PSTR(">>>>>>>>>>>>>>>>CAPACITY OK ON LUN"), lun); - for(uint8_t i = 0; i < 8 /*sizeof (Capacity)*/; i++) - D_PrintHex (capacity.data[i], 0x80); - Notify(PSTR("\r\n\r\n"), 0x80); - // Only 512/1024/2048/4096 are valid values! - uint32_t c = BMAKE32(capacity.data[4], capacity.data[5], capacity.data[6], capacity.data[7]); - if(c != 0x0200LU && c != 0x0400LU && c != 0x0800LU && c != 0x1000LU) { - return false; - } - // Store capacity information. - CurrentSectorSize[lun] = (uint16_t)(c); // & 0xFFFF); - - CurrentCapacity[lun] = BMAKE32(capacity.data[0], capacity.data[1], capacity.data[2], capacity.data[3]) + 1; - if(CurrentCapacity[lun] == /*0xffffffffLU */ 0x01LU || CurrentCapacity[lun] == 0x00LU) { - // Buggy firmware will report 0xffffffff or 0 for no media - if(CurrentCapacity[lun]) - ErrorMessage (PSTR(">>>>>>>>>>>>>>>>BUGGY FIRMWARE. CAPACITY FAIL ON LUN"), lun); - return false; - } - delay(20); - Page3F(lun); - if(!TestUnitReady(lun)) return true; - return false; + uint8_t rcode; + Capacity capacity; + for (uint8_t i = 0; i < 8; i++) capacity.data[i] = 0; + + rcode = ReadCapacity10(lun, (uint8_t*)capacity.data); + if (rcode) { + //printf(">>>>>>>>>>>>>>>>ReadCapacity returned %i\r\n", rcode); + return false; + } + ErrorMessage (PSTR(">>>>>>>>>>>>>>>>CAPACITY OK ON LUN"), lun); + for (uint8_t i = 0; i < 8 /*sizeof (Capacity)*/; i++) + D_PrintHex (capacity.data[i], 0x80); + Notify(PSTR("\r\n\r\n"), 0x80); + + // Only 512/1024/2048/4096 are valid values! + uint32_t c = BMAKE32(capacity.data[4], capacity.data[5], capacity.data[6], capacity.data[7]); + if (c != 0x0200UL && c != 0x0400UL && c != 0x0800UL && c != 0x1000UL) return false; + + // Store capacity information. + CurrentSectorSize[lun] = (uint16_t)(c); // & 0xFFFF); + + CurrentCapacity[lun] = BMAKE32(capacity.data[0], capacity.data[1], capacity.data[2], capacity.data[3]) + 1; + if (CurrentCapacity[lun] == /*0xFFFFFFFFUL */ 0x01UL || CurrentCapacity[lun] == 0x00UL) { + // Buggy firmware will report 0xFFFFFFFF or 0 for no media + if (CurrentCapacity[lun]) + ErrorMessage (PSTR(">>>>>>>>>>>>>>>>BUGGY FIRMWARE. CAPACITY FAIL ON LUN"), lun); + return false; + } + delay(20); + Page3F(lun); + return !TestUnitReady(lun); } /** @@ -652,24 +628,20 @@ bool BulkOnly::CheckLUN(uint8_t lun) { * Scan for media change on all LUNs */ void BulkOnly::CheckMedia() { - for(uint8_t lun = 0; lun <= bMaxLUN; lun++) { - if(TestUnitReady(lun)) { - LUNOk[lun] = false; - continue; - } - if(!LUNOk[lun]) - LUNOk[lun] = CheckLUN(lun); - } -#if 0 - printf("}}}}}}}}}}}}}}}}STATUS "); - for(uint8_t lun = 0; lun <= bMaxLUN; lun++) { - if(LUNOk[lun]) - printf("#"); - else printf("."); - } - printf("\r\n"); -#endif - qNextPollTime = (uint32_t)millis() + 2000; + for (uint8_t lun = 0; lun <= bMaxLUN; lun++) { + if (TestUnitReady(lun)) { + LUNOk[lun] = false; + continue; + } + if (!LUNOk[lun]) LUNOk[lun] = CheckLUN(lun); + } + #if 0 + printf("}}}}}}}}}}}}}}}}STATUS "); + for (uint8_t lun = 0; lun <= bMaxLUN; lun++) + printf(LUNOk[lun] ? "#" : "."); + printf("\r\n"); + #endif + qNextPollTime = (uint32_t)millis() + 2000; } /** @@ -678,25 +650,15 @@ void BulkOnly::CheckMedia() { * @return */ uint8_t BulkOnly::Poll() { - //uint8_t rcode = 0; - - if(!bPollEnable) - return 0; - - if((int32_t)((uint32_t)millis() - qNextPollTime) >= 0L) { - CheckMedia(); - } - //rcode = 0; - - return 0; + //uint8_t rcode = 0; + if (!bPollEnable) return 0; + if ((int32_t)((uint32_t)millis() - qNextPollTime) >= 0L) CheckMedia(); + //rcode = 0; + return 0; } //////////////////////////////////////////////////////////////////////////////// - - // SCSI code - - //////////////////////////////////////////////////////////////////////////////// /** @@ -708,7 +670,7 @@ uint8_t BulkOnly::Poll() { uint8_t BulkOnly::GetMaxLUN(uint8_t *plun) { uint8_t ret = pUsb->ctrlReq(bAddress, 0, bmREQ_MASSIN, MASS_REQ_GET_MAX_LUN, 0, 0, bIface, 1, 1, plun, NULL); - if(ret == hrSTALL) + if (ret == hrSTALL) *plun = 0; return 0; @@ -726,7 +688,7 @@ uint8_t BulkOnly::Inquiry(uint8_t lun, uint16_t bsize, uint8_t *buf) { Notify(PSTR("\r\nInquiry\r\n"), 0x80); Notify(PSTR("---------\r\n"), 0x80); - CDB6_t cdb = CDB6_t(SCSI_CMD_INQUIRY, lun, 0LU, (uint8_t)bsize, 0); + CDB6_t cdb = CDB6_t(SCSI_CMD_INQUIRY, lun, 0UL, (uint8_t)bsize, 0); uint8_t rc = SCSITransaction6(&cdb, bsize, buf, (uint8_t)MASS_CMD_DIR_IN); return rc; @@ -740,7 +702,7 @@ uint8_t BulkOnly::Inquiry(uint8_t lun, uint16_t bsize, uint8_t *buf) { */ uint8_t BulkOnly::TestUnitReady(uint8_t lun) { //SetCurLUN(lun); - if(!bAddress) + if (!bAddress) return MASS_ERR_UNIT_NOT_READY; Notify(PSTR("\r\nTestUnitReady\r\n"), 0x80); @@ -796,7 +758,7 @@ uint8_t BulkOnly::ReadCapacity10(uint8_t lun, uint8_t *buf) { */ uint8_t BulkOnly::Page3F(uint8_t lun) { uint8_t buf[192]; - for(int i = 0; i < 192; i++) { + for (int i = 0; i < 192; i++) { buf[i] = 0x00; } WriteOk[lun] = true; @@ -804,11 +766,11 @@ uint8_t BulkOnly::Page3F(uint8_t lun) { return 0; #endif uint8_t rc = ModeSense6(lun, 0, 0x3f, 0, 192, buf); - if(!rc) { + if (!rc) { WriteOk[lun] = ((buf[2] & 0x80) == 0); Notify(PSTR("Mode Sense: "), 0x80); - for(int i = 0; i < 4; i++) { - D_PrintHex (buf[i], 0x80); + for (int i = 0; i < 4; i++) { + D_PrintHex (buf[i], 0x80); Notify(PSTR(" "), 0x80); } Notify(PSTR("\r\n"), 0x80); @@ -828,7 +790,7 @@ uint8_t BulkOnly::RequestSense(uint8_t lun, uint16_t size, uint8_t *buf) { Notify(PSTR("\r\nRequestSense\r\n"), 0x80); Notify(PSTR("----------------\r\n"), 0x80); - CDB6_t cdb = CDB6_t(SCSI_CMD_REQUEST_SENSE, lun, 0LU, (uint8_t)size, 0); + CDB6_t cdb = CDB6_t(SCSI_CMD_REQUEST_SENSE, lun, 0UL, (uint8_t)size, 0); CommandBlockWrapper cbw = CommandBlockWrapper(++dCBWTag, (uint32_t)size, &cdb, (uint8_t)MASS_CMD_DIR_IN); //SetCurLUN(lun); return Transaction(&cbw, size, buf); @@ -836,11 +798,7 @@ uint8_t BulkOnly::RequestSense(uint8_t lun, uint16_t size, uint8_t *buf) { //////////////////////////////////////////////////////////////////////////////// - - // USB code - - //////////////////////////////////////////////////////////////////////////////// /** @@ -850,17 +808,17 @@ uint8_t BulkOnly::RequestSense(uint8_t lun, uint16_t size, uint8_t *buf) { * @return */ uint8_t BulkOnly::ClearEpHalt(uint8_t index) { - if(index == 0) + if (index == 0) return 0; uint8_t ret = 0; - while((ret = (pUsb->ctrlReq(bAddress, 0, USB_SETUP_HOST_TO_DEVICE | USB_SETUP_TYPE_STANDARD | USB_SETUP_RECIPIENT_ENDPOINT, USB_REQUEST_CLEAR_FEATURE, USB_FEATURE_ENDPOINT_HALT, 0, ((index == epDataInIndex) ? (0x80 | epInfo[index].epAddr) : epInfo[index].epAddr), 0, 0, NULL, NULL)) == 0x01)) + while ((ret = (pUsb->ctrlReq(bAddress, 0, USB_SETUP_HOST_TO_DEVICE | USB_SETUP_TYPE_STANDARD | USB_SETUP_RECIPIENT_ENDPOINT, USB_REQUEST_CLEAR_FEATURE, USB_FEATURE_ENDPOINT_HALT, 0, ((index == epDataInIndex) ? (0x80 | epInfo[index].epAddr) : epInfo[index].epAddr), 0, 0, NULL, NULL)) == 0x01)) delay(6); - if(ret) { - ErrorMessage (PSTR("ClearEpHalt"), ret); - ErrorMessage (PSTR("EP"), ((index == epDataInIndex) ? (0x80 | epInfo[index].epAddr) : epInfo[index].epAddr)); + if (ret) { + ErrorMessage (PSTR("ClearEpHalt"), ret); + ErrorMessage (PSTR("EP"), ((index == epDataInIndex) ? (0x80 | epInfo[index].epAddr) : epInfo[index].epAddr)); return ret; } epInfo[index].bmSndToggle = 0; @@ -873,7 +831,7 @@ uint8_t BulkOnly::ClearEpHalt(uint8_t index) { * */ void BulkOnly::Reset() { - while(pUsb->ctrlReq(bAddress, 0, bmREQ_MASSOUT, MASS_REQ_BOMSR, 0, 0, bIface, 0, 0, NULL, NULL) == 0x01) delay(6); + while (pUsb->ctrlReq(bAddress, 0, bmREQ_MASSOUT, MASS_REQ_BOMSR, 0, 0, bIface, 0, 0, NULL, NULL) == 0x01) delay(6); } /** @@ -901,29 +859,29 @@ uint8_t BulkOnly::ResetRecovery() { * Clear all EP data and clear all LUN status */ void BulkOnly::ClearAllEP() { - for(uint8_t i = 0; i < MASS_MAX_ENDPOINTS; i++) { - epInfo[i].epAddr = 0; - epInfo[i].maxPktSize = (i) ? 0 : 8; - epInfo[i].bmSndToggle = 0; - epInfo[i].bmRcvToggle = 0; - epInfo[i].bmNakPower = USB_NAK_DEFAULT; - } - - for(uint8_t i = 0; i < MASS_MAX_SUPPORTED_LUN; i++) { - LUNOk[i] = false; - WriteOk[i] = false; - CurrentCapacity[i] = 0lu; - CurrentSectorSize[i] = 0; - } - - bIface = 0; - bNumEP = 1; - bAddress = 0; - qNextPollTime = 0; - bPollEnable = false; - bLastUsbError = 0; - bMaxLUN = 0; - bTheLUN = 0; + for (uint8_t i = 0; i < MASS_MAX_ENDPOINTS; i++) { + epInfo[i].epAddr = 0; + epInfo[i].maxPktSize = (i) ? 0 : 8; + epInfo[i].bmSndToggle = 0; + epInfo[i].bmRcvToggle = 0; + epInfo[i].bmNakPower = USB_NAK_DEFAULT; + } + + for (uint8_t i = 0; i < MASS_MAX_SUPPORTED_LUN; i++) { + LUNOk[i] = false; + WriteOk[i] = false; + CurrentCapacity[i] = 0UL; + CurrentSectorSize[i] = 0; + } + + bIface = 0; + bNumEP = 1; + bAddress = 0; + qNextPollTime = 0; + bPollEnable = false; + bLastUsbError = 0; + bMaxLUN = 0; + bTheLUN = 0; } /** @@ -934,15 +892,15 @@ void BulkOnly::ClearAllEP() { * @return */ bool BulkOnly::IsValidCSW(CommandStatusWrapper *pcsw, CommandBlockWrapperBase *pcbw) { - if(pcsw->dCSWSignature != MASS_CSW_SIGNATURE) { - Notify(PSTR("CSW:Sig error\r\n"), 0x80); - return false; - } - if(pcsw->dCSWTag != pcbw->dCBWTag) { - Notify(PSTR("CSW:Wrong tag\r\n"), 0x80); - return false; - } - return true; + if (pcsw->dCSWSignature != MASS_CSW_SIGNATURE) { + Notify(PSTR("CSW:Sig error\r\n"), 0x80); + return false; + } + if (pcsw->dCSWTag != pcbw->dCBWTag) { + Notify(PSTR("CSW:Wrong tag\r\n"), 0x80); + return false; + } + return true; } /** @@ -953,65 +911,56 @@ bool BulkOnly::IsValidCSW(CommandStatusWrapper *pcsw, CommandBlockWrapperBase *p * @return */ uint8_t BulkOnly::HandleUsbError(uint8_t error, uint8_t index) { - uint8_t count = 3; - - bLastUsbError = error; - //if (error) - //ClearEpHalt(index); - while(error && count) { - if(error != hrSUCCESS) { - ErrorMessage (PSTR("USB Error"), error); - ErrorMessage (PSTR("Index"), index); - } - switch(error) { - // case hrWRONGPID: - case hrSUCCESS: - return MASS_ERR_SUCCESS; - case hrBUSY: - // SIE is busy, just hang out and try again. - return MASS_ERR_UNIT_BUSY; - case hrTIMEOUT: - case hrJERR: return MASS_ERR_DEVICE_DISCONNECTED; - case hrSTALL: - if(index == 0) - return MASS_ERR_STALL; - ClearEpHalt(index); - if(index != epDataInIndex) - return MASS_ERR_WRITE_STALL; - return MASS_ERR_STALL; - - case hrNAK: - if(index == 0) - return MASS_ERR_UNIT_BUSY; - return MASS_ERR_UNIT_BUSY; - - case hrTOGERR: - // Handle a very super rare corner case, where toggles become de-synched. - // I have only ran into one device that has this firmware bug, and this is - // the only clean way to get back into sync with the buggy device firmware. - // --AJK - if(bAddress && bConfNum) { - error = pUsb->setConf(bAddress, 0, bConfNum); - - if(error) - break; - } - return MASS_ERR_SUCCESS; - default: - ErrorMessage (PSTR("\r\nUSB"), error); - return MASS_ERR_GENERAL_USB_ERROR; - } - count--; - } // while - - return ((error && !count) ? MASS_ERR_GENERAL_USB_ERROR : MASS_ERR_SUCCESS); + uint8_t count = 3; + + bLastUsbError = error; + //if (error) + //ClearEpHalt(index); + while (error && count) { + if (error != hrSUCCESS) { + ErrorMessage (PSTR("USB Error"), error); + ErrorMessage (PSTR("Index"), index); + } + switch (error) { + // case hrWRONGPID: + case hrSUCCESS: return MASS_ERR_SUCCESS; + case hrBUSY: return MASS_ERR_UNIT_BUSY; // SIE is busy, just hang out and try again. + case hrTIMEOUT: + case hrJERR: return MASS_ERR_DEVICE_DISCONNECTED; + case hrSTALL: + if (index) { + ClearEpHalt(index); + return (index == epDataInIndex) ? MASS_ERR_STALL : MASS_ERR_WRITE_STALL; + } + return MASS_ERR_STALL; + + case hrNAK: + return index ? MASS_ERR_UNIT_BUSY : MASS_ERR_UNIT_BUSY; + + case hrTOGERR: + // Handle a super rare corner case, where toggles become de-synced. + // I've only run into one device that has this firmware bug, and this is + // the only clean way to get back into sync with the buggy device firmware. + // --AJK + if (bAddress && bConfNum) { + error = pUsb->setConf(bAddress, 0, bConfNum); + if (error) break; + } + return MASS_ERR_SUCCESS; + default: + ErrorMessage (PSTR("\r\nUSB"), error); + return MASS_ERR_GENERAL_USB_ERROR; + } + count--; + } // while + + return ((error && !count) ? MASS_ERR_GENERAL_USB_ERROR : MASS_ERR_SUCCESS); } #if MS_WANT_PARSER - -uint8_t BulkOnly::Transaction(CommandBlockWrapper *pcbw, uint16_t buf_size, void *buf) { - return Transaction(CommandBlockWrapper *pcbw, uint16_t buf_size, void *buf, 0); -} + uint8_t BulkOnly::Transaction(CommandBlockWrapper *pcbw, uint16_t buf_size, void *buf) { + return Transaction(CommandBlockWrapper *pcbw, uint16_t buf_size, void *buf, 0); + } #endif /** @@ -1024,101 +973,100 @@ uint8_t BulkOnly::Transaction(CommandBlockWrapper *pcbw, uint16_t buf_size, void * @return */ uint8_t BulkOnly::Transaction(CommandBlockWrapper *pcbw, uint16_t buf_size, void *buf -#if MS_WANT_PARSER - , uint8_t flags -#endif - ) { - -#if MS_WANT_PARSER - uint16_t bytes = (pcbw->dCBWDataTransferLength > buf_size) ? buf_size : pcbw->dCBWDataTransferLength; - printf("Transfersize %i\r\n", bytes); - delay(1000); - - bool callback = (flags & MASS_TRANS_FLG_CALLBACK) == MASS_TRANS_FLG_CALLBACK; -#else - uint16_t bytes = buf_size; -#endif - bool write = (pcbw->bmCBWFlags & MASS_CMD_DIR_IN) != MASS_CMD_DIR_IN; - uint8_t ret = 0; - uint8_t usberr; - CommandStatusWrapper csw; // up here, we allocate ahead to save cpu cycles. - SetCurLUN(pcbw->bmCBWLUN); - ErrorMessage (PSTR("CBW.dCBWTag"), pcbw->dCBWTag); - - while((usberr = pUsb->outTransfer(bAddress, epInfo[epDataOutIndex].epAddr, sizeof (CommandBlockWrapper), (uint8_t*)pcbw)) == hrBUSY) delay(1); - + #if MS_WANT_PARSER + , uint8_t flags + #endif +) { + #if MS_WANT_PARSER + uint16_t bytes = (pcbw->dCBWDataTransferLength > buf_size) ? buf_size : pcbw->dCBWDataTransferLength; + printf("Transfersize %i\r\n", bytes); + delay(1000); + + bool callback = (flags & MASS_TRANS_FLG_CALLBACK) == MASS_TRANS_FLG_CALLBACK; + #else + uint16_t bytes = buf_size; + #endif + + bool write = (pcbw->bmCBWFlags & MASS_CMD_DIR_IN) != MASS_CMD_DIR_IN; + uint8_t ret = 0; + uint8_t usberr; + CommandStatusWrapper csw; // up here, we allocate ahead to save cpu cycles. + SetCurLUN(pcbw->bmCBWLUN); + ErrorMessage (PSTR("CBW.dCBWTag"), pcbw->dCBWTag); + + while ((usberr = pUsb->outTransfer(bAddress, epInfo[epDataOutIndex].epAddr, sizeof (CommandBlockWrapper), (uint8_t*)pcbw)) == hrBUSY) delay(1); + + ret = HandleUsbError(usberr, epDataOutIndex); + //ret = HandleUsbError(pUsb->outTransfer(bAddress, epInfo[epDataOutIndex].epAddr, sizeof (CommandBlockWrapper), (uint8_t*)pcbw), epDataOutIndex); + if (ret) + ErrorMessage (PSTR("============================ CBW"), ret); + else { + if (bytes) { + if (!write) { + #if MS_WANT_PARSER + if (callback) { + uint8_t rbuf[bytes]; + while ((usberr = pUsb->inTransfer(bAddress, epInfo[epDataInIndex].epAddr, &bytes, rbuf)) == hrBUSY) delay(1); + if (usberr == hrSUCCESS) ((USBReadParser*)buf)->Parse(bytes, rbuf, 0); + } + else + #endif + { + while ((usberr = pUsb->inTransfer(bAddress, epInfo[epDataInIndex].epAddr, &bytes, (uint8_t*)buf)) == hrBUSY) delay(1); + } + ret = HandleUsbError(usberr, epDataInIndex); + } + else { + while ((usberr = pUsb->outTransfer(bAddress, epInfo[epDataOutIndex].epAddr, bytes, (uint8_t*)buf)) == hrBUSY) delay(1); ret = HandleUsbError(usberr, epDataOutIndex); - //ret = HandleUsbError(pUsb->outTransfer(bAddress, epInfo[epDataOutIndex].epAddr, sizeof (CommandBlockWrapper), (uint8_t*)pcbw), epDataOutIndex); - if(ret) { - ErrorMessage (PSTR("============================ CBW"), ret); - } else { - if(bytes) { - if(!write) { -#if MS_WANT_PARSER - if(callback) { - uint8_t rbuf[bytes]; - while((usberr = pUsb->inTransfer(bAddress, epInfo[epDataInIndex].epAddr, &bytes, rbuf)) == hrBUSY) delay(1); - if(usberr == hrSUCCESS) ((USBReadParser*)buf)->Parse(bytes, rbuf, 0); - } else { -#endif - while((usberr = pUsb->inTransfer(bAddress, epInfo[epDataInIndex].epAddr, &bytes, (uint8_t*)buf)) == hrBUSY) delay(1); -#if MS_WANT_PARSER - - } -#endif - ret = HandleUsbError(usberr, epDataInIndex); - } else { - while((usberr = pUsb->outTransfer(bAddress, epInfo[epDataOutIndex].epAddr, bytes, (uint8_t*)buf)) == hrBUSY) delay(1); - ret = HandleUsbError(usberr, epDataOutIndex); - } - if(ret) { - ErrorMessage (PSTR("============================ DAT"), ret); - } - } - } - - { - bytes = sizeof (CommandStatusWrapper); - int tries = 2; - while(tries--) { - while((usberr = pUsb->inTransfer(bAddress, epInfo[epDataInIndex].epAddr, &bytes, (uint8_t*) & csw)) == hrBUSY) delay(1); - if(!usberr) break; - ClearEpHalt(epDataInIndex); - if(tries) ResetRecovery(); - } - if(!ret) { - Notify(PSTR("CBW:\t\tOK\r\n"), 0x80); - Notify(PSTR("Data Stage:\tOK\r\n"), 0x80); - } else { - // Throw away csw, IT IS NOT OF ANY USE. - ResetRecovery(); - return ret; - } - ret = HandleUsbError(usberr, epDataInIndex); - if(ret) { - ErrorMessage (PSTR("============================ CSW"), ret); - } - if(usberr == hrSUCCESS) { - if(IsValidCSW(&csw, pcbw)) { - //ErrorMessage (PSTR("CSW.dCBWTag"), csw.dCSWTag); - //ErrorMessage (PSTR("bCSWStatus"), csw.bCSWStatus); - //ErrorMessage (PSTR("dCSWDataResidue"), csw.dCSWDataResidue); - Notify(PSTR("CSW:\t\tOK\r\n\r\n"), 0x80); - return csw.bCSWStatus; - } else { - // NOTE! Sometimes this is caused by the reported residue being wrong. - // Get a different device. It isn't compliant, and should have never passed Q&A. - // I own one... 05e3:0701 Genesys Logic, Inc. USB 2.0 IDE Adapter. - // Other devices that exhibit this behavior exist in the wild too. - // Be sure to check quirks in the Linux source code before reporting a bug. --xxxajk - Notify(PSTR("Invalid CSW\r\n"), 0x80); - ResetRecovery(); - //return MASS_ERR_SUCCESS; - return MASS_ERR_INVALID_CSW; - } - } - } - return ret; + } + if (ret) ErrorMessage (PSTR("============================ DAT"), ret); + } + } + + bytes = sizeof (CommandStatusWrapper); + int tries = 2; + while (tries--) { + while ((usberr = pUsb->inTransfer(bAddress, epInfo[epDataInIndex].epAddr, &bytes, (uint8_t*) & csw)) == hrBUSY) delay(1); + if (!usberr) break; + ClearEpHalt(epDataInIndex); + if (tries) ResetRecovery(); + } + + if (!ret) { + Notify(PSTR("CBW:\t\tOK\r\n"), 0x80); + Notify(PSTR("Data Stage:\tOK\r\n"), 0x80); + } + else { + // Throw away csw, IT IS NOT OF ANY USE. + ResetRecovery(); + return ret; + } + + ret = HandleUsbError(usberr, epDataInIndex); + if (ret) ErrorMessage (PSTR("============================ CSW"), ret); + + if (usberr == hrSUCCESS) { + if (IsValidCSW(&csw, pcbw)) { + //ErrorMessage (PSTR("CSW.dCBWTag"), csw.dCSWTag); + //ErrorMessage (PSTR("bCSWStatus"), csw.bCSWStatus); + //ErrorMessage (PSTR("dCSWDataResidue"), csw.dCSWDataResidue); + Notify(PSTR("CSW:\t\tOK\r\n\r\n"), 0x80); + return csw.bCSWStatus; + } + else { + // NOTE! Sometimes this is caused by the reported residue being wrong. + // Get a different device. It isn't compliant, and should have never passed Q&A. + // I own one... 05e3:0701 Genesys Logic, Inc. USB 2.0 IDE Adapter. + // Other devices that exhibit this behavior exist in the wild too. + // Be sure to check quirks in the Linux source code before reporting a bug. --xxxajk + Notify(PSTR("Invalid CSW\r\n"), 0x80); + ResetRecovery(); + //return MASS_ERR_SUCCESS; + return MASS_ERR_INVALID_CSW; + } + } + return ret; } /** @@ -1128,11 +1076,10 @@ uint8_t BulkOnly::Transaction(CommandBlockWrapper *pcbw, uint16_t buf_size, void * @return */ uint8_t BulkOnly::SetCurLUN(uint8_t lun) { - if(lun > bMaxLUN) - return MASS_ERR_INVALID_LUN; - bTheLUN = lun; - return MASS_ERR_SUCCESS; -}; + if (lun > bMaxLUN) return MASS_ERR_INVALID_LUN; + bTheLUN = lun; + return MASS_ERR_SUCCESS; +} /** * For driver use only. @@ -1141,83 +1088,78 @@ uint8_t BulkOnly::SetCurLUN(uint8_t lun) { * @return */ uint8_t BulkOnly::HandleSCSIError(uint8_t status) { - uint8_t ret = 0; + uint8_t ret = 0; - switch(status) { - case 0: return MASS_ERR_SUCCESS; - - case 2: - ErrorMessage (PSTR("Phase Error"), status); - ErrorMessage (PSTR("LUN"), bTheLUN); - ResetRecovery(); - return MASS_ERR_GENERAL_SCSI_ERROR; - - case 1: - ErrorMessage (PSTR("SCSI Error"), status); - ErrorMessage (PSTR("LUN"), bTheLUN); - RequestSenseResponce rsp; - - ret = RequestSense(bTheLUN, sizeof (RequestSenseResponce), (uint8_t*) & rsp); - - if(ret) { - return MASS_ERR_GENERAL_SCSI_ERROR; - } - ErrorMessage (PSTR("Response Code"), rsp.bResponseCode); - if(rsp.bResponseCode & 0x80) { - Notify(PSTR("Information field: "), 0x80); - for(int i = 0; i < 4; i++) { - D_PrintHex (rsp.CmdSpecificInformation[i], 0x80); - Notify(PSTR(" "), 0x80); - } - Notify(PSTR("\r\n"), 0x80); - } - ErrorMessage (PSTR("Sense Key"), rsp.bmSenseKey); - ErrorMessage (PSTR("Add Sense Code"), rsp.bAdditionalSenseCode); - ErrorMessage (PSTR("Add Sense Qual"), rsp.bAdditionalSenseQualifier); - // warning, this is not testing ASQ, only SK and ASC. - switch(rsp.bmSenseKey) { - case SCSI_S_UNIT_ATTENTION: - switch(rsp.bAdditionalSenseCode) { - case SCSI_ASC_MEDIA_CHANGED: - return MASS_ERR_MEDIA_CHANGED; - default: - return MASS_ERR_UNIT_NOT_READY; - } - case SCSI_S_NOT_READY: - switch(rsp.bAdditionalSenseCode) { - case SCSI_ASC_MEDIUM_NOT_PRESENT: - return MASS_ERR_NO_MEDIA; - default: - return MASS_ERR_UNIT_NOT_READY; - } - case SCSI_S_ILLEGAL_REQUEST: - switch(rsp.bAdditionalSenseCode) { - case SCSI_ASC_LBA_OUT_OF_RANGE: - return MASS_ERR_BAD_LBA; - default: - return MASS_ERR_CMD_NOT_SUPPORTED; - } - default: - return MASS_ERR_GENERAL_SCSI_ERROR; - } - - // case 4: return MASS_ERR_UNIT_BUSY; // Busy means retry later. - // case 0x05/0x14: we stalled out - // case 0x15/0x16: we naked out. - default: - ErrorMessage (PSTR("Gen SCSI Err"), status); - ErrorMessage (PSTR("LUN"), bTheLUN); - return status; - } // switch -} + switch (status) { + case 0: return MASS_ERR_SUCCESS; + case 2: + ErrorMessage (PSTR("Phase Error"), status); + ErrorMessage (PSTR("LUN"), bTheLUN); + ResetRecovery(); + return MASS_ERR_GENERAL_SCSI_ERROR; -//////////////////////////////////////////////////////////////////////////////// + case 1: + ErrorMessage (PSTR("SCSI Error"), status); + ErrorMessage (PSTR("LUN"), bTheLUN); + RequestSenseResponce rsp; + ret = RequestSense(bTheLUN, sizeof (RequestSenseResponce), (uint8_t*) & rsp); -// Debugging code + if (ret) return MASS_ERR_GENERAL_SCSI_ERROR; + + ErrorMessage (PSTR("Response Code"), rsp.bResponseCode); + if (rsp.bResponseCode & 0x80) { + Notify(PSTR("Information field: "), 0x80); + for (int i = 0; i < 4; i++) { + D_PrintHex (rsp.CmdSpecificInformation[i], 0x80); + Notify(PSTR(" "), 0x80); + } + Notify(PSTR("\r\n"), 0x80); + } + ErrorMessage (PSTR("Sense Key"), rsp.bmSenseKey); + ErrorMessage (PSTR("Add Sense Code"), rsp.bAdditionalSenseCode); + ErrorMessage (PSTR("Add Sense Qual"), rsp.bAdditionalSenseQualifier); + // warning, this is not testing ASQ, only SK and ASC. + switch (rsp.bmSenseKey) { + case SCSI_S_UNIT_ATTENTION: + switch (rsp.bAdditionalSenseCode) { + case SCSI_ASC_MEDIA_CHANGED: + return MASS_ERR_MEDIA_CHANGED; + default: + return MASS_ERR_UNIT_NOT_READY; + } + case SCSI_S_NOT_READY: + switch (rsp.bAdditionalSenseCode) { + case SCSI_ASC_MEDIUM_NOT_PRESENT: + return MASS_ERR_NO_MEDIA; + default: + return MASS_ERR_UNIT_NOT_READY; + } + case SCSI_S_ILLEGAL_REQUEST: + switch (rsp.bAdditionalSenseCode) { + case SCSI_ASC_LBA_OUT_OF_RANGE: + return MASS_ERR_BAD_LBA; + default: + return MASS_ERR_CMD_NOT_SUPPORTED; + } + default: + return MASS_ERR_GENERAL_SCSI_ERROR; + } + + // case 4: return MASS_ERR_UNIT_BUSY; // Busy means retry later. + // case 0x05/0x14: we stalled out + // case 0x15/0x16: we naked out. + default: + ErrorMessage (PSTR("Gen SCSI Err"), status); + ErrorMessage (PSTR("LUN"), bTheLUN); + return status; + } // switch +} +//////////////////////////////////////////////////////////////////////////////// +// Debugging code //////////////////////////////////////////////////////////////////////////////// /** @@ -1225,58 +1167,53 @@ uint8_t BulkOnly::HandleSCSIError(uint8_t status) { * @param ep_ptr */ void BulkOnly::PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR * ep_ptr) { - Notify(PSTR("Endpoint descriptor:"), 0x80); - Notify(PSTR("\r\nLength:\t\t"), 0x80); - D_PrintHex (ep_ptr->bLength, 0x80); - Notify(PSTR("\r\nType:\t\t"), 0x80); - D_PrintHex (ep_ptr->bDescriptorType, 0x80); - Notify(PSTR("\r\nAddress:\t"), 0x80); - D_PrintHex (ep_ptr->bEndpointAddress, 0x80); - Notify(PSTR("\r\nAttributes:\t"), 0x80); - D_PrintHex (ep_ptr->bmAttributes, 0x80); - Notify(PSTR("\r\nMaxPktSize:\t"), 0x80); - D_PrintHex (ep_ptr->wMaxPacketSize, 0x80); - Notify(PSTR("\r\nPoll Intrv:\t"), 0x80); - D_PrintHex (ep_ptr->bInterval, 0x80); - Notify(PSTR("\r\n"), 0x80); + Notify(PSTR("Endpoint descriptor:"), 0x80); + Notify(PSTR("\r\nLength:\t\t"), 0x80); + D_PrintHex (ep_ptr->bLength, 0x80); + Notify(PSTR("\r\nType:\t\t"), 0x80); + D_PrintHex (ep_ptr->bDescriptorType, 0x80); + Notify(PSTR("\r\nAddress:\t"), 0x80); + D_PrintHex (ep_ptr->bEndpointAddress, 0x80); + Notify(PSTR("\r\nAttributes:\t"), 0x80); + D_PrintHex (ep_ptr->bmAttributes, 0x80); + Notify(PSTR("\r\nMaxPktSize:\t"), 0x80); + D_PrintHex (ep_ptr->wMaxPacketSize, 0x80); + Notify(PSTR("\r\nPoll Intrv:\t"), 0x80); + D_PrintHex (ep_ptr->bInterval, 0x80); + Notify(PSTR("\r\n"), 0x80); } - //////////////////////////////////////////////////////////////////////////////// - - // misc/to kill/to-do - - //////////////////////////////////////////////////////////////////////////////// /* We won't be needing this... */ uint8_t BulkOnly::Read(uint8_t lun __attribute__((unused)), uint32_t addr __attribute__((unused)), uint16_t bsize __attribute__((unused)), uint8_t blocks __attribute__((unused)), USBReadParser * prs __attribute__((unused))) { -#if MS_WANT_PARSER - if(!LUNOk[lun]) return MASS_ERR_NO_MEDIA; - Notify(PSTR("\r\nRead (With parser)\r\n"), 0x80); - Notify(PSTR("---------\r\n"), 0x80); - - CommandBlockWrapper cbw = CommandBlockWrapper(); - - cbw.dCBWSignature = MASS_CBW_SIGNATURE; - cbw.dCBWTag = ++dCBWTag; - cbw.dCBWDataTransferLength = ((uint32_t)bsize * blocks); - cbw.bmCBWFlags = MASS_CMD_DIR_IN, - cbw.bmCBWLUN = lun; - cbw.bmCBWCBLength = 10; - - cbw.CBWCB[0] = SCSI_CMD_READ_10; - cbw.CBWCB[8] = blocks; - cbw.CBWCB[2] = ((addr >> 24) & 0xff); - cbw.CBWCB[3] = ((addr >> 16) & 0xff); - cbw.CBWCB[4] = ((addr >> 8) & 0xff); - cbw.CBWCB[5] = (addr & 0xff); - - return HandleSCSIError(Transaction(&cbw, bsize, prs, 1)); -#else - return MASS_ERR_NOT_IMPLEMENTED; -#endif + #if MS_WANT_PARSER + if (!LUNOk[lun]) return MASS_ERR_NO_MEDIA; + Notify(PSTR("\r\nRead (With parser)\r\n"), 0x80); + Notify(PSTR("---------\r\n"), 0x80); + + CommandBlockWrapper cbw = CommandBlockWrapper(); + + cbw.dCBWSignature = MASS_CBW_SIGNATURE; + cbw.dCBWTag = ++dCBWTag; + cbw.dCBWDataTransferLength = ((uint32_t)bsize * blocks); + cbw.bmCBWFlags = MASS_CMD_DIR_IN, + cbw.bmCBWLUN = lun; + cbw.bmCBWCBLength = 10; + + cbw.CBWCB[0] = SCSI_CMD_READ_10; + cbw.CBWCB[8] = blocks; + cbw.CBWCB[2] = ((addr >> 24) & 0xff); + cbw.CBWCB[3] = ((addr >> 16) & 0xff); + cbw.CBWCB[4] = ((addr >> 8) & 0xff); + cbw.CBWCB[5] = (addr & 0xff); + + return HandleSCSIError(Transaction(&cbw, bsize, prs, 1)); + #else + return MASS_ERR_NOT_IMPLEMENTED; + #endif } #endif // USB_FLASH_DRIVE_SUPPORT diff --git a/Marlin/src/sd/usb_flashdrive/lib/masstorage.h b/Marlin/src/sd/usb_flashdrive/lib/masstorage.h index 672f55b250ba..09b82fdb92d4 100644 --- a/Marlin/src/sd/usb_flashdrive/lib/masstorage.h +++ b/Marlin/src/sd/usb_flashdrive/lib/masstorage.h @@ -1,25 +1,26 @@ -/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Contact information -------------------- - -Circuits At Home, LTD -Web : http://www.circuitsathome.com -e-mail : support@circuitsathome.com +/** + * Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Contact information + * ------------------- + * + * Circuits At Home, LTD + * Web : http://www.circuitsathome.com + * e-mail : support@circuitsathome.com */ #pragma once @@ -407,7 +408,7 @@ struct CommandBlockWrapper : public CommandBlockWrapperBase { CommandBlockWrapper() : CommandBlockWrapperBase(0, 0, 0), bmReserved1(0), bmReserved2(0) { - for(int i = 0; i < 16; i++) CBWCB[i] = 0; + for (int i = 0; i < 16; i++) CBWCB[i] = 0; } // Generic Wrap, CDB zeroed. @@ -415,7 +416,7 @@ struct CommandBlockWrapper : public CommandBlockWrapperBase { CommandBlockWrapper(uint32_t tag, uint32_t xflen, uint8_t flgs, uint8_t lu, uint8_t cmdlen, uint8_t cmd) : CommandBlockWrapperBase(tag, xflen, flgs), bmCBWLUN(lu), bmReserved1(0), bmCBWCBLength(cmdlen), bmReserved2(0) { - for(int i = 0; i < 16; i++) CBWCB[i] = 0; + for (int i = 0; i < 16; i++) CBWCB[i] = 0; // Type punning can cause optimization problems and bugs. // Using reinterpret_cast to a dreinterpretifferent object is the proper way to do this. //(((BASICCDB_t *) CBWCB)->LUN) = cmd; @@ -492,27 +493,17 @@ class BulkOnly : public USBDeviceConfig, public UsbConfigXtracter { bool WriteOk[MASS_MAX_SUPPORTED_LUN]; void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr); - // Additional Initialization Method for Subclasses - virtual uint8_t OnInit() { - return 0; - }; + virtual uint8_t OnInit() { return 0; } public: BulkOnly(USB *p); - uint8_t GetLastUsbError() { - return bLastUsbError; - }; - - uint8_t GetbMaxLUN() { - return bMaxLUN; // Max LUN - } + uint8_t GetLastUsbError() { return bLastUsbError; }; - uint8_t GetbTheLUN() { - return bTheLUN; // Active LUN - } + uint8_t GetbMaxLUN() { return bMaxLUN; } // Max LUN + uint8_t GetbTheLUN() { return bTheLUN; } // Active LUN bool WriteProtected(uint8_t lun); uint8_t MediaCTL(uint8_t lun, uint8_t ctl); @@ -532,16 +523,12 @@ class BulkOnly : public USBDeviceConfig, public UsbConfigXtracter { uint8_t Release(); uint8_t Poll(); - virtual uint8_t GetAddress() { - return bAddress; - }; + virtual uint8_t GetAddress() { return bAddress; } // UsbConfigXtracter implementation void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep); - virtual bool DEVCLASSOK(uint8_t klass) { - return (klass == USB_CLASS_MASS_STORAGE); - } + virtual bool DEVCLASSOK(uint8_t klass) { return klass == USB_CLASS_MASS_STORAGE; } uint8_t SCSITransaction6(CDB6_t *cdb, uint16_t buf_size, void *buf, uint8_t dir); uint8_t SCSITransaction10(CDB10_t *cdb, uint16_t buf_size, void *buf, uint8_t dir); @@ -572,5 +559,4 @@ class BulkOnly : public USBDeviceConfig, public UsbConfigXtracter { uint8_t Transaction(CommandBlockWrapper *cbw, uint16_t bsize, void *buf); uint8_t HandleUsbError(uint8_t error, uint8_t index); uint8_t HandleSCSIError(uint8_t status); - }; diff --git a/Marlin/src/sd/usb_flashdrive/lib/max3421e.h b/Marlin/src/sd/usb_flashdrive/lib/max3421e.h index 1ad1e3d3012b..35011f55f15d 100644 --- a/Marlin/src/sd/usb_flashdrive/lib/max3421e.h +++ b/Marlin/src/sd/usb_flashdrive/lib/max3421e.h @@ -1,31 +1,32 @@ -/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Contact information -------------------- - -Circuits At Home, LTD -Web : http://www.circuitsathome.com -e-mail : support@circuitsathome.com +/** + * Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Contact information + * ------------------- + * + * Circuits At Home, LTD + * Web : http://www.circuitsathome.com + * e-mail : support@circuitsathome.com */ -#if !defined(_usb_h_) || defined(_max3421e_h_) -#error "Never include max3421e.h directly; include Usb.h instead" -#else +#pragma once -#define _max3421e_h_ +#ifndef _usb_h_ + #error "Never include max3421e.h directly; include Usb.h instead" +#endif /* MAX3421E register/bit names and bitmasks */ @@ -230,6 +231,3 @@ e-mail : support@circuitsathome.com #define MODE_FS_HOST (bmDPPULLDN|bmDMPULLDN|bmHOST|bmSOFKAENAB) #define MODE_LS_HOST (bmDPPULLDN|bmDMPULLDN|bmHOST|bmLOWSPEED|bmSOFKAENAB) - - -#endif //_max3421e_h_ diff --git a/Marlin/src/sd/usb_flashdrive/lib/message.cpp b/Marlin/src/sd/usb_flashdrive/lib/message.cpp index ac73794c4b73..3148afb5b983 100644 --- a/Marlin/src/sd/usb_flashdrive/lib/message.cpp +++ b/Marlin/src/sd/usb_flashdrive/lib/message.cpp @@ -1,25 +1,26 @@ -/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Contact information -------------------- - -Circuits At Home, LTD -Web : http://www.circuitsathome.com -e-mail : support@circuitsathome.com +/** + * Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Contact information + * ------------------- + * + * Circuits At Home, LTD + * Web : http://www.circuitsathome.com + * e-mail : support@circuitsathome.com */ #include "../../../inc/MarlinConfigPre.h" @@ -34,97 +35,94 @@ e-mail : support@circuitsathome.com int UsbDEBUGlvl = 0x80; void E_Notifyc(char c, int lvl) { - if(UsbDEBUGlvl < lvl) return; -#if defined(ARDUINO) && ARDUINO >=100 - USB_HOST_SERIAL.print(c); -#else - USB_HOST_SERIAL.print(c, BYTE); -#endif - //USB_HOST_SERIAL.flush(); + if (UsbDEBUGlvl < lvl) return; + USB_HOST_SERIAL.print(c + #if !defined(ARDUINO) || ARDUINO < 100 + , BYTE + #endif + ); + //USB_HOST_SERIAL.flush(); } void E_Notify(char const * msg, int lvl) { - if(UsbDEBUGlvl < lvl) return; - if(!msg) return; - char c; - - while((c = pgm_read_byte(msg++))) E_Notifyc(c, lvl); + if (UsbDEBUGlvl < lvl) return; + if (!msg) return; + while (const char c = pgm_read_byte(msg++)) E_Notifyc(c, lvl); } void E_NotifyStr(char const * msg, int lvl) { - if(UsbDEBUGlvl < lvl) return; - if(!msg) return; - char c; - - while((c = *msg++)) E_Notifyc(c, lvl); + if (UsbDEBUGlvl < lvl) return; + if (!msg) return; + while (const char c = *msg++) E_Notifyc(c, lvl); } void E_Notify(uint8_t b, int lvl) { - if(UsbDEBUGlvl < lvl) return; -#if defined(ARDUINO) && ARDUINO >=100 - USB_HOST_SERIAL.print(b); -#else - USB_HOST_SERIAL.print(b, DEC); -#endif - //USB_HOST_SERIAL.flush(); + if (UsbDEBUGlvl < lvl) return; + USB_HOST_SERIAL.print(b + #if !defined(ARDUINO) || ARDUINO < 100 + , DEC + #endif + ); + //USB_HOST_SERIAL.flush(); } void E_Notify(double d, int lvl) { - if(UsbDEBUGlvl < lvl) return; - USB_HOST_SERIAL.print(d); - //USB_HOST_SERIAL.flush(); + if (UsbDEBUGlvl < lvl) return; + USB_HOST_SERIAL.print(d); + //USB_HOST_SERIAL.flush(); } #ifdef DEBUG_USB_HOST -void NotifyFailGetDevDescr(void) { - Notify(PSTR("\r\ngetDevDescr "), 0x80); -} + void NotifyFailGetDevDescr(void) { + Notify(PSTR("\r\ngetDevDescr "), 0x80); + } -void NotifyFailSetDevTblEntry(void) { - Notify(PSTR("\r\nsetDevTblEn "), 0x80); -} + void NotifyFailSetDevTblEntry(void) { + Notify(PSTR("\r\nsetDevTblEn "), 0x80); + } -void NotifyFailGetConfDescr(void) { - Notify(PSTR("\r\ngetConf "), 0x80); -} + void NotifyFailGetConfDescr(void) { + Notify(PSTR("\r\ngetConf "), 0x80); + } -void NotifyFailSetConfDescr(void) { - Notify(PSTR("\r\nsetConf "), 0x80); -} + void NotifyFailSetConfDescr(void) { + Notify(PSTR("\r\nsetConf "), 0x80); + } -void NotifyFailGetDevDescr(uint8_t reason) { - NotifyFailGetDevDescr(); - NotifyFail(reason); -} + void NotifyFailGetDevDescr(uint8_t reason) { + NotifyFailGetDevDescr(); + NotifyFail(reason); + } -void NotifyFailSetDevTblEntry(uint8_t reason) { - NotifyFailSetDevTblEntry(); - NotifyFail(reason); + void NotifyFailSetDevTblEntry(uint8_t reason) { + NotifyFailSetDevTblEntry(); + NotifyFail(reason); -} + } -void NotifyFailGetConfDescr(uint8_t reason) { - NotifyFailGetConfDescr(); - NotifyFail(reason); -} + void NotifyFailGetConfDescr(uint8_t reason) { + NotifyFailGetConfDescr(); + NotifyFail(reason); + } -void NotifyFailSetConfDescr(uint8_t reason) { - NotifyFailSetConfDescr(); - NotifyFail(reason); -} + void NotifyFailSetConfDescr(uint8_t reason) { + NotifyFailSetConfDescr(); + NotifyFail(reason); + } -void NotifyFailUnknownDevice(uint16_t VID, uint16_t PID) { - Notify(PSTR("\r\nUnknown Device Connected - VID: "), 0x80); - D_PrintHex (VID, 0x80); - Notify(PSTR(" PID: "), 0x80); - D_PrintHex (PID, 0x80); -} + void NotifyFailUnknownDevice(uint16_t VID, uint16_t PID) { + Notify(PSTR("\r\nUnknown Device Connected - VID: "), 0x80); + D_PrintHex (VID, 0x80); + Notify(PSTR(" PID: "), 0x80); + D_PrintHex (PID, 0x80); + } + + void NotifyFail(uint8_t rcode) { + D_PrintHex (rcode, 0x80); + Notify(PSTR("\r\n"), 0x80); + } -void NotifyFail(uint8_t rcode) { - D_PrintHex (rcode, 0x80); - Notify(PSTR("\r\n"), 0x80); -} #endif // DEBUG_USB_HOST #endif // USB_FLASH_DRIVE_SUPPORT diff --git a/Marlin/src/sd/usb_flashdrive/lib/message.h b/Marlin/src/sd/usb_flashdrive/lib/message.h index 71c0f7bcdeae..087a4bf501a6 100644 --- a/Marlin/src/sd/usb_flashdrive/lib/message.h +++ b/Marlin/src/sd/usb_flashdrive/lib/message.h @@ -1,30 +1,32 @@ -/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Contact information -------------------- - -Circuits At Home, LTD -Web : http://www.circuitsathome.com -e-mail : support@circuitsathome.com +/** + * Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Contact information + * ------------------- + * + * Circuits At Home, LTD + * Web : http://www.circuitsathome.com + * e-mail : support@circuitsathome.com */ -#if !defined(_usb_h_) || defined(__MESSAGE_H__) -#error "Never include message.h directly; include Usb.h instead" -#else -#define __MESSAGE_H__ +#pragma once + +#ifndef _usb_h_ + #error "Never include message.h directly; include Usb.h instead" +#endif extern int UsbDEBUGlvl; @@ -34,52 +36,50 @@ void E_NotifyStr(char const * msg, int lvl); void E_Notifyc(char c, int lvl); #ifdef DEBUG_USB_HOST -#define Notify E_Notify -#define NotifyStr E_NotifyStr -#define Notifyc E_Notifyc -void NotifyFailGetDevDescr(uint8_t reason); -void NotifyFailSetDevTblEntry(uint8_t reason); -void NotifyFailGetConfDescr(uint8_t reason); -void NotifyFailSetConfDescr(uint8_t reason); -void NotifyFailGetDevDescr(void); -void NotifyFailSetDevTblEntry(void); -void NotifyFailGetConfDescr(void); -void NotifyFailSetConfDescr(void); -void NotifyFailUnknownDevice(uint16_t VID, uint16_t PID); -void NotifyFail(uint8_t rcode); + #define Notify E_Notify + #define NotifyStr E_NotifyStr + #define Notifyc E_Notifyc + void NotifyFailGetDevDescr(uint8_t reason); + void NotifyFailSetDevTblEntry(uint8_t reason); + void NotifyFailGetConfDescr(uint8_t reason); + void NotifyFailSetConfDescr(uint8_t reason); + void NotifyFailGetDevDescr(void); + void NotifyFailSetDevTblEntry(void); + void NotifyFailGetConfDescr(void); + void NotifyFailSetConfDescr(void); + void NotifyFailUnknownDevice(uint16_t VID, uint16_t PID); + void NotifyFail(uint8_t rcode); #else -#define Notify(...) ((void)0) -#define NotifyStr(...) ((void)0) -#define Notifyc(...) ((void)0) -#define NotifyFailGetDevDescr(...) ((void)0) -#define NotifyFailSetDevTblEntry(...) ((void)0) -#define NotifyFailGetConfDescr(...) ((void)0) -#define NotifyFailGetDevDescr(...) ((void)0) -#define NotifyFailSetDevTblEntry(...) ((void)0) -#define NotifyFailGetConfDescr(...) ((void)0) -#define NotifyFailSetConfDescr(...) ((void)0) -#define NotifyFailUnknownDevice(...) ((void)0) -#define NotifyFail(...) ((void)0) + #define Notify(...) ((void)0) + #define NotifyStr(...) ((void)0) + #define Notifyc(...) ((void)0) + #define NotifyFailGetDevDescr(...) ((void)0) + #define NotifyFailSetDevTblEntry(...) ((void)0) + #define NotifyFailGetConfDescr(...) ((void)0) + #define NotifyFailGetDevDescr(...) ((void)0) + #define NotifyFailSetDevTblEntry(...) ((void)0) + #define NotifyFailGetConfDescr(...) ((void)0) + #define NotifyFailSetConfDescr(...) ((void)0) + #define NotifyFailUnknownDevice(...) ((void)0) + #define NotifyFail(...) ((void)0) #endif template void ErrorMessage(uint8_t level, char const * msg, ERROR_TYPE rcode = 0) { -#ifdef DEBUG_USB_HOST - Notify(msg, level); - Notify(PSTR(": "), level); - D_PrintHex (rcode, level); - Notify(PSTR("\r\n"), level); -#endif + #ifdef DEBUG_USB_HOST + Notify(msg, level); + Notify(PSTR(": "), level); + D_PrintHex (rcode, level); + Notify(PSTR("\r\n"), level); + #endif } template void ErrorMessage(char const * msg __attribute__((unused)), ERROR_TYPE rcode __attribute__((unused)) = 0) { -#ifdef DEBUG_USB_HOST - Notify(msg, 0x80); - Notify(PSTR(": "), 0x80); - D_PrintHex (rcode, 0x80); - Notify(PSTR("\r\n"), 0x80); -#endif + #ifdef DEBUG_USB_HOST + Notify(msg, 0x80); + Notify(PSTR(": "), 0x80); + D_PrintHex (rcode, 0x80); + Notify(PSTR("\r\n"), 0x80); + #endif } - -#endif // __MESSAGE_H__ diff --git a/Marlin/src/sd/usb_flashdrive/lib/parsetools.cpp b/Marlin/src/sd/usb_flashdrive/lib/parsetools.cpp index 1d2a542df724..c03ce55cb31e 100644 --- a/Marlin/src/sd/usb_flashdrive/lib/parsetools.cpp +++ b/Marlin/src/sd/usb_flashdrive/lib/parsetools.cpp @@ -1,25 +1,26 @@ -/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Contact information -------------------- - -Circuits At Home, LTD -Web : http://www.circuitsathome.com -e-mail : support@circuitsathome.com +/** + * Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Contact information + * ------------------- + * + * Circuits At Home, LTD + * Web : http://www.circuitsathome.com + * e-mail : support@circuitsathome.com */ #include "../../../inc/MarlinConfigPre.h" @@ -29,53 +30,48 @@ e-mail : support@circuitsathome.com #include "Usb.h" bool MultiByteValueParser::Parse(uint8_t **pp, uint16_t *pcntdn) { - if(!pBuf) { - Notify(PSTR("Buffer pointer is NULL!\r\n"), 0x80); - return false; - } - for(; countDown && (*pcntdn); countDown--, (*pcntdn)--, (*pp)++) - pBuf[valueSize - countDown] = (**pp); + if (!pBuf) { + Notify(PSTR("Buffer pointer is NULL!\r\n"), 0x80); + return false; + } + for (; countDown && (*pcntdn); countDown--, (*pcntdn)--, (*pp)++) + pBuf[valueSize - countDown] = (**pp); - if(countDown) - return false; + if (countDown) return false; - countDown = valueSize; - return true; + countDown = valueSize; + return true; } bool PTPListParser::Parse(uint8_t **pp, uint16_t *pcntdn, PTP_ARRAY_EL_FUNC pf, const void *me) { - switch(nStage) { - case 0: - pBuf->valueSize = lenSize; - theParser.Initialize(pBuf); - nStage = 1; - - case 1: - if(!theParser.Parse(pp, pcntdn)) - return false; - - arLen = 0; - arLen = (pBuf->valueSize >= 4) ? *((uint32_t*)pBuf->pValue) : (uint32_t)(*((uint16_t*)pBuf->pValue)); - arLenCntdn = arLen; - nStage = 2; - - case 2: - pBuf->valueSize = valSize; - theParser.Initialize(pBuf); - nStage = 3; - - case 3: - for(; arLenCntdn; arLenCntdn--) { - if(!theParser.Parse(pp, pcntdn)) - return false; - - if(pf) - pf(pBuf, (arLen - arLenCntdn), me); - } - - nStage = 0; - } - return true; + switch (nStage) { + case 0: + pBuf->valueSize = lenSize; + theParser.Initialize(pBuf); + nStage = 1; + + case 1: + if (!theParser.Parse(pp, pcntdn)) return false; + + arLen = 0; + arLen = (pBuf->valueSize >= 4) ? *((uint32_t*)pBuf->pValue) : (uint32_t)(*((uint16_t*)pBuf->pValue)); + arLenCntdn = arLen; + nStage = 2; + + case 2: + pBuf->valueSize = valSize; + theParser.Initialize(pBuf); + nStage = 3; + + case 3: + for (; arLenCntdn; arLenCntdn--) { + if (!theParser.Parse(pp, pcntdn)) return false; + if (pf) pf(pBuf, (arLen - arLenCntdn), me); + } + + nStage = 0; + } + return true; } #endif // USB_FLASH_DRIVE_SUPPORT diff --git a/Marlin/src/sd/usb_flashdrive/lib/parsetools.h b/Marlin/src/sd/usb_flashdrive/lib/parsetools.h index 62892061571c..b075c05397b2 100644 --- a/Marlin/src/sd/usb_flashdrive/lib/parsetools.h +++ b/Marlin/src/sd/usb_flashdrive/lib/parsetools.h @@ -1,87 +1,86 @@ -/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Contact information -------------------- - -Circuits At Home, LTD -Web : http://www.circuitsathome.com -e-mail : support@circuitsathome.com +/** + * Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Contact information + * ------------------- + * + * Circuits At Home, LTD + * Web : http://www.circuitsathome.com + * e-mail : support@circuitsathome.com */ +#pragma once -#if !defined(_usb_h_) || defined(__PARSETOOLS_H__) -#error "Never include parsetools.h directly; include Usb.h instead" -#else -#define __PARSETOOLS_H__ +#ifndef _usb_h_ + #error "Never include parsetools.h directly; include Usb.h instead" +#endif struct MultiValueBuffer { - uint8_t valueSize; - void *pValue; + uint8_t valueSize; + void *pValue; } __attribute__((packed)); class MultiByteValueParser { - uint8_t * pBuf; - uint8_t countDown; - uint8_t valueSize; + uint8_t * pBuf; + uint8_t countDown; + uint8_t valueSize; public: - MultiByteValueParser() : pBuf(NULL), countDown(0), valueSize(0) { - }; + MultiByteValueParser() : pBuf(NULL), countDown(0), valueSize(0) { + }; - const uint8_t* GetBuffer() { - return pBuf; - }; + const uint8_t* GetBuffer() { return pBuf; } - void Initialize(MultiValueBuffer * const pbuf) { - pBuf = (uint8_t*)pbuf->pValue; - countDown = valueSize = pbuf->valueSize; - }; + void Initialize(MultiValueBuffer * const pbuf) { + pBuf = (uint8_t*)pbuf->pValue; + countDown = valueSize = pbuf->valueSize; + } - bool Parse(uint8_t **pp, uint16_t *pcntdn); + bool Parse(uint8_t **pp, uint16_t *pcntdn); }; class ByteSkipper { - uint8_t *pBuf; - uint8_t nStage; - uint16_t countDown; + uint8_t *pBuf; + uint8_t nStage; + uint16_t countDown; public: - ByteSkipper() : pBuf(NULL), nStage(0), countDown(0) { - }; - - void Initialize(MultiValueBuffer *pbuf) { - pBuf = (uint8_t*)pbuf->pValue; - countDown = 0; - }; - - bool Skip(uint8_t **pp, uint16_t *pcntdn, uint16_t bytes_to_skip) { - switch(nStage) { - case 0: - countDown = bytes_to_skip; - nStage++; - case 1: - for(; countDown && (*pcntdn); countDown--, (*pp)++, (*pcntdn)--); - - if(!countDown) - nStage = 0; - }; - return (!countDown); - }; + ByteSkipper() : pBuf(NULL), nStage(0), countDown(0) { + } + + void Initialize(MultiValueBuffer *pbuf) { + pBuf = (uint8_t*)pbuf->pValue; + countDown = 0; + } + + bool Skip(uint8_t **pp, uint16_t *pcntdn, uint16_t bytes_to_skip) { + switch (nStage) { + case 0: + countDown = bytes_to_skip; + nStage++; + case 1: + for (; countDown && (*pcntdn); countDown--, (*pp)++, (*pcntdn)--); + + if (!countDown) + nStage = 0; + } + return (!countDown); + } }; // Pointer to a callback function triggered for each element of PTP array when used with PTPArrayParser @@ -90,58 +89,57 @@ typedef void (*PTP_ARRAY_EL_FUNC)(const MultiValueBuffer * const p, uint32_t cou class PTPListParser { public: - enum ParseMode { - modeArray, modeRange/*, modeEnum*/ - }; + enum ParseMode { + modeArray, modeRange/*, modeEnum*/ + }; private: - uint8_t nStage; - uint8_t enStage; + uint8_t nStage; + uint8_t enStage; - uint32_t arLen; - uint32_t arLenCntdn; + uint32_t arLen; + uint32_t arLenCntdn; - uint8_t lenSize; // size of the array length field in bytes - uint8_t valSize; // size of the array element in bytes + uint8_t lenSize; // size of the array length field in bytes + uint8_t valSize; // size of the array element in bytes - MultiValueBuffer *pBuf; + MultiValueBuffer *pBuf; - // The only parser for both size and array element parsing - MultiByteValueParser theParser; + // The only parser for both size and array element parsing + MultiByteValueParser theParser; - uint8_t /*ParseMode*/ prsMode; + uint8_t /*ParseMode*/ prsMode; public: - PTPListParser() : - nStage(0), - enStage(0), - arLen(0), - arLenCntdn(0), - lenSize(0), - valSize(0), - pBuf(NULL), - prsMode(modeArray) { - }; - - void Initialize(const uint8_t len_size, const uint8_t val_size, MultiValueBuffer * const p, const uint8_t mode = modeArray) { - pBuf = p; - lenSize = len_size; - valSize = val_size; - prsMode = mode; - - if(prsMode == modeRange) { - arLenCntdn = arLen = 3; - nStage = 2; - } else { - arLenCntdn = arLen = 0; - nStage = 0; - } - enStage = 0; - theParser.Initialize(p); - }; - - bool Parse(uint8_t **pp, uint16_t *pcntdn, PTP_ARRAY_EL_FUNC pf, const void *me = NULL); + PTPListParser() : + nStage(0), + enStage(0), + arLen(0), + arLenCntdn(0), + lenSize(0), + valSize(0), + pBuf(NULL), + prsMode(modeArray) { } + ; + + void Initialize(const uint8_t len_size, const uint8_t val_size, MultiValueBuffer * const p, const uint8_t mode = modeArray) { + pBuf = p; + lenSize = len_size; + valSize = val_size; + prsMode = mode; + + if (prsMode == modeRange) { + arLenCntdn = arLen = 3; + nStage = 2; + } + else { + arLenCntdn = arLen = 0; + nStage = 0; + } + enStage = 0; + theParser.Initialize(p); + } + + bool Parse(uint8_t **pp, uint16_t *pcntdn, PTP_ARRAY_EL_FUNC pf, const void *me = NULL); }; - -#endif // __PARSETOOLS_H__ diff --git a/Marlin/src/sd/usb_flashdrive/lib/printhex.h b/Marlin/src/sd/usb_flashdrive/lib/printhex.h index 1261a2889d4d..2cde3fc34148 100644 --- a/Marlin/src/sd/usb_flashdrive/lib/printhex.h +++ b/Marlin/src/sd/usb_flashdrive/lib/printhex.h @@ -1,91 +1,80 @@ -/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Contact information -------------------- - -Circuits At Home, LTD -Web : http://www.circuitsathome.com -e-mail : support@circuitsathome.com +/** + * Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Contact information + * ------------------- + * + * Circuits At Home, LTD + * Web : http://www.circuitsathome.com + * e-mail : support@circuitsathome.com */ +#pragma once -#if !defined(_usb_h_) || defined(__PRINTHEX_H__) -#error "Never include printhex.h directly; include Usb.h instead" -#else -#define __PRINTHEX_H__ +#ifndef _usb_h_ + #error "Never include printhex.h directly; include Usb.h instead" +#endif void E_Notifyc(char c, int lvl); template void PrintHex(T val, int lvl) { - int num_nibbles = sizeof (T) * 2; - - do { - char v = 48 + (((val >> (num_nibbles - 1) * 4)) & 0x0f); - if(v > 57) v += 7; - E_Notifyc(v, lvl); - } while(--num_nibbles); + int num_nibbles = sizeof (T) * 2; + do { + char v = 48 + (((val >> (num_nibbles - 1) * 4)) & 0x0f); + if (v > 57) v += 7; + E_Notifyc(v, lvl); + } while (--num_nibbles); } template void PrintBin(T val, int lvl) { - for(T mask = (((T)1) << ((sizeof (T) << 3) - 1)); mask; mask >>= 1) - if(val & mask) - E_Notifyc('1', lvl); - else - E_Notifyc('0', lvl); + for (T mask = (((T)1) << ((sizeof (T) << 3) - 1)); mask; mask >>= 1) + E_Notifyc(val & mask ? '1' : '0', lvl); } template void SerialPrintHex(T val) { - int num_nibbles = sizeof (T) * 2; - - do { - char v = 48 + (((val >> (num_nibbles - 1) * 4)) & 0x0f); - if(v > 57) v += 7; - USB_HOST_SERIAL.print(v); - } while(--num_nibbles); + int num_nibbles = sizeof (T) * 2; + do { + char v = 48 + (((val >> (num_nibbles - 1) * 4)) & 0x0f); + if (v > 57) v += 7; + USB_HOST_SERIAL.print(v); + } while (--num_nibbles); } template void PrintHex2(Print *prn, T val) { - T mask = (((T)1) << (((sizeof (T) << 1) - 1) << 2)); - - while(mask > 1) { - if(val < mask) - prn->print("0"); - - mask >>= 4; - } - prn->print((T)val, HEX); + T mask = (((T)1) << (((sizeof (T) << 1) - 1) << 2)); + while (mask > 1) { + if (val < mask) prn->print("0"); + mask >>= 4; + } + prn->print((T)val, HEX); } template void D_PrintHex(T val __attribute__((unused)), int lvl __attribute__((unused))) { -#ifdef DEBUG_USB_HOST - PrintHex (val, lvl); -#endif + #ifdef DEBUG_USB_HOST + PrintHex (val, lvl); + #endif } template void D_PrintBin(T val, int lvl) { -#ifdef DEBUG_USB_HOST - PrintBin (val, lvl); -#endif + #ifdef DEBUG_USB_HOST + PrintBin (val, lvl); + #endif } - - - -#endif // __PRINTHEX_H__ diff --git a/Marlin/src/sd/usb_flashdrive/lib/settings.h b/Marlin/src/sd/usb_flashdrive/lib/settings.h index f59467b355cc..dc7782f2a2e4 100644 --- a/Marlin/src/sd/usb_flashdrive/lib/settings.h +++ b/Marlin/src/sd/usb_flashdrive/lib/settings.h @@ -1,25 +1,26 @@ -/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Contact information -------------------- - -Circuits At Home, LTD -Web : http://www.circuitsathome.com -e-mail : support@circuitsathome.com +/** + * Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Contact information + * ------------------- + * + * Circuits At Home, LTD + * Web : http://www.circuitsathome.com + * e-mail : support@circuitsathome.com */ #pragma once @@ -34,7 +35,7 @@ e-mail : support@circuitsathome.com * flash drives and simple USB hard drives. * Disable this by defining DELAY(x) to be delay(x). */ - #define delay(x) if((x) < 200) safe_delay(x) + #define delay(x) if ((x) < 200) safe_delay(x) /* Almost all USB flash drives and simple USB hard drives fail the write * protect test and add 20 - 30 seconds to USB init. Set SKIP_WRITE_PROTECT * to nonzero to skip the test and assume the drive is writable. @@ -43,9 +44,11 @@ e-mail : support@circuitsathome.com /* Since Marlin only cares about USB flash drives, we only need one LUN. */ #define MASS_MAX_SUPPORTED_LUN 1 #endif + //////////////////////////////////////////////////////////////////////////////// // SPI Configuration //////////////////////////////////////////////////////////////////////////////// + #ifndef USB_SPI #define USB_SPI SPI //#define USB_SPI SPI1 diff --git a/Marlin/src/sd/usb_flashdrive/lib/usb_ch9.h b/Marlin/src/sd/usb_flashdrive/lib/usb_ch9.h index 8b5e503fccce..039215b1bbcf 100644 --- a/Marlin/src/sd/usb_flashdrive/lib/usb_ch9.h +++ b/Marlin/src/sd/usb_flashdrive/lib/usb_ch9.h @@ -1,33 +1,33 @@ -/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Contact information -------------------- - -Circuits At Home, LTD -Web : http://www.circuitsathome.com -e-mail : support@circuitsathome.com +/** + * Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Contact information + * ------------------- + * + * Circuits At Home, LTD + * Web : http://www.circuitsathome.com + * e-mail : support@circuitsathome.com */ -#if !defined(_usb_h_) || defined(_ch9_h_) -#error "Never include usb_ch9.h directly; include Usb.h instead" -#else +#ifndef _usb_h_ + #error "Never include usb_ch9.h directly; include Usb.h instead" +#endif /* USB chapter 9 structures */ -#define _ch9_h_ /* Misc.USB constants */ #define DEV_DESCR_LEN 18 //device descriptor length @@ -80,7 +80,6 @@ e-mail : support@circuitsathome.com #define HID_DESCRIPTOR_HID 0x21 - /* OTG SET FEATURE Constants */ #define OTG_FEATURE_B_HNP_ENABLE 3 // SET FEATURE OTG - Enable B device to perform HNP #define OTG_FEATURE_A_HNP_SUPPORT 4 // SET FEATURE OTG - A device supports HNP @@ -169,5 +168,3 @@ typedef struct { uint8_t bDescrType; // Type of class descriptor uint16_t wDescriptorLength; // Total size of the Report descriptor } __attribute__((packed)) HID_CLASS_DESCRIPTOR_LEN_AND_TYPE; - -#endif // _ch9_h_ diff --git a/Marlin/src/sd/usb_flashdrive/usb_host.cpp b/Marlin/src/sd/usb_flashdrive/usb_host.cpp index 71155b82ac1e..41895e86d740 100644 --- a/Marlin/src/sd/usb_flashdrive/usb_host.cpp +++ b/Marlin/src/sd/usb_flashdrive/usb_host.cpp @@ -127,7 +127,7 @@ bool MAX3421e::start() { const uint8_t revision = regRd(rREVISION); if (revision == 0x00 || revision == 0xFF) { - SERIAL_ECHOLNPAIR("Revision register appears incorrect on MAX3421e initialization, got ", revision); + SERIAL_ECHOLNPAIR("Revision register appears incorrect on MAX3421e initialization. Got ", revision); return false; } diff --git a/README.md b/README.md index c1267a1ba688..414efa5e8975 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ # Marlin 3D Printer Firmware -[![Build Status](https://travis-ci.org/MarlinFirmware/Marlin.svg?branch=RCBugFix)](https://travis-ci.org/MarlinFirmware/Marlin) -[![Coverity Scan Build Status](https://scan.coverity.com/projects/2224/badge.svg)](https://scan.coverity.com/projects/2224) +[![Build Status](https://travis-ci.org/MarlinFirmware/Marlin.svg?branch=bugfix-2.0.x)](https://travis-ci.org/MarlinFirmware/Marlin) +![GitHub](https://img.shields.io/github/license/marlinfirmware/marlin.svg) +![GitHub contributors](https://img.shields.io/github/contributors/marlinfirmware/marlin.svg) +![GitHub Release Date](https://img.shields.io/github/release-date/marlinfirmware/marlin.svg) @@ -12,7 +14,7 @@ Please test this firmware and let us know if it misbehaves in any way. Volunteer __Not for production use. Use with caution!__ -Marlin 2.0 takes this popular RepRap firmware to the next level with support for much faster 32-bit processor boards. +Marlin 2.0 takes this popular RepRap firmware to the next level by adding support for much faster 32-bit and ARM-based boards while improving support for 8-bit AVR boards. Read about Marlin's decision to use a "Hardware Abstraction Layer" below. This branch is for patches to the latest 2.0.x release version. Periodically this branch will form the basis for the next minor 2.0.x release. @@ -20,17 +22,17 @@ Download earlier versions of Marlin on the [Releases page](https://github.com/Ma ## Building Marlin 2.0 -To build Marlin 2.0 you'll need [Arduino IDE 1.9](https://www.arduino.cc/en/main/software) or [PlatformIO](http://docs.platformio.org/en/latest/ide.html#platformio-ide). We've posted detailed instructions on how to [build Marlin 2.0 for ARM](http://marlinfw.org/docs/basics/install_arm.html). +To build Marlin 2.0 you'll need [Arduino IDE 1.8.8 or newer](https://www.arduino.cc/en/main/software) or [PlatformIO](http://docs.platformio.org/en/latest/ide.html#platformio-ide). We've posted detailed instructions on [Building Marlin with Arduino](http://marlinfw.org/docs/basics/install_arduino.html) and [Building Marlin with PlatformIO for ReArm](http://marlinfw.org/docs/basics/install_rearm.html) (which applies well to other 32-bit boards). ## Hardware Abstraction Layer (HAL) -Marlin 2.0 adds a new abstraction layer so that Marlin can build and run on 32-bit boards while still retaining full 8-bit AVR compatibility. In this way, features can be enhanced for more powerful platforms while still supporting AVR, whereas splitting up the code would make it harder to maintain and keep everything in sync. +Marlin 2.0 introduces a layer of abstraction so that all the existing high-level code can be built for 32-bit platforms while still retaining full 8-bit AVR compatibility. Retaining AVR compatibility and a single code-base is important to us, because we want to make sure that features and patches get as much testing and attention as possible, and that all platforms always benefit from the latest improvements. ### Current HALs name|processor|speed|flash|sram|logic|fpu ----|---------|-----|-----|----|-----|--- - [Arduino AVR](https://www.arduino.cc/)|ATmega, ATTiny, etc.|16-20MHz|64-256k|2-8k|5V|no + [Arduino AVR](https://www.arduino.cc/)|ATmega, ATTiny, etc.|16-20MHz|64-256k|2-16k|5V|no [Teensy++ 2.0](http://www.microchip.com/wwwproducts/en/AT90USB1286)|[AT90USB1286](http://www.microchip.com/wwwproducts/en/AT90USB1286)|16MHz|128k|8k|5V|no [Due](https://www.arduino.cc/en/Guide/ArduinoDue), [RAMPS-FD](http://www.reprap.org/wiki/RAMPS-FD), etc.|[SAM3X8E ARM-Cortex M3](http://www.microchip.com/wwwproducts/en/ATsam3x8e)|84MHz|512k|64+32k|3.3V|no [Re-ARM](https://www.kickstarter.com/projects/1245051645/re-arm-for-ramps-simple-32-bit-upgrade)|[LPC1768 ARM-Cortex M3](http://www.nxp.com/products/microcontrollers-and-processors/arm-based-processors-and-mcus/lpc-cortex-m-mcus/lpc1700-cortex-m3/512kb-flash-64kb-sram-ethernet-usb-lqfp100-package:LPC1768FBD100)|100MHz|512k|32+16+16k|3.3-5V|no @@ -60,11 +62,13 @@ Proposed patches should be submitted as a Pull Request against the ([bugfix-2.0. ## Credits The current Marlin dev team consists of: - - Roxanne Neufeld [[@Roxy-3D](https://github.com/Roxy-3D)] - English - - Scott Lahteine [[@thinkyhead](https://github.com/thinkyhead)] - English - - Bob Kuhn [[@Bob-the-Kuhn](https://github.com/Bob-the-Kuhn)] - English - - Chris Pepper [[@p3p](https://github.com/p3p)] - English - - João Brazio [[@jbrazio](https://github.com/jbrazio)] - Portuguese, English + + - Scott Lahteine [[@thinkyhead](https://github.com/thinkyhead)] - USA   [![Flattr Scott](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=thinkhead&url=https://github.com/MarlinFirmware/Marlin&title=Marlin&language=&tags=github&category=software) + - Roxanne Neufeld [[@Roxy-3D](https://github.com/Roxy-3D)] - USA + - Bob Kuhn [[@Bob-the-Kuhn](https://github.com/Bob-the-Kuhn)] - USA + - Chris Pepper [[@p3p](https://github.com/p3p)] - UK + - João Brazio [[@jbrazio](https://github.com/jbrazio)] - Portugal + - Erik van der Zalm [[@ErikZalm](https://github.com/ErikZalm)] - Netherlands   [![Flattr Erik](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=ErikZalm&url=https://github.com/MarlinFirmware/Marlin&title=Marlin&language=&tags=github&category=software) ## License diff --git a/buildroot/bin/opt_add b/buildroot/bin/opt_add index 8ef7e07917ce..2c1eb3000822 100755 --- a/buildroot/bin/opt_add +++ b/buildroot/bin/opt_add @@ -1,3 +1,3 @@ #!/usr/bin/env bash -eval "echo \"#define ${1} ${2}\" >>Marlin/Configuration_adv.h" +eval "echo '#define ${@}' >>Marlin/Configuration_adv.h" diff --git a/buildroot/bin/restore_configs b/buildroot/bin/restore_configs index aa0766b20b9a..50db41feda3f 100755 --- a/buildroot/bin/restore_configs +++ b/buildroot/bin/restore_configs @@ -1,6 +1,6 @@ #!/usr/bin/env bash -cp Marlin/src/config/default/Configuration*.h Marlin +cp config/default/Configuration*.h Marlin [ -f Marlin/src/pins/pins_RAMPS.h.backup ] && cp Marlin/src/pins/pins_RAMPS.h.backup Marlin/src/pins/pins_RAMPS.h rm -f Marlin/src/pins/pins_RAMPS.h.backup diff --git a/buildroot/bin/update_defaults b/buildroot/bin/update_defaults index 2dcea0d15529..4442a54e4d8a 100755 --- a/buildroot/bin/update_defaults +++ b/buildroot/bin/update_defaults @@ -1,3 +1,3 @@ #!/usr/bin/env bash -cp Marlin/Configuration*.h Marlin/src/config/default +cp Marlin/Configuration*.h config/default diff --git a/buildroot/bin/use_example_configs b/buildroot/bin/use_example_configs index 423a77d02212..a0a0dcd3dd8a 100755 --- a/buildroot/bin/use_example_configs +++ b/buildroot/bin/use_example_configs @@ -2,18 +2,18 @@ restore_configs -if [ -f "Marlin/src/config/examples/$@/Configuration.h" ]; then - cp "Marlin/src/config/examples/$@/Configuration.h" Marlin/ +if [ -f "config/examples/$@/Configuration.h" ]; then + cp "config/examples/$@/Configuration.h" Marlin/ fi -if [ -f "Marlin/src/config/examples/$@/Configuration_adv.h" ]; then - cp "Marlin/src/config/examples/$@/Configuration_adv.h" Marlin/ +if [ -f "config/examples/$@/Configuration_adv.h" ]; then + cp "config/examples/$@/Configuration_adv.h" Marlin/ fi -if [ -f "Marlin/src/config/examples/$@/_Bootscreen.h" ]; then - cp "Marlin/src/config/examples/$@/_Bootscreen.h" Marlin/ +if [ -f "config/examples/$@/_Bootscreen.h" ]; then + cp "config/examples/$@/_Bootscreen.h" Marlin/ fi -if [ -f "Marlin/src/config/examples/$@/_Statusscreen.h" ]; then - cp "Marlin/src/config/examples/$@/_Statusscreen.h" Marlin/ +if [ -f "config/examples/$@/_Statusscreen.h" ]; then + cp "config/examples/$@/_Statusscreen.h" Marlin/ fi diff --git a/buildroot/share/PlatformIO/boards/blackSTM32F407VET6.json b/buildroot/share/PlatformIO/boards/blackSTM32F407VET6.json new file mode 100644 index 000000000000..c55d7cc80ace --- /dev/null +++ b/buildroot/share/PlatformIO/boards/blackSTM32F407VET6.json @@ -0,0 +1,65 @@ +{ + "build": { + "core": "stm32", + "cpu": "cortex-m4", + "extra_flags": "-DSTM32F407xx", + "f_cpu": "168000000L", + "hwids": [ + [ + "0x1EAF", + "0x0003" + ], + [ + "0x0483", + "0x3748" + ] + ], + "ldscript": "stm32f407xe.ld", + "mcu": "stm32f407vet6", + "variant": "MARLIN_F407VE" + }, + "debug": { + "jlink_device": "STM32F407VE", + "openocd_target": "stm32f4x", + "svd_path": "STM32F40x.svd", + "tools": { + "stlink": { + "server": { + "arguments": [ + "-f", + "scripts/interface/stlink.cfg", + "-c", + "transport select hla_swd", + "-f", + "scripts/target/stm32f4x.cfg", + "-c", + "reset_config none" + ], + "executable": "bin/openocd", + "package": "tool-openocd" + } + } + } + }, + "frameworks": [ + "arduino", + "stm32cube" + ], + "name": "STM32F407VE (192k RAM. 512k Flash)", + "upload": { + "disable_flushing": false, + "maximum_ram_size": 131072, + "maximum_size": 514288, + "protocol": "stlink", + "protocols": [ + "stlink", + "dfu", + "jlink" + ], + "require_upload_port": true, + "use_1200bps_touch": false, + "wait_for_upload_port": false + }, + "url": "http://www.st.com/en/microcontrollers/stm32f407ve.html", + "vendor": "Generic" +} diff --git a/buildroot/share/PlatformIO/ldscripts/mks_robin.ld b/buildroot/share/PlatformIO/ldscripts/mks_robin.ld new file mode 100644 index 000000000000..785345543c0c --- /dev/null +++ b/buildroot/share/PlatformIO/ldscripts/mks_robin.ld @@ -0,0 +1,14 @@ +MEMORY +{ + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K - 40 + rom (rx) : ORIGIN = 0x08007000, LENGTH = 512K - 28K +} + +/* Provide memory region aliases for common.inc */ +REGION_ALIAS("REGION_TEXT", rom); +REGION_ALIAS("REGION_DATA", ram); +REGION_ALIAS("REGION_BSS", ram); +REGION_ALIAS("REGION_RODATA", rom); + +/* Let common.inc handle the real work. */ +INCLUDE common.inc diff --git a/buildroot/share/PlatformIO/scripts/black_stm32f407vet6.py b/buildroot/share/PlatformIO/scripts/black_stm32f407vet6.py new file mode 100644 index 000000000000..cc43893d09fa --- /dev/null +++ b/buildroot/share/PlatformIO/scripts/black_stm32f407vet6.py @@ -0,0 +1,29 @@ +import os,shutil +from SCons.Script import DefaultEnvironment +from platformio import util + +env = DefaultEnvironment() +platform = env.PioPlatform() +board = env.BoardConfig() + +FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoststm32") +CMSIS_DIR = os.path.join(FRAMEWORK_DIR, "CMSIS", "CMSIS") +assert os.path.isdir(FRAMEWORK_DIR) +assert os.path.isdir(CMSIS_DIR) +assert os.path.isdir("buildroot/share/PlatformIO/variants") + +mcu_type = board.get("build.mcu")[:-2] +variant = board.get("build.variant") +series = mcu_type[:7].upper() + "xx" +variant_dir = os.path.join(FRAMEWORK_DIR, "variants", variant) + +source_dir = os.path.join("buildroot/share/PlatformIO/variants", variant) +assert os.path.isdir(source_dir) + +if not os.path.isdir(variant_dir): + os.mkdir(variant_dir) + +for file_name in os.listdir(source_dir): + full_file_name = os.path.join(source_dir, file_name) + if os.path.isfile(full_file_name): + shutil.copy(full_file_name, variant_dir) diff --git a/buildroot/share/PlatformIO/scripts/mks_robin.py b/buildroot/share/PlatformIO/scripts/mks_robin.py new file mode 100644 index 000000000000..742f4cd17379 --- /dev/null +++ b/buildroot/share/PlatformIO/scripts/mks_robin.py @@ -0,0 +1,30 @@ +Import("env") + +# Relocate firmware from 0x08000000 to 0x08007000 +for define in env['CPPDEFINES']: + if define[0] == "VECT_TAB_ADDR": + env['CPPDEFINES'].remove(define) +env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000")) +env.Replace(LDSCRIPT_PATH="buildroot/share/PlatformIO/ldscripts/mks_robin.ld") + +# Encrypt ${PROGNAME}.bin and save it as 'Robin.bin' +def encrypt(source, target, env): + import os + + key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E] + + firmware = open(target[0].path, "rb") + robin = open(target[0].dir.path +'/Robin.bin', "wb") + length = os.path.getsize(target[0].path) + position = 0 + try: + while position < length: + byte = firmware.read(1) + if position >= 320 and position < 31040: + byte = chr(ord(byte) ^ key[position & 31]) + robin.write(byte) + position += 1 + finally: + firmware.close() + robin.close() +env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt); diff --git a/buildroot/share/PlatformIO/variants/MARLIN_F407VE/PeripheralPins.c b/buildroot/share/PlatformIO/variants/MARLIN_F407VE/PeripheralPins.c new file mode 100644 index 000000000000..4e6a71d80162 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_F407VE/PeripheralPins.c @@ -0,0 +1,438 @@ +/* + ******************************************************************************* + * Copyright (c) 2019, STMicroelectronics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. 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. + * 3. Neither the name of STMicroelectronics nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * 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. + ******************************************************************************* + * Automatically generated from STM32F407Z(E-G)Tx.xml + */ +#include "Arduino.h" +#include "PeripheralPins.h" + +/* ===== + * Note: Commented lines are alternative possibilities which are not used per default. + * If you change them, you will have to know what you do + * ===== + */ + +//*** ADC *** + +#ifdef HAL_ADC_MODULE_ENABLED +const PinMap PinMap_ADC[] = { + {PA_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC1_IN0 + // {PA_0, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC2_IN0 + // {PA_0, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC3_IN0 + {PA_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC1_IN1 + // {PA_1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC2_IN1 + // {PA_1, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC3_IN1 + // {PA_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC1_IN2 + {PA_2, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC2_IN2 + // {PA_2, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC3_IN2 + // {PA_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC1_IN3 + // {PA_3, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC2_IN3 + {PA_3, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC3_IN3 + {PA_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC1_IN4 + // {PA_4, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC2_IN4 + // {PA_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC1_IN5 + {PA_5, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC2_IN5 +#if defined(ARDUINO_BLACK_F407ZE) || defined(ARDUINO_BLACK_F407ZG) + // {PA_6, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC1_IN6 + // {PA_6, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC2_IN6 + // {PA_7, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC1_IN7 + // {PA_7, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC2_IN7 + // {PB_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC1_IN8 +#endif + {PB_0, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC2_IN8 + {PB_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC1_IN9 + // {PB_1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC2_IN9 + // {PC_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC1_IN10 + // {PC_0, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC2_IN10 + {PC_0, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC3_IN10 + {PC_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC1_IN11 + // {PC_1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC2_IN11 + // {PC_1, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC3_IN11 + // {PC_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 12, 0)}, // ADC1_IN12 + {PC_2, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 12, 0)}, // ADC2_IN12 + // {PC_2, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 12, 0)}, // ADC3_IN12 + // {PC_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 13, 0)}, // ADC1_IN13 + // {PC_3, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 13, 0)}, // ADC2_IN13 + {PC_3, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 13, 0)}, // ADC3_IN13 + // {PC_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC1_IN14 + {PC_4, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC2_IN14 + // {PC_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC1_IN15 + {PC_5, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC2_IN15 +#if defined(ARDUINO_BLACK_F407ZE) || defined(ARDUINO_BLACK_F407ZG) + // {PF_3, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC3_IN9 + // {PF_4, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC3_IN14 + // {PF_5, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC3_IN15 + {PF_6, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC3_IN4 + {PF_7, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC3_IN5 + {PF_8, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC3_IN6 + // {PF_9, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC3_IN7 + // {PF_10, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC3_IN8 +#endif + {NC, NP, 0} +}; +#endif + +//*** DAC *** + +#ifdef HAL_DAC_MODULE_ENABLED +const PinMap PinMap_DAC[] = { + {PA_4, DAC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // DAC_OUT1 + {PA_5, DAC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // DAC_OUT2 + {NC, NP, 0} +}; +#endif + +//*** I2C *** + +#ifdef HAL_I2C_MODULE_ENABLED +const PinMap PinMap_I2C_SDA[] = { + {PB_7, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PB_9, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PB_11, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, + {PC_9, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)}, +#if defined(ARDUINO_BLACK_F407ZE) || defined(ARDUINO_BLACK_F407ZG) + {PF_0, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, +#endif + {NC, NP, 0} +}; +#endif + +#ifdef HAL_I2C_MODULE_ENABLED +const PinMap PinMap_I2C_SCL[] = { + {PA_8, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)}, + {PB_6, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PB_8, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PB_10, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, +#if defined(ARDUINO_BLACK_F407ZE) || defined(ARDUINO_BLACK_F407ZG) + {PF_1, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, +#endif + {NC, NP, 0} +}; +#endif + +//*** PWM *** + +#ifdef HAL_TIM_MODULE_ENABLED +const PinMap PinMap_PWM[] = { + {PA_0, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 + // {PA_0, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 1, 0)}, // TIM5_CH1 + {PA_1, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 + // {PA_1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 2, 0)}, // TIM5_CH2 + {PA_2, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 + // {PA_2, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 3, 0)}, // TIM5_CH3 + // {PA_2, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 1, 0)}, // TIM9_CH1 + {PA_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4 + // {PA_3, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 4, 0)}, // TIM5_CH4 + // {PA_3, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 2, 0)}, // TIM9_CH2 + {PA_5, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 + // {PA_5, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 1)}, // TIM8_CH1N + {PA_6, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 + // {PA_6, TIM13, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM13, 1, 0)}, // TIM13_CH1 + // {PA_7, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N + {PA_7, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 + // {PA_7, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 1)}, // TIM8_CH1N + // {PA_7, TIM14, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM14, 1, 0)}, // TIM14_CH1 + {PA_8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1 + {PA_9, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2 + {PA_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3 + {PA_11, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 4, 0)}, // TIM1_CH4 + // {PA_15, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 + // {PB_0, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N + {PB_0, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3 + // {PB_0, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 1)}, // TIM8_CH2N + // {PB_1, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N + {PB_1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4 + // {PB_1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 1)}, // TIM8_CH3N + // {PB_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 + {PB_4, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 + {PB_5, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 + {PB_6, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)}, // TIM4_CH1 + {PB_7, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)}, // TIM4_CH2 + {PB_8, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 3, 0)}, // TIM4_CH3 + {PB_8, TIM10, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM10, 1, 0)}, // TIM10_CH1 + {PB_9, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4 + {PB_9, TIM11, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM11, 1, 0)}, // TIM11_CH1 + {PB_10, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 + {PB_11, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4 + {PB_13, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N + {PB_14, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N + {PB_14, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 1)}, // TIM8_CH2N + {PB_14, TIM12, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM12, 1, 0)}, // TIM12_CH1 + {PB_15, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N + {PB_15, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 1)}, // TIM8_CH3N + {PB_15, TIM12, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM12, 2, 0)}, // TIM12_CH2 + {PC_6, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 + {PC_6, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 0)}, // TIM8_CH1 + {PC_7, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 + {PC_7, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 0)}, // TIM8_CH2 + {PC_8, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3 + {PC_8, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 0)}, // TIM8_CH3 + {PC_9, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4 + {PC_9, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 4, 0)}, // TIM8_CH4 + {PD_12, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)}, // TIM4_CH1 + {PD_13, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)}, // TIM4_CH2 + {PD_14, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 3, 0)}, // TIM4_CH3 + {PD_15, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4 + {PE_5, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 1, 0)}, // TIM9_CH1 + {PE_6, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 2, 0)}, // TIM9_CH2 + {PE_8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N + {PE_9, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1 + {PE_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N + {PE_11, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2 + {PE_12, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N + {PE_13, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3 + {PE_14, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 4, 0)}, // TIM1_CH4 +#if defined(ARDUINO_BLACK_F407ZE) || defined(ARDUINO_BLACK_F407ZG) + {PF_6, TIM10, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM10, 1, 0)}, // TIM10_CH1 + {PF_7, TIM11, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM11, 1, 0)}, // TIM11_CH1 + {PF_8, TIM13, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM13, 1, 0)}, // TIM13_CH1 + {PF_9, TIM14, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM14, 1, 0)}, // TIM14_CH1 +#endif + {NC, NP, 0} +}; +#endif + +//*** SERIAL *** + +#ifdef HAL_UART_MODULE_ENABLED +const PinMap PinMap_UART_TX[] = { + {PA_0, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PA_2, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PA_9, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PB_6, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PB_10, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PC_6, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)}, + // {PC_10, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PC_10, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PC_12, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)}, + {PD_5, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PD_8, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, +#if defined(ARDUINO_BLACK_F407ZE) || defined(ARDUINO_BLACK_F407ZG) + // {PG_14, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)}, +#endif + {NC, NP, 0} +}; +#endif + +#ifdef HAL_UART_MODULE_ENABLED +const PinMap PinMap_UART_RX[] = { + {PA_1, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PA_3, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PA_10, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PB_7, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PB_11, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PC_7, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)}, + // {PC_11, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PC_11, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PD_2, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)}, + {PD_6, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PD_9, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, +#if defined(ARDUINO_BLACK_F407ZE) || defined(ARDUINO_BLACK_F407ZG) + // {PG_9, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)}, +#endif + {NC, NP, 0} +}; +#endif + +#ifdef HAL_UART_MODULE_ENABLED +const PinMap PinMap_UART_RTS[] = { + {PA_1, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PA_12, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PB_14, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PD_4, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PD_12, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, +#if defined(ARDUINO_BLACK_F407ZE) || defined(ARDUINO_BLACK_F407ZG) + {PG_8, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)}, + {PG_12, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)}, +#endif + {NC, NP, 0} +}; +#endif + +#ifdef HAL_UART_MODULE_ENABLED +const PinMap PinMap_UART_CTS[] = { + {PA_0, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PA_11, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PB_13, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PD_3, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PD_11, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, +#if defined(ARDUINO_BLACK_F407ZE) || defined(ARDUINO_BLACK_F407ZG) + {PG_13, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)}, + {PG_15, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)}, +#endif + {NC, NP, 0} +}; +#endif + +//*** SPI *** + +#ifdef HAL_SPI_MODULE_ENABLED +const PinMap PinMap_SPI_MOSI[] = { + {PA_7, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PB_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PB_5, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PB_15, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_3, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_12, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_SPI_MODULE_ENABLED +const PinMap PinMap_SPI_MISO[] = { + {PA_6, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PB_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PB_4, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PB_14, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_2, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_11, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_SPI_MODULE_ENABLED +const PinMap PinMap_SPI_SCLK[] = { + {PA_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PB_3, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PB_3, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PB_10, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PB_13, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_10, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_SPI_MODULE_ENABLED +const PinMap PinMap_SPI_SSEL[] = { + {PA_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PA_4, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PA_15, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PA_15, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PB_9, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PB_12, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {NC, NP, 0} +}; +#endif + +//*** CAN *** + +#ifdef HAL_CAN_MODULE_ENABLED +const PinMap PinMap_CAN_RD[] = { + {PA_11, CAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)}, + {PB_5, CAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN2)}, + {PB_8, CAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)}, + {PB_12, CAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN2)}, + {PD_0, CAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_CAN_MODULE_ENABLED +const PinMap PinMap_CAN_TD[] = { + {PA_12, CAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)}, + {PB_6, CAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN2)}, + {PB_9, CAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)}, + {PB_13, CAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN2)}, + {PD_1, CAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)}, + {NC, NP, 0} +}; +#endif + +//*** ETHERNET *** + +#ifdef HAL_ETH_MODULE_ENABLED +const PinMap PinMap_Ethernet[] = { + {PA_0, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_CRS + {PA_1, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_REF_CLK|ETH_RX_CLK + {PA_2, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_MDIO + {PA_3, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_COL + {PA_7, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_CRS_DV|ETH_RX_DV + {PB_0, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RXD2 + {PB_1, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RXD3 + {PB_5, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_PPS_OUT + {PB_8, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD3 + {PB_10, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RX_ER + {PB_11, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TX_EN + {PB_12, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD0 + {PB_13, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD1 + {PC_1, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_MDC + {PC_2, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD2 + {PC_3, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TX_CLK + {PC_4, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RXD0 + {PC_5, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RXD1 + {PE_2, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD3 +#if defined(ARDUINO_BLACK_F407ZE) || defined(ARDUINO_BLACK_F407ZG) + {PG_8, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_PPS_OUT + {PG_11, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TX_EN + {PG_13, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD0 + {PG_14, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD1 +#endif + {NC, NP, 0} +}; +#endif + +//*** No QUADSPI *** + +//*** USB *** + +#ifdef HAL_PCD_MODULE_ENABLED +const PinMap PinMap_USB_OTG_FS[] = { + // {PA_8, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_SOF + // {PA_9, USB_OTG_FS, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, GPIO_AF_NONE)}, // USB_OTG_FS_VBUS + // {PA_10, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_ID + {PA_11, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_DM + {PA_12, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_DP + {NC, NP, 0} +}; +#endif + +#ifdef HAL_PCD_MODULE_ENABLED +const PinMap PinMap_USB_OTG_HS[] = { +#ifdef USE_USB_HS_IN_FS + {PA_4, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_OTG_HS_FS)}, // USB_OTG_HS_SOF + {PB_12, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_PULLUP, GPIO_AF12_OTG_HS_FS)}, // USB_OTG_HS_ID + {PB_13, USB_OTG_HS, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, GPIO_AF_NONE)}, // USB_OTG_HS_VBUS + {PB_14, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_OTG_HS_FS)}, // USB_OTG_HS_DM + {PB_15, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_OTG_HS_FS)}, // USB_OTG_HS_DP +#else + {PA_3, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_D0 + {PA_5, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_CK + {PB_0, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_D1 + {PB_1, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_D2 + {PB_5, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_D7 + {PB_10, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_D3 + {PB_11, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_D4 + {PB_12, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_D5 + {PB_13, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_D6 + {PC_0, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_STP + {PC_2, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_DIR + {PC_3, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_HS)}, // USB_OTG_HS_ULPI_NXT +#endif /* USE_USB_HS_IN_FS */ + {NC, NP, 0} +}; +#endif diff --git a/buildroot/share/PlatformIO/variants/MARLIN_F407VE/PinNamesVar.h b/buildroot/share/PlatformIO/variants/MARLIN_F407VE/PinNamesVar.h new file mode 100644 index 000000000000..f3c4f0ee0762 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_F407VE/PinNamesVar.h @@ -0,0 +1,50 @@ +/* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 +SYS_WKUP1 = PA_0, +#endif +#ifdef PWR_WAKEUP_PIN2 +SYS_WKUP2 = NC, +#endif +#ifdef PWR_WAKEUP_PIN3 +SYS_WKUP3 = NC, +#endif +#ifdef PWR_WAKEUP_PIN4 +SYS_WKUP4 = NC, +#endif +#ifdef PWR_WAKEUP_PIN5 +SYS_WKUP5 = NC, +#endif +#ifdef PWR_WAKEUP_PIN6 +SYS_WKUP6 = NC, +#endif +#ifdef PWR_WAKEUP_PIN7 +SYS_WKUP7 = NC, +#endif +#ifdef PWR_WAKEUP_PIN8 +SYS_WKUP8 = NC, +#endif +/* USB */ +#ifdef USBCON +USB_OTG_FS_SOF = PA_8, +USB_OTG_FS_VBUS = PA_9, +USB_OTG_FS_ID = PA_10, +USB_OTG_FS_DM = PA_11, +USB_OTG_FS_DP = PA_12, +USB_OTG_HS_ULPI_D0 = PA_3, +USB_OTG_HS_SOF = PA_4, +USB_OTG_HS_ULPI_CK = PA_5, +USB_OTG_HS_ULPI_D1 = PB_0, +USB_OTG_HS_ULPI_D2 = PB_1, +USB_OTG_HS_ULPI_D7 = PB_5, +USB_OTG_HS_ULPI_D3 = PB_10, +USB_OTG_HS_ULPI_D4 = PB_11, +USB_OTG_HS_ID = PB_12, +USB_OTG_HS_ULPI_D5 = PB_12, +USB_OTG_HS_ULPI_D6 = PB_13, +USB_OTG_HS_VBUS = PB_13, +USB_OTG_HS_DM = PB_14, +USB_OTG_HS_DP = PB_15, +USB_OTG_HS_ULPI_STP = PC_0, +USB_OTG_HS_ULPI_DIR = PC_2, +USB_OTG_HS_ULPI_NXT = PC_3, +#endif diff --git a/buildroot/share/PlatformIO/variants/MARLIN_F407VE/ldscript.ld b/buildroot/share/PlatformIO/variants/MARLIN_F407VE/ldscript.ld new file mode 100644 index 000000000000..cdbbfcdcd187 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_F407VE/ldscript.ld @@ -0,0 +1,184 @@ +/* +***************************************************************************** +** +** File : LinkerScript.ld +** +** Abstract : Linker script for STM32F407VETx Device with +** 512KByte FLASH, 128KByte RAM +** +** Set heap size, stack size and stack location according +** to application requirements. +** +** Set memory bank area and size if external memory is used. +** +** Target : STMicroelectronics STM32 +** +** +** Distribution: The file is distributed as is, without any warranty +** of any kind. +** +** (c)Copyright Ac6. +** You may use this file as-is or modify it according to the needs of your +** project. Distribution of this file (unmodified or modified) is not +** permitted. Ac6 permit registered System Workbench for MCU users the +** rights to distribute the assembled, compiled & linked contents of this +** file as part of an application binary file, provided that it is built +** using the System Workbench for MCU toolchain. +** +***************************************************************************** +*/ + +/* Entry Point */ +ENTRY(Reset_Handler) + +/* Highest address of the user mode stack */ +_estack = 0x20020000; /* end of RAM */ +/* Generate a link error if heap and stack don't fit into RAM */ +_Min_Heap_Size = 0x200; /* required amount of heap */ +_Min_Stack_Size = 0x400; /* required amount of stack */ + +/* Specify the memory areas */ +MEMORY +{ +RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K +CCMRAM (rw) : ORIGIN = 0x10000000, LENGTH = 64K +FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 512K +} + +/* Define output sections */ +SECTIONS +{ + /* The startup code goes first into FLASH */ + .isr_vector : + { + . = ALIGN(4); + KEEP(*(.isr_vector)) /* Startup code */ + . = ALIGN(4); + } >FLASH + + /* The program code and other data goes into FLASH */ + .text ALIGN(8): + { + . = ALIGN(4); + *(.text) /* .text sections (code) */ + *(.text*) /* .text* sections (code) */ + *(.glue_7) /* glue arm to thumb code */ + *(.glue_7t) /* glue thumb to arm code */ + *(.eh_frame) + + KEEP (*(.init)) + KEEP (*(.fini)) + + . = ALIGN(4); + _etext = .; /* define a global symbols at end of code */ + } >FLASH + + /* Constant data goes into FLASH */ + .rodata ALIGN(4): + { + . = ALIGN(4); + *(.rodata) /* .rodata sections (constants, strings, etc.) */ + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ + . = ALIGN(4); + } >FLASH + + .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH + .ARM : { + __exidx_start = .; + *(.ARM.exidx*) + __exidx_end = .; + } >FLASH + + .preinit_array : + { + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array*)) + PROVIDE_HIDDEN (__preinit_array_end = .); + } >FLASH + .init_array : + { + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array*)) + PROVIDE_HIDDEN (__init_array_end = .); + } >FLASH + .fini_array : + { + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array*)) + PROVIDE_HIDDEN (__fini_array_end = .); + } >FLASH + + /* used by the startup to initialize data */ + _sidata = LOADADDR(.data); + + /* Initialized data sections goes into RAM, load LMA copy after code */ + .data : + { + . = ALIGN(4); + _sdata = .; /* create a global symbol at data start */ + *(.data) /* .data sections */ + *(.data*) /* .data* sections */ + + . = ALIGN(4); + _edata = .; /* define a global symbol at data end */ + } >RAM AT> FLASH + + _siccmram = LOADADDR(.ccmram); + + /* CCM-RAM section + * + * IMPORTANT NOTE! + * If initialized variables will be placed in this section, + * the startup code needs to be modified to copy the init-values. + */ + .ccmram : + { + . = ALIGN(4); + _sccmram = .; /* create a global symbol at ccmram start */ + *(.ccmram) + *(.ccmram*) + + . = ALIGN(4); + _eccmram = .; /* create a global symbol at ccmram end */ + } >CCMRAM AT> FLASH + + + /* Uninitialized data section */ + . = ALIGN(4); + .bss : + { + /* This is used by the startup in order to initialize the .bss secion */ + _sbss = .; /* define a global symbol at bss start */ + __bss_start__ = _sbss; + *(.bss) + *(.bss*) + *(COMMON) + + . = ALIGN(4); + _ebss = .; /* define a global symbol at bss end */ + __bss_end__ = _ebss; + } >RAM + + /* User_heap_stack section, used to check that there is enough RAM left */ + ._user_heap_stack : + { + . = ALIGN(8); + PROVIDE ( end = . ); + PROVIDE ( _end = . ); + . = . + _Min_Heap_Size; + . = . + _Min_Stack_Size; + . = ALIGN(8); + } >RAM + + /* Remove information from the standard libraries */ + /DISCARD/ : + { + libc.a ( * ) + libm.a ( * ) + libgcc.a ( * ) + } + + .ARM.attributes 0 : { *(.ARM.attributes) } +} diff --git a/buildroot/share/PlatformIO/variants/MARLIN_F407VE/stm32f4xx_hal_conf.h b/buildroot/share/PlatformIO/variants/MARLIN_F407VE/stm32f4xx_hal_conf.h new file mode 100644 index 000000000000..2e111dff89d5 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_F407VE/stm32f4xx_hal_conf.h @@ -0,0 +1,481 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_conf.h + * @brief HAL configuration file. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2017 STMicroelectronics. + * All rights reserved.

+ * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __STM32F4xx_HAL_CONF_H +#define __STM32F4xx_HAL_CONF_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ + +/* ########################## Module Selection ############################## */ +/** + * @brief This is the list of modules to be used in the HAL driver + */ +#define HAL_MODULE_ENABLED +#define HAL_ADC_MODULE_ENABLED +/* #define HAL_CAN_MODULE_ENABLED */ +/* #define HAL_CAN_LEGACY_MODULE_ENABLED */ +#define HAL_CRC_MODULE_ENABLED +/* #define HAL_CEC_MODULE_ENABLED */ +/* #define HAL_CRYP_MODULE_ENABLED */ +#define HAL_DAC_MODULE_ENABLED +/* #define HAL_DCMI_MODULE_ENABLED */ +#define HAL_DMA_MODULE_ENABLED +/* #define HAL_DMA2D_MODULE_ENABLED */ +/* #define HAL_ETH_MODULE_ENABLED */ +#define HAL_FLASH_MODULE_ENABLED +/* #define HAL_NAND_MODULE_ENABLED */ +/* #define HAL_NOR_MODULE_ENABLED */ +/* #define HAL_PCCARD_MODULE_ENABLED */ +/* #define HAL_SRAM_MODULE_ENABLED */ +/* #define HAL_SDRAM_MODULE_ENABLED */ +/* #define HAL_HASH_MODULE_ENABLED */ +#define HAL_GPIO_MODULE_ENABLED +/* #define HAL_EXTI_MODULE_ENABLED */ +#define HAL_I2C_MODULE_ENABLED +/* #define HAL_SMBUS_MODULE_ENABLED */ +/* #define HAL_I2S_MODULE_ENABLED */ +/* #define HAL_IWDG_MODULE_ENABLED */ +/* #define HAL_LTDC_MODULE_ENABLED */ +/* #define HAL_DSI_MODULE_ENABLED */ +#define HAL_PWR_MODULE_ENABLED +/* #define HAL_QSPI_MODULE_ENABLED */ +#define HAL_RCC_MODULE_ENABLED +/* #define HAL_RNG_MODULE_ENABLED */ +#define HAL_RTC_MODULE_ENABLED +/* #define HAL_SAI_MODULE_ENABLED */ +#define HAL_SD_MODULE_ENABLED +#define HAL_SPI_MODULE_ENABLED +#define HAL_TIM_MODULE_ENABLED +/* #define HAL_UART_MODULE_ENABLED */ +/* #define HAL_USART_MODULE_ENABLED */ +/* #define HAL_IRDA_MODULE_ENABLED */ +/* #define HAL_SMARTCARD_MODULE_ENABLED */ +/* #define HAL_WWDG_MODULE_ENABLED */ +#define HAL_CORTEX_MODULE_ENABLED +#define HAL_PCD_MODULE_ENABLED +/* #define HAL_HCD_MODULE_ENABLED */ +/* #define HAL_FMPI2C_MODULE_ENABLED */ +/* #define HAL_SPDIFRX_MODULE_ENABLED */ +/* #define HAL_DFSDM_MODULE_ENABLED */ +/* #define HAL_LPTIM_MODULE_ENABLED */ +/* #define HAL_MMC_MODULE_ENABLED */ + +/* ########################## HSE/HSI Values adaptation ##################### */ +/** + * @brief Adjust the value of External High Speed oscillator (HSE) used in your application. + * This value is used by the RCC HAL module to compute the system frequency + * (when HSE is used as system clock source, directly or through the PLL). + */ +#if !defined (HSE_VALUE) +#define HSE_VALUE ((uint32_t)8000000U) /*!< Value of the External oscillator in Hz */ +#endif /* HSE_VALUE */ + +#if !defined (HSE_STARTUP_TIMEOUT) +#define HSE_STARTUP_TIMEOUT ((uint32_t)100U) /*!< Time out for HSE start up, in ms */ +#endif /* HSE_STARTUP_TIMEOUT */ + +/** + * @brief Internal High Speed oscillator (HSI) value. + * This value is used by the RCC HAL module to compute the system frequency + * (when HSI is used as system clock source, directly or through the PLL). + */ +#if !defined (HSI_VALUE) +#define HSI_VALUE ((uint32_t)16000000U) /*!< Value of the Internal oscillator in Hz*/ +#endif /* HSI_VALUE */ + +/** + * @brief Internal Low Speed oscillator (LSI) value. + */ +#if !defined (LSI_VALUE) +#define LSI_VALUE ((uint32_t)32000U) /*!< LSI Typical Value in Hz*/ +#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz +The real value may vary depending on the variations +in voltage and temperature.*/ +/** + * @brief External Low Speed oscillator (LSE) value. + */ +#if !defined (LSE_VALUE) +#define LSE_VALUE ((uint32_t)32768U) /*!< Value of the External Low Speed oscillator in Hz */ +#endif /* LSE_VALUE */ + +#if !defined (LSE_STARTUP_TIMEOUT) +#define LSE_STARTUP_TIMEOUT ((uint32_t)5000U) /*!< Time out for LSE start up, in ms */ +#endif /* LSE_STARTUP_TIMEOUT */ + +/** + * @brief External clock source for I2S peripheral + * This value is used by the I2S HAL module to compute the I2S clock source + * frequency, this source is inserted directly through I2S_CKIN pad. + */ +#if !defined (EXTERNAL_CLOCK_VALUE) +#define EXTERNAL_CLOCK_VALUE ((uint32_t)12288000U) /*!< Value of the External audio frequency in Hz*/ +#endif /* EXTERNAL_CLOCK_VALUE */ + +/* Tip: To avoid modifying this file each time you need to use different HSE, + === you can define the HSE value in your toolchain compiler preprocessor. */ + +/* ########################### System Configuration ######################### */ +/** + * @brief This is the HAL system configuration section + */ +#define VDD_VALUE ((uint32_t)3300U) /*!< Value of VDD in mv */ +#define TICK_INT_PRIORITY ((uint32_t)0U) /*!< tick interrupt priority */ +#define USE_RTOS 0U +#define PREFETCH_ENABLE 1U +#define INSTRUCTION_CACHE_ENABLE 1U +#define DATA_CACHE_ENABLE 1U + +#define USE_HAL_ADC_REGISTER_CALLBACKS 0U /* ADC register callback disabled */ +#define USE_HAL_CAN_REGISTER_CALLBACKS 0U /* CAN register callback disabled */ +#define USE_HAL_CEC_REGISTER_CALLBACKS 0U /* CEC register callback disabled */ +#define USE_HAL_CRYP_REGISTER_CALLBACKS 0U /* CRYP register callback disabled */ +#define USE_HAL_DAC_REGISTER_CALLBACKS 0U /* DAC register callback disabled */ +#define USE_HAL_DCMI_REGISTER_CALLBACKS 0U /* DCMI register callback disabled */ +#define USE_HAL_DFSDM_REGISTER_CALLBACKS 0U /* DFSDM register callback disabled */ +#define USE_HAL_DMA2D_REGISTER_CALLBACKS 0U /* DMA2D register callback disabled */ +#define USE_HAL_DSI_REGISTER_CALLBACKS 0U /* DSI register callback disabled */ +#define USE_HAL_ETH_REGISTER_CALLBACKS 0U /* ETH register callback disabled */ +#define USE_HAL_HASH_REGISTER_CALLBACKS 0U /* HASH register callback disabled */ +#define USE_HAL_HCD_REGISTER_CALLBACKS 0U /* HCD register callback disabled */ +#define USE_HAL_I2C_REGISTER_CALLBACKS 0U /* I2C register callback disabled */ +#define USE_HAL_FMPI2C_REGISTER_CALLBACKS 0U /* FMPI2C register callback disabled */ +#define USE_HAL_I2S_REGISTER_CALLBACKS 0U /* I2S register callback disabled */ +#define USE_HAL_IRDA_REGISTER_CALLBACKS 0U /* IRDA register callback disabled */ +#define USE_HAL_LPTIM_REGISTER_CALLBACKS 0U /* LPTIM register callback disabled */ +#define USE_HAL_LTDC_REGISTER_CALLBACKS 0U /* LTDC register callback disabled */ +#define USE_HAL_MMC_REGISTER_CALLBACKS 0U /* MMC register callback disabled */ +#define USE_HAL_NAND_REGISTER_CALLBACKS 0U /* NAND register callback disabled */ +#define USE_HAL_NOR_REGISTER_CALLBACKS 0U /* NOR register callback disabled */ +#define USE_HAL_PCCARD_REGISTER_CALLBACKS 0U /* PCCARD register callback disabled */ +#define USE_HAL_PCD_REGISTER_CALLBACKS 0U /* PCD register callback disabled */ +#define USE_HAL_QSPI_REGISTER_CALLBACKS 0U /* QSPI register callback disabled */ +#define USE_HAL_RNG_REGISTER_CALLBACKS 0U /* RNG register callback disabled */ +#define USE_HAL_RTC_REGISTER_CALLBACKS 0U /* RTC register callback disabled */ +#define USE_HAL_SAI_REGISTER_CALLBACKS 0U /* SAI register callback disabled */ +#define USE_HAL_SD_REGISTER_CALLBACKS 0U /* SD register callback disabled */ +#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U /* SMARTCARD register callback disabled */ +#define USE_HAL_SDRAM_REGISTER_CALLBACKS 0U /* SDRAM register callback disabled */ +#define USE_HAL_SRAM_REGISTER_CALLBACKS 0U /* SRAM register callback disabled */ +#define USE_HAL_SPDIFRX_REGISTER_CALLBACKS 0U /* SPDIFRX register callback disabled */ +#define USE_HAL_SMBUS_REGISTER_CALLBACKS 0U /* SMBUS register callback disabled */ +#define USE_HAL_SPI_REGISTER_CALLBACKS 0U /* SPI register callback disabled */ +#define USE_HAL_TIM_REGISTER_CALLBACKS 0U /* TIM register callback disabled */ +#define USE_HAL_UART_REGISTER_CALLBACKS 0U /* UART register callback disabled */ +#define USE_HAL_USART_REGISTER_CALLBACKS 0U /* USART register callback disabled */ +#define USE_HAL_WWDG_REGISTER_CALLBACKS 0U /* WWDG register callback disabled */ + +/* ########################## Assert Selection ############################## */ +/** + * @brief Uncomment the line below to expanse the "assert_param" macro in the + * HAL drivers code + */ +/* #define USE_FULL_ASSERT 1U */ + +/* ################## Ethernet peripheral configuration ##################### */ + +/* Section 1 : Ethernet peripheral configuration */ + +/* MAC ADDRESS: MAC_ADDR0:MAC_ADDR1:MAC_ADDR2:MAC_ADDR3:MAC_ADDR4:MAC_ADDR5 */ +#define MAC_ADDR0 2U +#define MAC_ADDR1 0U +#define MAC_ADDR2 0U +#define MAC_ADDR3 0U +#define MAC_ADDR4 0U +#define MAC_ADDR5 0U + +/* Definition of the Ethernet driver buffers size and count */ +#define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */ +#define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */ +#define ETH_RXBUFNB ((uint32_t)4U) /* 4 Rx buffers of size ETH_RX_BUF_SIZE */ +#define ETH_TXBUFNB ((uint32_t)4U) /* 4 Tx buffers of size ETH_TX_BUF_SIZE */ + +/* Section 2: PHY configuration section */ + +/* DP83848_PHY_ADDRESS Address*/ +#define DP83848_PHY_ADDRESS 0x01U +/* PHY Reset delay these values are based on a 1 ms Systick interrupt*/ +#define PHY_RESET_DELAY ((uint32_t)0x000000FFU) +/* PHY Configuration delay */ +#define PHY_CONFIG_DELAY ((uint32_t)0x00000FFFU) + +#define PHY_READ_TO ((uint32_t)0x0000FFFFU) +#define PHY_WRITE_TO ((uint32_t)0x0000FFFFU) + +/* Section 3: Common PHY Registers */ + +#define PHY_BCR ((uint16_t)0x0000U) /*!< Transceiver Basic Control Register */ +#define PHY_BSR ((uint16_t)0x0001U) /*!< Transceiver Basic Status Register */ + +#define PHY_RESET ((uint16_t)0x8000U) /*!< PHY Reset */ +#define PHY_LOOPBACK ((uint16_t)0x4000U) /*!< Select loop-back mode */ +#define PHY_FULLDUPLEX_100M ((uint16_t)0x2100U) /*!< Set the full-duplex mode at 100 Mb/s */ +#define PHY_HALFDUPLEX_100M ((uint16_t)0x2000U) /*!< Set the half-duplex mode at 100 Mb/s */ +#define PHY_FULLDUPLEX_10M ((uint16_t)0x0100U) /*!< Set the full-duplex mode at 10 Mb/s */ +#define PHY_HALFDUPLEX_10M ((uint16_t)0x0000U) /*!< Set the half-duplex mode at 10 Mb/s */ +#define PHY_AUTONEGOTIATION ((uint16_t)0x1000U) /*!< Enable auto-negotiation function */ +#define PHY_RESTART_AUTONEGOTIATION ((uint16_t)0x0200U) /*!< Restart auto-negotiation function */ +#define PHY_POWERDOWN ((uint16_t)0x0800U) /*!< Select the power down mode */ +#define PHY_ISOLATE ((uint16_t)0x0400U) /*!< Isolate PHY from MII */ + +#define PHY_AUTONEGO_COMPLETE ((uint16_t)0x0020U) /*!< Auto-Negotiation process completed */ +#define PHY_LINKED_STATUS ((uint16_t)0x0004U) /*!< Valid link established */ +#define PHY_JABBER_DETECTION ((uint16_t)0x0002U) /*!< Jabber condition detected */ + +/* Section 4: Extended PHY Registers */ +#define PHY_SR ((uint16_t)0x10U) /*!< PHY status register Offset */ + +#define PHY_SPEED_STATUS ((uint16_t)0x0002U) /*!< PHY Speed mask */ +#define PHY_DUPLEX_STATUS ((uint16_t)0x0004U) /*!< PHY Duplex mask */ + +/* ################## SPI peripheral configuration ########################## */ + +/* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver +* Activated: CRC code is present inside driver +* Deactivated: CRC code cleaned from driver +*/ + +#define USE_SPI_CRC 0U + +/* Includes ------------------------------------------------------------------*/ +/** + * @brief Include module's header file + */ + +#ifdef HAL_RCC_MODULE_ENABLED +#include "stm32f4xx_hal_rcc.h" +#endif /* HAL_RCC_MODULE_ENABLED */ + +#ifdef HAL_GPIO_MODULE_ENABLED +#include "stm32f4xx_hal_gpio.h" +#endif /* HAL_GPIO_MODULE_ENABLED */ + +#ifdef HAL_EXTI_MODULE_ENABLED +#include "stm32f4xx_hal_exti.h" +#endif /* HAL_EXTI_MODULE_ENABLED */ + +#ifdef HAL_DMA_MODULE_ENABLED +#include "stm32f4xx_hal_dma.h" +#endif /* HAL_DMA_MODULE_ENABLED */ + +#ifdef HAL_CORTEX_MODULE_ENABLED +#include "stm32f4xx_hal_cortex.h" +#endif /* HAL_CORTEX_MODULE_ENABLED */ + +#ifdef HAL_ADC_MODULE_ENABLED +#include "stm32f4xx_hal_adc.h" +#endif /* HAL_ADC_MODULE_ENABLED */ + +#ifdef HAL_CAN_MODULE_ENABLED +#include "stm32f4xx_hal_can.h" +#endif /* HAL_CAN_MODULE_ENABLED */ + +#ifdef HAL_CAN_LEGACY_MODULE_ENABLED +#include "stm32f4xx_hal_can_legacy.h" +#endif /* HAL_CAN_LEGACY_MODULE_ENABLED */ + +#ifdef HAL_CRC_MODULE_ENABLED +#include "stm32f4xx_hal_crc.h" +#endif /* HAL_CRC_MODULE_ENABLED */ + +#ifdef HAL_CRYP_MODULE_ENABLED +#include "stm32f4xx_hal_cryp.h" +#endif /* HAL_CRYP_MODULE_ENABLED */ + +#ifdef HAL_DMA2D_MODULE_ENABLED +#include "stm32f4xx_hal_dma2d.h" +#endif /* HAL_DMA2D_MODULE_ENABLED */ + +#ifdef HAL_DAC_MODULE_ENABLED +#include "stm32f4xx_hal_dac.h" +#endif /* HAL_DAC_MODULE_ENABLED */ + +#ifdef HAL_DCMI_MODULE_ENABLED +#include "stm32f4xx_hal_dcmi.h" +#endif /* HAL_DCMI_MODULE_ENABLED */ + +#ifdef HAL_ETH_MODULE_ENABLED +#include "stm32f4xx_hal_eth.h" +#endif /* HAL_ETH_MODULE_ENABLED */ + +#ifdef HAL_FLASH_MODULE_ENABLED +#include "stm32f4xx_hal_flash.h" +#endif /* HAL_FLASH_MODULE_ENABLED */ + +#ifdef HAL_SRAM_MODULE_ENABLED +#include "stm32f4xx_hal_sram.h" +#endif /* HAL_SRAM_MODULE_ENABLED */ + +#ifdef HAL_NOR_MODULE_ENABLED +#include "stm32f4xx_hal_nor.h" +#endif /* HAL_NOR_MODULE_ENABLED */ + +#ifdef HAL_NAND_MODULE_ENABLED +#include "stm32f4xx_hal_nand.h" +#endif /* HAL_NAND_MODULE_ENABLED */ + +#ifdef HAL_PCCARD_MODULE_ENABLED +#include "stm32f4xx_hal_pccard.h" +#endif /* HAL_PCCARD_MODULE_ENABLED */ + +#ifdef HAL_SDRAM_MODULE_ENABLED +#include "stm32f4xx_hal_sdram.h" +#endif /* HAL_SDRAM_MODULE_ENABLED */ + +#ifdef HAL_HASH_MODULE_ENABLED +#include "stm32f4xx_hal_hash.h" +#endif /* HAL_HASH_MODULE_ENABLED */ + +#ifdef HAL_I2C_MODULE_ENABLED +#include "stm32f4xx_hal_i2c.h" +#endif /* HAL_I2C_MODULE_ENABLED */ + +#ifdef HAL_SMBUS_MODULE_ENABLED +#include "stm32f4xx_hal_smbus.h" +#endif /* HAL_SMBUS_MODULE_ENABLED */ + +#ifdef HAL_I2S_MODULE_ENABLED +#include "stm32f4xx_hal_i2s.h" +#endif /* HAL_I2S_MODULE_ENABLED */ + +#ifdef HAL_IWDG_MODULE_ENABLED +#include "stm32f4xx_hal_iwdg.h" +#endif /* HAL_IWDG_MODULE_ENABLED */ + +#ifdef HAL_LTDC_MODULE_ENABLED +#include "stm32f4xx_hal_ltdc.h" +#endif /* HAL_LTDC_MODULE_ENABLED */ + +#ifdef HAL_PWR_MODULE_ENABLED +#include "stm32f4xx_hal_pwr.h" +#endif /* HAL_PWR_MODULE_ENABLED */ + +#ifdef HAL_RNG_MODULE_ENABLED +#include "stm32f4xx_hal_rng.h" +#endif /* HAL_RNG_MODULE_ENABLED */ + +#ifdef HAL_RTC_MODULE_ENABLED +#include "stm32f4xx_hal_rtc.h" +#endif /* HAL_RTC_MODULE_ENABLED */ + +#ifdef HAL_SAI_MODULE_ENABLED +#include "stm32f4xx_hal_sai.h" +#endif /* HAL_SAI_MODULE_ENABLED */ + +#ifdef HAL_SD_MODULE_ENABLED +#include "stm32f4xx_hal_sd.h" +#endif /* HAL_SD_MODULE_ENABLED */ + +#ifdef HAL_SPI_MODULE_ENABLED +#include "stm32f4xx_hal_spi.h" +#endif /* HAL_SPI_MODULE_ENABLED */ + +#ifdef HAL_TIM_MODULE_ENABLED +#include "stm32f4xx_hal_tim.h" +#endif /* HAL_TIM_MODULE_ENABLED */ + +#ifdef HAL_UART_MODULE_ENABLED +#include "stm32f4xx_hal_uart.h" +#endif /* HAL_UART_MODULE_ENABLED */ + +#ifdef HAL_USART_MODULE_ENABLED +#include "stm32f4xx_hal_usart.h" +#endif /* HAL_USART_MODULE_ENABLED */ + +#ifdef HAL_IRDA_MODULE_ENABLED +#include "stm32f4xx_hal_irda.h" +#endif /* HAL_IRDA_MODULE_ENABLED */ + +#ifdef HAL_SMARTCARD_MODULE_ENABLED +#include "stm32f4xx_hal_smartcard.h" +#endif /* HAL_SMARTCARD_MODULE_ENABLED */ + +#ifdef HAL_WWDG_MODULE_ENABLED +#include "stm32f4xx_hal_wwdg.h" +#endif /* HAL_WWDG_MODULE_ENABLED */ + +#ifdef HAL_PCD_MODULE_ENABLED +#include "stm32f4xx_hal_pcd.h" +#endif /* HAL_PCD_MODULE_ENABLED */ + +#ifdef HAL_HCD_MODULE_ENABLED +#include "stm32f4xx_hal_hcd.h" +#endif /* HAL_HCD_MODULE_ENABLED */ + +#ifdef HAL_DSI_MODULE_ENABLED +#include "stm32f4xx_hal_dsi.h" +#endif /* HAL_DSI_MODULE_ENABLED */ + +#ifdef HAL_QSPI_MODULE_ENABLED +#include "stm32f4xx_hal_qspi.h" +#endif /* HAL_QSPI_MODULE_ENABLED */ + +#ifdef HAL_CEC_MODULE_ENABLED +#include "stm32f4xx_hal_cec.h" +#endif /* HAL_CEC_MODULE_ENABLED */ + +#ifdef HAL_FMPI2C_MODULE_ENABLED +#include "stm32f4xx_hal_fmpi2c.h" +#endif /* HAL_FMPI2C_MODULE_ENABLED */ + +#ifdef HAL_SPDIFRX_MODULE_ENABLED +#include "stm32f4xx_hal_spdifrx.h" +#endif /* HAL_SPDIFRX_MODULE_ENABLED */ + +#ifdef HAL_DFSDM_MODULE_ENABLED +#include "stm32f4xx_hal_dfsdm.h" +#endif /* HAL_DFSDM_MODULE_ENABLED */ + +#ifdef HAL_LPTIM_MODULE_ENABLED +#include "stm32f4xx_hal_lptim.h" +#endif /* HAL_LPTIM_MODULE_ENABLED */ + +#ifdef HAL_MMC_MODULE_ENABLED +#include "stm32f4xx_hal_mmc.h" +#endif /* HAL_MMC_MODULE_ENABLED */ + +/* Exported macro ------------------------------------------------------------*/ +#ifdef USE_FULL_ASSERT +/** + * @brief The assert_param macro is used for function's parameters check. + * @param expr: If expr is false, it calls assert_failed function + * which reports the name of the source file and the source + * line number of the call that failed. + * If expr is true, it returns no value. + * @retval None + */ +#define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__)) +/* Exported functions ------------------------------------------------------- */ +void assert_failed(uint8_t *file, uint32_t line); +#else +#define assert_param(expr) ((void)0U) +#endif /* USE_FULL_ASSERT */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F4xx_HAL_CONF_H */ + + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/buildroot/share/PlatformIO/variants/MARLIN_F407VE/variant.cpp b/buildroot/share/PlatformIO/variants/MARLIN_F407VE/variant.cpp new file mode 100644 index 000000000000..01523224e11e --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_F407VE/variant.cpp @@ -0,0 +1,165 @@ +/* + ******************************************************************************* + * Copyright (c) 2017, STMicroelectronics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. 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. + * 3. Neither the name of STMicroelectronics nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * 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 "variant.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// Pin number +// This array allows to wrap Arduino pin number(Dx or x) +// to STM32 PinName (PX_n) +const PinName digitalPin[] = { + // Right Side + //Int //Ext + //3V3 //3V3 + //3V3 //3V3 + //BOOT0 //BOOT1 + //GND //GND + //GND //GND + PE_1, PE_0, // D0, D1 + PB_9, PB_8, + PB_7, PB_6, + PB_5, PB_3, + PD_7, PD_6, + PD_5, PD_4, // D10, D11 + PD_3, PD_2, + PD_1, PD_0, + PC_12, PC_11, + PC_10, PA_15, + PA_12, PA_11, // D20, D21 PA_11: USB_DM, PA_12: USB_DP + PA_10, PA_9, + PA_8, PC_9, + PC_8, PC_7, + PC_6, PD_15, + PD_14, PD_13, // D30, D31 + PD_12, PD_11, + PD_10, PD_9, + PD_8, PB_15, + // Left Side + //Ext //Int + //5V //5V + //5V //5V + //3V3 //3V3 + //3V3 //3V3 + //GND //GND + PE_2, PE_3, + PE_4, PE_5, // D40, D41 PE_4: BUT K0, PE_5: BUT K1 + PE_6, PC_13, + PC_0, PC_1, + PC_2, PC_3, + //VREF- //VREF+ + PA_0, PA_1, // PA_0(WK_UP): BUT K_UP) + PA_2, PA_3, // D50, D51 + PA_4, PA_5, + /*PA_6, PA_7,*/ // PA_6, PA_7: Moved to allow contiguous analog pins + PC_4, PC_5, + PB_0, PB_1, + PA_6, PA_7, // PA_6: LED D2, PA_7: LED D3 (active LOW) + PE_7, PE_8, // D60, D61 + PE_9, PE_10, + PE_11, PE_12, + PE_13, PE_14, + PE_15, PB_10, + PB_11, PB_12, // D70, D71 + PB_13, PB_14, + PB_4, +}; + +#ifdef __cplusplus +} +#endif + +// ---------------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief System Clock Configuration + * @param None + * @retval None + */ +WEAK void SystemClock_Config(void) +{ + + RCC_OscInitTypeDef RCC_OscInitStruct; + RCC_ClkInitTypeDef RCC_ClkInitStruct; + + /**Configure the main internal regulator output voltage + */ + __HAL_RCC_PWR_CLK_ENABLE(); + + __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); + + /**Initializes the CPU, AHB and APB busses clocks + */ + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; + RCC_OscInitStruct.HSEState = RCC_HSE_ON; + RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; + RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; + RCC_OscInitStruct.PLL.PLLM = 8; + RCC_OscInitStruct.PLL.PLLN = 336; + RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; + RCC_OscInitStruct.PLL.PLLQ = 7; + if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { + _Error_Handler(__FILE__, __LINE__); + } + + /**Initializes the CPU, AHB and APB busses clocks + */ + RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK + | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2; + RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; + RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; + RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4; + RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2; + + if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK) { + _Error_Handler(__FILE__, __LINE__); + } + + /**Configure the Systick interrupt time + */ + HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000); + + /**Configure the Systick + */ + HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK); + + /* SysTick_IRQn interrupt configuration */ + HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0); +} + +#ifdef __cplusplus +} +#endif diff --git a/buildroot/share/PlatformIO/variants/MARLIN_F407VE/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_F407VE/variant.h new file mode 100644 index 000000000000..9e383114e67f --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_F407VE/variant.h @@ -0,0 +1,219 @@ +/* + ******************************************************************************* + * Copyright (c) 2017, STMicroelectronics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. 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. + * 3. Neither the name of STMicroelectronics nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * 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. + ******************************************************************************* + */ + +#ifndef _VARIANT_ARDUINO_STM32_ +#define _VARIANT_ARDUINO_STM32_ + +/*---------------------------------------------------------------------------- + * Headers + *----------------------------------------------------------------------------*/ +#include "PeripheralPins.h" + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +/*---------------------------------------------------------------------------- + * Pins + *----------------------------------------------------------------------------*/ +extern const PinName digitalPin[]; +// Right Side +#define PE1 0 +#define PE0 1 +#define PB9 2 +#define PB8 3 +#define PB7 4 +#define PB6 5 +#define PB5 6 +#define PB3 7 +#define PD7 8 +#define PD6 9 +#define PD5 10 +#define PD4 11 +#define PD3 12 +#define PD2 13 +#define PD1 14 +#define PD0 15 +#define PC12 16 +#define PC11 17 +#define PC10 18 +#define PA15 19 +#define PA12 20 // USB_DP +#define PA11 21 // USB_DM +#define PA10 22 +#define PA9 23 +#define PA8 24 +#define PC9 25 +#define PC8 26 +#define PC7 27 +#define PC6 28 +#define PD15 29 +#define PD14 30 +#define PD13 31 +#define PD12 32 +#define PD11 33 +#define PD10 34 +#define PD9 35 +#define PD8 36 +#define PB15 37 +// Left Side +#define PE2 38 +#define PE3 39 +#define PE4 40 // BUT K0 +#define PE5 41 // BUT K1 +#define PE6 42 +#define PC13 43 +#define PC0 44 // A0 +#define PC1 45 // A1 +#define PC2 46 // A2 +#define PC3 47 // A3 +#define PA0 48 // A4/WK_UP: BUT K_UP +#define PA1 49 // A5 +#define PA2 50 // A6 +#define PA3 51 // A7 +#define PA4 52 // A8 +#define PA5 53 // A9 +#define PC4 54 // A10 +#define PC5 55 // A11 +#define PB0 56 // A12 +#define PB1 57 // A13 +#define PA6 58 // LED D2 +#define PA7 59 // LED D3 (active LOW) +#define PE7 60 +#define PE8 61 +#define PE9 62 +#define PE10 63 +#define PE11 64 +#define PE12 65 +#define PE13 66 +#define PE14 67 +#define PE15 68 +#define PB10 69 +#define PB11 70 +#define PB12 71 +#define PB13 72 +#define PB14 73 +#define PB4 74 + +// This must be a literal +#define NUM_DIGITAL_PINS 75 +// This must be a literal with a value less than or equal to MAX_ANALOG_INPUTS +#define NUM_ANALOG_INPUTS 14 +#define NUM_ANALOG_FIRST 44 + +// Below ADC, DAC and PWM definitions already done in the core +// Could be redefined here if needed +// ADC resolution is 12bits +//#define ADC_RESOLUTION 12 +//#define DACC_RESOLUTION 12 + +// PWM resolution +#define PWM_RESOLUTION 8 +#define PWM_FREQUENCY 20000 +#define PWM_MAX_DUTY_CYCLE 255 + +// On-board LED pin number +#define LED_D2 PA6 +#define LED_D3 PA7 + +// Board specific button +#define BTN_K_UP PA0 + +#define LED_BUILTIN LED_D2 +#define LED_GREEN LED_D2 + +// On-board user button +#define BTN_K0 PE4 +#define BTN_K1 PE3 +#define USER_BTN BTN_K0 + +// Below SPI and I2C definitions already done in the core +// Could be redefined here if differs from the default one +// SPI Definitions +#define PIN_SPI_MOSI PB15 +#define PIN_SPI_MISO PB14 +#define PIN_SPI_SCK PB13 +#define PIN_SPI_SS PB12 +//#define PIN_SPI_SS1 PB0 // W25Q16 (on board flash) + +// I2C Definitions +#define PIN_WIRE_SDA PB7 +#define PIN_WIRE_SCL PB6 + +// Timer Definitions +//Do not use timer used by PWM pins when possible. See PinMap_PWM in PeripheralPins.c +#define TIMER_TONE TIM6 + +// Do not use basic timer: OC is required +#define TIMER_SERVO TIM2 //TODO: advanced-control timers don't work + +// UART Definitions +// Define here Serial instance number to map on Serial generic name +#define SERIAL_UART_INSTANCE 1 //ex: 2 for Serial2 (USART2) +// DEBUG_UART could be redefined to print on another instance than 'Serial' +//#define DEBUG_UART ((USART_TypeDef *) U(S)ARTX) // ex: USART3 +// DEBUG_UART baudrate, default: 9600 if not defined +//#define DEBUG_UART_BAUDRATE x +// DEBUG_UART Tx pin name, default: the first one found in PinMap_UART_TX for DEBUG_UART +//#define DEBUG_PINNAME_TX PX_n // PinName used for TX + +// Default pin used for 'Serial' instance (ex: ST-Link) +// Mandatory for Firmata +#define PIN_SERIAL_RX PA10 +#define PIN_SERIAL_TX PA9 + +#ifdef __cplusplus +} // extern "C" +#endif +/*---------------------------------------------------------------------------- + * Arduino objects - C++ only + *----------------------------------------------------------------------------*/ + +#ifdef __cplusplus +// These serial port names are intended to allow libraries and architecture-neutral +// sketches to automatically default to the correct port name for a particular type +// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, +// the first hardware serial port whose RX/TX pins are not dedicated to another use. +// +// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor +// +// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial +// +// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library +// +// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. +// +// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX +// pins are NOT connected to anything by default. +#define SERIAL_PORT_MONITOR Serial +#define SERIAL_PORT_HARDWARE Serial1 +#endif + +#endif /* _VARIANT_ARDUINO_STM32_ */ diff --git a/buildroot/share/atom/auto_build.py b/buildroot/share/atom/auto_build.py index 494d63f8e867..b51d598f71d4 100644 --- a/buildroot/share/atom/auto_build.py +++ b/buildroot/share/atom/auto_build.py @@ -1,7 +1,7 @@ ####################################### # # Marlin 3D Printer Firmware -# Copyright (C) 2018 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] +# Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] # # Based on Sprinter and grbl. # Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -105,6 +105,7 @@ target_env = '' board_name = '' +from datetime import datetime, date, time ######### # Python 2 error messages: @@ -892,6 +893,8 @@ def run_PIO(dummy): write_to_screen_queue('\nBoard name: ' + board_name + '\n') # put build info at the bottom of the screen write_to_screen_queue('Build type: ' + build_type + '\n') write_to_screen_queue('Environment used: ' + target_env + '\n') + write_to_screen_queue(str(datetime.now()) + '\n') + # end - run_PIO diff --git a/buildroot/share/fonts/README.md b/buildroot/share/fonts/README.md index ee9d8e00bb74..4e6f6f9b1528 100644 --- a/buildroot/share/fonts/README.md +++ b/buildroot/share/fonts/README.md @@ -16,7 +16,7 @@ http://creativecommons.org/publicdomain/zero/1.0/ - ISO10646_Kana.fon ([fe2bd23](https://github.com/MarlinFirmware/Marlin/commit/fe2bd237d556439499dfdee852c1550c7a16430a)) - Marlin_symbols.fon ([fe2bd23](https://github.com/MarlinFirmware/Marlin/commit/fe2bd237d556439499dfdee852c1550c7a16430a)) -Additional changes to the original font files being distritubted with Marlin are copyrighted under the terms of the [GPLv3](http://www.gnu.org/licenses/gpl-3.0.txt) license. +Additional changes to the original font files distributed with Marlin are copyrighted under the terms of the [GPLv3](http://www.gnu.org/licenses/gpl-3.0.txt) license. ## Documentation diff --git a/buildroot/share/fonts/genallfont.sh b/buildroot/share/fonts/genallfont.sh index ff4a18aa9ca9..543a9d3b9732 100755 --- a/buildroot/share/fonts/genallfont.sh +++ b/buildroot/share/fonts/genallfont.sh @@ -103,7 +103,10 @@ if [ 1 = 1 ]; then cat <src/lcd/dogm/fontdata/fontdata_ISO10646_1.h /** * Marlin 3D Printer Firmware - * Copyright (C) 2018 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * 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 diff --git a/buildroot/share/fonts/genpages.c b/buildroot/share/fonts/genpages.c index c18ecd9fa80e..2a87b19d47f7 100644 --- a/buildroot/share/fonts/genpages.c +++ b/buildroot/share/fonts/genpages.c @@ -157,7 +157,7 @@ uint8_t* get_utf8_value(uint8_t *pstart, wchar_t *pval) { } void usage(char* progname) { - fprintf(stderr, "Usage: %s\n", progname); + fprintf(stderr, "usage: %s\n", progname); fprintf(stderr, " read data from stdin\n"); } diff --git a/buildroot/share/fonts/marlin-6x12-1.bdf b/buildroot/share/fonts/marlin-6x12-1.bdf index 0b8871325dba..b40fce01529f 100644 --- a/buildroot/share/fonts/marlin-6x12-1.bdf +++ b/buildroot/share/fonts/marlin-6x12-1.bdf @@ -108,17 +108,14 @@ STARTCHAR uni0006 ENCODING 6 SWIDTH 545 0 DWIDTH 6 0 -BBX 5 9 0 -1 +BBX 5 6 0 1 BITMAP E0 -80 -C0 -B0 -A8 -28 -30 -28 -28 +8C +EA +8C +8A +0A ENDCHAR STARTCHAR uni0007 ENCODING 7 diff --git a/buildroot/share/fonts/marlin-6x12-2.bdf b/buildroot/share/fonts/marlin-6x12-2.bdf index 5c02d53cc4f5..d36a6e9f6362 100644 --- a/buildroot/share/fonts/marlin-6x12-2.bdf +++ b/buildroot/share/fonts/marlin-6x12-2.bdf @@ -108,17 +108,14 @@ STARTCHAR uni0006 ENCODING 6 SWIDTH 545 0 DWIDTH 6 0 -BBX 5 9 0 -1 +BBX 5 6 0 1 BITMAP E0 -80 -C0 -B0 -A8 -28 -30 -28 -28 +8C +EA +8C +8A +0A ENDCHAR STARTCHAR uni0007 ENCODING 7 diff --git a/buildroot/share/fonts/marlin-6x12-3.bdf b/buildroot/share/fonts/marlin-6x12-3.bdf index 2f3403dc1092..30f2a4fcdfb7 100644 --- a/buildroot/share/fonts/marlin-6x12-3.bdf +++ b/buildroot/share/fonts/marlin-6x12-3.bdf @@ -108,17 +108,14 @@ STARTCHAR uni0006 ENCODING 6 SWIDTH 545 0 DWIDTH 6 0 -BBX 5 9 0 -1 +BBX 5 6 0 1 BITMAP E0 -80 -C0 -B0 -A8 -28 -30 -28 -28 +8C +EA +8C +8A +0A ENDCHAR STARTCHAR uni0007 ENCODING 7 diff --git a/buildroot/share/git/firstpush b/buildroot/share/git/firstpush index 60767f04bc2d..443166088c5c 100755 --- a/buildroot/share/git/firstpush +++ b/buildroot/share/git/firstpush @@ -6,7 +6,7 @@ # commit log to watch Travis CI progress. # -[[ $# == 0 ]] || { echo "Usage: `basename $0`" 1>&2 ; exit 1; } +[[ $# == 0 ]] || { echo "usage: `basename $0`" 1>&2 ; exit 1; } MFINFO=$(mfinfo) || exit 1 IFS=' ' read -a INFO <<< "$MFINFO" diff --git a/buildroot/share/git/ghtp b/buildroot/share/git/ghtp index 83f461ef10c6..3c0d42a63708 100755 --- a/buildroot/share/git/ghtp +++ b/buildroot/share/git/ghtp @@ -13,7 +13,7 @@ case "$1" in -[Hh]) TYPE=HTTPS ; MATCH="git@" ; FORMULA="$GH_SSH/$GH_HTTPS" ;; -[Ss]) TYPE=SSH ; MATCH="https:" ; FORMULA="$GH_HTTPS/$GH_SSH" ;; *) - echo "Usage: `basename $0` -h | -s" 1>&2 + echo "usage: `basename $0` -h | -s" 1>&2 echo -e " \e[0;92m-h\e[0m to switch to HTTPS" 1>&2 echo -e " \e[0;92m-s\e[0m to switch to SSH" 1>&2 exit 1 diff --git a/buildroot/share/git/mfadd b/buildroot/share/git/mfadd index 48a810b7c69b..5f1c0003c914 100755 --- a/buildroot/share/git/mfadd +++ b/buildroot/share/git/mfadd @@ -7,7 +7,7 @@ # Example: mfadd thinkyhead:patch-1 copy_of_patch-1 # -[[ $# > 0 && $# < 3 && $1 != "-h" && $1 != "--help" ]] || { echo "Usage: `basename $0` (user | ref copyname)" 1>&2 ; exit 1; } +[[ $# > 0 && $# < 3 && $1 != "-h" && $1 != "--help" ]] || { echo "usage: `basename $0` (user | ref copyname)" 1>&2 ; exit 1; } # If a colon is included, split the parts if [[ $1 =~ ":" ]]; then diff --git a/buildroot/share/git/mfdoc b/buildroot/share/git/mfdoc index 4b62fa8b3c14..eba599c612c5 100755 --- a/buildroot/share/git/mfdoc +++ b/buildroot/share/git/mfdoc @@ -5,7 +5,7 @@ # Start Jekyll in watch mode to work on Marlin Documentation and preview locally # -[[ $# == 0 ]] || { echo "Usage: `basename $0`" 1>&2 ; exit 1; } +[[ $# == 0 ]] || { echo "usage: `basename $0`" 1>&2 ; exit 1; } MFINFO=$(mfinfo "$@") || exit 1 IFS=' ' read -a INFO <<< "$MFINFO" diff --git a/buildroot/share/git/mffp b/buildroot/share/git/mffp index b8b7b37a793d..8a5fb40de995 100755 --- a/buildroot/share/git/mffp +++ b/buildroot/share/git/mffp @@ -6,7 +6,7 @@ # By default: `git push upstream HEAD:bugfix-1.1.x` # -[[ $# < 3 && $1 != "-h" && $1 != "--help" ]] || { echo "Usage: `basename $0` [1|2] [commit-id]" 1>&2 ; exit 1; } +[[ $# < 3 && $1 != "-h" && $1 != "--help" ]] || { echo "usage: `basename $0` [1|2] [commit-id]" 1>&2 ; exit 1; } if [[ $1 == '1' || $1 == '2' ]]; then MFINFO=$(mfinfo "$1") || exit 1 diff --git a/buildroot/share/git/mfinfo b/buildroot/share/git/mfinfo index c7ae159ffb24..3249473b8947 100755 --- a/buildroot/share/git/mfinfo +++ b/buildroot/share/git/mfinfo @@ -6,18 +6,12 @@ # # - Remote (upstream) Org name (MarlinFirmware) # - Remote (origin) Org name (your Github username) -# - Repo Name (Marlin, MarlinDev, MarlinDocumentation) -# - PR Target branch (bugfix-1.1.x, bugfix-2.0.x, or master) +# - Repo Name (Marlin, MarlinDocumentation) +# - PR Target branch (bugfix-1.1.x, bugfix-2.0.x, etc.) # - Branch Arg (the branch argument or current branch) # - Current Branch # -usage() { - echo "Usage: `basename $0` [1|2] [branch]" 1>&2 -} - -[[ $# < 3 && $1 != "-h" && $1 != "--help" ]] || { usage; exit 1; } - CURR=$(git branch 2>/dev/null | grep ^* | sed 's/\* //g') [[ -z $CURR ]] && { echo "No git repository here!" 1>&2 ; exit 1; } [[ $CURR == "(no"* ]] && { echo "Git is busy with merge, rebase, etc." 1>&2 ; exit 1; } @@ -28,30 +22,39 @@ REPO=$(git remote get-url upstream 2>/dev/null | sed -E 's/.*\/(.*)\.git/\1/') ORG=$(git remote get-url upstream 2>/dev/null | sed -E 's/.*[\/:](.*)\/.*$/\1/') [[ $ORG == MarlinFirmware ]] || { echo "`basename $0`: Not a Marlin repository." 1>&2 ; exit 1; } +FORK=$(git remote get-url origin 2>/dev/null | sed -E 's/.*[\/:](.*)\/.*$/\1/') + +# Defaults if no arguments given +BRANCH=$CURR +INDEX=1 + +while [[ $# -gt 0 ]]; do + opt="$1" ; shift ; val="$1" + + IFS='=' read -a PARTS <<<"$opt" + [[ "${PARTS[1]}" != "" ]] && { HAS_EQUALS=1 ; opt="${PARTS[0]}" ; val="${PARTS[1]}" ; } + + GOODVAL=1 + if [[ "$val" =~ ^-{1,2}.* || ! "$opt" =~ ^-{1,2}.* ]]; then + GOODVAL=0 + val="" + fi + + case "$opt" in + -*|--*) MORE="$MORE$opt " ; [[ $HAS_EQUALS ]] && MORE="$MORE=$val" ;; + 1|2) INDEX=$opt ;; + *) BRANCH="$opt" ;; + esac + +done + case "$REPO" in - Marlin ) TARG=bugfix-1.1.x ; - [[ $# > 0 ]] && [[ $1 == 2 ]] && TARG=bugfix-2.0.x - ;; + Marlin ) TARG=bugfix-1.1.x ; [[ $INDEX == 2 ]] && TARG=bugfix-2.0.x ;; MarlinDocumentation ) TARG=master ;; esac -FORK=$(git remote get-url origin 2>/dev/null | sed -E 's/.*[\/:](.*)\/.*$/\1/') +[[ $BRANCH =~ ^[0-9]$ ]] && USAGE=1 -# BRANCH can be given as the last argument -case "$#" in - 0 ) BRANCH=$CURR ;; - 1 ) - case "$1" in - 1|2) BRANCH=$CURR ;; - *) BRANCH=$1 ;; - esac - ;; - 2 ) - case "$1" in - 1|2) BRANCH=$2 ;; - *) usage ; exit 1 ;; - esac - ;; -esac +[[ $USAGE ]] && { echo "usage: `basename $0` [1|2] [branch]" 1>&2 ; exit 1 ; } -echo "$ORG $FORK $REPO $TARG $BRANCH $CURR" +echo "$ORG $FORK $REPO $TARG $BRANCH $CURR $MORE" diff --git a/buildroot/share/git/mfinit b/buildroot/share/git/mfinit index 05bab8767ddd..bc2495ad9594 100755 --- a/buildroot/share/git/mfinit +++ b/buildroot/share/git/mfinit @@ -5,7 +5,7 @@ # Create the upstream remote for a forked repository # -[[ $# == 0 ]] || { echo "Usage: `basename $0`" 1>&2 ; exit 1; } +[[ $# == 0 ]] || { echo "usage: `basename $0`" 1>&2 ; exit 1; } [[ -z $(git branch 2>/dev/null | grep ^* | sed 's/\* //g') ]] && { echo "No git repository here!" 1>&2 ; exit 1; } diff --git a/buildroot/share/git/mfnew b/buildroot/share/git/mfnew index a33c3f081ae8..6d067a7f08e6 100755 --- a/buildroot/share/git/mfnew +++ b/buildroot/share/git/mfnew @@ -6,7 +6,7 @@ # usage() { - echo "Usage: `basename $0` [1|2] [name]" 1>&2 + echo "usage: `basename $0` [1|2] [name]" 1>&2 } [[ $# < 3 && $1 != "-h" && $1 != "--help" ]] || { usage; exit 1; } diff --git a/buildroot/share/git/mfpr b/buildroot/share/git/mfpr index 2750195b7e4e..773a13a05c30 100755 --- a/buildroot/share/git/mfpr +++ b/buildroot/share/git/mfpr @@ -5,7 +5,7 @@ # Make a PR of the current branch against RCBugFix or dev # -[[ $# < 2 && $1 != "-h" && $1 != "--help" ]] || { echo "Usage: `basename $0` [branch]" 1>&2 ; exit 1; } +[[ $# < 2 && $1 != "-h" && $1 != "--help" ]] || { echo "usage: `basename $0` [branch]" 1>&2 ; exit 1; } MFINFO=$(mfinfo "$@") || exit 1 IFS=' ' read -a INFO <<< "$MFINFO" diff --git a/buildroot/share/git/mfpub b/buildroot/share/git/mfpub index 200602506c8d..29eb0543d7e1 100755 --- a/buildroot/share/git/mfpub +++ b/buildroot/share/git/mfpub @@ -9,7 +9,7 @@ # any permanent changes to 'master'. # -[[ $# < 2 && $1 != "-h" && $1 != "--help" ]] || { echo "Usage: `basename $0` [branch]" 1>&2 ; exit 1; } +[[ $# < 2 && $1 != "-h" && $1 != "--help" ]] || { echo "usage: `basename $0` [branch]" 1>&2 ; exit 1; } MFINFO=$(mfinfo "$@") || exit 1 IFS=' ' read -a INFO <<< "$MFINFO" @@ -115,10 +115,28 @@ git clean -d -f git checkout gh-pages || { echo "Something went wrong!"; exit 1; } rsync -av ${TMPFOLDER}/ ./ +opensite() { + TOOL=$(which gnome-open xdg-open open | awk '{ print $1 }') + URL="http://marlinfw.org/" + if [ -z "$TOOL" ]; then + echo "Can't find a tool to open the URL:" + echo $URL + else + echo "Opening the site in the browser..." + "$TOOL" "$URL" + fi +} + # Commit and push the new live site directly git add --all git commit --message "Built from ${COMMIT}" -git push upstream +git push upstream | { + while IFS= read -r line + do + [[ $line =~ "gh-pages -> gh-pages" ]] && opensite + echo "$line" + done +} # remove the temporary folder rm -rf ${TMPFOLDER} diff --git a/buildroot/share/git/mfqp b/buildroot/share/git/mfqp index e00e7e52e989..febd3c8ad343 100755 --- a/buildroot/share/git/mfqp +++ b/buildroot/share/git/mfqp @@ -5,14 +5,27 @@ # Add all changed files, commit as "patch", do `mfrb` and `git push -f` # -[[ $# < 2 && $1 != "-h" && $1 != "--help" ]] || { echo "Usage: `basename $0` [1|2]" 1>&2 ; exit 1; } - MFINFO=$(mfinfo "$@") || exit 1 IFS=' ' read -a INFO <<< "$MFINFO" REPO=${INFO[2]} TARG=${INFO[3]} CURR=${INFO[5]} +IND=6 +while [ $IND -lt ${#INFO[@]} ]; do + ARG=${INFO[$IND]} + case "$ARG" in + -q|--quick ) QUICK="-q" ;; + -h|--help ) USAGE=1 ;; + * ) USAGE=1 ; echo "unknown option: $ARG" ;; + esac + let IND+=1 +done + +[[ ${INFO[4]} =~ [0-9] ]] && USAGE=1 + +[[ $USAGE ]] && { echo "usage: `basename $0` [1|2]" 1>&2 ; exit 1 ; } + git add . git commit -m "patch" @@ -23,5 +36,5 @@ if [[ $CURR == $TARG ]]; then echo "Don't alter the PR Target branch."; exit 1 fi else - mfrb "$@" && git push -f + mfrb $QUICK "$@" && git push -f fi diff --git a/buildroot/share/git/mfrb b/buildroot/share/git/mfrb index 32d50559fa19..a3b4ce267c02 100755 --- a/buildroot/share/git/mfrb +++ b/buildroot/share/git/mfrb @@ -5,15 +5,26 @@ # Do "git rebase -i" against the "target" branch (bugfix-1.1.x, bugfix-2.0.x, or master) # -[[ $# < 2 && $1 != "-h" && $1 != "--help" ]] || { echo "Usage: `basename $0` [1|2]" 1>&2 ; exit 1; } - MFINFO=$(mfinfo "$@") || exit 1 IFS=' ' read -a INFO <<< "$MFINFO" TARG=${INFO[3]} CURR=${INFO[5]} +IND=6 +while [ $IND -lt ${#INFO[@]} ]; do + ARG=${INFO[$IND]} + case "$ARG" in + -q|--quick ) QUICK=1 ;; + -h|--help ) USAGE=1 ;; + * ) USAGE=1 ; echo "unknown option: $ARG" ;; + esac + let IND+=1 +done + +[[ $USAGE ]] && { echo "usage: `basename $0` [1|2]" 1>&2 ; exit 1 ; } + # If the branch isn't currently the PR target if [[ $TARG != $CURR ]]; then - git fetch upstream + [[ $QUICK ]] || git fetch upstream git rebase upstream/$TARG && git rebase -i upstream/$TARG fi diff --git a/buildroot/share/git/mfup b/buildroot/share/git/mfup index f28d76aa444f..691259e2a99b 100755 --- a/buildroot/share/git/mfup +++ b/buildroot/share/git/mfup @@ -7,7 +7,7 @@ # - Force-push the branch to 'origin' # -[[ $# < 3 && $1 != "-h" && $1 != "--help" ]] || { echo "Usage: `basename $0` [1|2] [branch]" 1>&2 ; exit 1; } +[[ $# < 3 && $1 != "-h" && $1 != "--help" ]] || { echo "usage: `basename $0` [1|2] [branch]" 1>&2 ; exit 1; } MFINFO=$(mfinfo "$@") || exit 1 IFS=' ' read -a INFO <<< "$MFINFO" diff --git a/buildroot/share/sublime/RepRapTools/G-Code.sublime-syntax b/buildroot/share/sublime/RepRapTools/G-Code.sublime-syntax index 35be0adfecd6..59be5721f20d 100644 --- a/buildroot/share/sublime/RepRapTools/G-Code.sublime-syntax +++ b/buildroot/share/sublime/RepRapTools/G-Code.sublime-syntax @@ -10,10 +10,10 @@ # name: G-Code (RepRap) file_extensions: - - [ gco, gcode ] + - [ g, gco, gcode ] scope: source.gcode variables: - decimal: '[+-]?\d+(\.(\d+)?)?' + decimal: '[+-]?\d+(\.\d*)?' contexts: prototype: @@ -25,11 +25,11 @@ contexts: pop: true main: - - meta_content_scope: ctx.line.gcode + - meta_scope: line.gcode - match: '([Nn]\s*(\d+))' captures: - 1: ctx.gcode_line_num + 1: entity.nword.gcode 2: constant.numeric.line-number.gcode - match: () @@ -40,7 +40,7 @@ contexts: - meta_content_scope: ctx.command.gcode # M20 S2 P/path/to/file/name.gco - - match: ([Mm](20))(\s*(S)(2)\s*(P)) + - match: ([Mm](20))\s*((S)(2)\s*(P)) captures: 1: entity.command.gcode markup.bold.gcode 2: constant.numeric.command.gcode @@ -50,15 +50,15 @@ contexts: 6: keyword.param.gcode set: gcode_string_arg - # command followed by data + # M117 or M118 - Commands taking a string - match: ([Mm]\s*(11[78]))\b captures: 1: entity.command.gcode markup.bold.gcode 2: constant.numeric.command.gcode set: gcode_string_arg - # command followed by data - - match: '([GMTgmt]\s*(\d+)((\.)(\d+))?)' + # Other commands, followed by data + - match: ([GMTgmt]\s*(\d+)((\.)(\d+))?) captures: 1: entity.command.gcode markup.bold.gcode 2: constant.numeric.command.gcode @@ -74,16 +74,30 @@ contexts: - meta_content_scope: ctx.params.gcode # M32 [S] [P] !/path/file.gco# - - match: '!' - scope: entity.string.filename.open + - match: \! + scope: punctuation.string.path.open.gcode push: gcode_path_arg # asterisk starts a checksum - match: \* - scope: entity.checksum.gcode + scope: punctuation.marker.checksum.gcode set: gcode_checksum - # parameter and value + # parameter and single-quoted value + - match: ([A-Za-z])\s*(') + captures: + 1: keyword.param.gcode + 2: punctuation.quote.single.open.gcode + push: gcode_string_arg_quoted_single + + # parameter and double-quoted value + - match: ([A-Za-z])\s*(") + captures: + 1: keyword.param.gcode + 2: punctuation.quote.double.open.gcode + push: gcode_string_arg_quoted_double + + # parameter and numeric value - match: ([A-Za-z])\s*({{decimal}}) captures: 1: keyword.param.gcode @@ -97,27 +111,67 @@ contexts: - match: () set: syntax_error + gcode_string_arg_quoted_single: + - meta_content_scope: string.quoted.single.gcode + + - match: ([^'\\]+) + + - match: (\\) + scope: punctuation.string.escape.gcode + push: escape_char + + - match: (') + scope: punctuation.quote.single.close.gcode + pop: true + + - match: () + set: syntax_error + + gcode_string_arg_quoted_double: + - meta_content_scope: string.quoted.double.gcode + + - match: ([^"\\]+) + + - match: (\\) + scope: punctuation.string.escape.gcode + push: escape_char + + - match: (") + scope: punctuation.quote.double.close.gcode + pop: true + + - match: () + set: syntax_error + gcode_string_arg: - meta_content_scope: ctx.string.gcode - match: ([^;]+) scope: string.unquoted.gcode - gcode_path_arg: - - meta_content_scope: ctx.path.gcode + escape_char: + - meta_scope: string.escape.gcode punctuation.string.escape.gcode - - match: ([^#]+) - scope: string.unquoted.path.gcode + - match: '.' + pop: true + + gcode_path_arg: + - meta_content_scope: string.unquoted.path.gcode - match: (#) - scope: entity.string.path.close.gcode + scope: punctuation.string.path.close.gcode pop: true gcode_checksum: - - meta_content_scope: ctx.checksum.gcode + - meta_content_scope: constant.numeric.checksum.gcode + - meta_include_prototype: false - match: \d+ - scope: constant.numeric.checksum.gcode + + - match: ( *)$ + pop: true + + - include: mixin_comment - match: () set: syntax_error @@ -130,15 +184,15 @@ contexts: # Comments begin with a ';' and finish at the end of the line. mixin_comment: - match: ^\s*; - scope: punctuation.definition.comment.line.start + scope: punctuation.comment.line.start set: gcode_comment - match: \s*; - scope: punctuation.definition.comment.eol.start + scope: punctuation.comment.eol.start set: gcode_comment # Comment to end of line. gcode_comment: - - meta_scope: comment.gcode + - meta_content_scope: comment.gcode - match: \s*$ pop: true diff --git a/buildroot/share/sublime/RepRapTools/syntax_test_G-code.gcode b/buildroot/share/sublime/RepRapTools/syntax_test_G-code.gcode new file mode 100644 index 000000000000..c47701bd55c4 --- /dev/null +++ b/buildroot/share/sublime/RepRapTools/syntax_test_G-code.gcode @@ -0,0 +1,88 @@ +; SYNTAX TEST "G-code.sublime-syntax" + +; This is a G-code comment +;^comment + +G1 X100 Y100 ; Move to 100,100 +;^entity.command.gcode +; ^keyword.param.gcode +; ^constant.numeric.param.gcode +; ^comment + +M20 P'/path/to/macro/macro.g' R12 +;<-entity.command.gcode +;^constant.numeric.command.gcode +; ^keyword.param.gcode +; ^punctuation.quote.single.open.gcode +; ^string.quoted.single.gcode +; ^punctuation.quote.single.close.gcode + +M117 This is a message ; and comment +;<-entity.command.gcode +;^constant.numeric.command.gcode +; ^string.unquoted.gcode +; ^punctuation.comment.eol.start +; ^comment.gcode + +M118 This is a message ; and comment +;<-entity.command.gcode +;^constant.numeric.command.gcode +; ^string.unquoted.gcode +; ^punctuation.comment.eol.start +; ^comment.gcode + +M98 P'/path/to/macro/macro.g' R12 +;<-entity.command.gcode +;^constant.numeric.command.gcode +; ^keyword.param.gcode +; ^punctuation.quote.single.open.gcode +; ^string.quoted.single.gcode +; ^punctuation.quote.single.close.gcode + +M98 P"/path/to/macro/macro.g" R12 +;<-entity.command.gcode +;^constant.numeric.command.gcode +; ^keyword.param.gcode +; ^punctuation.quote.double.open.gcode +; ^string.quoted.double.gcode +; ^punctuation.quote.double.close.gcode + +M32 S100 P0 !/path/file.gco# +;<-entity.command.gcode +;^constant.numeric.command.gcode +; ^keyword.param.gcode +; ^constant.numeric.param.gcode +; ^punctuation.string.path.open.gcode +; ^string.unquoted.path.gcode +; ^punctuation.string.path.close.gcode + +G28 ; Home All +;<-entity.command.gcode +;^constant.numeric.command.gcode +; ^punctuation.comment.eol.start +; ^comment.gcode + +N123 G1 X5 Y0 *64 ; EOL Comment +;<-entity.nword.gcode +;^constant.numeric.line-number.gcode +; ^entity.command.gcode +; ^constant.numeric.command.gcode +; ^keyword.param.gcode +; ^constant.numeric.param.gcode +; ^punctuation.marker.checksum.gcode +; ^constant.numeric.checksum.gcode + +N234 G1 X-5 Y+2 *64 error +;<-entity.nword.gcode +;^constant.numeric.line-number.gcode +; ^entity.command.gcode +; ^constant.numeric.command.gcode +; ^keyword.param.gcode +; ^constant.numeric.param.gcode +; ^punctuation.marker.checksum.gcode +; ^constant.numeric.checksum.gcode +; ^invalid.error.syntax.gcode + +N234 M107 *64 +; ^-invalid.error.syntax.gcode + diff --git a/buildroot/share/tests/DUE_tests b/buildroot/share/tests/DUE-tests similarity index 85% rename from buildroot/share/tests/DUE_tests rename to buildroot/share/tests/DUE-tests index 78ca3bd2ddca..8a04f424431b 100755 --- a/buildroot/share/tests/DUE_tests +++ b/buildroot/share/tests/DUE-tests @@ -15,7 +15,7 @@ exec_test $1 $2 "RAMPS4DUE_EFB S_CURVE_ACCELERATION EEPROM_SETTINGS" restore_configs opt_set MOTHERBOARD BOARD_RADDS -opt_enable USE_XMAX_PLUG USE_YMAX_PLUG FIX_MOUNTED_PROBE AUTO_BED_LEVELING_BILINEAR \ +opt_enable USE_XMAX_PLUG USE_YMAX_PLUG BLTOUCH AUTO_BED_LEVELING_BILINEAR \ Z_TRIPLE_STEPPER_DRIVERS Z_TRIPLE_ENDSTOPS Z_STEPPER_AUTO_ALIGN opt_add Z2_MAX_ENDSTOP_INVERTING false opt_add Z3_MAX_ENDSTOP_INVERTING false @@ -32,5 +32,5 @@ restore_configs opt_set MOTHERBOARD BOARD_RAMPS4DUE_EEF opt_set EXTRUDERS 2 opt_set NUM_SERVOS 1 -opt_enable SWITCHING_EXTRUDER ULTIMAKERCONTROLLER +opt_enable SWITCHING_EXTRUDER ULTIMAKERCONTROLLER BEEP_ON_FEEDRATE_CHANGE exec_test $1 $2 "Test RAMPS4DUE with SWITCHING_EXTRUDER" diff --git a/buildroot/share/tests/LPC1768_tests b/buildroot/share/tests/LPC1768-tests similarity index 67% rename from buildroot/share/tests/LPC1768_tests rename to buildroot/share/tests/LPC1768-tests index 371619b04d9b..a76ef8eef9ab 100755 --- a/buildroot/share/tests/LPC1768_tests +++ b/buildroot/share/tests/LPC1768-tests @@ -13,31 +13,31 @@ exec_test $1 $2 "Build Re-ARM Default Configuration" restore_configs opt_set MOTHERBOARD BOARD_RAMPS_14_RE_ARM_EFB opt_enable VIKI2 SDSUPPORT -exec_test $1 $2 "ReARM EFB VIKI2 and SDSUPPORT" +opt_enable SERIAL_PORT2 +opt_enable NEOPIXEL_LED +opt_set NEOPIXEL_PIN P1_16 +exec_test $1 $2 "ReARM EFB VIKI2, SDSUPPORT, 2 Serial ports (USB CDC + UART0), NeoPixel" restore_configs use_example_configs Mks/Sbase exec_test $1 $2 "MKS SBASE Example Config" -restore_configs -use_example_configs Azteeg/X5GT -exec_test $1 $2 "Azteeg X5GT Example Config" - restore_configs opt_set MOTHERBOARD BOARD_MKS_SBASE opt_set EXTRUDERS 2 -opt_set NUM_SERVOS 1 -opt_enable SWITCHING_EXTRUDER ULTIMAKERCONTROLLER -exec_test $1 $2 "MKS_SBASE SWITCHING_EXTRUDER" +opt_set TEMP_SENSOR_1 1 +opt_set NUM_SERVOS 2 +opt_set SERVO_DELAY "{ 300, 300 }" +opt_enable SWITCHING_NOZZLE SWITCHING_NOZZLE_E1_SERVO_NR ULTIMAKERCONTROLLER +exec_test $1 $2 "MKS_SBASE SWITCHING_NOZZLE" restore_configs opt_set MOTHERBOARD BOARD_RAMPS_14_RE_ARM_EEB opt_set EXTRUDERS 2 -opt_set TEMP_SENSOR_0 1 -opt_set TEMP_SENSOR_1 5 -opt_set TEMP_SENSOR_BED 1 -opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER SDSUPPORT \ - FILAMENT_WIDTH_SENSOR FILAMENT_LCD_DISPLAY \ +opt_set TEMP_SENSOR_1 -1 +opt_set TEMP_SENSOR_BED 5 +opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER SDSUPPORT ADAPTIVE_FAN_SLOWING NO_FAN_SLOWING_IN_PID_TUNING \ + FILAMENT_WIDTH_SENSOR FILAMENT_LCD_DISPLAY PID_EXTRUSION_SCALING \ FIX_MOUNTED_PROBE Z_SAFE_HOMING AUTO_BED_LEVELING_BILINEAR Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE \ BABYSTEPPING BABYSTEP_XY BABYSTEP_ZPROBE_OFFSET BABYSTEP_ZPROBE_GFX_OVERLAY \ PRINTCOUNTER NOZZLE_PARK_FEATURE NOZZLE_CLEAN_FEATURE SLOW_PWM_HEATERS PIDTEMPBED EEPROM_SETTINGS INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT \ @@ -62,17 +62,5 @@ opt_set FAN_KICKSTART_TIME 100 opt_set XY_FREQUENCY_LIMIT 15 exec_test $1 $2 "MKS SBASE Many less common options" -restore_configs -use_example_configs delta/generic -opt_set MOTHERBOARD BOARD_COHESION3D_REMIX -opt_enable AUTO_BED_LEVELING_BILINEAR EEPROM_SETTINGS EEPROM_CHITCHAT -opt_disable Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN -opt_set X_DRIVER_TYPE TMC2130 -opt_set Y_DRIVER_TYPE TMC2130 -opt_set Z_DRIVER_TYPE TMC2130 -opt_enable TMC_USE_SW_SPI MONITOR_DRIVER_STATUS STEALTHCHOP HYBRID_THRESHOLD TMC_DEBUG \ - SENSORLESS_PROBING X_STALL_SENSITIVITY Y_STALL_SENSITIVITY Z_STALL_SENSITIVITY -exec_test $1 $2 "Delta Config (generic) + BOARD_COHESION3D_REMIX + UBL + EEPROM_SETTINGS + SENSORLESS_PROBING" - # clean up restore_configs diff --git a/buildroot/share/tests/LPC1769-tests b/buildroot/share/tests/LPC1769-tests new file mode 100755 index 000000000000..c030af45e724 --- /dev/null +++ b/buildroot/share/tests/LPC1769-tests @@ -0,0 +1,55 @@ +#!/usr/bin/env bash +# +# Build tests for LPC1769 (NXP ARM Cortex-M3) +# + +# exit on first failure +set -e + +restore_configs +use_example_configs Azteeg/X5GT +exec_test $1 $2 "Azteeg X5GT Example Config" + +restore_configs +opt_set MOTHERBOARD BOARD_SMOOTHIEBOARD +opt_set EXTRUDERS 2 +opt_set TEMP_SENSOR_1 -1 +opt_set TEMP_SENSOR_BED 5 +opt_enable VIKI2 SDSUPPORT ADAPTIVE_FAN_SLOWING NO_FAN_SLOWING_IN_PID_TUNING \ + FIX_MOUNTED_PROBE Z_SAFE_HOMING AUTO_BED_LEVELING_BILINEAR Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE \ + BABYSTEPPING BABYSTEP_XY BABYSTEP_ZPROBE_OFFSET BABYSTEP_ZPROBE_GFX_OVERLAY \ + PRINTCOUNTER NOZZLE_PARK_FEATURE NOZZLE_CLEAN_FEATURE SLOW_PWM_HEATERS PIDTEMPBED EEPROM_SETTINGS INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT \ + ADVANCED_PAUSE_FEATURE PARK_HEAD_ON_PAUSE \ + LCD_INFO_MENU ARC_SUPPORT BEZIER_CURVE_SUPPORT EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES SDCARD_SORT_ALPHA +opt_set GRID_MAX_POINTS_X 16 +exec_test $1 $2 "Smoothieboard Many Features" + +restore_configs +opt_set MOTHERBOARD BOARD_AZTEEG_X5_MINI_WIFI +opt_enable COREYX USE_XMAX_PLUG DAC_MOTOR_CURRENT_DEFAULT \ + REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT BABYSTEPPING \ + AUTO_BED_LEVELING_UBL RESTORE_LEVELING_AFTER_G28 EEPROM_SETTINGS \ + FILAMENT_LCD_DISPLAY FILAMENT_WIDTH_SENSOR FAN_SOFT_PWM \ + SHOW_TEMP_ADC_VALUES HOME_Y_BEFORE_X EMERGENCY_PARSER FAN_KICKSTART_TIME \ + ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED ADVANCED_OK \ + VOLUMETRIC_DEFAULT_ON NO_WORKSPACE_OFFSETS ACTION_ON_KILL \ + EXTRA_FAN_SPEED FWRETRACT MENU_ADDAUTOSTART SDCARD_SORT_ALPHA +opt_set FAN_MIN_PWM 50 +opt_set FAN_KICKSTART_TIME 100 +opt_set XY_FREQUENCY_LIMIT 15 +exec_test $1 $2 "Azteeg X5 MINI WIFI Many less common options" + +restore_configs +use_example_configs delta/generic +opt_set MOTHERBOARD BOARD_COHESION3D_REMIX +opt_enable AUTO_BED_LEVELING_BILINEAR EEPROM_SETTINGS EEPROM_CHITCHAT +opt_disable Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN +opt_set X_DRIVER_TYPE TMC2130 +opt_set Y_DRIVER_TYPE TMC2130 +opt_set Z_DRIVER_TYPE TMC2130 +opt_enable TMC_USE_SW_SPI MONITOR_DRIVER_STATUS STEALTHCHOP HYBRID_THRESHOLD TMC_DEBUG \ + SENSORLESS_PROBING X_STALL_SENSITIVITY Y_STALL_SENSITIVITY Z_STALL_SENSITIVITY +exec_test $1 $2 "Delta Config (generic) + BOARD_COHESION3D_REMIX + UBL + EEPROM_SETTINGS + SENSORLESS_PROBING" + +# clean up +restore_configs diff --git a/buildroot/share/tests/STM32F1_tests b/buildroot/share/tests/STM32F1-tests similarity index 100% rename from buildroot/share/tests/STM32F1_tests rename to buildroot/share/tests/STM32F1-tests diff --git a/buildroot/share/tests/esp32-tests b/buildroot/share/tests/esp32-tests new file mode 100755 index 000000000000..30c1aa6e40ea --- /dev/null +++ b/buildroot/share/tests/esp32-tests @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# +# Build tests for esp32 +# + +# exit on first failure +set -e + +restore_configs +opt_set MOTHERBOARD BOARD_ESP32 +opt_enable WIFISUPPORT +opt_set "WIFI_SSID \"ssid\"" +opt_set "WIFI_PWD \"password\"" +opt_set TX_BUFFER_SIZE 64 +opt_add WEBSUPPORT +exec_test $1 $2 "ESP32 with WIFISUPPORT and WEBSUPPORT" + +# cleanup +restore_configs diff --git a/buildroot/share/tests/linux_native-tests b/buildroot/share/tests/linux_native-tests new file mode 100755 index 000000000000..cc45f5c29be4 --- /dev/null +++ b/buildroot/share/tests/linux_native-tests @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +# +# Build tests for Linux x86_64 +# + +# exit on first failure +set -e + +restore_configs +opt_set MOTHERBOARD BOARD_LINUX_RAMPS +opt_set TEMP_SENSOR_BED 1 +opt_enable PIDTEMPBED EEPROM_SETTINGS +exec_test $1 $2 "Linux with EEPROM" + +# cleanup +restore_configs diff --git a/buildroot/share/tests/megaatmega2560_tests b/buildroot/share/tests/megaatmega2560-tests similarity index 86% rename from buildroot/share/tests/megaatmega2560_tests rename to buildroot/share/tests/megaatmega2560-tests index 501eb8d96c3f..0ca2c419b774 100755 --- a/buildroot/share/tests/megaatmega2560_tests +++ b/buildroot/share/tests/megaatmega2560-tests @@ -26,20 +26,23 @@ opt_set MOTHERBOARD BOARD_RAMPS_14_EEB opt_set EXTRUDERS 2 opt_set TEMP_SENSOR_0 -2 opt_set TEMP_SENSOR_1 1 -opt_set TEMP_SENSOR_BED 1 +opt_set TEMP_SENSOR_BED 2 opt_set POWER_SUPPLY 1 opt_set GRID_MAX_POINTS_X 16 -opt_enable PIDTEMPBED FIX_MOUNTED_PROBE Z_SAFE_HOMING \ - SDSUPPORT EEPROM_SETTINGS REPRAP_DISCOUNT_SMART_CONTROLLER \ - BLINKM PCA9632 RGB_LED NEOPIXEL_LED AUTO_POWER_CONTROL \ +opt_set FANMUX0_PIN 53 +opt_enable PIDTEMPBED FIX_MOUNTED_PROBE Z_SAFE_HOMING EEPROM_SETTINGS \ + REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT SD_REPRINT_LAST_SELECTED_FILE BINARY_FILE_TRANSFER \ + NEOPIXEL_LED BLINKM PCA9632 RGB_LED RGB_LED_R_PIN RGB_LED_G_PIN RGB_LED_B_PIN \ NOZZLE_PARK_FEATURE FILAMENT_RUNOUT_SENSOR FILAMENT_RUNOUT_DISTANCE_MM \ AUTO_BED_LEVELING_LINEAR Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE \ SKEW_CORRECTION SKEW_CORRECTION_FOR_Z SKEW_CORRECTION_GCODE \ FWRETRACT ARC_P_CIRCLES ADVANCED_PAUSE_FEATURE CNC_WORKSPACE_PLANES CNC_COORDINATE_SYSTEMS \ - POWER_LOSS_RECOVERY POWER_LOSS_PIN POWER_LOSS_STATE FAST_FILE_TRANSFER \ + AUTO_POWER_CONTROL POWER_LOSS_RECOVERY POWER_LOSS_PIN POWER_LOSS_STATE \ LCD_PROGRESS_BAR LCD_PROGRESS_BAR_TEST PINS_DEBUGGING \ - MAX7219_DEBUG LED_CONTROL_MENU CASE_LIGHT_ENABLE CASE_LIGHT_USE_NEOPIXEL CODEPENDENT_XY_HOMING -opt_set FANMUX0_PIN 53 + MAX7219_DEBUG LED_CONTROL_MENU CASE_LIGHT_ENABLE CASE_LIGHT_USE_NEOPIXEL CODEPENDENT_XY_HOMING BACKLASH_COMPENSATION BACKLASH_GCODE +opt_enable SLOW_PWM_HEATERS THERMAL_PROTECTION_CHAMBER +opt_set TEMP_SENSOR_CHAMBER 3 +opt_set HEATER_CHAMBER_PIN 45 exec_test $1 $2 "RAMPS with 2 extruders, RRDFGSC, Linear ABL, LEDs, and many options" # @@ -66,7 +69,7 @@ exec_test $1 $2 "Azteeg X3 with 5 extruders, RRDFGSC, probeless UBL, Linear Adva opt_enable Z_PROBE_SLED SKEW_CORRECTION SKEW_CORRECTION_FOR_Z SKEW_CORRECTION_GCODE opt_set LCD_LANGUAGE jp-kana opt_disable SEGMENT_LEVELED_MOVES -opt_enable BABYSTEP_ZPROBE_OFFSET DOUBLECLICK_FOR_Z_BABYSTEPPING BABYSTEP_HOTEND_Z_OFFSET +opt_enable BABYSTEPPING BABYSTEP_XY BABYSTEP_ZPROBE_OFFSET DOUBLECLICK_FOR_Z_BABYSTEPPING BABYSTEP_HOTEND_Z_OFFSET BABYSTEP_DISPLAY_TOTAL exec_test $1 $2 "... Sled Z Probe, Skew, UBL Cartesian moves, Japanese, and Z probe BABYSTEPPING" # @@ -110,7 +113,7 @@ exec_test $1 $2 "MINIRAMBO for PWM_MOTOR_CURRENT etc" # restore_configs opt_set MOTHERBOARD BOARD_AZTEEG_X3_PRO -opt_enable MIXING_EXTRUDER CR10_STOCKDISPLAY +opt_enable MIXING_EXTRUDER GRADIENT_MIX GRADIENT_VTOOL CR10_STOCKDISPLAY opt_set MIXING_STEPPERS 5 opt_set LCD_LANGUAGE ru exec_test $1 $2 "Mixing Extruder with 5 steppers, Cyrillic" @@ -150,7 +153,7 @@ opt_set EXTRUDERS 2 opt_set TEMP_SENSOR_1 -4 opt_set SERVO_DELAY "{ 300, 300, 300 }" opt_enable COREYX USE_XMAX_PLUG \ - REPRAP_DISCOUNT_SMART_CONTROLLER BABYSTEPPING DAC_MOTOR_CURRENT_DEFAULT \ + REPRAP_DISCOUNT_SMART_CONTROLLER BABYSTEPPING BABYSTEP_DISPLAY_TOTAL DAC_MOTOR_CURRENT_DEFAULT \ FILAMENT_LCD_DISPLAY FILAMENT_WIDTH_SENSOR \ ENDSTOP_INTERRUPTS_FEATURE ENDSTOP_NOISE_THRESHOLD FAN_SOFT_PWM SDSUPPORT \ SWITCHING_TOOLHEAD NUM_SERVOS DEBUG_LEVELING_FEATURE \ @@ -261,7 +264,6 @@ exec_test $1 $2 "Many less common options" # Test a full-featured CR-10S config # use_example_configs Creality/CR-10S -opt_enable SHOW_CUSTOM_BOOTSCREEN exec_test $1 $2 "Full-featured CR-10S config" # # BQ Hephestos 2 @@ -269,10 +271,10 @@ exec_test $1 $2 "Full-featured CR-10S config" #use_example_configs Hephestos_2 #exec_test $1 $2 "Stuff" # -# Delta Config (generic) + ABL bilinear + PROBE_MANUALLY +# Delta Config (generic) + ABL bilinear + BLTOUCH use_example_configs delta/generic -opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER DELTA_CALIBRATION_MENU AUTO_BED_LEVELING_BILINEAR PROBE_MANUALLY -exec_test $1 $2 "Delta Config (generic) + ABL bilinear + PROBE_MANUALLY" +opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER DELTA_CALIBRATION_MENU AUTO_BED_LEVELING_BILINEAR BLTOUCH BLTOUCH_V3 +exec_test $1 $2 "Delta Config (generic) + ABL bilinear + BLTOUCH" # # Delta Config (generic) + UBL + ALLEN_KEY + OLED_PANEL_TINYBOY2 + EEPROM_SETTINGS # @@ -296,23 +298,24 @@ exec_test $1 $2 "Delta Config (FLSUN AC because it's complex)" use_example_configs SCARA opt_enable USE_ZMIN_PLUG FIX_MOUNTED_PROBE AUTO_BED_LEVELING_BILINEAR PAUSE_BEFORE_DEPLOY_STOW \ EEPROM_SETTINGS EEPROM_CHITCHAT ULTIMAKERCONTROLLER \ - MONITOR_DRIVER_STATUS STEALTHCHOP HYBRID_THRESHOLD SENSORLESS_HOMING + MONITOR_DRIVER_STATUS STEALTHCHOP_XY STEALTHCHOP_Z STEALTHCHOP_E HYBRID_THRESHOLD SENSORLESS_HOMING opt_set X_DRIVER_TYPE TMC2130 opt_set Y_DRIVER_TYPE TMC2130 opt_set Z_DRIVER_TYPE TMC2130 opt_set E0_DRIVER_TYPE TMC2130 exec_test $1 $2 "SCARA with TMC2130" # -# TMC2208 Config +# Test mixed TMC config # restore_configs -opt_set X_DRIVER_TYPE TMC2208 -opt_set Y_DRIVER_TYPE TMC2208 +opt_set X_DRIVER_TYPE TMC2160 +opt_set Y_DRIVER_TYPE TMC5160 opt_set Z_DRIVER_TYPE TMC2208 -opt_set E0_DRIVER_TYPE TMC2208 -opt_disable Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN -opt_enable REPRAPWORLD_KEYPAD MONITOR_DRIVER_STATUS STEALTHCHOP HYBRID_THRESHOLD TMC_DEBUG -exec_test $1 $2 "TMC2208 Config" +opt_set E0_DRIVER_TYPE TMC2130 +opt_set X_MIN_ENDSTOP_INVERTING true +opt_set Y_MIN_ENDSTOP_INVERTING true +opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER MONITOR_DRIVER_STATUS STEALTHCHOP_XY STEALTHCHOP_Z STEALTHCHOP_E HYBRID_THRESHOLD USE_ZMIN_PLUG SENSORLESS_HOMING TMC_DEBUG +exec_test $1 $2 "Mixed TMC configuration" # # tvrrug Config need to check board type for sanguino atmega644p # diff --git a/buildroot/share/tests/run_tests b/buildroot/share/tests/run_tests index ec21df500e74..229cfb588a1b 100755 --- a/buildroot/share/tests/run_tests +++ b/buildroot/share/tests/run_tests @@ -33,7 +33,7 @@ if [[ $2 = "ALL" ]]; then declare -a tests=(${dir_list[@]/*run_tests/}) for f in "${tests[@]}"; do env_backup - testenv=$(basename $f | cut -d"_" -f1) + testenv=$(basename $f | cut -d"-" -f1) printf "Running \033[0;32m$f\033[0m Tests\n" exec_test $1 "$testenv --target clean" "Setup Build Environment" $f $1 $testenv @@ -42,7 +42,7 @@ if [[ $2 = "ALL" ]]; then else env_backup exec_test $1 "$2 --target clean" "Setup Build Environment" - $2_tests $1 $2 + $2-tests $1 $2 env_restore fi printf "\033[0;32mAll tests completed successfully\033[0m\n" diff --git a/buildroot/share/tests/teensy35_tests b/buildroot/share/tests/teensy35-tests similarity index 69% rename from buildroot/share/tests/teensy35_tests rename to buildroot/share/tests/teensy35-tests index 053ad97a4319..6539bf98549e 100755 --- a/buildroot/share/tests/teensy35_tests +++ b/buildroot/share/tests/teensy35-tests @@ -15,16 +15,19 @@ exec_test $1 $2 "Teensy3.5 with default config" # Test as many features together as possible # restore_configs +opt_set MOTHERBOARD BOARD_TEENSY35_36 opt_set EXTRUDERS 2 opt_set TEMP_SENSOR_0 1 opt_set TEMP_SENSOR_1 5 opt_set TEMP_SENSOR_BED 1 -opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER SDSUPPORT \ - FILAMENT_WIDTH_SENSOR FILAMENT_LCD_DISPLAY \ +opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER LCD_INFO_MENU SDSUPPORT SDCARD_SORT_ALPHA \ + FILAMENT_WIDTH_SENSOR FILAMENT_LCD_DISPLAY CALIBRATION_GCODE \ FIX_MOUNTED_PROBE Z_SAFE_HOMING AUTO_BED_LEVELING_BILINEAR Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE \ BABYSTEPPING BABYSTEP_XY BABYSTEP_ZPROBE_OFFSET BABYSTEP_ZPROBE_GFX_OVERLAY \ PRINTCOUNTER NOZZLE_PARK_FEATURE NOZZLE_CLEAN_FEATURE SLOW_PWM_HEATERS PIDTEMPBED EEPROM_SETTINGS INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT M100_FREE_MEMORY_WATCHER \ - ADVANCED_PAUSE_FEATURE LCD_INFO_MENU ARC_SUPPORT BEZIER_CURVE_SUPPORT EXPERIMENTAL_I2CBUS EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES SDCARD_SORT_ALPHA PARK_HEAD_ON_PAUSE + ADVANCED_PAUSE_FEATURE ARC_SUPPORT BEZIER_CURVE_SUPPORT EXPERIMENTAL_I2CBUS EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES PARK_HEAD_ON_PAUSE \ + PHOTO_GCODE PHOTO_POSITION PHOTO_SWITCH_POSITION PHOTO_SWITCH_MS PHOTO_DELAY_MS PHOTO_RETRACT_MM \ + HOST_ACTION_COMMANDS HOST_PROMPT_SUPPORT opt_set I2C_SLAVE_ADDRESS 63 opt_set GRID_MAX_POINTS_X 16 exec_test $1 $2 "Teensy3.5 with many features" @@ -33,6 +36,7 @@ exec_test $1 $2 "Teensy3.5 with many features" # Test a Sled Z Probe with Linear leveling # restore_configs +opt_set MOTHERBOARD BOARD_TEENSY35_36 opt_enable EEPROM_SETTINGS Z_PROBE_SLED AUTO_BED_LEVELING_LINEAR DEBUG_LEVELING_FEATURE GCODE_MACROS exec_test $1 $2 "Sled Z Probe with Linear leveling" @@ -40,6 +44,7 @@ exec_test $1 $2 "Sled Z Probe with Linear leveling" # Test a Servo Probe # # restore_configs +# opt_set MOTHERBOARD BOARD_TEENSY35_36 # opt_enable Z_PROBE_SERVO_NR Z_SERVO_ANGLES DEACTIVATE_SERVOS_AFTER_MOVE \ # AUTO_BED_LEVELING_3POINT DEBUG_LEVELING_FEATURE EEPROM_SETTINGS # opt_set NUM_SERVOS 1 @@ -52,17 +57,21 @@ exec_test $1 $2 "Sled Z Probe with Linear leveling" # exec_test $1 $2 "...with AUTO_BED_LEVELING_3POINT, DEBUG_LEVELING_FEATURE, EEPROM_SETTINGS, EEPROM_CHITCHAT, EXTENDED_CAPABILITIES_REPORT, and AUTO_REPORT_TEMPERATURES" # -# Test MESH_BED_LEVELING feature, with LCD +# Test MAGNETIC_PARKING_EXTRUDER with LCD # restore_configs -opt_enable MESH_BED_LEVELING MESH_G28_REST_ORIGIN MANUAL_BED_LEVELING ULTIMAKERCONTROLLER -exec_test $1 $2 "MESH_BED_LEVELING feature, with LCD" +opt_set MOTHERBOARD BOARD_TEENSY35_36 +opt_set EXTRUDERS 2 +opt_set TEMP_SENSOR_1 1 +opt_enable MAGNETIC_PARKING_EXTRUDER ULTIMAKERCONTROLLER +exec_test $1 $2 "MAGNETIC_PARKING_EXTRUDER with LCD" # # Mixing Extruder # restore_configs -opt_enable MIXING_EXTRUDER DIRECT_MIXING_IN_G1 +opt_set MOTHERBOARD BOARD_TEENSY35_36 +opt_enable MIXING_EXTRUDER DIRECT_MIXING_IN_G1 GRADIENT_MIX GRADIENT_VTOOL REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER opt_set MIXING_STEPPERS 2 exec_test $1 $2 "Mixing Extruder" @@ -70,6 +79,7 @@ exec_test $1 $2 "Mixing Extruder" # Test SWITCHING_EXTRUDER # # restore_configs +# opt_set MOTHERBOARD BOARD_TEENSY35_36 # opt_set EXTRUDERS 2 # opt_set NUM_SERVOS 1 # opt_enable SWITCHING_EXTRUDER ULTIMAKERCONTROLLER @@ -78,6 +88,7 @@ exec_test $1 $2 "Mixing Extruder" # Enable COREXY # restore_configs +opt_set MOTHERBOARD BOARD_TEENSY35_36 opt_enable COREXY exec_test $1 $2 "COREXY" @@ -85,6 +96,7 @@ exec_test $1 $2 "COREXY" # Enable COREXZ # restore_configs +opt_set MOTHERBOARD BOARD_TEENSY35_36 opt_enable COREXZ exec_test $1 $2 "COREXZ" @@ -92,6 +104,7 @@ exec_test $1 $2 "COREXZ" # Enable Z_DUAL_STEPPER_DRIVERS, Z_DUAL_ENDSTOPS # restore_configs +opt_set MOTHERBOARD BOARD_TEENSY35_36 opt_enable Z_DUAL_STEPPER_DRIVERS Z_DUAL_ENDSTOPS pins_set RAMPS X_MAX_PIN -1 opt_add Z2_MAX_PIN 2 diff --git a/buildroot/share/vscode/AutoBuildMarlin/extension.js b/buildroot/share/vscode/AutoBuildMarlin/extension.js index 8277517955e6..01198a62bbf3 100644 --- a/buildroot/share/vscode/AutoBuildMarlin/extension.js +++ b/buildroot/share/vscode/AutoBuildMarlin/extension.js @@ -8,19 +8,26 @@ function activate(context) { var NEXT_TERM_ID = 1; var pio_build = vscode.commands.registerCommand('piobuild', function () { - const terminal = vscode.window.createTerminal(`#${NEXT_TERM_ID++}`); + vscode.commands.executeCommand('workbench.action.files.saveAll'); + const terminal = vscode.window.createTerminal(`AB Build #${NEXT_TERM_ID++}`); + terminal.show(true); terminal.sendText("python buildroot/share/atom/auto_build.py build"); }); var pio_clean = vscode.commands.registerCommand('pioclean', function () { - const terminal = vscode.window.createTerminal(`#${NEXT_TERM_ID++}`); + const terminal = vscode.window.createTerminal(`AB Clean #${NEXT_TERM_ID++}`); + terminal.show(true); terminal.sendText("python buildroot/share/atom/auto_build.py clean"); }); var pio_upload = vscode.commands.registerCommand('pioupload', function () { - const terminal = vscode.window.createTerminal(`#${NEXT_TERM_ID++}`); + vscode.commands.executeCommand('workbench.action.files.saveAll'); + const terminal = vscode.window.createTerminal(`AB Upload #${NEXT_TERM_ID++}`); + terminal.show(true); terminal.sendText("python buildroot/share/atom/auto_build.py upload"); }); var pio_traceback = vscode.commands.registerCommand('piotraceback', function () { - const terminal = vscode.window.createTerminal(`#${NEXT_TERM_ID++}`); + vscode.commands.executeCommand('workbench.action.files.saveAll'); + const terminal = vscode.window.createTerminal(`AB Traceback #${NEXT_TERM_ID++}`); + terminal.show(true); terminal.sendText("python buildroot/share/atom/auto_build.py traceback"); }); diff --git a/Marlin/src/config/default/Configuration.h b/config/default/Configuration.h similarity index 87% rename from Marlin/src/config/default/Configuration.h rename to config/default/Configuration.h index 09ad249b429e..6b24012db165 100644 --- a/Marlin/src/config/default/Configuration.h +++ b/config/default/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -416,7 +471,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -501,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 ========================= @@ -579,8 +635,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -668,6 +725,14 @@ #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 @@ -676,10 +741,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -708,11 +776,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -722,11 +790,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -761,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) @@ -851,6 +927,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -959,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 @@ -977,6 +1056,9 @@ #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 @@ -1049,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 @@ -1068,13 +1150,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 @@ -1143,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 @@ -1169,6 +1252,8 @@ #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 @@ -1340,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 /** @@ -1710,11 +1795,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1813,6 +1905,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1861,6 +1959,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1906,6 +2013,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1919,10 +2027,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1935,6 +2039,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 * @@ -1960,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 @@ -1989,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(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/default/Configuration_adv.h similarity index 71% rename from Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h rename to config/default/Configuration_adv.h index 82e0e1be652e..bc41518a7ed0 100644 --- a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h +++ b/config/default/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ //#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. @@ -853,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1068,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 @@ -915,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1109,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 @@ -940,11 +1118,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 @@ -1124,6 +1308,7 @@ //#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 @@ -1174,6 +1359,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. @@ -1201,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1598,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1673,7 @@ #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. @@ -1399,7 +1695,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 @@ -1411,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2020,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2123,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2277,83 @@ #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/config/examples/3DFabXYZ/Migbot/Configuration.h b/config/examples/3DFabXYZ/Migbot/Configuration.h new file mode 100644 index 000000000000..a236c65cfa4c --- /dev/null +++ b/config/examples/3DFabXYZ/Migbot/Configuration.h @@ -0,0 +1,2158 @@ +/** + * 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 "AJMartel" // Who made the changes. +#define SHOW_BOOTSCREEN +#define STRING_SPLASH_LINE1 SHORT_BUILD_VERSION // will be shown during bootup in line 1 +#define STRING_SPLASH_LINE2 WEBSITE_URL // will be shown during bootup in line 2 + +/** + * *** VENDORS PLEASE READ *** + * + * Marlin allows you to add a custom boot image for Graphical LCDs. + * With this option Marlin will first show your custom screen followed + * by the standard Marlin logo with version number and web URL. + * + * We encourage you to take advantage of this new feature and we also + * respectfully request that you retain the unmodified Marlin boot screen. + */ + +// Enable to show the bitmap in Marlin/_Bootscreen.h on startup. +//#define SHOW_CUSTOM_BOOTSCREEN + +// Enable to show the bitmap in Marlin/_Statusscreen.h on the status screen. +//#define CUSTOM_STATUS_SCREEN_IMAGE + +// @section machine + +/** + * Select the serial port on the board to use for communication with the host. + * This allows the connection of wireless adapters (for instance) to non-default port pins. + * Note: The first serial port (-1 or 0) will always be used by the Arduino bootloader. + * + * :[-1, 0, 1, 2, 3, 4, 5, 6, 7] + */ +#define SERIAL_PORT 0 + +/** + * Select a secondary serial port on the board to use for communication with the host. + * This allows the connection of wireless adapters (for instance) to non-default port pins. + * Serial port -1 is the USB emulated serial port, if available. + * + * :[-1, 0, 1, 2, 3, 4, 5, 6, 7] + */ +//#define SERIAL_PORT_2 -1 + +/** + * This setting determines the communication speed of the printer. + * + * 250000 works in most cases, but you might try a lower speed if + * you commonly experience drop-outs during host printing. + * You may try up to 1000000 to speed up SD file transfer. + * + * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000] + */ +#define BAUDRATE 250000 + +// Enable the Bluetooth serial interface on AT90USB devices +//#define BLUETOOTH + +// The following define selects which electronics board you have. +// Please choose the name from boards.h that matches your setup +#ifndef MOTHERBOARD + #define MOTHERBOARD BOARD_MKS_BASE_14 +#endif + +// Optional custom name for your RepStrap or other custom machine +// Displayed in the LCD "Ready" message +#define CUSTOM_MACHINE_NAME "3DFabXYZ i3" + +// Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines) +// You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4) +//#define MACHINE_UUID "00000000-0000-0000-0000-000000000000" + +// @section extruder + +// This defines the number of extruders +// :[1, 2, 3, 4, 5, 6] +#define EXTRUDERS 1 + +// Generally expected filament diameter (1.75, 2.85, 3.0, ...). Used for Volumetric, Filament Width Sensor, etc. +#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75 + +// For Cyclops or any "multi-extruder" that shares a single nozzle. +//#define SINGLENOZZLE + +/** + * Průša MK2 Single Nozzle Multi-Material Multiplexer, and variants. + * + * This device allows one stepper driver on a control board to drive + * two to eight stepper motors, one at a time, in a manner suitable + * for extruders. + * + * This option only allows the multiplexer to switch on tool-change. + * Additional options to configure custom E moves are pending. + */ +//#define MK2_MULTIPLEXER +#if ENABLED(MK2_MULTIPLEXER) + // Override the default DIO selector pins here, if needed. + // Some pins files may provide defaults for these pins. + //#define E_MUX0_PIN 40 // Always Required + //#define E_MUX1_PIN 42 // Needed for 3 to 8 inputs + //#define E_MUX2_PIN 44 // Needed for 5 to 8 inputs +#endif + +/** + * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif +#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 + +// 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 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 + +#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 + +// 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 + +// 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 + +//=========================================================================== +//============================= 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 + + // Electron + #define DEFAULT_Kp 29.12 + #define DEFAULT_Ki 3.22 + #define DEFAULT_Kd 65.83 + + // 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 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 true // set to true to invert the logic of the endstop. +#define Y_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. +#define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. +#define Z_MIN_PROBE_ENDSTOP_INVERTING true // set to true to invert the logic of the probe. + +/** + * Stepper Drivers + * + * These settings allow Marlin to tune stepper driver timing and enable advanced options for + * stepper drivers that support them. You may also override timing options in Configuration_adv.h. + * + * A4988 is assumed for unspecified drivers. + * + * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, + * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, + * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, + * 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 } +#define DEFAULT_AXIS_STEPS_PER_UNIT { 79.9738621, 80.2429911, 399.7264854 , 99.4696994 } + +/** + * Default Max Feed Rate (mm/s) + * Override with M203 + * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] + */ +#define DEFAULT_MAX_FEEDRATE { 225, 225, 3, 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 { 1590, 1590, 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 1590 // X, Y, Z and E acceleration for printing moves +#define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration for retracts +#define DEFAULT_TRAVEL_ACCELERATION 1590 // 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 8.0 + #define DEFAULT_YJERK 8.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 21 // X offset: -left +right [of the nozzle] +#define Y_PROBE_OFFSET_FROM_EXTRUDER 61 // 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 7500 + +// Feedrate (mm/m) for the first approach when double-probing (MULTIPLE_PROBING == 2) +#define Z_PROBE_SPEED_FAST HOMING_FEEDRATE_Z + +// Feedrate (mm/m) for the "accurate" probe of each point +#define Z_PROBE_SPEED_SLOW (Z_PROBE_SPEED_FAST / 2) + +// The number of probes to perform at each point. +// Set to 2 for a fast/slow probe, using the second probe result. +// Set to 3 or more for slow probes, averaging the results. +//#define MULTIPLE_PROBING 2 + +/** + * Z probes require clearance when deploying, stowing, and moving between + * probe points to avoid hitting the bed and other hardware. + * Servo-mounted probes require extra space for the arm to rotate. + * Inductive probes need space to keep from triggering early. + * + * Use these settings to specify the distance (mm) to raise the probe (or + * lower the bed). The values set here apply over and above any (negative) + * probe Z Offset set with Z_PROBE_OFFSET_FROM_EXTRUDER, M851, or the LCD. + * Only integer values >= 1 are valid here. + * + * Example: `M851 Z-5` with a CLEARANCE of 4 => 9mm from bed to nozzle. + * But: `M851 Z+1` with a CLEARANCE of 2 => 2mm from bed to nozzle. + */ +#define Z_CLEARANCE_DEPLOY_PROBE 5 // Z Clearance for Deploy/Stow +#define Z_CLEARANCE_BETWEEN_PROBES 3 // 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 +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif + +/** + * Enable one or more of the following if probing seems unreliable. + * Heaters and/or fans can be disabled during probing to minimize electrical + * noise. A delay can also be added to allow noise and vibration to settle. + * These options are most useful for the BLTouch probe, but may also improve + * readings with inductive probes and piezo sensors. + */ +//#define PROBING_HEATERS_OFF // Turn heaters off when probing +#if ENABLED(PROBING_HEATERS_OFF) + //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) +#endif +//#define PROBING_FANS_OFF // Turn fans off when probing +//#define 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 false +#define INVERT_Z_DIR true + +// @section extruder + +// For direct drive extruder v9 set to true, for geared extruder set to false. +#define INVERT_E0_DIR false +#define INVERT_E1_DIR false +#define INVERT_E2_DIR false +#define INVERT_E3_DIR false +#define INVERT_E4_DIR false +#define INVERT_E5_DIR false + +// @section homing + +//#define NO_MOTION_BEFORE_HOMING // Inhibit movement until all axes have been homed + +//#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. + +#define Z_HOMING_HEIGHT 3 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... + // Be sure you have this distance over your Z_MAX_POS in case. + +// Direction of endstops when homing; 1=MAX, -1=MIN +// :[-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 219 +#define Y_BED_SIZE 280 + +// 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 4 + + // Set the boundaries for probing (where the probe can reach). + #define LEFT_PROBE_BED_POSITION X_PROBE_OFFSET_FROM_EXTRUDER + #define RIGHT_PROBE_BED_POSITION (X_BED_SIZE - (X_PROBE_OFFSET_FROM_EXTRUDER) + MIN_PROBE_EDGE) + #define FRONT_PROBE_BED_POSITION Y_PROBE_OFFSET_FROM_EXTRUDER + #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 205 +#define PREHEAT_1_TEMP_BED 60 +#define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 + +#define PREHEAT_2_LABEL "ABS" +#define PREHEAT_2_TEMP_HOTEND 255 +#define PREHEAT_2_TEMP_BED 100 +#define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 + +#define PREHEAT_3_LABEL "HIPS" +#define PREHEAT_3_TEMP_HOTEND 220 //HIPS +#define PREHEAT_3_TEMP_BED 100 +#define PREHEAT_3_FAN_SPEED 0 // Value from 0 to 255 + +#define PREHEAT_4_LABEL "PP" +#define PREHEAT_4_TEMP_HOTEND 254 //PP +#define PREHEAT_4_TEMP_BED 100 +#define PREHEAT_4_FAN_SPEED 0 // Value from 0 to 255 + +#define PREHEAT_5_LABEL "PET" +#define PREHEAT_5_TEMP_HOTEND 240 //PET +#define PREHEAT_5_TEMP_BED 90 +#define PREHEAT_5_FAN_SPEED 0 // Value from 0 to 255 + +#define PREHEAT_6_LABEL "FLEX" +#define PREHEAT_6_TEMP_HOTEND 230 //FLEX +#define PREHEAT_6_TEMP_BED 50 +#define PREHEAT_6_FAN_SPEED 0 // Value from 0 to 255 + +#define PREHEAT_7_LABEL "NYLON" +#define PREHEAT_7_TEMP_HOTEND 240 //NYLON +#define PREHEAT_7_TEMP_BED 80 +#define PREHEAT_7_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 + +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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. +// :[0,1,2,3,4,5,6,7] +#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 50 + #define RGB_LED_G_PIN 51 + #define RGB_LED_B_PIN 52 + #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 3 // Servo index starts with 0 for M280 command + +// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle. +// 300ms is a good value but you can try less delay. +// If the servo can't reach the requested position, increase it. +#define SERVO_DELAY { 300 } + +// Only power servos during movement, otherwise leave off to prevent jitter +//#define DEACTIVATE_SERVOS_AFTER_MOVE + +// Allow servo angle to be edited and saved to EEPROM +//#define EDITABLE_SERVO_ANGLES diff --git a/config/examples/3DFabXYZ/Migbot/Configuration_adv.h b/config/examples/3DFabXYZ/Migbot/Configuration_adv.h new file mode 100644 index 000000000000..f616a0b46d54 --- /dev/null +++ b/config/examples/3DFabXYZ/Migbot/Configuration_adv.h @@ -0,0 +1,2361 @@ +/** + * 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 + +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#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) + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. + //#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 9 // 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 11 // 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) + #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 75 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 160 // (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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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 + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif + +#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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // 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 12 + + // Canon Hack Development Kit + // http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + #define CHDK_PIN 12 + + // 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 "Test" + #define USER_SCRIPT_DONE "M117 Script Done" + #define USER_SCRIPT_AUDIBLE_FEEDBACK + //#define USER_SCRIPT_RETURN // Return to status screen after a script + + #define USER_DESC_1 "Test Print" + #define USER_GCODE_1 "G28\nG29\nG26" + + /* + #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/config/examples/3DFabXYZ/Migbot/Readme.md b/config/examples/3DFabXYZ/Migbot/Readme.md new file mode 100644 index 000000000000..67959e4ef05b --- /dev/null +++ b/config/examples/3DFabXYZ/Migbot/Readme.md @@ -0,0 +1,3 @@ +Personalized config files for the "Electron"\"Tevo 3D" i3 6th gen +https://www.3dprintersbay.com/electron3d-reprap-prusa-i3-kit +https://reprap.org/wiki/Migbot_Prusa_i3 diff --git a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration.h b/config/examples/AlephObjects/TAZ4/Configuration.h similarity index 87% rename from Marlin/src/config/examples/AlephObjects/TAZ4/Configuration.h rename to config/examples/AlephObjects/TAZ4/Configuration.h index df5e48e91a4b..23a18ca03058 100644 --- a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration.h +++ b/config/examples/AlephObjects/TAZ4/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 7 #define TEMP_SENSOR_1 0 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX 74 // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 16 // If the temperature difference between the target temperature and the actual temperature @@ -425,7 +480,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -521,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 ========================= @@ -599,8 +655,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -688,6 +745,14 @@ #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 @@ -696,10 +761,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 8.0 -#define DEFAULT_YJERK 8.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 10.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 8.0 + #define DEFAULT_YJERK 8.0 + #define DEFAULT_ZJERK 0.3 +#endif + +#define DEFAULT_EJERK 10.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -728,11 +796,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -742,11 +810,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -781,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) @@ -871,6 +947,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -979,7 +1058,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 @@ -997,6 +1076,9 @@ #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 @@ -1069,7 +1151,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 @@ -1088,13 +1170,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 @@ -1163,7 +1246,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 @@ -1189,6 +1272,8 @@ #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 @@ -1360,10 +1445,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 /** @@ -1730,11 +1815,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1833,6 +1925,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1881,6 +1979,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1926,6 +2033,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1939,10 +2047,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1955,6 +2059,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 * @@ -1980,11 +2088,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 @@ -2009,7 +2117,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(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 71% rename from Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h rename to config/examples/AlephObjects/TAZ4/Configuration_adv.h index ee7ee61d6a9c..cc644db4b8ec 100644 --- a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h +++ b/config/examples/AlephObjects/TAZ4/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ //#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. @@ -853,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1068,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 @@ -915,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1109,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 @@ -940,11 +1118,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 @@ -1124,6 +1308,7 @@ //#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 @@ -1174,6 +1359,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. @@ -1201,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1598,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1673,7 @@ #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. @@ -1399,7 +1695,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 @@ -1411,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2020,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2123,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2277,83 @@ #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/AliExpress/CL-260/Configuration.h b/config/examples/AliExpress/CL-260/Configuration.h similarity index 87% rename from Marlin/src/config/examples/AliExpress/CL-260/Configuration.h rename to config/examples/AliExpress/CL-260/Configuration.h index 350fa70e2d85..86a9d1bf6ad5 100644 --- a/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h +++ b/config/examples/AliExpress/CL-260/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -416,7 +471,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -501,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 ========================= @@ -579,8 +635,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -668,6 +725,14 @@ #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 @@ -676,10 +741,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -708,11 +776,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -722,11 +790,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -761,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) @@ -851,6 +927,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -959,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 @@ -977,6 +1056,9 @@ #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 @@ -1049,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 @@ -1068,13 +1150,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 @@ -1143,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 @@ -1169,6 +1252,8 @@ #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 @@ -1340,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 /** @@ -1710,11 +1795,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1813,6 +1905,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1861,6 +1959,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1906,6 +2013,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1919,10 +2027,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1935,6 +2039,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 * @@ -1960,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 @@ -1989,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(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/config/examples/AliExpress/UM2pExt/Configuration.h b/config/examples/AliExpress/UM2pExt/Configuration.h new file mode 100644 index 000000000000..19920c016136 --- /dev/null +++ b/config/examples/AliExpress/UM2pExt/Configuration.h @@ -0,0 +1,2138 @@ +/** + * 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 0 + +/** + * Select a secondary serial port on the board to use for communication with the host. + * This allows the connection of wireless adapters (for instance) to non-default port pins. + * Serial port -1 is the USB emulated serial port, if available. + * + * :[-1, 0, 1, 2, 3, 4, 5, 6, 7] + */ +//#define SERIAL_PORT_2 -1 + +/** + * This setting determines the communication speed of the printer. + * + * 250000 works in most cases, but you might try a lower speed if + * you commonly experience drop-outs during host printing. + * You may try up to 1000000 to speed up SD file transfer. + * + * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000] + */ +#define BAUDRATE 250000 + +// Enable the Bluetooth serial interface on AT90USB devices +//#define BLUETOOTH + +// The following define selects which electronics board you have. +// Please choose the name from boards.h that matches your setup +#ifndef MOTHERBOARD + #define MOTHERBOARD BOARD_ULTIMAIN_2 +#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 2.85 + +// 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif +#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 20 +#define TEMP_SENSOR_1 20 +#define TEMP_SENSOR_2 0 +#define TEMP_SENSOR_3 0 +#define TEMP_SENSOR_4 0 +#define TEMP_SENSOR_5 0 +#define TEMP_SENSOR_BED 20 +#define TEMP_SENSOR_CHAMBER 0 + +// Dummy thermistor constant temperature readings, for use with 998 and 999 +#define DUMMY_THERMISTOR_998_VALUE 25 +#define DUMMY_THERMISTOR_999_VALUE 100 + +// Use temp sensor 1 as a redundant sensor with sensor 0. If the readings +// from the two sensors differ too much the print will be aborted. +//#define TEMP_SENSOR_1_AS_REDUNDANT +#define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 + +#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 + +// 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 + +// 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 + +//=========================================================================== +//============================= 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 + + // Ultimaker2+ + +#define DEFAULT_Kp 9.74 +#define DEFAULT_Ki 0.69 +#define DEFAULT_Kd 34.32 + + /* + #define DEFAULT_Kp 10.03 + #define DEFAULT_Ki 1.50 + #define DEFAULT_Kd 70.0 + */ + + //#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 1000 + +//=========================================================================== +//======================== 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 true // set to true to invert the logic of the endstop. +#define Y_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. +#define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. +#define Z_MIN_PROBE_ENDSTOP_INVERTING true // set to true to invert the logic of the probe. + +/** + * Stepper Drivers + * + * These settings allow Marlin to tune stepper driver timing and enable advanced options for + * stepper drivers that support them. You may also override timing options in Configuration_adv.h. + * + * A4988 is assumed for unspecified drivers. + * + * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, + * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, + * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, + * 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, 200, 355 } + +/** + * Default Max Feed Rate (mm/s) + * Override with M203 + * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] + */ +#define DEFAULT_MAX_FEEDRATE { 300, 300, 40, 45} + +/** + * Default Max Acceleration (change/s) change = mm/s + * (Maximum start speed for accelerated moves) + * Override with M201 + * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] + */ +#define DEFAULT_MAX_ACCELERATION { 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 +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif + +/** + * Enable one or more of the following if probing seems unreliable. + * Heaters and/or fans can be disabled during probing to minimize electrical + * noise. A delay can also be added to allow noise and vibration to settle. + * These options are most useful for the BLTouch probe, but may also improve + * readings with inductive probes and piezo sensors. + */ +//#define PROBING_HEATERS_OFF // Turn heaters off when probing +#if ENABLED(PROBING_HEATERS_OFF) + //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) +#endif +//#define PROBING_FANS_OFF // Turn fans off when probing +//#define 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 false +#define INVERT_Z_DIR true + +// @section extruder + +// For direct drive extruder v9 set to true, for geared extruder set to false. +#define INVERT_E0_DIR true +#define INVERT_E1_DIR true +#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 220 +#define Y_BED_SIZE 220 + +// 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 300 + +/** + * 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 (100*60) +#define HOMING_FEEDRATE_Z (40*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 CYRILLIC + +/** + * 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 + +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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. +// :[0,1,2,3,4,5,6,7] +#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 3 // Servo index starts with 0 for M280 command + +// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle. +// 300ms is a good value but you can try less delay. +// If the servo can't reach the requested position, increase it. +#define SERVO_DELAY { 300 } + +// Only power servos during movement, otherwise leave off to prevent jitter +//#define DEACTIVATE_SERVOS_AFTER_MOVE + +// Allow servo angle to be edited and saved to EEPROM +//#define EDITABLE_SERVO_ANGLES diff --git a/config/examples/AliExpress/UM2pExt/Configuration_adv.h b/config/examples/AliExpress/UM2pExt/Configuration_adv.h new file mode 100644 index 000000000000..5d9e92d45899 --- /dev/null +++ b/config/examples/AliExpress/UM2pExt/Configuration_adv.h @@ -0,0 +1,2361 @@ +/** + * 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 + +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#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) + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. + //#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 255 // 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 { 1200, 1200, 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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 + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif + +#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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // 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 128 + +// 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 FILAMENT_BOWDEN_LENGTH 705 // (mm) + + #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 80 // (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 (FILAMENT_BOWDEN_LENGTH + 50) // (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 80 // (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 (FILAMENT_BOWDEN_LENGTH - 50) // (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 0 // (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/Anet/A2/Configuration.h b/config/examples/Anet/A2/Configuration.h similarity index 87% rename from Marlin/src/config/examples/Anet/A2/Configuration.h rename to config/examples/Anet/A2/Configuration.h index cef7791da4ed..fed0e75f09a8 100644 --- a/Marlin/src/config/examples/Anet/A2/Configuration.h +++ b/config/examples/Anet/A2/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 5 #define TEMP_SENSOR_1 0 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -416,7 +471,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -501,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 ========================= @@ -579,8 +635,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -668,6 +725,14 @@ #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 @@ -676,10 +741,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -708,11 +776,11 @@ //#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -722,11 +790,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -761,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) @@ -851,6 +927,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -959,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 @@ -977,6 +1056,9 @@ #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 @@ -1049,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 @@ -1068,13 +1150,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 @@ -1143,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 @@ -1169,6 +1252,8 @@ #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 @@ -1340,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 /** @@ -1710,11 +1795,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1815,6 +1907,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1863,6 +1961,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1908,6 +2015,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1921,10 +2029,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1937,6 +2041,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 * @@ -1962,11 +2070,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 @@ -1991,7 +2099,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(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 71% rename from Marlin/src/config/examples/Anet/A2plus/Configuration_adv.h rename to config/examples/Anet/A2/Configuration_adv.h index b4e749dfc8af..e959aeaf8e4a 100644 --- a/Marlin/src/config/examples/Anet/A2plus/Configuration_adv.h +++ b/config/examples/Anet/A2/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ #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. @@ -853,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1068,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 @@ -915,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1109,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 @@ -940,11 +1118,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 @@ -1124,6 +1308,7 @@ //#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 @@ -1174,6 +1359,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. @@ -1201,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1598,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1673,7 @@ #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. @@ -1399,7 +1695,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 @@ -1411,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2020,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2123,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2277,83 @@ #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/Anet/A2plus/Configuration.h b/config/examples/Anet/A2plus/Configuration.h similarity index 87% rename from Marlin/src/config/examples/Anet/A2plus/Configuration.h rename to config/examples/Anet/A2plus/Configuration.h index e4ea1c1ff446..23f1cf5f36f0 100644 --- a/Marlin/src/config/examples/Anet/A2plus/Configuration.h +++ b/config/examples/Anet/A2plus/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 5 #define TEMP_SENSOR_1 0 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -416,7 +471,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -501,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 ========================= @@ -579,8 +635,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -668,6 +725,14 @@ #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 @@ -676,10 +741,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -708,11 +776,11 @@ //#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -722,11 +790,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -761,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) @@ -851,6 +927,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -959,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 @@ -977,6 +1056,9 @@ #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 @@ -1049,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 @@ -1068,13 +1150,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 @@ -1143,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 @@ -1169,6 +1252,8 @@ #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 @@ -1340,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 /** @@ -1710,11 +1795,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1815,6 +1907,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1863,6 +1961,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1908,6 +2015,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1921,10 +2029,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1937,6 +2041,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 * @@ -1962,11 +2070,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 @@ -1991,7 +2099,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(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 71% rename from Marlin/src/config/examples/Anet/A2/Configuration_adv.h rename to config/examples/Anet/A2plus/Configuration_adv.h index b4e749dfc8af..e959aeaf8e4a 100644 --- a/Marlin/src/config/examples/Anet/A2/Configuration_adv.h +++ b/config/examples/Anet/A2plus/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ #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. @@ -853,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1068,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 @@ -915,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1109,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 @@ -940,11 +1118,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 @@ -1124,6 +1308,7 @@ //#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 @@ -1174,6 +1359,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. @@ -1201,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1598,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1673,7 @@ #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. @@ -1399,7 +1695,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 @@ -1411,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2020,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2123,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2277,83 @@ #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/Anet/A6/Configuration.h b/config/examples/Anet/A6/Configuration.h similarity index 88% rename from Marlin/src/config/examples/Anet/A6/Configuration.h rename to config/examples/Anet/A6/Configuration.h index 88ad69adcb36..b33abd387f9e 100644 --- a/Marlin/src/config/examples/Anet/A6/Configuration.h +++ b/config/examples/Anet/A6/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -149,8 +149,8 @@ // :[1, 2, 3, 4, 5, 6] #define EXTRUDERS 1 -// Generally expected filament diameter (1.75, 2.85, 3.0, ...). Used for Volumetric, Filament Width Sensor, etc. -#define DEFAULT_NOMINAL_FILAMENT_DIA 3.0 +// The Anet A6 original extruder is designed for 1.75mm +#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75 // For Cyclops or any "multi-extruder" that shares a single nozzle. //#define SINGLENOZZLE @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 11 #define TEMP_SENSOR_1 0 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -427,7 +482,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -521,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 ========================= @@ -599,8 +655,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -713,6 +770,13 @@ //#define DEFAULT_RETRACT_ACCELERATION 2000 // E acceleration for retracts //#define DEFAULT_TRAVEL_ACCELERATION 4000 // 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) @@ -724,10 +788,13 @@ */ // ANET A6 Firmware V2.0 defaults (jerk): // Vxy-jerk: 10, Vz-jerk: +000.30, Ve-jerk: 5 -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -756,11 +823,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -770,11 +837,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -809,6 +873,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) @@ -928,6 +1003,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -1074,7 +1152,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 @@ -1092,6 +1170,9 @@ #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 @@ -1164,7 +1245,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 @@ -1183,13 +1264,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 @@ -1282,7 +1364,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 @@ -1308,6 +1390,8 @@ #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 @@ -1493,10 +1577,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 /** @@ -1863,11 +1947,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1968,6 +2059,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -2016,6 +2113,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2061,6 +2167,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -2074,10 +2181,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -2090,6 +2193,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 * @@ -2115,11 +2222,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 @@ -2144,7 +2251,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(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 71% rename from Marlin/src/config/examples/Anet/A6/Configuration_adv.h rename to config/examples/Anet/A6/Configuration_adv.h index c73d08f6a199..0c593f8a7032 100644 --- a/Marlin/src/config/examples/Anet/A6/Configuration_adv.h +++ b/config/examples/Anet/A6/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #define THERMAL_PROTECTION_PERIOD 60 // Seconds #define THERMAL_PROTECTION_HYSTERESIS 10 // 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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,30 +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 @@ -400,6 +469,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 @@ -432,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 @@ -457,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 @@ -482,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -570,6 +721,13 @@ #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 @@ -594,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -629,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -744,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -785,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -815,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -844,6 +1023,7 @@ */ #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. @@ -852,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -885,13 +1068,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 @@ -914,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -931,7 +1109,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 @@ -939,11 +1118,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 @@ -1123,6 +1308,7 @@ //#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 @@ -1173,6 +1359,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. @@ -1200,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1330,13 +1598,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1344,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1355,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1377,6 +1673,7 @@ #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. @@ -1398,7 +1695,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 @@ -1410,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1447,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1542,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1638,11 +2020,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1746,35 +2123,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1896,7 +2277,83 @@ #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/Anet/A8/Configuration.h b/config/examples/Anet/A8/Configuration.h similarity index 87% rename from Marlin/src/config/examples/Anet/A8/Configuration.h rename to config/examples/Anet/A8/Configuration.h index 3b729240a150..430e175824e6 100644 --- a/Marlin/src/config/examples/Anet/A8/Configuration.h +++ b/config/examples/Anet/A8/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -175,6 +175,16 @@ //#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) @@ -185,25 +195,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -213,13 +250,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -235,6 +286,10 @@ #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). @@ -306,7 +361,9 @@ * 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 * @@ -325,7 +382,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 5 #define TEMP_SENSOR_1 0 @@ -345,37 +402,34 @@ //#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. - -// 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. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +#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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -388,10 +442,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 15 // If the temperature difference between the target temperature and the actual temperature @@ -423,7 +478,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -439,9 +494,9 @@ * heater. If your configuration is significantly different than this and you don't understand * the issues involved, don't use bed PID until someone else verifies that your hardware works. */ -//#define PIDTEMPBED +#define PIDTEMPBED -#define BED_LIMIT_SWITCHING +//#define BED_LIMIT_SWITCHING /** * Max Bed Power @@ -457,9 +512,9 @@ //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 + //#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 @@ -467,6 +522,12 @@ //#define DEFAULT_bedKi 1.41 //#define DEFAULT_bedKd 1675.16 + // ANET A8 + // original Bed + 0.3mm Heat conducting into 4mm borosilicate (PID-Autotune: M303 E-1 S60 C5): + #define DEFAULT_bedKp 295.00 + #define DEFAULT_bedKi 35.65 + #define DEFAULT_bedKd 610.21 + // FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles. #endif // PIDTEMPBED @@ -508,6 +569,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 ========================= @@ -586,8 +648,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -675,6 +738,14 @@ #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 @@ -683,10 +754,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -715,11 +789,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -729,11 +803,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -768,6 +839,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) @@ -858,6 +940,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -966,7 +1051,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 @@ -984,6 +1069,9 @@ #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 @@ -1056,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 @@ -1075,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 @@ -1150,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 20 #define PROBE_PT_1_Y 160 #define PROBE_PT_2_X 20 @@ -1176,6 +1265,8 @@ #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 @@ -1347,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 { (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 /** @@ -1717,11 +1808,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1822,6 +1920,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1870,6 +1974,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1915,6 +2028,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1928,10 +2042,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1944,6 +2054,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 * @@ -1969,11 +2083,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 @@ -1998,7 +2112,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(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 71% rename from Marlin/src/config/examples/Anet/A8/Configuration_adv.h rename to config/examples/Anet/A8/Configuration_adv.h index 4cad717ac438..19c43967459a 100644 --- a/Marlin/src/config/examples/Anet/A8/Configuration_adv.h +++ b/config/examples/Anet/A8/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #define THERMAL_PROTECTION_PERIOD 60 // Seconds #define THERMAL_PROTECTION_HYSTERESIS 10 // 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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ #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. @@ -853,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1068,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 @@ -915,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1109,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 @@ -940,11 +1118,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 @@ -1124,6 +1308,7 @@ //#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 @@ -1174,6 +1359,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. @@ -1201,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1598,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1673,7 @@ #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. @@ -1399,7 +1695,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 @@ -1411,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2020,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2123,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2277,83 @@ #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/AnimationExample/_Bootscreen.h b/config/examples/AnimationExample/_Bootscreen.h similarity index 99% rename from Marlin/src/config/examples/AnimationExample/_Bootscreen.h rename to config/examples/AnimationExample/_Bootscreen.h index 6a697356266e..351abf6fe054 100644 --- a/Marlin/src/config/examples/AnimationExample/_Bootscreen.h +++ b/config/examples/AnimationExample/_Bootscreen.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/config/examples/AnyCubic/i3/Configuration.h b/config/examples/AnyCubic/i3/Configuration.h new file mode 100644 index 000000000000..540956d7facb --- /dev/null +++ b/config/examples/AnyCubic/i3/Configuration.h @@ -0,0 +1,2137 @@ +/** + * 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 0 + +/** + * Select a secondary serial port on the board to use for communication with the host. + * This allows the connection of wireless adapters (for instance) to non-default port pins. + * Serial port -1 is the USB emulated serial port, if available. + * + * :[-1, 0, 1, 2, 3, 4, 5, 6, 7] + */ +//#define SERIAL_PORT_2 -1 + +/** + * This setting determines the communication speed of the printer. + * + * 250000 works in most cases, but you might try a lower speed if + * you commonly experience drop-outs during host printing. + * You may try up to 1000000 to speed up SD file transfer. + * + * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000] + */ +#define BAUDRATE 250000 + +// Enable the Bluetooth serial interface on AT90USB devices +//#define BLUETOOTH + +// The following define selects which electronics board you have. +// Please choose the name from boards.h that matches your setup +#ifndef MOTHERBOARD + #define MOTHERBOARD BOARD_TRIGORILLA_14 +#endif + +// Optional custom name for your RepStrap or other custom machine +// Displayed in the LCD "Ready" message +#define CUSTOM_MACHINE_NAME "Anycubic i3" + +// Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines) +// You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4) +//#define MACHINE_UUID "00000000-0000-0000-0000-000000000000" + +// @section extruder + +// This defines the number of extruders +// :[1, 2, 3, 4, 5, 6] +#define EXTRUDERS 1 + +// Generally expected filament diameter (1.75, 2.85, 3.0, ...). Used for Volumetric, Filament Width Sensor, etc. +#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75 + +// For Cyclops or any "multi-extruder" that shares a single nozzle. +//#define SINGLENOZZLE + +/** + * Průša MK2 Single Nozzle Multi-Material Multiplexer, and variants. + * + * This device allows one stepper driver on a control board to drive + * two to eight stepper motors, one at a time, in a manner suitable + * for extruders. + * + * This option only allows the multiplexer to switch on tool-change. + * Additional options to configure custom E moves are pending. + */ +//#define MK2_MULTIPLEXER +#if ENABLED(MK2_MULTIPLEXER) + // Override the default DIO selector pins here, if needed. + // Some pins files may provide defaults for these pins. + //#define E_MUX0_PIN 40 // Always Required + //#define E_MUX1_PIN 42 // Needed for 3 to 8 inputs + //#define E_MUX2_PIN 44 // Needed for 5 to 8 inputs +#endif + +/** + * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif +#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 + +// 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 + +// 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 + +// 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 + +//=========================================================================== +//============================= 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 + + // ANYCUBIC I3 240C and 8 cycles + #define DEFAULT_Kp 17.80 + #define DEFAULT_Ki 0.84 + #define DEFAULT_Kd 64.84 + + // 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 + + // Anycubic I3 with Ultrabase. 100C and 8 cycles + #define DEFAULT_bedKp 218.59 + #define DEFAULT_bedKi 43.04 + #define DEFAULT_bedKd 277.56 + + //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 420 + +//=========================================================================== +//======================== 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 true // set to true to invert the logic of the endstop. +#define Y_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. +#define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. +#define Z_MIN_PROBE_ENDSTOP_INVERTING true // set to true to invert the logic of the probe. + +/** + * Stepper Drivers + * + * These settings allow Marlin to tune stepper driver timing and enable advanced options for + * stepper drivers that support them. You may also override timing options in Configuration_adv.h. + * + * A4988 is assumed for unspecified drivers. + * + * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, + * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, + * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, + * 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, 400, 96.2 } + +/** + * Default Max Feed Rate (mm/s) + * Override with M203 + * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] + */ +#define DEFAULT_MAX_FEEDRATE { 500, 500, 6, 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 { 1500, 1500, 50, 8000 } + +/** + * 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 2000 // 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 5.0 + #define DEFAULT_YJERK 2.0 + #define DEFAULT_ZJERK 0.4 +#endif + +#define DEFAULT_EJERK 2.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 75 // X offset: -left +right [of the nozzle] +#define Y_PROBE_OFFSET_FROM_EXTRUDER 5 // Y offset: -front +behind [the nozzle] +#define Z_PROBE_OFFSET_FROM_EXTRUDER -2 // 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 +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif + +/** + * Enable one or more of the following if probing seems unreliable. + * Heaters and/or fans can be disabled during probing to minimize electrical + * noise. A delay can also be added to allow noise and vibration to settle. + * These options are most useful for the BLTouch probe, but may also improve + * readings with inductive probes and piezo sensors. + */ +//#define PROBING_HEATERS_OFF // Turn heaters off when probing +#if ENABLED(PROBING_HEATERS_OFF) + //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) +#endif +//#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing +//#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors + +// For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 +// :{ 0:'Low', 1:'High' } +#define X_ENABLE_ON 0 +#define Y_ENABLE_ON 0 +#define Z_ENABLE_ON 0 +#define E_ENABLE_ON 0 // For all extruders + +// Disables axis stepper immediately when it's not being used. +// WARNING: When motors turn off there is a chance of losing position accuracy! +#define DISABLE_X false +#define DISABLE_Y false +#define DISABLE_Z false + +// Warn on display about possibly reduced accuracy +//#define DISABLE_REDUCED_ACCURACY_WARNING + +// @section extruder + +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER true // Keep only the active extruder enabled + +// @section machine + +// Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way. +#define INVERT_X_DIR false +#define INVERT_Y_DIR false +#define INVERT_Z_DIR true + +// @section extruder + +// For direct drive extruder v9 set to true, for geared extruder set to false. +#define INVERT_E0_DIR false +#define INVERT_E1_DIR false +#define INVERT_E2_DIR false +#define INVERT_E3_DIR false +#define INVERT_E4_DIR false +#define INVERT_E5_DIR false + +// @section homing + +//#define NO_MOTION_BEFORE_HOMING // Inhibit movement until all axes have been homed + +//#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. + +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... + // Be sure you have this distance over your Z_MAX_POS in case. + +// Direction of endstops when homing; 1=MAX, -1=MIN +// :[-1,1] +#define X_HOME_DIR -1 +#define Y_HOME_DIR -1 +#define Z_HOME_DIR -1 + +// @section machine + +// The size of the print bed +#define X_BED_SIZE 210 +#define Y_BED_SIZE 210 + +// Travel limits (mm) after homing, corresponding to endstop positions. +#define X_MIN_POS -10 +#define Y_MIN_POS -11 +#define Z_MIN_POS 0 +#define X_MAX_POS X_BED_SIZE +#define Y_MAX_POS Y_BED_SIZE +#define Z_MAX_POS 250 + +/** + * 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 200 +#define PREHEAT_1_TEMP_BED 65 +#define PREHEAT_1_FAN_SPEED 255 // Value from 0 to 255 + +#define PREHEAT_2_LABEL "ABS" +#define PREHEAT_2_TEMP_HOTEND 240 +#define PREHEAT_2_TEMP_BED 95 +#define PREHEAT_2_FAN_SPEED 255 // Value from 0 to 255 + +/** + * Nozzle Park + * + * Park the nozzle at the given XYZ position on idle or G27. + * + * The "P" parameter controls the action applied to the Z axis: + * + * P0 (Default) If Z is below park Z raise the nozzle. + * P1 Raise the nozzle always to Z-park height. + * P2 Raise the nozzle by Z-park amount, limited to Z_MAX_POS. + */ +//#define NOZZLE_PARK_FEATURE + +#if ENABLED(NOZZLE_PARK_FEATURE) + // Specify a park position as { X, Y, Z_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 WESTERN + +/** + * 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 + +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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. +// :[0,1,2,3,4,5,6,7] +#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 1 // Servo index starts with 0 for M280 command + +// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle. +// 300ms is a good value but you can try less delay. +// If the servo can't reach the requested position, increase it. +#define SERVO_DELAY { 300 } + +// Only power servos during movement, otherwise leave off to prevent jitter +//#define DEACTIVATE_SERVOS_AFTER_MOVE + +// Allow servo angle to be edited and saved to EEPROM +//#define EDITABLE_SERVO_ANGLES diff --git a/config/examples/AnyCubic/i3/Configuration_adv.h b/config/examples/AnyCubic/i3/Configuration_adv.h new file mode 100644 index 000000000000..c1e8a3bf1d7b --- /dev/null +++ b/config/examples/AnyCubic/i3/Configuration_adv.h @@ -0,0 +1,2359 @@ +/** + * 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 + +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#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) + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. + //#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 7 // 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 TRIGORILLA_FAN2_PIN +#define E1_AUTO_FAN_PIN -1 +#define E2_AUTO_FAN_PIN -1 +#define E3_AUTO_FAN_PIN -1 +#define E4_AUTO_FAN_PIN -1 +#define E5_AUTO_FAN_PIN -1 +#define CHAMBER_AUTO_FAN_PIN -1 +#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 +#define EXTRUDER_AUTO_FAN_SPEED 255 // 255 == full speed + +/** + * Part-Cooling Fan Multiplexer + * + * This feature allows you to digitally multiplex the fan output. + * The multiplexer is automatically switched at tool-change. + * Set FANMUX[012]_PINs below for up to 2, 4, or 8 multiplexed fans. + */ +#define FANMUX0_PIN -1 +#define FANMUX1_PIN -1 +#define FANMUX2_PIN -1 + +/** + * M355 Case Light on-off / brightness + */ +//#define CASE_LIGHT_ENABLE +#if ENABLED(CASE_LIGHT_ENABLE) + //#define CASE_LIGHT_PIN 4 // Override the default pin if needed + #define INVERT_CASE_LIGHT false // Set true if Case Light is ON when pin is LOW + #define CASE_LIGHT_DEFAULT_ON true // Set default power-up state on + #define CASE_LIGHT_DEFAULT_BRIGHTNESS 105 // Set default power-up brightness (0-255, requires PWM pin) + //#define MENU_ITEM_CASE_LIGHT // Add a Case Light option to the LCD main menu + //#define CASE_LIGHT_USE_NEOPIXEL // Use Neopixel LED as case light, requires NEOPIXEL_LED. + #if ENABLED(CASE_LIGHT_USE_NEOPIXEL) + #define CASE_LIGHT_NEOPIXEL_COLOR { 255, 255, 255, 255 } // { Red, Green, Blue, White } + #endif +#endif + +//=========================================================================== +//============================ Mechanical Settings ========================== +//=========================================================================== + +// @section homing + +// If you want endstops to stay on (by default) even when not homing +// enable this option. Override at any time with M120, M121. +//#define ENDSTOPS_ALWAYS_ON_DEFAULT + +// @section extras + +//#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. + +// Employ an external closed loop controller. Override pins here if needed. +//#define EXTERNAL_CLOSED_LOOP_CONTROLLER +#if ENABLED(EXTERNAL_CLOSED_LOOP_CONTROLLER) + //#define CLOSED_LOOP_ENABLE_PIN -1 + //#define CLOSED_LOOP_MOVE_COMPLETE_PIN -1 +#endif + +/** + * Dual Steppers / Dual Endstops + * + * This section will allow you to use extra E drivers to drive a second motor for X, Y, or Z axes. + * + * For example, set X_DUAL_STEPPER_DRIVERS setting to use a second motor. If the motors need to + * spin in opposite directions set INVERT_X2_VS_X_DIR. If the second motor needs its own endstop + * set X_DUAL_ENDSTOPS. This can adjust for "racking." Use X2_USE_ENDSTOP to set the endstop plug + * that should be used for the second endstop. Extra endstops will appear in the output of 'M119'. + * + * Use X_DUAL_ENDSTOP_ADJUSTMENT to adjust for mechanical imperfection. After homing both motors + * this offset is applied to the X2 motor. To find the offset home the X axis, and measure the error + * in X2. Dual endstop offsets can be set at runtime with 'M666 X Y Z'. + */ + +//#define X_DUAL_STEPPER_DRIVERS +#if ENABLED(X_DUAL_STEPPER_DRIVERS) + #define INVERT_X2_VS_X_DIR true // Set 'true' if X motors should rotate in opposite directions + //#define X_DUAL_ENDSTOPS + #if ENABLED(X_DUAL_ENDSTOPS) + #define X2_USE_ENDSTOP _XMAX_ + #define X_DUAL_ENDSTOPS_ADJUSTMENT 0 + #endif +#endif + +//#define Y_DUAL_STEPPER_DRIVERS +#if ENABLED(Y_DUAL_STEPPER_DRIVERS) + #define INVERT_Y2_VS_Y_DIR true // Set 'true' if Y motors should rotate in opposite directions + //#define Y_DUAL_ENDSTOPS + #if ENABLED(Y_DUAL_ENDSTOPS) + #define Y2_USE_ENDSTOP _YMAX_ + #define Y_DUAL_ENDSTOPS_ADJUSTMENT 0 + #endif +#endif + +//#define Z_DUAL_STEPPER_DRIVERS +#if ENABLED(Z_DUAL_STEPPER_DRIVERS) + //#define Z_DUAL_ENDSTOPS + #if ENABLED(Z_DUAL_ENDSTOPS) + #define Z2_USE_ENDSTOP _XMAX_ + #define Z_DUAL_ENDSTOPS_ADJUSTMENT 0 + #endif +#endif + +//#define Z_TRIPLE_STEPPER_DRIVERS +#if ENABLED(Z_TRIPLE_STEPPER_DRIVERS) + //#define Z_TRIPLE_ENDSTOPS + #if ENABLED(Z_TRIPLE_ENDSTOPS) + #define Z2_USE_ENDSTOP _XMAX_ + #define Z3_USE_ENDSTOP _YMAX_ + #define Z_TRIPLE_ENDSTOPS_ADJUSTMENT2 0 + #define Z_TRIPLE_ENDSTOPS_ADJUSTMENT3 0 + #endif +#endif + +/** + * Dual X Carriage + * + * This setup has two X carriages that can move independently, each with its own hotend. + * The carriages can be used to print an object with two colors or materials, or in + * "duplication mode" it can print two identical or X-mirrored objects simultaneously. + * The inactive carriage is parked automatically to prevent oozing. + * X1 is the left carriage, X2 the right. They park and home at opposite ends of the X axis. + * By default the X2 stepper is assigned to the first unused E plug on the board. + * + * 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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 + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif + +#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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // 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/ArmEd/Configuration.h b/config/examples/ArmEd/Configuration.h similarity index 87% rename from Marlin/src/config/examples/ArmEd/Configuration.h rename to config/examples/ArmEd/Configuration.h index cdf74682f6f0..7d23ad27eea0 100644 --- a/Marlin/src/config/examples/ArmEd/Configuration.h +++ b/config/examples/ArmEd/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -154,17 +154,6 @@ // For Cyclops or any "multi-extruder" that shares a single nozzle. //#define SINGLENOZZLE -#if ENABLED(SINGLENOZZLE) - // Parameters for filament retract / prime on toolchange - #define SINGLENOZZLE_SWAP_LENGTH 12 // (mm) - #define SINGLENOZZLE_SWAP_RETRACT_SPEED 3600 // (mm/m) - #define SINGLENOZZLE_SWAP_PRIME_SPEED 3600 // (mm/m) - //#define SINGLENOZZLE_SWAP_PARK - #if ENABLED(SINGLENOZZLE_SWAP_PARK) - #define SINGLENOZZLE_TOOLCHANGE_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } - #define SINGLENOZZLE_PARK_XY_FEEDRATE 6000 // (mm/m) - #endif -#endif /** * Průša MK2 Single Nozzle Multi-Material Multiplexer, and variants. @@ -185,6 +174,16 @@ //#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) @@ -195,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -223,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -245,6 +285,10 @@ #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). @@ -316,7 +360,9 @@ * 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 * @@ -335,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 5 #define TEMP_SENSOR_1 0 @@ -355,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -398,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -427,7 +471,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -513,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 ========================= @@ -591,8 +636,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -680,6 +726,14 @@ #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 @@ -688,10 +742,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 8.0 -#define DEFAULT_YJERK 8.0 -#define DEFAULT_ZJERK 0.4 -#define DEFAULT_EJERK 1.5 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 8.0 + #define DEFAULT_YJERK 8.0 + #define DEFAULT_ZJERK 0.4 +#endif + +#define DEFAULT_EJERK 1.5 // May be used by Linear Advance /** * S-Curve Acceleration @@ -720,11 +777,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -734,11 +791,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -773,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) @@ -863,6 +928,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -971,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 @@ -989,6 +1057,9 @@ #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 @@ -1061,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 @@ -1080,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 @@ -1155,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 @@ -1181,6 +1253,8 @@ #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 @@ -1352,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 /** @@ -1722,11 +1796,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1825,6 +1906,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1873,6 +1960,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1918,6 +2014,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1931,10 +2028,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1947,6 +2040,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 * @@ -1972,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 @@ -2001,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(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 000000000000..97c1ddcf81c0 --- /dev/null +++ b/config/examples/ArmEd/Configuration_adv.h @@ -0,0 +1,2363 @@ +/** + * 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 + +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#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) + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. + //#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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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 + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif + +#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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // 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 87% rename from Marlin/src/config/examples/Azteeg/X5GT/Configuration.h rename to config/examples/Azteeg/X5GT/Configuration.h index 9daade4b70e7..959ec9c669a6 100644 --- a/Marlin/src/config/examples/Azteeg/X5GT/Configuration.h +++ b/config/examples/Azteeg/X5GT/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -416,7 +471,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -501,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 ========================= @@ -579,8 +635,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -668,6 +725,14 @@ #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 @@ -676,10 +741,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -708,11 +776,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -722,11 +790,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -761,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) @@ -851,6 +927,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -959,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 @@ -977,6 +1056,9 @@ #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 @@ -1049,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 @@ -1068,13 +1150,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 @@ -1143,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 @@ -1169,6 +1252,8 @@ #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 @@ -1202,8 +1287,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) @@ -1340,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 /** @@ -1710,11 +1795,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1813,6 +1905,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1861,6 +1959,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1906,6 +2013,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1919,10 +2027,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) #define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1935,6 +2039,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 * @@ -1960,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 @@ -1989,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(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 87% rename from Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration.h rename to config/examples/BIBO/TouchX/cyclops/Configuration.h index 160817eae657..b8c873de36e1 100644 --- a/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration.h +++ b/config/examples/BIBO/TouchX/cyclops/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 5 #define TEMP_SENSOR_1 0 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -416,7 +471,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -501,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 ========================= @@ -579,8 +635,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -668,6 +725,14 @@ #define DEFAULT_RETRACT_ACCELERATION 1100 // E acceleration for retracts #define DEFAULT_TRAVEL_ACCELERATION 1100 // 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 @@ -676,10 +741,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 7.0 -#define DEFAULT_YJERK 7.0 -#define DEFAULT_ZJERK 0.65 -#define DEFAULT_EJERK 5.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 7.0 + #define DEFAULT_YJERK 7.0 + #define DEFAULT_ZJERK 0.65 +#endif + +#define DEFAULT_EJERK 5.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -708,11 +776,11 @@ //#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -722,11 +790,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -761,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) @@ -851,6 +927,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -959,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 @@ -977,6 +1056,9 @@ #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 @@ -1049,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 @@ -1066,15 +1148,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 @@ -1143,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 @@ -1169,6 +1252,8 @@ #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 @@ -1340,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 /** @@ -1710,11 +1795,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1813,6 +1905,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1861,6 +1959,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1906,6 +2013,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1919,10 +2027,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1935,6 +2039,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 * @@ -1960,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 @@ -1989,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(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 71% rename from Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration_adv.h rename to config/examples/BIBO/TouchX/cyclops/Configuration_adv.h index 914d78f9318c..fbf90e400a7a 100644 --- a/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration_adv.h +++ b/config/examples/BIBO/TouchX/cyclops/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #define THERMAL_PROTECTION_PERIOD 45 // Seconds #define THERMAL_PROTECTION_HYSTERESIS 2 // 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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,30 +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 @@ -400,6 +469,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 @@ -432,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 @@ -457,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 @@ -482,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -570,6 +721,13 @@ #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 @@ -594,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -629,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -744,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -785,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -815,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -844,6 +1023,7 @@ */ //#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. @@ -852,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -885,13 +1068,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 @@ -914,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -931,7 +1109,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 @@ -939,11 +1118,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 @@ -1123,6 +1308,7 @@ //#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 @@ -1173,6 +1359,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. @@ -1200,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1330,13 +1598,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1344,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1355,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1377,6 +1673,7 @@ #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. @@ -1398,7 +1695,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 @@ -1410,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1447,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1542,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1638,11 +2020,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1746,35 +2123,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1896,7 +2277,83 @@ #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/BIBO/TouchX/default/Configuration.h b/config/examples/BIBO/TouchX/default/Configuration.h similarity index 87% rename from Marlin/src/config/examples/BIBO/TouchX/default/Configuration.h rename to config/examples/BIBO/TouchX/default/Configuration.h index 83e8e9a32a1c..847a0dbc43f2 100644 --- a/Marlin/src/config/examples/BIBO/TouchX/default/Configuration.h +++ b/config/examples/BIBO/TouchX/default/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 5 #define TEMP_SENSOR_1 5 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -416,7 +471,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -501,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 ========================= @@ -579,8 +635,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -668,6 +725,14 @@ #define DEFAULT_RETRACT_ACCELERATION 1100 // E acceleration for retracts #define DEFAULT_TRAVEL_ACCELERATION 1100 // 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 @@ -676,10 +741,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 7.0 -#define DEFAULT_YJERK 7.0 -#define DEFAULT_ZJERK 0.65 -#define DEFAULT_EJERK 5.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 7.0 + #define DEFAULT_YJERK 7.0 + #define DEFAULT_ZJERK 0.65 +#endif + +#define DEFAULT_EJERK 5.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -708,11 +776,11 @@ //#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -722,11 +790,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -761,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) @@ -851,6 +927,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -959,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 @@ -977,6 +1056,9 @@ #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 @@ -1049,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 @@ -1066,15 +1148,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 @@ -1143,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 @@ -1169,6 +1252,8 @@ #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 @@ -1340,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 /** @@ -1710,11 +1795,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1813,6 +1905,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1861,6 +1959,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1906,6 +2013,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1919,10 +2027,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1935,6 +2039,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 * @@ -1960,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 @@ -1989,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(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 71% rename from Marlin/src/config/examples/BIBO/TouchX/default/Configuration_adv.h rename to config/examples/BIBO/TouchX/default/Configuration_adv.h index 8f644d6a6c31..fbb76e029a4b 100644 --- a/Marlin/src/config/examples/BIBO/TouchX/default/Configuration_adv.h +++ b/config/examples/BIBO/TouchX/default/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #define THERMAL_PROTECTION_PERIOD 60 // Seconds #define THERMAL_PROTECTION_HYSTERESIS 2 // 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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ //#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. @@ -853,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1068,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 @@ -915,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1109,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 @@ -940,11 +1118,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 @@ -1124,6 +1308,7 @@ //#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 @@ -1174,6 +1359,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. @@ -1201,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1598,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1673,7 @@ #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. @@ -1399,7 +1695,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 @@ -1411,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2020,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2123,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2277,83 @@ #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/BQ/Hephestos/Configuration.h b/config/examples/BQ/Hephestos/Configuration.h similarity index 87% rename from Marlin/src/config/examples/BQ/Hephestos/Configuration.h rename to config/examples/BQ/Hephestos/Configuration.h index d05631d63ead..a98e73d97a25 100644 --- a/Marlin/src/config/examples/BQ/Hephestos/Configuration.h +++ b/config/examples/BQ/Hephestos/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -404,7 +459,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -489,6 +544,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 ========================= @@ -567,8 +623,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -656,6 +713,14 @@ #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 @@ -664,10 +729,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -696,11 +764,11 @@ //#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -710,11 +778,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -749,6 +814,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) @@ -839,6 +915,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -947,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 @@ -965,6 +1044,9 @@ #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 @@ -1037,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 @@ -1056,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 @@ -1131,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 @@ -1157,6 +1240,8 @@ #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 @@ -1328,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 /** @@ -1698,11 +1783,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1801,6 +1893,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1849,6 +1947,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1894,6 +2001,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1907,10 +2015,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1923,6 +2027,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 * @@ -1948,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 @@ -1977,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(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/Hephestos/Configuration_adv.h similarity index 71% rename from Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h rename to config/examples/BQ/Hephestos/Configuration_adv.h index cd10d663b926..7a4c6e561ea0 100644 --- a/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h +++ b/config/examples/BQ/Hephestos/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -483,11 +552,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +718,13 @@ #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 @@ -595,7 +749,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +784,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +902,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +954,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +984,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1020,7 @@ */ //#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. @@ -853,12 +1029,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1065,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 @@ -915,13 +1095,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1106,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 @@ -940,11 +1115,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 @@ -1124,6 +1305,7 @@ //#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 @@ -1174,6 +1356,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. @@ -1201,127 +1384,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #if AXIS_IS_TMC(E1) + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + #define E1_RSENSE 0.11 + #endif - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E2) + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + #define E2_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #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 - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1595,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1636,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1647,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1670,7 @@ #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. @@ -1399,7 +1692,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 @@ -1411,27 +1704,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1724,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define 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 - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1903,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2017,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2120,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2274,83 @@ #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/BQ/Hephestos_2/Configuration.h b/config/examples/BQ/Hephestos_2/Configuration.h similarity index 87% rename from Marlin/src/config/examples/BQ/Hephestos_2/Configuration.h rename to config/examples/BQ/Hephestos_2/Configuration.h index 0cbd5071885c..474110f36f2d 100644 --- a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration.h +++ b/config/examples/BQ/Hephestos_2/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -182,6 +182,16 @@ //#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) @@ -192,25 +202,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -220,13 +257,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -242,6 +293,10 @@ #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). @@ -313,7 +368,9 @@ * 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 * @@ -332,7 +389,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 70 #define TEMP_SENSOR_1 0 @@ -352,30 +409,27 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 @@ -395,10 +449,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -417,7 +472,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -502,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 ========================= @@ -580,8 +636,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -669,6 +726,14 @@ #define DEFAULT_RETRACT_ACCELERATION 1300 // E acceleration for retracts #define DEFAULT_TRAVEL_ACCELERATION 1500 // 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 @@ -677,10 +742,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 5.0 -#define DEFAULT_YJERK 5.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 10.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 5.0 + #define DEFAULT_YJERK 5.0 + #define DEFAULT_ZJERK 0.3 +#endif + +#define DEFAULT_EJERK 10.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -709,11 +777,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -723,11 +791,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -762,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) @@ -836,12 +912,12 @@ * 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 0 // Z Clearance for Deploy/Stow -#define Z_CLEARANCE_BETWEEN_PROBES 2 // Z Clearance between probe points +#define Z_CLEARANCE_DEPLOY_PROBE 0 // Z Clearance for Deploy/Stow +#define Z_CLEARANCE_BETWEEN_PROBES 2 // Z Clearance between probe points #define Z_CLEARANCE_MULTI_PROBE 5 // Z Clearance between multiple probes -//#define Z_AFTER_PROBING 5 // Z position after probing is done +//#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 +#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 @@ -852,6 +928,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -960,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 @@ -977,6 +1056,9 @@ #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. + + // 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 @@ -1049,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 @@ -1068,13 +1150,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 @@ -1143,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 @@ -1169,6 +1252,8 @@ #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 @@ -1340,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), 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 /** @@ -1710,11 +1795,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1813,6 +1905,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1861,6 +1959,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1906,6 +2013,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1919,10 +2027,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1935,6 +2039,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 * @@ -1960,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 @@ -1989,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(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 71% rename from Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h rename to config/examples/BQ/Hephestos_2/Configuration_adv.h index b6725c00ac38..218045c7476a 100644 --- a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h +++ b/config/examples/BQ/Hephestos_2/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -483,11 +552,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -579,6 +726,13 @@ #define ENCODER_100X_STEPS_PER_SEC 50 // (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 @@ -603,7 +757,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -638,8 +792,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -753,7 +910,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -794,19 +962,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -824,8 +992,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -853,6 +1028,7 @@ */ #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 2 // Babysteps are very small. Increase for faster motion. @@ -861,12 +1037,15 @@ #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) #define DOUBLECLICK_MAX_INTERVAL 1500 // Maximum interval between clicks, in milliseconds. // Note: Extra time may be added to mitigate controller latency. + //#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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -894,13 +1073,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 @@ -923,13 +1103,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -940,7 +1114,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 @@ -948,11 +1123,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 @@ -1132,6 +1313,7 @@ //#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 @@ -1182,6 +1364,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. @@ -1209,127 +1392,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #if AXIS_IS_TMC(E1) + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + #define E1_RSENSE 0.11 + #endif - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E2) + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + #define E2_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #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 - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1339,13 +1603,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1353,7 +1644,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1364,9 +1655,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1386,6 +1678,7 @@ #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. @@ -1407,7 +1700,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 @@ -1419,27 +1712,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1456,62 +1732,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define 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 - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1551,12 +1911,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1647,11 +2025,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1755,35 +2128,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1905,7 +2282,83 @@ #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/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 99% rename from Marlin/src/config/examples/BQ/Hephestos_2/_Bootscreen.h rename to config/examples/BQ/Hephestos_2/_Bootscreen.h index 0e771c0c7f7b..5bc99616ea9d 100644 --- a/Marlin/src/config/examples/BQ/Hephestos_2/_Bootscreen.h +++ b/config/examples/BQ/Hephestos_2/_Bootscreen.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/config/examples/BQ/WITBOX/Configuration.h b/config/examples/BQ/WITBOX/Configuration.h similarity index 87% rename from Marlin/src/config/examples/BQ/WITBOX/Configuration.h rename to config/examples/BQ/WITBOX/Configuration.h index f1fd8318bc58..3b1eafc68641 100644 --- a/Marlin/src/config/examples/BQ/WITBOX/Configuration.h +++ b/config/examples/BQ/WITBOX/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -404,7 +459,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -489,6 +544,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 ========================= @@ -567,8 +623,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -656,6 +713,14 @@ #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 @@ -664,10 +729,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -696,11 +764,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -710,11 +778,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -749,6 +814,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) @@ -839,6 +915,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -947,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 @@ -965,6 +1044,9 @@ #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 @@ -1037,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 @@ -1056,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 @@ -1131,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 @@ -1157,6 +1240,8 @@ #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 @@ -1328,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 /** @@ -1698,11 +1783,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1801,6 +1893,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1849,6 +1947,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1894,6 +2001,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1907,10 +2015,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1923,6 +2027,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 * @@ -1948,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 @@ -1977,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(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/WITBOX/Configuration_adv.h similarity index 71% rename from Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h rename to config/examples/BQ/WITBOX/Configuration_adv.h index cd10d663b926..7a4c6e561ea0 100644 --- a/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h +++ b/config/examples/BQ/WITBOX/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -483,11 +552,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +718,13 @@ #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 @@ -595,7 +749,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +784,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +902,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +954,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +984,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1020,7 @@ */ //#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. @@ -853,12 +1029,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1065,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 @@ -915,13 +1095,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1106,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 @@ -940,11 +1115,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 @@ -1124,6 +1305,7 @@ //#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 @@ -1174,6 +1356,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. @@ -1201,127 +1384,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #if AXIS_IS_TMC(E1) + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + #define E1_RSENSE 0.11 + #endif - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E2) + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + #define E2_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #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 - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1595,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1636,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1647,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1670,7 @@ #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. @@ -1399,7 +1692,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 @@ -1411,27 +1704,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1724,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define 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 - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1903,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2017,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2120,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2274,83 @@ #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/Cartesio/Configuration.h b/config/examples/Cartesio/Configuration.h similarity index 87% rename from Marlin/src/config/examples/Cartesio/Configuration.h rename to config/examples/Cartesio/Configuration.h index b7404119e6ae..06586f2e0d75 100644 --- a/Marlin/src/config/examples/Cartesio/Configuration.h +++ b/config/examples/Cartesio/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -175,6 +175,16 @@ //#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) @@ -185,25 +195,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -213,13 +250,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -235,6 +286,10 @@ #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). @@ -306,7 +361,9 @@ * 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 * @@ -325,7 +382,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -345,37 +402,34 @@ //#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. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 1 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +#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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -388,10 +442,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -417,7 +472,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -500,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 ========================= @@ -578,8 +634,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -667,6 +724,14 @@ #define DEFAULT_RETRACT_ACCELERATION 10000 // 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 @@ -675,10 +740,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -707,11 +775,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -721,11 +789,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -760,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) @@ -850,6 +926,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -958,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 @@ -976,6 +1055,9 @@ #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 @@ -1048,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 @@ -1067,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 @@ -1142,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 @@ -1168,6 +1251,8 @@ #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 @@ -1339,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 /** @@ -1709,11 +1794,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1812,6 +1904,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1860,6 +1958,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1905,6 +2012,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1918,10 +2026,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) #define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1934,6 +2038,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 * @@ -1959,11 +2067,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 @@ -1988,7 +2096,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(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 71% rename from Marlin/src/config/examples/Cartesio/Configuration_adv.h rename to config/examples/Cartesio/Configuration_adv.h index fb18a3b9f89e..46c45394b4a2 100644 --- a/Marlin/src/config/examples/Cartesio/Configuration_adv.h +++ b/config/examples/Cartesio/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ //#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. @@ -853,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1068,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 @@ -915,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1109,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 @@ -940,11 +1118,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 @@ -1124,6 +1308,7 @@ //#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 @@ -1174,6 +1359,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. @@ -1201,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1598,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1673,7 @@ #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. @@ -1399,7 +1695,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 @@ -1411,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2020,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2123,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2277,83 @@ #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/Cartesio/_Bootscreen.h b/config/examples/Cartesio/_Bootscreen.h similarity index 99% rename from Marlin/src/config/examples/Cartesio/_Bootscreen.h rename to config/examples/Cartesio/_Bootscreen.h index e0efd83767ec..c42a6fb37dcb 100644 --- a/Marlin/src/config/examples/Cartesio/_Bootscreen.h +++ b/config/examples/Cartesio/_Bootscreen.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/config/examples/Creality/CR-10/Configuration.h b/config/examples/Creality/CR-10/Configuration.h old mode 100755 new mode 100644 similarity index 87% rename from Marlin/src/config/examples/Creality/CR-10/Configuration.h rename to config/examples/Creality/CR-10/Configuration.h index cede057f4ab5..93f1daf401b1 --- a/Marlin/src/config/examples/Creality/CR-10/Configuration.h +++ b/config/examples/Creality/CR-10/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -421,7 +476,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -511,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 ========================= @@ -589,8 +645,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -678,6 +735,14 @@ #define DEFAULT_RETRACT_ACCELERATION 500 // 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 @@ -686,10 +751,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 2.7 -#define DEFAULT_EJERK 5.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 10.0 + #define DEFAULT_YJERK 10.0 + #define DEFAULT_ZJERK 2.7 +#endif + +#define DEFAULT_EJERK 5.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -718,11 +786,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -732,11 +800,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -771,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) @@ -861,6 +937,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -969,7 +1048,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 @@ -987,6 +1066,9 @@ #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 @@ -1059,7 +1141,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 @@ -1078,13 +1160,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 @@ -1153,7 +1236,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 @@ -1179,6 +1262,8 @@ #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 @@ -1217,7 +1302,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 @@ -1350,10 +1435,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 /** @@ -1720,11 +1805,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1823,6 +1915,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1871,6 +1969,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1916,6 +2023,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1929,10 +2037,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1945,6 +2049,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 * @@ -1970,11 +2078,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 @@ -1999,7 +2107,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(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 old mode 100755 new mode 100644 similarity index 71% rename from Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h rename to config/examples/Creality/CR-10/Configuration_adv.h index 88fda1efe0e3..3f322fbce3fb --- a/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h +++ b/config/examples/Creality/CR-10/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ #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. @@ -853,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1068,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 @@ -915,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1109,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 @@ -940,11 +1118,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 @@ -1124,6 +1308,7 @@ //#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 @@ -1174,6 +1359,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. @@ -1201,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1598,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1673,7 @@ #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. @@ -1399,7 +1695,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 @@ -1411,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1642,11 +2023,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1750,35 +2126,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1900,7 +2280,83 @@ #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/Creality/CR-10mini/_Bootscreen.h b/config/examples/Creality/CR-10/_Bootscreen.h similarity index 98% rename from Marlin/src/config/examples/Creality/CR-10mini/_Bootscreen.h rename to config/examples/Creality/CR-10/_Bootscreen.h index 38fb68f7da9f..45fdb622b1ed 100644 --- a/Marlin/src/config/examples/Creality/CR-10mini/_Bootscreen.h +++ b/config/examples/Creality/CR-10/_Bootscreen.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/config/examples/Creality/CR-10/_Statusscreen.h b/config/examples/Creality/CR-10/_Statusscreen.h similarity index 96% rename from Marlin/src/config/examples/Creality/CR-10/_Statusscreen.h rename to config/examples/Creality/CR-10/_Statusscreen.h index 9df6de9c1059..1ae998fec826 100644 --- a/Marlin/src/config/examples/Creality/CR-10/_Statusscreen.h +++ b/config/examples/Creality/CR-10/_Statusscreen.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/config/examples/Creality/CR-10S/Configuration.h b/config/examples/Creality/CR-10S/Configuration.h similarity index 87% rename from Marlin/src/config/examples/Creality/CR-10S/Configuration.h rename to config/examples/Creality/CR-10S/Configuration.h index 21435c635037..a2c0418d0192 100644 --- a/Marlin/src/config/examples/Creality/CR-10S/Configuration.h +++ b/config/examples/Creality/CR-10S/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -416,7 +471,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -501,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 ========================= @@ -579,8 +635,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -668,6 +725,14 @@ #define DEFAULT_RETRACT_ACCELERATION 1000 // E acceleration for retracts #define DEFAULT_TRAVEL_ACCELERATION 800 // 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 @@ -676,10 +741,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.4 -#define DEFAULT_EJERK 5.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 10.0 + #define DEFAULT_YJERK 10.0 + #define DEFAULT_ZJERK 0.4 +#endif + +#define DEFAULT_EJERK 5.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -708,11 +776,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -722,11 +790,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -761,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) @@ -851,6 +927,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -959,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 @@ -977,9 +1056,12 @@ #define FIL_RUNOUT_INVERTING true // set to true to invert the logic of the sensor. #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. - #define FILAMENT_RUNOUT_SCRIPT "M600" #define FIL_RUNOUT_PIN 2 // Creality CR10-S stock sensor + // 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. @@ -1050,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 @@ -1069,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 @@ -1144,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 @@ -1170,6 +1253,8 @@ #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 @@ -1208,7 +1293,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 @@ -1341,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 + 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 /** @@ -1711,11 +1796,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1814,6 +1906,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1862,6 +1960,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1907,6 +2014,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1920,10 +2028,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1936,6 +2040,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 * @@ -1961,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 @@ -1990,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(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 71% rename from Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h rename to config/examples/Creality/CR-10S/Configuration_adv.h index ceb09db9c3c5..f83034b153bc 100644 --- a/Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h +++ b/config/examples/Creality/CR-10S/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ #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 5 // Babysteps are very small. Increase for faster motion. @@ -853,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1068,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 @@ -915,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1109,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 @@ -940,11 +1118,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 @@ -1124,6 +1308,7 @@ //#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 @@ -1174,6 +1359,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 4 // (mm) Unload initial retract length. @@ -1201,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1598,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1673,7 @@ #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. @@ -1399,7 +1695,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 @@ -1411,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2020,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2123,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2277,83 @@ #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/Creality/CR-10S/_Bootscreen.h b/config/examples/Creality/CR-10S/_Bootscreen.h similarity index 98% rename from Marlin/src/config/examples/Creality/CR-10S/_Bootscreen.h rename to config/examples/Creality/CR-10S/_Bootscreen.h index 38fb68f7da9f..45fdb622b1ed 100644 --- a/Marlin/src/config/examples/Creality/CR-10S/_Bootscreen.h +++ b/config/examples/Creality/CR-10S/_Bootscreen.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/config/examples/Creality/CR-10S/_Statusscreen.h b/config/examples/Creality/CR-10S/_Statusscreen.h similarity index 97% rename from Marlin/src/config/examples/Creality/CR-10S/_Statusscreen.h rename to config/examples/Creality/CR-10S/_Statusscreen.h index b8b13e000c01..75a820d5865f 100644 --- a/Marlin/src/config/examples/Creality/CR-10S/_Statusscreen.h +++ b/config/examples/Creality/CR-10S/_Statusscreen.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/config/examples/Creality/CR-10_5S/Configuration.h b/config/examples/Creality/CR-10_5S/Configuration.h new file mode 100644 index 000000000000..bb8872c622b9 --- /dev/null +++ b/config/examples/Creality/CR-10_5S/Configuration.h @@ -0,0 +1,2130 @@ +/** + * 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 "(Evgeny-SPB, CR-10 S5)" // 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_RAMPS_CREALITY +#endif + +// Optional custom name for your RepStrap or other custom machine +// Displayed in the LCD "Ready" message +#define CUSTOM_MACHINE_NAME "CR-10 S5" + +// Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines) +// You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4) +//#define MACHINE_UUID "00000000-0000-0000-0000-000000000000" + +// @section extruder + +// This defines the number of extruders +// :[1, 2, 3, 4, 5, 6] +#define EXTRUDERS 1 + +// Generally expected filament diameter (1.75, 2.85, 3.0, ...). Used for Volumetric, Filament Width Sensor, etc. +#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75 + +// For Cyclops or any "multi-extruder" that shares a single nozzle. +//#define SINGLENOZZLE + +/** + * Průša MK2 Single Nozzle Multi-Material Multiplexer, and variants. + * + * This device allows one stepper driver on a control board to drive + * two to eight stepper motors, one at a time, in a manner suitable + * for extruders. + * + * This option only allows the multiplexer to switch on tool-change. + * Additional options to configure custom E moves are pending. + */ +//#define MK2_MULTIPLEXER +#if ENABLED(MK2_MULTIPLEXER) + // Override the default DIO selector pins here, if needed. + // Some pins files may provide defaults for these pins. + //#define E_MUX0_PIN 40 // Always Required + //#define E_MUX1_PIN 42 // Needed for 3 to 8 inputs + //#define E_MUX2_PIN 44 // Needed for 5 to 8 inputs +#endif + +/** + * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif +#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 5 +#define TEMP_SENSOR_CHAMBER 0 + +// Dummy thermistor constant temperature readings, for use with 998 and 999 +#define DUMMY_THERMISTOR_998_VALUE 25 +#define DUMMY_THERMISTOR_999_VALUE 100 + +// Use temp sensor 1 as a redundant sensor with sensor 0. If the readings +// from the two sensors differ too much the print will be aborted. +//#define TEMP_SENSOR_1_AS_REDUNDANT +#define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 + +#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 + +// 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 + +// 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 + +//=========================================================================== +//============================= 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 1000 + +//=========================================================================== +//======================== 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, 400, 93 } // Stock Creality +//#define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 400, 415 } // Creality with Bondtech extruder + +/** + * 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 { 300, 300, 100, 5000 } + +/** + * Default Acceleration (change/s) change = mm/s + * Override with M204 + * + * M204 P Acceleration + * M204 R Retract Acceleration + * M204 T Travel Acceleration + */ +#define DEFAULT_ACCELERATION 500 // X, Y, Z and E acceleration for printing moves +#define DEFAULT_RETRACT_ACCELERATION 500 // 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 5.0 + #define DEFAULT_YJERK 5.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 +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif + +/** + * Enable one or more of the following if probing seems unreliable. + * Heaters and/or fans can be disabled during probing to minimize electrical + * noise. A delay can also be added to allow noise and vibration to settle. + * These options are most useful for the BLTouch probe, but may also improve + * readings with inductive probes and piezo sensors. + */ +//#define PROBING_HEATERS_OFF // Turn heaters off when probing +#if ENABLED(PROBING_HEATERS_OFF) + //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) +#endif +//#define PROBING_FANS_OFF // Turn fans off when probing +//#define 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 false +#define INVERT_Z_DIR true + +// @section extruder + +// For direct drive extruder v9 set to true, for geared extruder set to false. +#define INVERT_E0_DIR false // Stock Creality CR-10 5S +//#define INVERT_E0_DIR true // Creality with Bondtech extruder +#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 510 // Nozzle is at X4 when homed +#define Y_BED_SIZE 510 // Nozzle is at Y2 when homed + +// Travel limits (mm) after homing, corresponding to endstop positions. +#define X_MIN_POS 0 +#define Y_MIN_POS 0 +#define Z_MIN_POS 0 +#define X_MAX_POS X_BED_SIZE +#define Y_MAX_POS Y_BED_SIZE +#define Z_MAX_POS 510 + +/** + * 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 true // set to true to invert the logic of the sensor. + #define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins. + //#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins. + #define FIL_RUNOUT_PIN 2 // Creality CR10-S stock sensor + + // 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 // 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 // (°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 4 +#define MANUAL_Y_HOME_POS 2 +//#define MANUAL_Z_HOME_POS 0 + +// Use "Z Safe Homing" to avoid homing with a Z probe outside the bed area. +// +// 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 (20*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 205 +#define PREHEAT_1_TEMP_BED 60 +#define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 + +#define PREHEAT_2_LABEL "ABS" +#define PREHEAT_2_TEMP_HOTEND 250 +#define PREHEAT_2_TEMP_BED 80 +#define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 + +/** + * 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 + 20), (Y_MAX_POS - 20), 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 + +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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. +// :[0,1,2,3,4,5,6,7] +#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 3 // Servo index starts with 0 for M280 command + +// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle. +// 300ms is a good value but you can try less delay. +// If the servo can't reach the requested position, increase it. +#define SERVO_DELAY { 300 } + +// Only power servos during movement, otherwise leave off to prevent jitter +//#define DEACTIVATE_SERVOS_AFTER_MOVE + +// Allow servo angle to be edited and saved to EEPROM +//#define EDITABLE_SERVO_ANGLES diff --git a/config/examples/Creality/CR-10_5S/Configuration_adv.h b/config/examples/Creality/CR-10_5S/Configuration_adv.h new file mode 100644 index 000000000000..9db49935490a --- /dev/null +++ b/config/examples/Creality/CR-10_5S/Configuration_adv.h @@ -0,0 +1,2359 @@ +/** + * 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 + +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#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 40 // 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 40 // Seconds + #define THERMAL_PROTECTION_BED_HYSTERESIS 4 // Degrees Celsius + + /** + * As described above, except for the bed (M140/M190/M303). + */ + #define WATCH_BED_TEMP_PERIOD 600 // 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) + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. + //#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 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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 true // Pre-allocate a static array for faster pre-sorting. + #define SDSORT_USES_STACK true // 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 + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif + +#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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // 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 10 // (mm) Initial retract. + // This short retract is done immediately, before parking the nozzle. + #define FILAMENT_CHANGE_UNLOAD_FEEDRATE 41 // (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 750 // (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 41 // (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 600 // (mm) Load length of filament, from extruder gear to nozzle. + // For Bowden, the full length of the tube and nozzle. + // For direct drive, the full length of the nozzle. + #define ADVANCED_PAUSE_CONTINUOUS_PURGE // Purge continuously up to the purge length until interrupted. + #define ADVANCED_PAUSE_PURGE_FEEDRATE 3 // (mm/s) Extrude feedrate (after loading). Should be slower than load feedrate. + #define ADVANCED_PAUSE_PURGE_LENGTH 150 // (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 10 // (mm) Unload initial retract length. + #define FILAMENT_UNLOAD_DELAY 5000 // (ms) Delay for the filament to cool after retract. + #define FILAMENT_UNLOAD_PURGE_LENGTH 0 // (mm) An unretract is done, then this length is purged. + + #define PAUSE_PARK_NOZZLE_TIMEOUT 45 // (seconds) Time limit before the nozzle is turned off for safety. + #define FILAMENT_CHANGE_ALERT_BEEPS 6 // 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/Creality/CR-10/_Bootscreen.h b/config/examples/Creality/CR-10_5S/_Bootscreen.h similarity index 98% rename from Marlin/src/config/examples/Creality/CR-10/_Bootscreen.h rename to config/examples/Creality/CR-10_5S/_Bootscreen.h index d74e7ae9f90b..45fdb622b1ed 100644 --- a/Marlin/src/config/examples/Creality/CR-10/_Bootscreen.h +++ b/config/examples/Creality/CR-10_5S/_Bootscreen.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -52,4 +52,4 @@ const unsigned char custom_start_bmp[] PROGMEM = { B00001111,B11000011,B11110000,B00000111,B11000000,B11111111,B11000111,B11111100,B01111111,B00000111,B10000001,B11000000,B00000000,B01111110,B00011111,B11000000, B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B00000000,B00000000,B00000000,B00000000,B00000000, B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B00000000,B00000000,B00000000,B00000000,B00000000 -}; \ No newline at end of file +}; diff --git a/Marlin/src/config/examples/Creality/CR-10mini/Configuration.h b/config/examples/Creality/CR-10mini/Configuration.h similarity index 87% rename from Marlin/src/config/examples/Creality/CR-10mini/Configuration.h rename to config/examples/Creality/CR-10mini/Configuration.h index d43352d402d0..2639fc587b93 100644 --- a/Marlin/src/config/examples/Creality/CR-10mini/Configuration.h +++ b/config/examples/Creality/CR-10mini/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -183,6 +183,16 @@ //#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) @@ -193,25 +203,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -221,13 +258,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -243,6 +294,10 @@ #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). @@ -314,7 +369,9 @@ * 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 * @@ -333,7 +390,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -353,37 +410,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -396,10 +450,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - #define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + #define PID_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 @@ -430,7 +485,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -520,6 +575,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 ========================= @@ -598,8 +654,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -658,7 +715,7 @@ * Override with M92 * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] */ -#define DEFAULT_AXIS_STEPS_PER_UNIT { 79.60, 80, 400, 229.4 } +#define DEFAULT_AXIS_STEPS_PER_UNIT { 79.60, 80, 400, 95 } /** * Default Max Feed Rate (mm/s) @@ -687,6 +744,14 @@ #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 @@ -695,10 +760,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -727,11 +795,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -741,11 +809,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -780,6 +845,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) @@ -870,6 +946,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -978,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 @@ -996,6 +1075,9 @@ #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 @@ -1068,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 @@ -1087,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 @@ -1162,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 @@ -1188,6 +1271,8 @@ #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 @@ -1226,7 +1311,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 @@ -1359,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 /** @@ -1729,11 +1814,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1832,6 +1924,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1880,6 +1978,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1925,6 +2032,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1938,10 +2046,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1954,6 +2058,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 * @@ -1979,11 +2087,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 @@ -2008,7 +2116,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(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 71% rename from Marlin/src/config/examples/Creality/CR-10mini/Configuration_adv.h rename to config/examples/Creality/CR-10mini/Configuration_adv.h index 47779101471c..1c243a9d8d64 100644 --- a/Marlin/src/config/examples/Creality/CR-10mini/Configuration_adv.h +++ b/config/examples/Creality/CR-10mini/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ #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. @@ -853,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1068,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 @@ -915,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1109,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 @@ -940,11 +1118,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 @@ -1124,6 +1308,7 @@ //#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 @@ -1174,6 +1359,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. @@ -1201,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1598,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1673,7 @@ #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. @@ -1399,7 +1695,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 @@ -1411,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2020,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2123,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2277,83 @@ #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/config/examples/Creality/CR-10mini/_Bootscreen.h b/config/examples/Creality/CR-10mini/_Bootscreen.h new file mode 100644 index 000000000000..45fdb622b1ed --- /dev/null +++ b/config/examples/Creality/CR-10mini/_Bootscreen.h @@ -0,0 +1,55 @@ +/** + * 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 . + * + */ + +/** + * Custom Boot Screen bitmap + * + * Place this file in the root with your configuration files + * and enable SHOW_CUSTOM_BOOTSCREEN in Configuration.h. + * + * Use the Marlin Bitmap Converter to make your own: + * http://marlinfw.org/tools/u8glib/converter.html + */ + +#define CUSTOM_BOOTSCREEN_TIMEOUT 1000 +#define CUSTOM_BOOTSCREEN_BMPWIDTH 128 + +const unsigned char custom_start_bmp[] PROGMEM = { + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111100,B00000000,B00000000, + B00001111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000001,B10000110,B00011111,B11000000, + B00011000,B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B01100000,B00111100,B00001100,B00000000,B00000000,B00000001,B10000011,B00001100,B01100000, + B00010000,B00110000,B00000000,B00000000,B00000000,B00000000,B00000000,B01100000,B00111100,B00001100,B00000000,B00000000,B00000001,B10000011,B00001100,B00110000, + B00110000,B00110000,B00000000,B00000000,B00000000,B00000000,B00000000,B01100000,B00000000,B00001100,B00000000,B00000000,B00000000,B00000011,B00001100,B00011000, + B00110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01100000,B00000000,B00111111,B00001111,B00111100,B00000000,B00000011,B00001100,B00001100, + B01100000,B00000001,B11011111,B00001111,B11100000,B11111110,B00000000,B01100000,B00011100,B00011100,B00000110,B00011000,B00000000,B00000110,B00001100,B00001100, + B01100000,B00000000,B11110011,B00011000,B00110001,B10000011,B00000000,B01100000,B00001100,B00001100,B00000011,B00011000,B00000000,B00011110,B00001100,B00001100, + B01100000,B00000000,B11100000,B00110000,B00111001,B10000011,B00000000,B01100000,B00001100,B00001100,B00000011,B00110000,B00000000,B00000011,B00001100,B00001100, + B01100000,B00000000,B11000000,B00110000,B00111000,B00001111,B00000000,B01100000,B00001100,B00001100,B00000011,B00110000,B00000000,B00000001,B10001100,B00001100, + B01100000,B00000000,B11000000,B00111111,B11111000,B11111011,B00000000,B01100000,B00001100,B00001100,B00000011,B00110000,B00000000,B00000001,B10001100,B00001100, + B01100000,B00110000,B11000000,B00110000,B00000001,B10000011,B00000000,B01100000,B00001100,B00001100,B00000001,B11110000,B00000001,B10000001,B10001100,B00001100, + B01100000,B00110000,B11000000,B00110000,B00000001,B10000011,B00000000,B01100000,B00001100,B00001100,B00000000,B11100000,B00000001,B10000001,B10001100,B00011000, + B00110000,B00110000,B11000000,B00011000,B00110001,B10000011,B00000000,B01100000,B00001100,B00001100,B01000000,B11100000,B00000001,B10000011,B10001100,B00110000, + B00011000,B01100000,B11000000,B00001100,B01100001,B10000111,B11000000,B11100000,B00011100,B00001100,B11000000,B01100000,B00000000,B11000011,B00001100,B01100000, + B00001111,B11000011,B11110000,B00000111,B11000000,B11111111,B11000111,B11111100,B01111111,B00000111,B10000001,B11000000,B00000000,B01111110,B00011111,B11000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B00000000,B00000000,B00000000,B00000000,B00000000 +}; diff --git a/Marlin/src/config/examples/Creality/CR-10mini/_Statusscreen.h b/config/examples/Creality/CR-10mini/_Statusscreen.h similarity index 97% rename from Marlin/src/config/examples/Creality/CR-10mini/_Statusscreen.h rename to config/examples/Creality/CR-10mini/_Statusscreen.h index 29353ad7e5c6..9b45f9a40f0b 100644 --- a/Marlin/src/config/examples/Creality/CR-10mini/_Statusscreen.h +++ b/config/examples/Creality/CR-10mini/_Statusscreen.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/config/examples/Creality/CR-8/Configuration.h b/config/examples/Creality/CR-8/Configuration.h similarity index 87% rename from Marlin/src/config/examples/Creality/CR-8/Configuration.h rename to config/examples/Creality/CR-8/Configuration.h index 862352661133..9fb629a362dd 100644 --- a/Marlin/src/config/examples/Creality/CR-8/Configuration.h +++ b/config/examples/Creality/CR-8/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -421,7 +476,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -511,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 ========================= @@ -589,8 +645,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -678,6 +735,14 @@ #define DEFAULT_RETRACT_ACCELERATION 500 // E acceleration for retracts #define DEFAULT_TRAVEL_ACCELERATION 500 // 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 @@ -686,10 +751,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 20.0 -#define DEFAULT_YJERK 20.0 -#define DEFAULT_ZJERK 0.4 -#define DEFAULT_EJERK 5.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 10.0 + #define DEFAULT_YJERK 10.0 + #define DEFAULT_ZJERK 0.4 +#endif + +#define DEFAULT_EJERK 5.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -718,11 +786,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -732,11 +800,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -771,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) @@ -861,6 +937,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -969,7 +1048,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 @@ -987,6 +1066,9 @@ #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 @@ -1059,7 +1141,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 @@ -1078,13 +1160,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 @@ -1153,7 +1236,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 @@ -1179,6 +1262,8 @@ #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 @@ -1217,7 +1302,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 @@ -1350,10 +1435,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 /** @@ -1720,11 +1805,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1823,6 +1915,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1871,6 +1969,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1916,6 +2023,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1929,10 +2037,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1945,6 +2049,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 * @@ -1970,11 +2078,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 @@ -1999,7 +2107,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(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 71% rename from Marlin/src/config/examples/Creality/CR-8/Configuration_adv.h rename to config/examples/Creality/CR-8/Configuration_adv.h index 1e5b7396ae7b..0d60cb5156e6 100644 --- a/Marlin/src/config/examples/Creality/CR-8/Configuration_adv.h +++ b/config/examples/Creality/CR-8/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ #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 5 // Babysteps are very small. Increase for faster motion. @@ -853,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1068,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 @@ -915,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1109,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 @@ -940,11 +1118,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 @@ -1124,6 +1308,7 @@ //#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 @@ -1174,6 +1359,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. @@ -1201,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1598,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1673,7 @@ #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. @@ -1399,7 +1695,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 @@ -1411,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2020,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2123,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2277,83 @@ #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/Creality/Ender-2/Configuration.h b/config/examples/Creality/Ender-2/Configuration.h similarity index 87% rename from Marlin/src/config/examples/Creality/Ender-2/Configuration.h rename to config/examples/Creality/Ender-2/Configuration.h index 7f2818e13b8e..1d093d064c5a 100644 --- a/Marlin/src/config/examples/Creality/Ender-2/Configuration.h +++ b/config/examples/Creality/Ender-2/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -420,7 +475,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -505,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 ========================= @@ -583,8 +639,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -672,6 +729,14 @@ #define DEFAULT_RETRACT_ACCELERATION 500 // E acceleration for retracts #define DEFAULT_TRAVEL_ACCELERATION 500 // 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 @@ -680,10 +745,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -712,11 +780,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -726,11 +794,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -765,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) @@ -855,6 +931,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -963,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 @@ -981,6 +1060,9 @@ #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 @@ -1053,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 @@ -1072,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 3 @@ -1147,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 @@ -1173,6 +1256,8 @@ #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 @@ -1211,7 +1296,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 @@ -1344,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 /** @@ -1714,11 +1799,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1817,6 +1909,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1865,6 +1963,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1910,6 +2017,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1923,10 +2031,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1939,6 +2043,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 * @@ -1964,11 +2072,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 @@ -1993,7 +2101,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(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 71% rename from Marlin/src/config/examples/Creality/Ender-2/Configuration_adv.h rename to config/examples/Creality/Ender-2/Configuration_adv.h index 83723a207f19..b3629a382f39 100644 --- a/Marlin/src/config/examples/Creality/Ender-2/Configuration_adv.h +++ b/config/examples/Creality/Ender-2/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -483,11 +552,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +718,13 @@ #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 @@ -595,7 +749,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +784,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +902,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +954,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +984,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1020,7 @@ */ //#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. @@ -853,12 +1029,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1065,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 @@ -915,13 +1095,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1106,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 @@ -940,11 +1115,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 @@ -1124,6 +1305,7 @@ //#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 @@ -1174,6 +1356,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. @@ -1201,127 +1384,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #if AXIS_IS_TMC(E1) + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + #define E1_RSENSE 0.11 + #endif - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E2) + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + #define E2_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #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 - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1595,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1636,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1647,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1670,7 @@ #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. @@ -1399,7 +1692,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 @@ -1411,27 +1704,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1724,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define 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 - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1903,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2017,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2120,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2274,83 @@ #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/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 99% rename from Marlin/src/config/examples/Creality/Ender-2/_Bootscreen.h rename to config/examples/Creality/Ender-2/_Bootscreen.h index 11be930e9c92..c0cbe560c654 100644 --- a/Marlin/src/config/examples/Creality/Ender-2/_Bootscreen.h +++ b/config/examples/Creality/Ender-2/_Bootscreen.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/config/examples/Creality/Ender-2/_Statusscreen.h b/config/examples/Creality/Ender-2/_Statusscreen.h similarity index 97% rename from Marlin/src/config/examples/Creality/Ender-2/_Statusscreen.h rename to config/examples/Creality/Ender-2/_Statusscreen.h index b8f474ee8091..16a68c846eeb 100644 --- a/Marlin/src/config/examples/Creality/Ender-2/_Statusscreen.h +++ b/config/examples/Creality/Ender-2/_Statusscreen.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/config/examples/Creality/Ender-3/Configuration.h b/config/examples/Creality/Ender-3/Configuration.h similarity index 87% rename from Marlin/src/config/examples/Creality/Ender-3/Configuration.h rename to config/examples/Creality/Ender-3/Configuration.h index 0e532a9dc0e1..195440f59e9e 100644 --- a/Marlin/src/config/examples/Creality/Ender-3/Configuration.h +++ b/config/examples/Creality/Ender-3/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - #define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + #define PID_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 @@ -420,7 +475,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -505,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 ========================= @@ -583,8 +639,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -672,6 +729,14 @@ #define DEFAULT_RETRACT_ACCELERATION 500 // E acceleration for retracts #define DEFAULT_TRAVEL_ACCELERATION 500 // 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 @@ -680,10 +745,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -712,11 +780,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -726,11 +794,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -765,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) @@ -855,6 +931,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -927,8 +1006,8 @@ // @section machine // The size of the print bed -#define X_BED_SIZE 220 -#define Y_BED_SIZE 220 +#define X_BED_SIZE 235 +#define Y_BED_SIZE 235 // Travel limits (mm) after homing, corresponding to endstop positions. #define X_MIN_POS 0 @@ -963,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 @@ -981,6 +1060,9 @@ #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 @@ -1053,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 @@ -1072,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 3 @@ -1147,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 @@ -1173,6 +1256,8 @@ #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 @@ -1344,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 /** @@ -1714,11 +1799,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1817,6 +1909,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1865,6 +1963,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1910,6 +2017,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1923,10 +2031,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1939,6 +2043,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 * @@ -1964,11 +2072,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 @@ -1993,7 +2101,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(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 71% rename from Marlin/src/config/examples/Creality/Ender-3/Configuration_adv.h rename to config/examples/Creality/Ender-3/Configuration_adv.h index 2127ff2eb530..bc7b8ef168ef 100644 --- a/Marlin/src/config/examples/Creality/Ender-3/Configuration_adv.h +++ b/config/examples/Creality/Ender-3/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -483,11 +552,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +718,13 @@ #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 @@ -595,7 +749,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +784,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +902,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +954,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +984,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1020,7 @@ */ #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. @@ -853,12 +1029,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1065,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 @@ -915,13 +1095,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1106,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 @@ -940,11 +1115,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 @@ -1124,6 +1305,7 @@ //#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 @@ -1174,6 +1356,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. @@ -1201,127 +1384,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #if AXIS_IS_TMC(E1) + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + #define E1_RSENSE 0.11 + #endif - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E2) + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + #define E2_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #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 - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1595,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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_24V + + /** + * 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. @@ -1345,7 +1636,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1647,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1670,7 @@ #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. @@ -1399,7 +1692,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 @@ -1411,27 +1704,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1724,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define 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 - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1903,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2017,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2120,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2274,83 @@ #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/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 99% rename from Marlin/src/config/examples/Creality/Ender-3/_Bootscreen.h rename to config/examples/Creality/Ender-3/_Bootscreen.h index 11be930e9c92..c0cbe560c654 100644 --- a/Marlin/src/config/examples/Creality/Ender-3/_Bootscreen.h +++ b/config/examples/Creality/Ender-3/_Bootscreen.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/config/examples/Creality/Ender-3/_Statusscreen.h b/config/examples/Creality/Ender-3/_Statusscreen.h similarity index 96% rename from Marlin/src/config/examples/Creality/Ender-3/_Statusscreen.h rename to config/examples/Creality/Ender-3/_Statusscreen.h index 285711236a43..a85edcda22e8 100644 --- a/Marlin/src/config/examples/Creality/Ender-3/_Statusscreen.h +++ b/config/examples/Creality/Ender-3/_Statusscreen.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/config/examples/Creality/Ender-4/Configuration.h b/config/examples/Creality/Ender-4/Configuration.h similarity index 87% rename from Marlin/src/config/examples/Creality/Ender-4/Configuration.h rename to config/examples/Creality/Ender-4/Configuration.h index f03d73f16fb9..e6d585d7a29c 100644 --- a/Marlin/src/config/examples/Creality/Ender-4/Configuration.h +++ b/config/examples/Creality/Ender-4/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - #define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + #define PID_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 @@ -421,7 +476,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -511,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 ========================= @@ -589,8 +645,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -678,6 +735,14 @@ #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 @@ -686,10 +751,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 20.0 -#define DEFAULT_YJERK 20.0 -#define DEFAULT_ZJERK 2.4 -#define DEFAULT_EJERK 5.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 10.0 + #define DEFAULT_YJERK 10.0 + #define DEFAULT_ZJERK 2.4 +#endif + +#define DEFAULT_EJERK 5.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -718,11 +786,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -732,11 +800,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -771,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) @@ -861,6 +937,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -969,7 +1048,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 @@ -987,6 +1066,9 @@ #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 @@ -1059,7 +1141,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 @@ -1078,13 +1160,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 @@ -1153,7 +1236,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 @@ -1179,6 +1262,8 @@ #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 @@ -1217,7 +1302,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 @@ -1350,10 +1435,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 /** @@ -1720,11 +1805,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1823,6 +1915,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1871,6 +1969,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1916,6 +2023,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1929,10 +2037,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1945,6 +2049,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 * @@ -1970,11 +2078,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 @@ -1999,7 +2107,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(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 71% rename from Marlin/src/config/examples/Creality/Ender-4/Configuration_adv.h rename to config/examples/Creality/Ender-4/Configuration_adv.h index f8bcdbee0d15..e2450ba5b8f6 100644 --- a/Marlin/src/config/examples/Creality/Ender-4/Configuration_adv.h +++ b/config/examples/Creality/Ender-4/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -262,7 +321,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) @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ #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 5 // Babysteps are very small. Increase for faster motion. @@ -853,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1068,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 @@ -915,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1109,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 @@ -940,11 +1118,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 @@ -1124,6 +1308,7 @@ //#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 @@ -1174,6 +1359,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. @@ -1201,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1598,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1673,7 @@ #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. @@ -1399,7 +1695,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 @@ -1411,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2020,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2123,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2277,83 @@ #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/Einstart-S/Configuration.h b/config/examples/Einstart-S/Configuration.h similarity index 87% rename from Marlin/src/config/examples/Einstart-S/Configuration.h rename to config/examples/Einstart-S/Configuration.h index 652f27fbd079..246bd987b719 100644 --- a/Marlin/src/config/examples/Einstart-S/Configuration.h +++ b/config/examples/Einstart-S/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -326,7 +383,7 @@ * * 666 : Custom table generated for 200K thermistor with 10k pullup on Einstart S * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 666 #define TEMP_SENSOR_1 0 @@ -346,37 +403,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -389,10 +443,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -424,7 +479,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -509,6 +564,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 ========================= @@ -591,8 +647,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -680,6 +737,14 @@ #define DEFAULT_RETRACT_ACCELERATION 2000 // E acceleration for retracts #define DEFAULT_TRAVEL_ACCELERATION 2000 // 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 @@ -688,10 +753,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -720,11 +788,11 @@ //#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -734,11 +802,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -772,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) @@ -861,6 +937,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -969,7 +1048,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 @@ -987,6 +1066,9 @@ #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 @@ -1059,7 +1141,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 @@ -1078,13 +1160,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 @@ -1153,7 +1236,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 @@ -1179,6 +1262,8 @@ #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 @@ -1350,10 +1435,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 /** @@ -1720,11 +1805,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1823,6 +1915,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1867,6 +1965,15 @@ // #define U8GLIB_SH1106_EINSTART +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1912,6 +2019,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1925,10 +2033,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1941,6 +2045,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 * @@ -1966,11 +2074,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 @@ -1995,7 +2103,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(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 71% rename from Marlin/src/config/examples/Einstart-S/Configuration_adv.h rename to config/examples/Einstart-S/Configuration_adv.h index 15c66658573a..e3be6a540b0d 100644 --- a/Marlin/src/config/examples/Einstart-S/Configuration_adv.h +++ b/config/examples/Einstart-S/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ //#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. @@ -853,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1068,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 @@ -915,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1109,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 @@ -940,11 +1118,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 @@ -1124,6 +1308,7 @@ //#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 @@ -1174,6 +1359,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. @@ -1201,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1598,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1673,7 @@ #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. @@ -1399,7 +1695,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 @@ -1411,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2020,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2123,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2277,83 @@ #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/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 87% rename from Marlin/src/config/examples/Felix/Configuration.h rename to config/examples/Felix/Configuration.h index d48a140b2e20..1183a2e89861 100644 --- a/Marlin/src/config/examples/Felix/Configuration.h +++ b/config/examples/Felix/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#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. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +#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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -404,7 +459,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -482,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 ========================= @@ -560,8 +616,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -650,6 +707,14 @@ #define DEFAULT_RETRACT_ACCELERATION 5000 // 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 @@ -658,10 +723,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -690,11 +758,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -704,11 +772,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -743,6 +808,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) @@ -833,6 +909,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -941,7 +1020,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 @@ -959,6 +1038,9 @@ #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 @@ -1031,7 +1113,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 @@ -1050,13 +1132,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 @@ -1125,7 +1208,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 @@ -1151,6 +1234,8 @@ #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 @@ -1322,10 +1407,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 /** @@ -1692,11 +1777,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1795,6 +1887,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1843,6 +1941,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1888,6 +1995,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1901,10 +2009,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1917,6 +2021,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 * @@ -1942,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 @@ -1971,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(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 71% rename from Marlin/src/config/examples/Felix/Configuration_adv.h rename to config/examples/Felix/Configuration_adv.h index ec2fdd35c49a..9bebb34d0f40 100644 --- a/Marlin/src/config/examples/Felix/Configuration_adv.h +++ b/config/examples/Felix/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ //#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. @@ -853,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1068,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 @@ -915,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1109,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 @@ -940,11 +1118,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 @@ -1124,6 +1308,7 @@ //#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 @@ -1174,6 +1359,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. @@ -1201,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1598,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1673,7 @@ #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. @@ -1399,7 +1695,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 @@ -1411,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2020,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2123,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2277,83 @@ #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/Felix/DUAL/Configuration.h b/config/examples/Felix/DUAL/Configuration.h similarity index 87% rename from Marlin/src/config/examples/Felix/DUAL/Configuration.h rename to config/examples/Felix/DUAL/Configuration.h index ce9e6cf40108..ec3992e80154 100644 --- a/Marlin/src/config/examples/Felix/DUAL/Configuration.h +++ b/config/examples/Felix/DUAL/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#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. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +#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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -404,7 +459,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -482,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 ========================= @@ -560,8 +616,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -650,6 +707,14 @@ #define DEFAULT_RETRACT_ACCELERATION 5000 // 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 @@ -658,10 +723,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -690,11 +758,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -704,11 +772,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -743,6 +808,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) @@ -833,6 +909,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -941,7 +1020,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 @@ -959,6 +1038,9 @@ #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 @@ -1031,7 +1113,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 @@ -1050,13 +1132,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 @@ -1125,7 +1208,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 @@ -1151,6 +1234,8 @@ #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 @@ -1322,10 +1407,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 /** @@ -1692,11 +1777,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1795,6 +1887,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1843,6 +1941,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1888,6 +1995,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1901,10 +2009,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1917,6 +2021,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 * @@ -1942,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 @@ -1971,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(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/config/examples/FlashForge/CreatorPro/Configuration.h b/config/examples/FlashForge/CreatorPro/Configuration.h new file mode 100644 index 000000000000..410c3052b41b --- /dev/null +++ b/config/examples/FlashForge/CreatorPro/Configuration.h @@ -0,0 +1,2118 @@ +/** + * 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 "M. Baker" // 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_MIGHTYBOARD_REVE +#endif + +// Optional custom name for your RepStrap or other custom machine +// Displayed in the LCD "Ready" message +#define CUSTOM_MACHINE_NAME "CreatorPro" + +// 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 + +// 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif +#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, -33.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 -2 +#define TEMP_SENSOR_1 -2 +#define TEMP_SENSOR_2 0 +#define TEMP_SENSOR_3 0 +#define TEMP_SENSOR_4 0 +#define TEMP_SENSOR_5 0 +#define TEMP_SENSOR_BED 1 +#define TEMP_SENSOR_CHAMBER 0 + +// Dummy thermistor constant temperature readings, for use with 998 and 999 +#define DUMMY_THERMISTOR_998_VALUE 25 +#define DUMMY_THERMISTOR_999_VALUE 100 + +// Use temp sensor 1 as a redundant sensor with sensor 0. If the readings +// from the two sensors differ too much the print will be aborted. +//#define TEMP_SENSOR_1_AS_REDUNDANT +#define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 + +#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 + +// 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 + +// 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 + +//=========================================================================== +//============================= 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 + +#define DEFAULT_Kp 20.03 +#define DEFAULT_Ki 1.22 +#define DEFAULT_Kd 82.05 + + +#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 true // set to true to invert the logic of the endstop. +#define X_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. +#define Y_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. +#define Z_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. +#define Z_MIN_PROBE_ENDSTOP_INVERTING 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]]]]] + */ +//really Sailfish... got enough precision on that float for an 8 bit system? +//I'm leaving this in for posterior's sake +#define DEFAULT_AXIS_STEPS_PER_UNIT { 94.139704, 94.139704, 400, 96.275201870333662468889989185642 } + +/** + * Default Max Feed Rate (mm/s) + * Override with M203 + * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] + */ +#define DEFAULT_MAX_FEEDRATE { 500, 500, 20, 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 { 5000, 5000, 100, 80000 } + +/** + * Default Acceleration (change/s) change = mm/s + * Override with M204 + * + * M204 P Acceleration + * M204 R Retract Acceleration + * M204 T Travel Acceleration + */ +#define DEFAULT_ACCELERATION 1750 // X, Y, Z and E max acceleration for printing moves +#define DEFAULT_RETRACT_ACCELERATION 5000 // 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 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 +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif + +/** + * Enable one or more of the following if probing seems unreliable. + * Heaters and/or fans can be disabled during probing to minimize electrical + * noise. A delay can also be added to allow noise and vibration to settle. + * These options are most useful for the BLTouch probe, but may also improve + * readings with inductive probes and piezo sensors. + */ +//#define PROBING_HEATERS_OFF // Turn heaters off when probing +#if ENABLED(PROBING_HEATERS_OFF) + //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) +#endif +//#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing +//#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors + +// For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 +// :{ 0:'Low', 1:'High' } +#define X_ENABLE_ON 0 +#define Y_ENABLE_ON 0 +#define Z_ENABLE_ON 0 +#define E_ENABLE_ON 0 // For all extruders + +// Disables axis stepper immediately when it's not being used. +// WARNING: When motors turn off there is a chance of losing position accuracy! +#define DISABLE_X false +#define DISABLE_Y false +#define DISABLE_Z false + +// Warn on display about possibly reduced accuracy +//#define DISABLE_REDUCED_ACCURACY_WARNING + +// @section extruder + +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled + +// @section machine + +// Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way. +#define INVERT_X_DIR true +#define INVERT_Y_DIR true +#define INVERT_Z_DIR true + +// @section extruder + +// For direct drive extruder v9 set to true, for geared extruder set to false. +#define INVERT_E0_DIR true +#define INVERT_E1_DIR false +#define INVERT_E2_DIR false +#define INVERT_E3_DIR false +#define INVERT_E4_DIR false +#define INVERT_E5_DIR false + +// @section homing + +//#define NO_MOTION_BEFORE_HOMING // Inhibit movement until all axes have been homed + +//#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. + +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... + // Be sure you have this distance over your Z_MAX_POS in case. + +// Direction of endstops when homing; 1=MAX, -1=MIN +// :[-1,1] +#define X_HOME_DIR 1 +#define Y_HOME_DIR 1 +#define Z_HOME_DIR -1 + +// @section machine + + +//these values are used in your slicer +#define X_BED_SIZE 227 +#define Y_BED_SIZE 148 + +// Travel limits (mm) after homing, corresponding to endstop positions. +#define X_MIN_POS -120 +#define Y_MIN_POS -84 +#define Z_MIN_POS 0 +#define X_MAX_POS 152 +#define Y_MAX_POS 77 +#define Z_MAX_POS 150 + +/** + * 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_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_MAX_POS - 2), (Y_MAX_POS - 2), 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 + +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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. +// :[0,1,2,3,4,5,6,7] +#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 3 // Servo index starts with 0 for M280 command + +// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle. +// 300ms is a good value but you can try less delay. +// If the servo can't reach the requested position, increase it. +#define SERVO_DELAY { 300 } + +// Only power servos during movement, otherwise leave off to prevent jitter +//#define DEACTIVATE_SERVOS_AFTER_MOVE + +// Allow servo angle to be edited and saved to EEPROM +//#define EDITABLE_SERVO_ANGLES diff --git a/config/examples/FlashForge/CreatorPro/Configuration_adv.h b/config/examples/FlashForge/CreatorPro/Configuration_adv.h new file mode 100644 index 000000000000..c63fe14c88da --- /dev/null +++ b/config/examples/FlashForge/CreatorPro/Configuration_adv.h @@ -0,0 +1,2355 @@ +/** + * 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 + +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#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) + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. + //#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 EX1_FAN_PIN +#define E1_AUTO_FAN_PIN EX2_FAN_PIN +#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 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 0x2F // 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 5 // 5DPRINT: 4 AZTEEG_X3_PRO: 8 +// Actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS +#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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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 + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif + +#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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // 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 0 // (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/FolgerTech/i3-2020/Configuration.h b/config/examples/FolgerTech/i3-2020/Configuration.h similarity index 87% rename from Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h rename to config/examples/FolgerTech/i3-2020/Configuration.h index d9a60e48db1f..5f8a8717add3 100644 --- a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h +++ b/config/examples/FolgerTech/i3-2020/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 5 #define TEMP_SENSOR_1 0 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -421,7 +476,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -506,6 +561,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 ========================= @@ -584,8 +640,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -674,6 +731,14 @@ #define DEFAULT_RETRACT_ACCELERATION 400 // E acceleration for retracts #define DEFAULT_TRAVEL_ACCELERATION 400 // 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 @@ -682,10 +747,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 8.5 -#define DEFAULT_YJERK 8.5 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 4.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 8.5 + #define DEFAULT_YJERK 8.5 + #define DEFAULT_ZJERK 0.3 +#endif + +#define DEFAULT_EJERK 4.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -714,11 +782,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -728,11 +796,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -767,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) @@ -857,6 +933,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -965,7 +1044,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 @@ -983,6 +1062,9 @@ #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 @@ -1055,7 +1137,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 @@ -1074,13 +1156,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 @@ -1149,7 +1232,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 @@ -1175,6 +1258,8 @@ #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 @@ -1346,10 +1431,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 /** @@ -1716,11 +1801,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1819,6 +1911,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1867,6 +1965,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1912,6 +2019,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1925,10 +2033,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1941,6 +2045,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 * @@ -1966,11 +2074,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 @@ -1995,7 +2103,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(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 71% rename from Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h rename to config/examples/FolgerTech/i3-2020/Configuration_adv.h index 429772071745..ed5232413c1d 100644 --- a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h +++ b/config/examples/FolgerTech/i3-2020/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #define THERMAL_PROTECTION_PERIOD 40 // Seconds #define THERMAL_PROTECTION_HYSTERESIS 2 // 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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ #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 2 // Babysteps are very small. Increase for faster motion. @@ -853,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1068,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 @@ -915,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1109,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 @@ -940,11 +1118,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 @@ -1124,6 +1308,7 @@ //#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 @@ -1174,6 +1359,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. @@ -1201,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #if AXIS_IS_TMC(E1) + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + #define E1_RSENSE 0.11 + #endif - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E2) + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + #define E2_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + #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. */ @@ -1331,13 +1598,40 @@ //#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 + #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 TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1673,7 @@ #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. @@ -1399,7 +1695,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 @@ -1411,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + #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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #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 @@ -1543,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2020,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2123,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1905,7 +2285,83 @@ #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/Formbot/Raptor/Configuration.h b/config/examples/Formbot/Raptor/Configuration.h similarity index 87% rename from Marlin/src/config/examples/Formbot/Raptor/Configuration.h rename to config/examples/Formbot/Raptor/Configuration.h index 8086bd36906e..dcff64002691 100644 --- a/Marlin/src/config/examples/Formbot/Raptor/Configuration.h +++ b/config/examples/Formbot/Raptor/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -215,6 +215,16 @@ //#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) @@ -225,25 +235,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -253,13 +290,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -275,6 +326,10 @@ #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). @@ -346,7 +401,9 @@ * 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 * @@ -365,7 +422,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -389,38 +446,35 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== @@ -434,10 +488,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - #define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + #define PID_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 @@ -468,7 +523,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -553,6 +608,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 ========================= @@ -631,8 +687,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -743,6 +800,14 @@ #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 @@ -751,19 +816,21 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#if ENABLED(X_SpreadCycle) || DISABLED(X_2208) - #define DEFAULT_XJERK 20.0 -#else - #define DEFAULT_XJERK 10.0 +#if DISABLED(JUNCTION_DEVIATION) + #if ENABLED(X_SpreadCycle) || DISABLED(X_2208) + #define DEFAULT_XJERK 20.0 + #else + #define DEFAULT_XJERK 10.0 + #endif + #if ENABLED(Y_SpreadCycle) || DISABLED(Y_2208) + #define DEFAULT_YJERK 10.0 + #else + #define DEFAULT_YJERK 5.0 + #endif + #define DEFAULT_ZJERK 0.4 #endif -#if ENABLED(Y_SpreadCycle) || DISABLED(Y_2208) - #define DEFAULT_YJERK 10.0 -#else - #define DEFAULT_YJERK 5.0 -#endif -#define DEFAULT_ZJERK 0.4 -#define DEFAULT_EJERK 5.0 +#define DEFAULT_EJERK 5.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -792,11 +859,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -806,11 +873,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -845,6 +909,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) @@ -933,6 +1008,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -1055,7 +1133,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 @@ -1076,6 +1154,9 @@ #define FIL_RUNOUT_INVERTING true // 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 @@ -1152,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 @@ -1171,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 6 @@ -1249,7 +1331,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 @@ -1275,6 +1357,8 @@ #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 @@ -1308,8 +1392,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) @@ -1446,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 { 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 /** @@ -1816,11 +1900,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1919,6 +2010,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1967,6 +2064,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2012,6 +2118,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -2025,10 +2132,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -2041,6 +2144,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 * @@ -2066,11 +2173,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 @@ -2095,7 +2202,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(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 70% rename from Marlin/src/config/examples/Formbot/Raptor/Configuration_adv.h rename to config/examples/Formbot/Raptor/Configuration_adv.h index b86b563e33a6..536922596dd7 100644 --- a/Marlin/src/config/examples/Formbot/Raptor/Configuration_adv.h +++ b/config/examples/Formbot/Raptor/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #define THERMAL_PROTECTION_PERIOD 210 // Seconds #define THERMAL_PROTECTION_HYSTERESIS 2 // 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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -262,11 +321,11 @@ */ #define CASE_LIGHT_ENABLE #if ENABLED(CASE_LIGHT_ENABLE) - #define CASE_LIGHT_PIN 5 + //#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 255 // Set default power-up brightness (0-255, requires PWM pin) - #define MENU_ITEM_CASE_LIGHT // Add a Case Light option to the LCD main menu + #define MENU_ITEM_CASE_LIGHT // Add a Case Light option to the LCD main menu //#define CASE_LIGHT_USE_NEOPIXEL // Use Neopixel LED as case light, requires NEOPIXEL_LED. #if ENABLED(CASE_LIGHT_USE_NEOPIXEL) #define CASE_LIGHT_NEOPIXEL_COLOR { 255, 255, 255, 255 } // { Red, Green, Blue, White } @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ #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 25 // Babysteps are very small. Increase for faster motion. @@ -853,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -888,13 +1070,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 @@ -917,13 +1100,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -934,7 +1111,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 @@ -942,11 +1120,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 @@ -1126,6 +1310,7 @@ //#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 @@ -1176,6 +1361,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. @@ -1203,127 +1389,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #if AXIS_IS_TMC(E1) + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + #define E1_RSENSE 0.11 + #endif - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E2) + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + #define E2_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + #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. */ @@ -1333,13 +1600,40 @@ //#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 + #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 TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1347,7 +1641,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1358,9 +1652,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1380,6 +1675,7 @@ #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. @@ -1401,7 +1697,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 @@ -1413,27 +1709,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1450,62 +1729,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + #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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #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 @@ -1545,12 +1908,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1641,11 +2022,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1751,35 +2127,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1901,7 +2281,83 @@ #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/Formbot/Raptor/_Bootscreen.h b/config/examples/Formbot/Raptor/_Bootscreen.h similarity index 99% rename from Marlin/src/config/examples/Formbot/Raptor/_Bootscreen.h rename to config/examples/Formbot/Raptor/_Bootscreen.h index 13da76269663..6a0923258d09 100644 --- a/Marlin/src/config/examples/Formbot/Raptor/_Bootscreen.h +++ b/config/examples/Formbot/Raptor/_Bootscreen.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/config/examples/Formbot/Raptor/_Statusscreen.h b/config/examples/Formbot/Raptor/_Statusscreen.h similarity index 97% rename from Marlin/src/config/examples/Formbot/Raptor/_Statusscreen.h rename to config/examples/Formbot/Raptor/_Statusscreen.h index d0450837abb4..c1d862cb7247 100644 --- a/Marlin/src/config/examples/Formbot/Raptor/_Statusscreen.h +++ b/config/examples/Formbot/Raptor/_Statusscreen.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration.h b/config/examples/Formbot/T_Rex_2+/Configuration.h similarity index 87% rename from Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration.h rename to config/examples/Formbot/T_Rex_2+/Configuration.h index 30422027ec74..343203670226 100644 --- a/Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration.h +++ b/config/examples/Formbot/T_Rex_2+/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -177,6 +177,16 @@ //#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) @@ -187,25 +197,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -215,13 +252,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -237,6 +288,10 @@ #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). @@ -314,7 +369,9 @@ * 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 * @@ -333,7 +390,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -359,37 +416,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -402,10 +456,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - #define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + #define PID_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 @@ -438,7 +493,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -530,6 +585,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 ========================= @@ -608,8 +664,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -675,7 +732,7 @@ * Override with M203 * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] */ -#define DEFAULT_MAX_FEEDRATE { 250, 100, 5, 25 } +#define DEFAULT_MAX_FEEDRATE { 200, 100, 5, 25 } /** * Default Max Acceleration (change/s) change = mm/s @@ -697,6 +754,14 @@ #define DEFAULT_RETRACT_ACCELERATION 1500 // E acceleration for retracts #define DEFAULT_TRAVEL_ACCELERATION 1500 // 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 @@ -705,10 +770,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 12.0 // More conservitive numbers. -#define DEFAULT_YJERK 8.0 -#define DEFAULT_ZJERK 0.4 -#define DEFAULT_EJERK 5.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 12.0 // More conservative numbers. + #define DEFAULT_YJERK 8.0 + #define DEFAULT_ZJERK 0.4 +#endif + +#define DEFAULT_EJERK 5.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -737,11 +805,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -751,11 +819,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -790,6 +855,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 @@ -881,6 +957,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -989,7 +1068,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 @@ -1007,6 +1086,9 @@ #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 @@ -1079,7 +1161,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 @@ -1098,13 +1180,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 @@ -1178,7 +1261,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 @@ -1204,6 +1287,8 @@ #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 @@ -1375,10 +1460,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 /** @@ -1745,11 +1830,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1848,6 +1940,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1896,6 +1994,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1941,6 +2048,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1954,10 +2062,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1970,6 +2074,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 * @@ -1995,11 +2103,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 @@ -2024,7 +2132,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(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif @@ -2052,3 +2160,9 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES + +#ifdef ROXYs_TRex + #define LED_PIN -1 + #define BEEPER_PIN -1 + #define KILL_PIN -1 +#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 71% 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 36140c566087..2180458d09f9 100644 --- a/Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration_adv.h +++ b/config/examples/Formbot/T_Rex_2+/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #define THERMAL_PROTECTION_PERIOD 60 // Seconds #define THERMAL_PROTECTION_HYSTERESIS 10 // 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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. #define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,6 +254,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 /** @@ -362,28 +421,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 @@ -405,6 +473,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 +506,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 +531,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 @@ -487,11 +559,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -575,6 +725,13 @@ #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 @@ -599,7 +756,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -634,8 +791,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -749,7 +909,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -790,19 +961,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -820,8 +991,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -849,7 +1027,8 @@ */ #define BABYSTEPPING #if ENABLED(BABYSTEPPING) - //#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. @@ -857,12 +1036,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 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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) @@ -891,13 +1072,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 @@ -920,13 +1102,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -937,7 +1113,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 @@ -945,11 +1122,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 @@ -1129,6 +1312,7 @@ //#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 @@ -1179,6 +1363,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 0 // (mm) Unload initial retract length. @@ -1206,127 +1391,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #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 - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E1) + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + #define E1_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #if AXIS_IS_TMC(E2) + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + #define E2_RSENSE 0.11 + #endif - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1336,13 +1602,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1350,7 +1643,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1361,9 +1654,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1383,6 +1677,7 @@ #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. @@ -1404,7 +1699,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 @@ -1416,27 +1711,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1453,62 +1731,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1548,12 +1910,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1644,11 +2024,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1752,35 +2127,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1912,7 +2291,83 @@ #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/Formbot/T_Rex_2+/_Bootscreen.h b/config/examples/Formbot/T_Rex_2+/_Bootscreen.h similarity index 99% rename from Marlin/src/config/examples/Formbot/T_Rex_2+/_Bootscreen.h rename to config/examples/Formbot/T_Rex_2+/_Bootscreen.h index c2333ed4cfd9..880950a7b1b5 100644 --- a/Marlin/src/config/examples/Formbot/T_Rex_2+/_Bootscreen.h +++ b/config/examples/Formbot/T_Rex_2+/_Bootscreen.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/config/examples/Formbot/T_Rex_2+/_Statusscreen.h b/config/examples/Formbot/T_Rex_2+/_Statusscreen.h similarity index 97% rename from Marlin/src/config/examples/Formbot/T_Rex_2+/_Statusscreen.h rename to config/examples/Formbot/T_Rex_2+/_Statusscreen.h index 689b1c947f1b..4197cbb4824c 100644 --- a/Marlin/src/config/examples/Formbot/T_Rex_2+/_Statusscreen.h +++ b/config/examples/Formbot/T_Rex_2+/_Statusscreen.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/config/examples/Formbot/T_Rex_3/Configuration.h b/config/examples/Formbot/T_Rex_3/Configuration.h similarity index 87% rename from Marlin/src/config/examples/Formbot/T_Rex_3/Configuration.h rename to config/examples/Formbot/T_Rex_3/Configuration.h index 776119cca104..9c133527a85c 100644 --- a/Marlin/src/config/examples/Formbot/T_Rex_3/Configuration.h +++ b/config/examples/Formbot/T_Rex_3/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -178,6 +178,16 @@ //#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) @@ -188,25 +198,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -216,13 +253,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -238,6 +289,10 @@ #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). @@ -309,7 +364,9 @@ * 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 * @@ -328,7 +385,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -353,37 +410,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -396,10 +450,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - #define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + #define PID_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 @@ -425,7 +480,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -510,6 +565,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 ========================= @@ -588,8 +644,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -684,6 +741,14 @@ #define DEFAULT_RETRACT_ACCELERATION 1500 // E acceleration for retracts #define DEFAULT_TRAVEL_ACCELERATION 1500 // 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 @@ -692,15 +757,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -//#define DEFAULT_XJERK 20.0 -//#define DEFAULT_YJERK 10.0 -//#define DEFAULT_ZJERK 0.4 -//#define DEFAULT_EJERK 5.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 12.0 // More conservative numbers. + #define DEFAULT_YJERK 8.0 + #define DEFAULT_ZJERK 0.4 +#endif -#define DEFAULT_XJERK 12.0 // More conservitive numbers. -#define DEFAULT_YJERK 8.0 -#define DEFAULT_ZJERK 0.4 -#define DEFAULT_EJERK 5.0 +#define DEFAULT_EJERK 5.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -729,11 +792,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -743,11 +806,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -782,6 +842,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) @@ -872,6 +943,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -984,7 +1058,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 @@ -1007,6 +1081,9 @@ #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 @@ -1079,7 +1156,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 @@ -1098,13 +1175,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 @@ -1173,7 +1251,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 @@ -1199,6 +1277,8 @@ #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 @@ -1370,10 +1450,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 /** @@ -1743,11 +1823,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1846,6 +1933,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1894,6 +1987,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1939,6 +2041,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1952,10 +2055,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1968,6 +2067,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 * @@ -1993,11 +2096,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 @@ -2022,7 +2125,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(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif @@ -2050,3 +2153,9 @@ // Allow servo angle to be edited and saved to EEPROM //#define EDITABLE_SERVO_ANGLES + +#ifdef ROXYs_TRex + #define LED_PIN -1 + #define BEEPER_PIN -1 + #define KILL_PIN -1 +#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 71% 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 da3f9d7fd29f..d8ee58e1a476 100644 --- a/Marlin/src/config/examples/Formbot/T_Rex_3/Configuration_adv.h +++ b/config/examples/Formbot/T_Rex_3/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #define THERMAL_PROTECTION_PERIOD 60 // Seconds #define THERMAL_PROTECTION_HYSTERESIS 10 // 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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. #define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,6 +254,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 /** @@ -362,29 +421,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 @@ -406,6 +473,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 +506,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 +531,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 @@ -488,11 +559,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -576,6 +725,13 @@ #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 @@ -600,7 +756,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -635,8 +791,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -750,7 +909,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -791,19 +961,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -821,8 +991,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -850,6 +1027,7 @@ */ #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 40 // Babysteps are very small. Increase for faster motion. @@ -858,12 +1036,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -891,13 +1072,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 @@ -920,13 +1102,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -937,7 +1113,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 @@ -945,11 +1122,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 @@ -1129,6 +1312,7 @@ //#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 @@ -1179,6 +1363,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 0 // (mm) Unload initial retract length. @@ -1206,127 +1391,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1336,13 +1602,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1350,7 +1643,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1361,9 +1654,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1383,6 +1677,7 @@ #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. @@ -1404,7 +1699,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 @@ -1416,27 +1711,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1453,62 +1731,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1548,12 +1910,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1644,11 +2024,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2122,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1907,7 +2286,83 @@ #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/Formbot/T_Rex_3/_Bootscreen.h b/config/examples/Formbot/T_Rex_3/_Bootscreen.h similarity index 99% rename from Marlin/src/config/examples/Formbot/T_Rex_3/_Bootscreen.h rename to config/examples/Formbot/T_Rex_3/_Bootscreen.h index ad09d3523b01..90cfd306e748 100644 --- a/Marlin/src/config/examples/Formbot/T_Rex_3/_Bootscreen.h +++ b/config/examples/Formbot/T_Rex_3/_Bootscreen.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/config/examples/Formbot/T_Rex_3/_Statusscreen.h b/config/examples/Formbot/T_Rex_3/_Statusscreen.h similarity index 97% rename from Marlin/src/config/examples/Formbot/T_Rex_3/_Statusscreen.h rename to config/examples/Formbot/T_Rex_3/_Statusscreen.h index 689b1c947f1b..4197cbb4824c 100644 --- a/Marlin/src/config/examples/Formbot/T_Rex_3/_Statusscreen.h +++ b/config/examples/Formbot/T_Rex_3/_Statusscreen.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/config/examples/Geeetech/A10M/Configuration.h b/config/examples/Geeetech/A10M/Configuration.h new file mode 100644 index 000000000000..462f7f9dee98 --- /dev/null +++ b/config/examples/Geeetech/A10M/Configuration.h @@ -0,0 +1,2112 @@ +/** + * 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 0 + +/** + * Select a secondary serial port on the board to use for communication with the host. + * This allows the connection of wireless adapters (for instance) to non-default port pins. + * Serial port -1 is the USB emulated serial port, if available. + * + * :[-1, 0, 1, 2, 3, 4, 5, 6, 7] + */ +//#define SERIAL_PORT_2 -1 + +/** + * This setting determines the communication speed of the printer. + * + * 250000 works in most cases, but you might try a lower speed if + * you commonly experience drop-outs during host printing. + * You may try up to 1000000 to speed up SD file transfer. + * + * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000] + */ +#define BAUDRATE 250000 + +// Enable the Bluetooth serial interface on AT90USB devices +//#define BLUETOOTH + +// The following define selects which electronics board you have. +// Please choose the name from boards.h that matches your setup +#ifndef MOTHERBOARD + #define MOTHERBOARD BOARD_GT2560_V3 +#endif + +// Optional custom name for your RepStrap or other custom machine +// Displayed in the LCD "Ready" message +#define CUSTOM_MACHINE_NAME "Geeetech A10M" + +// Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines) +// You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4) +//#define MACHINE_UUID "00000000-0000-0000-0000-000000000000" + +// @section extruder + +// This defines the number of extruders +// :[1, 2, 3, 4, 5, 6] +#define EXTRUDERS 1 + +// Generally expected filament diameter (1.75, 2.85, 3.0, ...). Used for Volumetric, Filament Width Sensor, etc. +#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75 + +// For Cyclops or any "multi-extruder" that shares a single nozzle. +//#define SINGLENOZZLE + +/** + * Průša MK2 Single Nozzle Multi-Material Multiplexer, and variants. + * + * This device allows one stepper driver on a control board to drive + * two to eight stepper motors, one at a time, in a manner suitable + * for extruders. + * + * This option only allows the multiplexer to switch on tool-change. + * Additional options to configure custom E moves are pending. + */ +//#define MK2_MULTIPLEXER +#if ENABLED(MK2_MULTIPLEXER) + // Override the default DIO selector pins here, if needed. + // Some pins files may provide defaults for these pins. + //#define E_MUX0_PIN 40 // Always Required + //#define E_MUX1_PIN 42 // Needed for 3 to 8 inputs + //#define E_MUX2_PIN 44 // Needed for 5 to 8 inputs +#endif + +/** + * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif +#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 + +// 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 + +// 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 + +// 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 + +//=========================================================================== +//============================= 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 + + // A10M [@thinkyhead] + #define DEFAULT_Kp 45.80 + #define DEFAULT_Ki 3.61 + #define DEFAULT_Kd 145.39 + +#endif // PIDTEMP + +//=========================================================================== +//====================== PID > Bed Temperature Control ====================== +//=========================================================================== + +/** + * PID Bed Heating + * + * If this option is enabled set PID constants below. + * If this option is disabled, bang-bang will be used and BED_LIMIT_SWITCHING will enable hysteresis. + * + * The PID frequency will be the same as the extruder PWM. + * If PID_dT is the default, and correct for the hardware/configuration, that means 7.689Hz, + * which is fine for driving a square wave into a resistive load and does not significantly + * impact FET heating. This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W + * heater. If your configuration is significantly different than this and you don't understand + * the issues involved, don't use bed PID until someone else verifies that your hardware works. + */ +#define PIDTEMPBED + +//#define BED_LIMIT_SWITCHING + +/** + * Max Bed Power + * Applies to all forms of bed control (PID, bang-bang, and bang-bang with hysteresis). + * When set to any value below 255, enables a form of PWM to the bed that acts like a divider + * so don't use it unless you are OK with PWM on your bed. (See the comment on enabling PIDTEMPBED) + */ +#define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current + +#if ENABLED(PIDTEMPBED) + + //#define PID_BED_DEBUG // Sends debug data to the serial port. + + // MeCreator2 generated by Autotune + #define DEFAULT_bedKp 182.46 // 175.68 189.95 + #define DEFAULT_bedKi 35.92 // 34.59 37.40 + #define DEFAULT_bedKd 231.70 // 223.07 241.19 + + // 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 450 + +//=========================================================================== +//======================== 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 true // set to true to invert the logic of the endstop. +#define Y_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. +#define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. +#define Z_MIN_PROBE_ENDSTOP_INVERTING true // set to true to invert the logic of the probe. + +/** + * Stepper Drivers + * + * These settings allow Marlin to tune stepper driver timing and enable advanced options for + * stepper drivers that support them. You may also override timing options in Configuration_adv.h. + * + * A4988 is assumed for unspecified drivers. + * + * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, + * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, + * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, + * 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.3, 80.8, 400, 340 } + +/** + * Default Max Feed Rate (mm/s) + * Override with M203 + * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] + */ +#define DEFAULT_MAX_FEEDRATE { 400, 400, 40, 45 } + +/** + * Default Max Acceleration (change/s) change = mm/s + * (Maximum start speed for accelerated moves) + * Override with M201 + * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] + */ +#define DEFAULT_MAX_ACCELERATION { 5000, 5000, 40, 5000 } + +/** + * Default Acceleration (change/s) change = mm/s + * Override with M204 + * + * M204 P Acceleration + * M204 R Retract Acceleration + * M204 T Travel Acceleration + */ +#define DEFAULT_ACCELERATION 1000 // X, Y, Z and E acceleration for printing moves +#define DEFAULT_RETRACT_ACCELERATION 2000 // 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 10.0 + #define DEFAULT_YJERK 10.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 -37 // 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 -0.5 // Z offset: -below +above [the nozzle] + +// Certain types of probes need to stay away from edges +#define MIN_PROBE_EDGE 10 + +// X and Y axis travel speed (mm/m) between probes +#define XY_PROBE_SPEED 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 +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif + +/** + * Enable one or more of the following if probing seems unreliable. + * Heaters and/or fans can be disabled during probing to minimize electrical + * noise. A delay can also be added to allow noise and vibration to settle. + * These options are most useful for the BLTouch probe, but may also improve + * readings with inductive probes and piezo sensors. + */ +#define PROBING_HEATERS_OFF // Turn heaters off when probing +#if ENABLED(PROBING_HEATERS_OFF) + #define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) +#endif +#define PROBING_FANS_OFF // Turn fans off when probing +//#define 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 220 +#define Y_BED_SIZE 220 + +// Travel limits (mm) after homing, corresponding to endstop positions. +#define X_MIN_POS -10 +#define Y_MIN_POS -5 +#define Z_MIN_POS 0 +#define X_MAX_POS X_BED_SIZE +#define Y_MAX_POS Y_BED_SIZE +#define Z_MAX_POS 260 + +/** + * 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 2 // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each. + #define FIL_RUNOUT_PIN 66 + #define FIL_RUNOUT2_PIN 67 + #define FIL_RUNOUT_INVERTING true // set to true to invert the logic of the sensors. + #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 5 + #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 (100*60) +#define HOMING_FEEDRATE_Z (20*60) + +// Validate that endstops are triggered on homing moves +#define VALIDATE_HOMING_ENDSTOPS + +// @section calibrate + +/** + * Bed Skew Compensation + * + * This feature corrects for misalignment in the XYZ axes. + * + * Take the following steps to get the bed skew in the XY plane: + * 1. Print a test square (e.g., https://www.thingiverse.com/thing:2563185) + * 2. For XY_DIAG_AC measure the diagonal A to C + * 3. For XY_DIAG_BD measure the diagonal B to D + * 4. For XY_SIDE_AD measure the edge A to D + * + * Marlin automatically computes skew factors from these measurements. + * Skew factors may also be computed and set manually: + * + * - Compute AB : SQRT(2*AC*AC+2*BD*BD-4*AD*AD)/2 + * - XY_SKEW_FACTOR : TAN(PI/2-ACOS((AC*AC-AB*AB-AD*AD)/(2*AB*AD))) + * + * If desired, follow the same procedure for XZ and YZ. + * Use these diagrams for reference: + * + * Y Z Z + * ^ B-------C ^ B-------C ^ B-------C + * | / / | / / | / / + * | / / | / / | / / + * | A-------D | A-------D | A-------D + * +-------------->X +-------------->X +-------------->Y + * XY_SKEW_FACTOR XZ_SKEW_FACTOR YZ_SKEW_FACTOR + */ +//#define SKEW_CORRECTION + +#if ENABLED(SKEW_CORRECTION) + // Input all length measurements here: + #define XY_DIAG_AC 282.8427124746 + #define XY_DIAG_BD 282.8427124746 + #define XY_SIDE_AD 200 + + // Or, set the default skew factors directly here + // to override the above measurements: + #define XY_SKEW_FACTOR 0.0 + + //#define SKEW_CORRECTION_FOR_Z + #if ENABLED(SKEW_CORRECTION_FOR_Z) + #define XZ_DIAG_AC 282.8427124746 + #define XZ_DIAG_BD 282.8427124746 + #define YZ_DIAG_AC 282.8427124746 + #define YZ_DIAG_BD 282.8427124746 + #define YZ_SIDE_AD 200 + #define XZ_SKEW_FACTOR 0.0 + #define YZ_SKEW_FACTOR 0.0 + #endif + + // Enable this option for M852 to set skew at runtime + //#define SKEW_CORRECTION_GCODE +#endif + +//============================================================================= +//============================= Additional Features =========================== +//============================================================================= + +// @section extras + +// +// EEPROM +// +// The microcontroller can store settings in the EEPROM, e.g. max velocity... +// M500 - stores parameters in EEPROM +// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily). +// M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to. +// +#define EEPROM_SETTINGS // Enable for M500 and M501 commands +//#define DISABLE_M503 // Saves ~2700 bytes of PROGMEM. Disable for release! +#define EEPROM_CHITCHAT // Give feedback on EEPROM commands. Disable to save PROGMEM. + +// +// Host Keepalive +// +// When enabled Marlin will send a busy status message to the host +// every couple of seconds when it can't accept commands. +// +#define HOST_KEEPALIVE_FEATURE // Disable this if your host doesn't like keepalive messages +#define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113. +#define BUSY_WHILE_HEATING // Some hosts require "busy" messages even during heating + +// +// M100 Free Memory Watcher +// +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage + +// +// G20/G21 Inch mode support +// +//#define INCH_MODE_SUPPORT + +// +// M149 Set temperature units support +// +//#define TEMPERATURE_UNITS_SUPPORT + +// @section temperature + +// Preheat Constants +#define PREHEAT_1_LABEL "PLA" +#define PREHEAT_1_TEMP_HOTEND 190 +#define PREHEAT_1_TEMP_BED 60 +#define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 + +#define PREHEAT_2_LABEL "ABS" +#define PREHEAT_2_TEMP_HOTEND 240 +#define PREHEAT_2_TEMP_BED 90 +#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 { 3, 3, 10 } + #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 2 + +// +// 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 + +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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. +// :[0,1,2,3,4,5,6,7] +#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 3 // Servo index starts with 0 for M280 command + +// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle. +// 300ms is a good value but you can try less delay. +// If the servo can't reach the requested position, increase it. +#define SERVO_DELAY { 300 } + +// Only power servos during movement, otherwise leave off to prevent jitter +//#define DEACTIVATE_SERVOS_AFTER_MOVE + +// Allow servo angle to be edited and saved to EEPROM +//#define EDITABLE_SERVO_ANGLES diff --git a/config/examples/Geeetech/A10M/Configuration_adv.h b/config/examples/Geeetech/A10M/Configuration_adv.h new file mode 100644 index 000000000000..01c089ed8cc7 --- /dev/null +++ b/config/examples/Geeetech/A10M/Configuration_adv.h @@ -0,0 +1,2359 @@ +/** + * 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 + +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#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) + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. + //#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 10 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 50 // (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 180000 // (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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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 69 // 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 true // Pre-allocate a static array for faster pre-sorting. + #define SDSORT_USES_STACK true // 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 + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif + +#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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // 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 5 // 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 18 // (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 450 // (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 12 // (mm/s) Slow move when starting load. + #define FILAMENT_CHANGE_SLOW_LOAD_LENGTH 450 // (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 40 // (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/config/examples/Geeetech/A20M/Configuration.h b/config/examples/Geeetech/A20M/Configuration.h new file mode 100644 index 000000000000..1f3b8b66b166 --- /dev/null +++ b/config/examples/Geeetech/A20M/Configuration.h @@ -0,0 +1,2116 @@ +/** + * 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 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_GT2560_V3_A20 +#endif + +// Optional custom name for your RepStrap or other custom machine +// Displayed in the LCD "Ready" message +#define CUSTOM_MACHINE_NAME "Geeetech A20M" + +// Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines) +// You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4) +//#define MACHINE_UUID "00000000-0000-0000-0000-000000000000" + +// @section extruder + +// This defines the number of extruders +// :[1, 2, 3, 4, 5, 6] +#define EXTRUDERS 1 + +// Generally expected filament diameter (1.75, 2.85, 3.0, ...). Used for Volumetric, Filament Width Sensor, etc. +#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75 + +// For Cyclops or any "multi-extruder" that shares a single nozzle. +//#define SINGLENOZZLE + +/** + * Průša MK2 Single Nozzle Multi-Material Multiplexer, and variants. + * + * This device allows one stepper driver on a control board to drive + * two to eight stepper motors, one at a time, in a manner suitable + * for extruders. + * + * This option only allows the multiplexer to switch on tool-change. + * Additional options to configure custom E moves are pending. + */ +//#define MK2_MULTIPLEXER +#if ENABLED(MK2_MULTIPLEXER) + // Override the default DIO selector pins here, if needed. + // Some pins files may provide defaults for these pins. + //#define E_MUX0_PIN 40 // Always Required + //#define E_MUX1_PIN 42 // Needed for 3 to 8 inputs + //#define E_MUX2_PIN 44 // Needed for 5 to 8 inputs +#endif + +/** + * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif +#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 + +// 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 + +// 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 + +// 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 + +//=========================================================================== +//============================= 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 + + // A20M [@thinkyhead] + #define DEFAULT_Kp 45.80 + #define DEFAULT_Ki 3.61 + #define DEFAULT_Kd 145.39 + +#endif // PIDTEMP + +//=========================================================================== +//====================== PID > Bed Temperature Control ====================== +//=========================================================================== + +/** + * PID Bed Heating + * + * If this option is enabled set PID constants below. + * If this option is disabled, bang-bang will be used and BED_LIMIT_SWITCHING will enable hysteresis. + * + * The PID frequency will be the same as the extruder PWM. + * If PID_dT is the default, and correct for the hardware/configuration, that means 7.689Hz, + * which is fine for driving a square wave into a resistive load and does not significantly + * impact FET heating. This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W + * heater. If your configuration is significantly different than this and you don't understand + * the issues involved, don't use bed PID until someone else verifies that your hardware works. + */ +#define PIDTEMPBED + +//#define BED_LIMIT_SWITCHING + +/** + * Max Bed Power + * Applies to all forms of bed control (PID, bang-bang, and bang-bang with hysteresis). + * When set to any value below 255, enables a form of PWM to the bed that acts like a divider + * so don't use it unless you are OK with PWM on your bed. (See the comment on enabling PIDTEMPBED) + */ +#define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current + +#if ENABLED(PIDTEMPBED) + + //#define PID_BED_DEBUG // Sends debug data to the serial port. + + // MeCreator2 generated by Autotune + #define DEFAULT_bedKp 182.46 // 175.68 189.95 + #define DEFAULT_bedKi 35.92 // 34.59 37.40 + #define DEFAULT_bedKd 231.70 // 223.07 241.19 + + // 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 400 + +//=========================================================================== +//======================== 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 true // set to true to invert the logic of the endstop. +#define Y_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. +#define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. +#define Z_MIN_PROBE_ENDSTOP_INVERTING true // set to true to invert the logic of the probe. + +/** + * Stepper Drivers + * + * These settings allow Marlin to tune stepper driver timing and enable advanced options for + * stepper drivers that support them. You may also override timing options in Configuration_adv.h. + * + * A4988 is assumed for unspecified drivers. + * + * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, + * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, + * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, + * 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.3, 80.8, 400, 340 } + +/** + * Default Max Feed Rate (mm/s) + * Override with M203 + * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] + */ +#define DEFAULT_MAX_FEEDRATE { 400, 400, 40, 45 } + +/** + * Default Max Acceleration (change/s) change = mm/s + * (Maximum start speed for accelerated moves) + * Override with M201 + * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] + */ +#define DEFAULT_MAX_ACCELERATION { 5000, 5000, 40, 5000 } + +/** + * Default Acceleration (change/s) change = mm/s + * Override with M204 + * + * M204 P Acceleration + * M204 R Retract Acceleration + * M204 T Travel Acceleration + */ +#define DEFAULT_ACCELERATION 1000 // X, Y, Z and E acceleration for printing moves +#define DEFAULT_RETRACT_ACCELERATION 2000 // 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 10.0 + #define DEFAULT_YJERK 10.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 -37 // 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 -0.5 // Z offset: -below +above [the nozzle] + +// Certain types of probes need to stay away from edges +#define MIN_PROBE_EDGE 10 + +// X and Y axis travel speed (mm/m) between probes +#define XY_PROBE_SPEED 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 +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif + +/** + * Enable one or more of the following if probing seems unreliable. + * Heaters and/or fans can be disabled during probing to minimize electrical + * noise. A delay can also be added to allow noise and vibration to settle. + * These options are most useful for the BLTouch probe, but may also improve + * readings with inductive probes and piezo sensors. + */ +#define PROBING_HEATERS_OFF // Turn heaters off when probing +#if ENABLED(PROBING_HEATERS_OFF) + //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) +#endif +#define PROBING_FANS_OFF // Turn fans off when probing +//#define 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 250 +#define Y_BED_SIZE 250 + +// Travel limits (mm) after homing, corresponding to endstop positions. +#define X_MIN_POS -10 +#define Y_MIN_POS -5 +#define Z_MIN_POS 0 +#define X_MAX_POS X_BED_SIZE +#define Y_MAX_POS Y_BED_SIZE +#define Z_MAX_POS 250 + +/** + * 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 2 // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each. + #define FIL_RUNOUT_PIN 66 + #define FIL_RUNOUT2_PIN 67 + #define FIL_RUNOUT_INVERTING true // set to true to invert the logic of the sensors. + #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 (100*60) +#define HOMING_FEEDRATE_Z (20*60) + +// Validate that endstops are triggered on homing moves +#define VALIDATE_HOMING_ENDSTOPS + +// @section calibrate + +/** + * Bed Skew Compensation + * + * This feature corrects for misalignment in the XYZ axes. + * + * Take the following steps to get the bed skew in the XY plane: + * 1. Print a test square (e.g., https://www.thingiverse.com/thing:2563185) + * 2. For XY_DIAG_AC measure the diagonal A to C + * 3. For XY_DIAG_BD measure the diagonal B to D + * 4. For XY_SIDE_AD measure the edge A to D + * + * Marlin automatically computes skew factors from these measurements. + * Skew factors may also be computed and set manually: + * + * - Compute AB : SQRT(2*AC*AC+2*BD*BD-4*AD*AD)/2 + * - XY_SKEW_FACTOR : TAN(PI/2-ACOS((AC*AC-AB*AB-AD*AD)/(2*AB*AD))) + * + * If desired, follow the same procedure for XZ and YZ. + * Use these diagrams for reference: + * + * Y Z Z + * ^ B-------C ^ B-------C ^ B-------C + * | / / | / / | / / + * | / / | / / | / / + * | A-------D | A-------D | A-------D + * +-------------->X +-------------->X +-------------->Y + * XY_SKEW_FACTOR XZ_SKEW_FACTOR YZ_SKEW_FACTOR + */ +//#define SKEW_CORRECTION + +#if ENABLED(SKEW_CORRECTION) + // Input all length measurements here: + #define XY_DIAG_AC 282.8427124746 + #define XY_DIAG_BD 282.8427124746 + #define XY_SIDE_AD 200 + + // Or, set the default skew factors directly here + // to override the above measurements: + #define XY_SKEW_FACTOR 0.0 + + //#define SKEW_CORRECTION_FOR_Z + #if ENABLED(SKEW_CORRECTION_FOR_Z) + #define XZ_DIAG_AC 282.8427124746 + #define XZ_DIAG_BD 282.8427124746 + #define YZ_DIAG_AC 282.8427124746 + #define YZ_DIAG_BD 282.8427124746 + #define YZ_SIDE_AD 200 + #define XZ_SKEW_FACTOR 0.0 + #define YZ_SKEW_FACTOR 0.0 + #endif + + // Enable this option for M852 to set skew at runtime + //#define SKEW_CORRECTION_GCODE +#endif + +//============================================================================= +//============================= Additional Features =========================== +//============================================================================= + +// @section extras + +// +// EEPROM +// +// The microcontroller can store settings in the EEPROM, e.g. max velocity... +// M500 - stores parameters in EEPROM +// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily). +// M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to. +// +#define EEPROM_SETTINGS // Enable for M500 and M501 commands +//#define DISABLE_M503 // Saves ~2700 bytes of PROGMEM. Disable for release! +#define EEPROM_CHITCHAT // Give feedback on EEPROM commands. Disable to save PROGMEM. + +// +// Host Keepalive +// +// When enabled Marlin will send a busy status message to the host +// every couple of seconds when it can't accept commands. +// +#define HOST_KEEPALIVE_FEATURE // Disable this if your host doesn't like keepalive messages +#define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113. +#define BUSY_WHILE_HEATING // Some hosts require "busy" messages even during heating + +// +// M100 Free Memory Watcher +// +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage + +// +// G20/G21 Inch mode support +// +//#define INCH_MODE_SUPPORT + +// +// M149 Set temperature units support +// +//#define TEMPERATURE_UNITS_SUPPORT + +// @section temperature + +// Preheat Constants +#define PREHEAT_1_LABEL "PLA" +#define PREHEAT_1_TEMP_HOTEND 190 +#define PREHEAT_1_TEMP_BED 60 +#define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255 + +#define PREHEAT_2_LABEL "ABS" +#define PREHEAT_2_TEMP_HOTEND 240 +#define PREHEAT_2_TEMP_BED 90 +#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 { 3, 3, 10 } + #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 2 + +// +// 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 +#define NEWPANEL + +// +// 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 +#define ST7920_DELAY_1 DELAY_NS(125) +#define ST7920_DELAY_2 DELAY_NS(125) +#define ST7920_DELAY_3 DELAY_NS(125) + +// +// 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 + +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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. +// :[0,1,2,3,4,5,6,7] +#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 3 // Servo index starts with 0 for M280 command + +// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle. +// 300ms is a good value but you can try less delay. +// If the servo can't reach the requested position, increase it. +#define SERVO_DELAY { 300 } + +// Only power servos during movement, otherwise leave off to prevent jitter +//#define DEACTIVATE_SERVOS_AFTER_MOVE + +// Allow servo angle to be edited and saved to EEPROM +//#define EDITABLE_SERVO_ANGLES diff --git a/config/examples/Geeetech/A20M/Configuration_adv.h b/config/examples/Geeetech/A20M/Configuration_adv.h new file mode 100644 index 000000000000..9f83bacd8289 --- /dev/null +++ b/config/examples/Geeetech/A20M/Configuration_adv.h @@ -0,0 +1,2359 @@ +/** + * 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 + +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#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) + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. + //#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 10 // (steps/s) Encoder rate for 10x speed + #define ENCODER_100X_STEPS_PER_SEC 50 // (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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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 69 // 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 true // Pre-allocate a static array for faster pre-sorting. + #define SDSORT_USES_STACK true // 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 + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif + +#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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // 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 5 // 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 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 400 // (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/Geeetech/GT2560/Configuration.h b/config/examples/Geeetech/GT2560/Configuration.h similarity index 87% rename from Marlin/src/config/examples/Geeetech/GT2560/Configuration.h rename to config/examples/Geeetech/GT2560/Configuration.h index 9afc16c4ab6d..197e85680ab6 100644 --- a/Marlin/src/config/examples/Geeetech/GT2560/Configuration.h +++ b/config/examples/Geeetech/GT2560/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -426,7 +481,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -516,6 +571,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 ========================= @@ -594,8 +650,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -683,6 +740,14 @@ #define DEFAULT_RETRACT_ACCELERATION 2000 // 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 @@ -691,10 +756,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 10.0 + #define DEFAULT_YJERK 10.0 + #define DEFAULT_ZJERK 0.3 +#endif + +#define DEFAULT_EJERK 4.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -723,11 +791,11 @@ //#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -737,11 +805,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -776,6 +841,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) @@ -866,6 +942,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -974,7 +1053,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 @@ -992,6 +1071,9 @@ #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 @@ -1064,7 +1146,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 @@ -1083,13 +1165,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 @@ -1158,7 +1241,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 @@ -1184,6 +1267,8 @@ #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 @@ -1355,10 +1440,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 /** @@ -1725,11 +1810,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1828,6 +1920,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1876,6 +1974,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1921,6 +2028,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1934,10 +2042,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1950,6 +2054,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 * @@ -1975,11 +2083,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 @@ -2004,7 +2112,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(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif @@ -2033,7 +2141,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 88% 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 bf4333174a3c..930e6dedcbab 100644 --- a/Marlin/src/config/examples/Geeetech/I3_Pro_X-GT2560/Configuration.h +++ b/config/examples/Geeetech/I3_Pro_X-GT2560/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -416,7 +471,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -501,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 ========================= @@ -579,8 +635,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -668,6 +725,14 @@ #define DEFAULT_RETRACT_ACCELERATION 2000 // 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 @@ -676,10 +741,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 5.0 -#define DEFAULT_YJERK 5.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 4.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 5.0 + #define DEFAULT_YJERK 5.0 + #define DEFAULT_ZJERK 0.3 +#endif + +#define DEFAULT_EJERK 4.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -708,11 +776,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -722,11 +790,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -851,6 +916,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -959,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 @@ -977,6 +1045,9 @@ #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 @@ -1049,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 @@ -1068,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 @@ -1143,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 @@ -1169,6 +1241,8 @@ #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 @@ -1340,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 /** @@ -1710,11 +1784,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1813,6 +1894,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1861,6 +1948,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1906,6 +2002,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1919,10 +2016,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1935,6 +2028,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 * @@ -1960,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 @@ -1989,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(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 87% rename from Marlin/src/config/examples/Geeetech/MeCreator2/Configuration.h rename to config/examples/Geeetech/MeCreator2/Configuration.h index 3df7e6f958ad..2ad7cb09311b 100644 --- a/Marlin/src/config/examples/Geeetech/MeCreator2/Configuration.h +++ b/config/examples/Geeetech/MeCreator2/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -420,7 +475,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -508,6 +563,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 ========================= @@ -586,8 +642,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -675,6 +732,14 @@ #define DEFAULT_RETRACT_ACCELERATION 2000 // E acceleration for retracts #define DEFAULT_TRAVEL_ACCELERATION 2000 // 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 @@ -683,10 +748,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 0 -#define DEFAULT_YJERK 0 -#define DEFAULT_ZJERK 0.6 -#define DEFAULT_EJERK 50.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 0 + #define DEFAULT_YJERK 0 + #define DEFAULT_ZJERK 0.6 +#endif + +#define DEFAULT_EJERK 50.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -715,11 +783,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -729,11 +797,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -768,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) @@ -858,6 +934,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -966,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 @@ -984,6 +1063,9 @@ #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 @@ -1056,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 @@ -1075,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 @@ -1150,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 @@ -1176,6 +1259,8 @@ #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 @@ -1347,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 /** @@ -1717,11 +1802,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1820,6 +1912,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1868,6 +1966,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1913,6 +2020,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1926,10 +2034,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1942,6 +2046,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 * @@ -1967,11 +2075,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 @@ -1996,7 +2104,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(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 71% rename from Marlin/src/config/examples/Geeetech/MeCreator2/Configuration_adv.h rename to config/examples/Geeetech/MeCreator2/Configuration_adv.h index 9fabbbab0348..146c8e8499f4 100644 --- a/Marlin/src/config/examples/Geeetech/MeCreator2/Configuration_adv.h +++ b/config/examples/Geeetech/MeCreator2/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.01 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ //#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. @@ -853,12 +1032,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 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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) @@ -893,7 +1074,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 @@ -916,13 +1097,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -933,7 +1108,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 @@ -941,11 +1117,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 @@ -1125,6 +1307,7 @@ //#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 @@ -1175,6 +1358,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. @@ -1202,127 +1386,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #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 - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E1) + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + #define E1_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #if AXIS_IS_TMC(E2) + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + #define E2_RSENSE 0.11 + #endif - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1332,13 +1597,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1346,7 +1638,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1357,9 +1649,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1379,6 +1672,7 @@ #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. @@ -1400,7 +1694,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 @@ -1412,27 +1706,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1449,62 +1726,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1544,12 +1905,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1640,11 +2019,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1733,35 +2107,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1883,7 +2261,83 @@ #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/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 87% 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 436c1a9c97f3..babbbf0afca2 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 @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -426,7 +481,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -516,6 +571,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 ========================= @@ -594,8 +650,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -683,6 +740,14 @@ #define DEFAULT_RETRACT_ACCELERATION 2000 // 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 @@ -691,10 +756,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -723,11 +791,11 @@ //#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -737,11 +805,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default #define Z_MIN_PROBE_PIN 32 /** @@ -777,6 +842,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) @@ -867,6 +943,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -975,7 +1054,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 @@ -993,6 +1072,9 @@ #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 @@ -1065,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 @@ -1084,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 4 @@ -1159,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 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1185,6 +1268,8 @@ #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 @@ -1356,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 /** @@ -1726,11 +1811,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1829,6 +1921,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1877,6 +1975,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1922,6 +2029,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1935,10 +2043,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1951,6 +2055,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 * @@ -1976,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 @@ -2005,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(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 87% 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 549551f2a124..e65c48122f16 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 @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -426,7 +481,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -516,6 +571,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 ========================= @@ -594,8 +650,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -683,6 +740,14 @@ #define DEFAULT_RETRACT_ACCELERATION 2000 // 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 @@ -691,10 +756,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -723,11 +791,11 @@ //#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -737,11 +805,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -776,6 +841,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) @@ -866,6 +942,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -974,7 +1053,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 @@ -992,6 +1071,9 @@ #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 @@ -1064,7 +1146,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 @@ -1083,13 +1165,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 @@ -1158,7 +1241,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 @@ -1184,6 +1267,8 @@ #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 @@ -1355,10 +1440,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 /** @@ -1725,11 +1810,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1828,6 +1920,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1876,6 +1974,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1921,6 +2028,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1934,10 +2042,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1950,6 +2054,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 * @@ -1975,11 +2083,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 @@ -2004,7 +2112,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(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 87% 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 8b50a3affbad..7f2ae01d6daf 100644 --- a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration.h +++ b/config/examples/Geeetech/Prusa i3 Pro C/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -416,7 +471,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -501,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 ========================= @@ -579,8 +635,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -668,6 +725,14 @@ #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 @@ -676,10 +741,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -708,11 +776,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -722,11 +790,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -761,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) @@ -851,6 +927,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -959,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 @@ -977,6 +1056,9 @@ #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 @@ -1049,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 @@ -1068,13 +1150,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 @@ -1143,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 @@ -1169,6 +1252,8 @@ #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 @@ -1340,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 /** @@ -1710,11 +1795,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1813,6 +1905,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1861,6 +1959,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1906,6 +2013,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1919,10 +2027,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1935,6 +2039,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 * @@ -1960,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 @@ -1989,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(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 71% 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 dc7c02246ae5..4b056919caf0 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 @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ #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. @@ -853,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1068,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 @@ -915,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1109,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 @@ -940,11 +1118,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 @@ -1124,6 +1308,7 @@ //#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 @@ -1174,6 +1359,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. @@ -1201,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1598,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1673,7 @@ #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. @@ -1399,7 +1695,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 @@ -1411,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2020,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2123,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2277,83 @@ #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/Geeetech/Prusa i3 Pro W/Configuration.h b/config/examples/Geeetech/Prusa i3 Pro W/Configuration.h similarity index 87% 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 1033325fa3c2..49b71294aba9 100644 --- a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration.h +++ b/config/examples/Geeetech/Prusa i3 Pro W/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -416,7 +471,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -501,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 ========================= @@ -579,8 +635,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -668,6 +725,14 @@ #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 @@ -676,10 +741,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -708,11 +776,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -722,11 +790,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -761,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) @@ -851,6 +927,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -959,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 @@ -977,6 +1056,9 @@ #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 @@ -1049,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 @@ -1068,13 +1150,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 @@ -1143,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 @@ -1169,6 +1252,8 @@ #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 @@ -1340,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 /** @@ -1710,11 +1795,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1813,6 +1905,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1861,6 +1959,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1906,6 +2013,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1919,10 +2027,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1935,6 +2039,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 * @@ -1960,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 @@ -1989,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(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 71% 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 dc7c02246ae5..4b056919caf0 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 @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ #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. @@ -853,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1068,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 @@ -915,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1109,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 @@ -940,11 +1118,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 @@ -1124,6 +1308,7 @@ //#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 @@ -1174,6 +1359,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. @@ -1201,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1598,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1673,7 @@ #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. @@ -1399,7 +1695,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 @@ -1411,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2020,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2123,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2277,83 @@ #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/Infitary/i3-M508/Configuration.h b/config/examples/Infitary/i3-M508/Configuration.h similarity index 87% rename from Marlin/src/config/examples/Infitary/i3-M508/Configuration.h rename to config/examples/Infitary/i3-M508/Configuration.h index fb26dd6f0229..7cc745496f6c 100644 --- a/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h +++ b/config/examples/Infitary/i3-M508/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -420,7 +475,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -505,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 ========================= @@ -583,8 +639,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -672,6 +729,14 @@ #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 @@ -680,10 +745,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -712,11 +780,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -726,11 +794,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -765,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) @@ -855,6 +931,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -963,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 @@ -981,6 +1060,9 @@ #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 @@ -1053,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 @@ -1072,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 3 @@ -1147,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 @@ -1173,6 +1256,8 @@ #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 @@ -1344,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 /** @@ -1714,11 +1799,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1817,6 +1909,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1865,6 +1963,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1910,6 +2017,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1923,10 +2031,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1939,6 +2043,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 * @@ -1964,11 +2072,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 @@ -1993,7 +2101,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(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 71% rename from Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h rename to config/examples/Infitary/i3-M508/Configuration_adv.h index 8c02f2f1adcb..4f30d9fffa0d 100644 --- a/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h +++ b/config/examples/Infitary/i3-M508/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ //#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. @@ -853,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1068,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 @@ -915,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1109,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 @@ -940,11 +1118,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 @@ -1124,6 +1308,7 @@ //#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 @@ -1174,6 +1359,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. @@ -1201,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1598,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1673,7 @@ #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. @@ -1399,7 +1695,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 @@ -1411,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2020,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2123,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2277,83 @@ #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/JGAurora/A5/Configuration.h b/config/examples/JGAurora/A5/Configuration.h similarity index 87% rename from Marlin/src/config/examples/JGAurora/A5/Configuration.h rename to config/examples/JGAurora/A5/Configuration.h index 8838b110e615..5497ce861694 100644 --- a/Marlin/src/config/examples/JGAurora/A5/Configuration.h +++ b/config/examples/JGAurora/A5/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -179,6 +179,16 @@ //#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) @@ -189,25 +199,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -217,13 +254,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -239,6 +290,10 @@ #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). @@ -310,7 +365,9 @@ * 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 * @@ -329,7 +386,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 15 // manual calibration of thermistor in JGAurora A5 hotend #define TEMP_SENSOR_1 0 @@ -349,37 +406,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -392,10 +446,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - #define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + #define PID_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 @@ -426,7 +481,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -513,6 +568,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 ========================= @@ -591,8 +647,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -680,6 +737,14 @@ #define DEFAULT_RETRACT_ACCELERATION 800 // 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 @@ -688,10 +753,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 8.0 -#define DEFAULT_YJERK 3.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 8.0 + #define DEFAULT_YJERK 3.0 + #define DEFAULT_ZJERK 0.3 +#endif + +#define DEFAULT_EJERK 5.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -720,11 +788,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -734,11 +802,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -773,6 +838,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) @@ -863,6 +939,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -971,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 @@ -989,6 +1068,9 @@ #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 @@ -1061,7 +1143,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 @@ -1078,15 +1160,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 @@ -1155,7 +1238,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 @@ -1181,6 +1264,8 @@ #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 @@ -1352,10 +1437,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 /** @@ -1722,11 +1807,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1825,6 +1917,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1873,6 +1971,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1918,6 +2025,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1931,10 +2039,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1947,6 +2051,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 * @@ -1972,11 +2080,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 @@ -2001,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(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 71% rename from Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h rename to config/examples/JGAurora/A5/Configuration_adv.h index c894b9ff22e3..54a3f8f3e75e 100644 --- a/Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h +++ b/config/examples/JGAurora/A5/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -483,11 +552,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +718,13 @@ #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 @@ -595,7 +749,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +784,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +902,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +954,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +984,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1020,7 @@ */ #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 5 // Babysteps are very small. Increase for faster motion. @@ -853,12 +1029,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1065,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 @@ -915,13 +1095,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1106,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 @@ -940,11 +1115,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 @@ -1124,6 +1305,7 @@ //#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 @@ -1174,6 +1356,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. @@ -1201,127 +1384,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #if AXIS_IS_TMC(E1) + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + #define E1_RSENSE 0.11 + #endif - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E2) + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + #define E2_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #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 - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1595,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1636,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1647,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1670,7 @@ #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. @@ -1399,7 +1692,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 @@ -1411,27 +1704,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1724,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define 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 - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1903,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2017,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2120,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2274,83 @@ #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/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 87% rename from Marlin/src/config/examples/MakerParts/Configuration.h rename to config/examples/MakerParts/Configuration.h index 50f63b9bd353..40483452894b 100644 --- a/Marlin/src/config/examples/MakerParts/Configuration.h +++ b/config/examples/MakerParts/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -194,6 +194,16 @@ //#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) @@ -204,25 +214,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -232,13 +269,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -254,6 +305,10 @@ #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). @@ -325,7 +380,9 @@ * 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 * @@ -344,7 +401,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -364,37 +421,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -407,10 +461,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - #define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + #define PID_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 @@ -436,7 +491,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -521,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 ========================= @@ -599,8 +655,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -688,6 +745,14 @@ #define DEFAULT_RETRACT_ACCELERATION 100 // E acceleration for retracts #define DEFAULT_TRAVEL_ACCELERATION MAX_XYAXIS_ACCEL // 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 @@ -696,10 +761,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 2.0 -#define DEFAULT_YJERK 2.0 -#define DEFAULT_ZJERK 0.4 -#define DEFAULT_EJERK 8.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 2.0 + #define DEFAULT_YJERK 2.0 + #define DEFAULT_ZJERK 0.4 +#endif + +#define DEFAULT_EJERK 8.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -728,11 +796,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -742,11 +810,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -781,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) @@ -871,6 +947,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -979,7 +1058,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 @@ -997,6 +1076,9 @@ #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 @@ -1069,7 +1151,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 @@ -1088,13 +1170,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 @@ -1163,7 +1246,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 @@ -1189,6 +1272,8 @@ #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 @@ -1360,10 +1445,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 /** @@ -1730,11 +1815,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1833,6 +1925,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1881,6 +1979,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1926,6 +2033,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1939,10 +2047,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1955,6 +2059,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 * @@ -1980,11 +2088,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 @@ -2009,7 +2117,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(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 71% rename from Marlin/src/config/examples/MakerParts/Configuration_adv.h rename to config/examples/MakerParts/Configuration_adv.h index e641f281a4a6..94bcc5e9cedc 100644 --- a/Marlin/src/config/examples/MakerParts/Configuration_adv.h +++ b/config/examples/MakerParts/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ //#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. @@ -853,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1068,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 @@ -915,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1109,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 @@ -940,11 +1118,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 @@ -1124,6 +1308,7 @@ //#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 @@ -1174,6 +1359,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. @@ -1201,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1598,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1673,7 @@ #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. @@ -1399,7 +1695,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 @@ -1411,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2020,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2123,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2277,83 @@ #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/MakerParts/_Bootscreen.h b/config/examples/MakerParts/_Bootscreen.h similarity index 99% rename from Marlin/src/config/examples/MakerParts/_Bootscreen.h rename to config/examples/MakerParts/_Bootscreen.h index 5ddf5c7ff4e2..907d61219454 100644 --- a/Marlin/src/config/examples/MakerParts/_Bootscreen.h +++ b/config/examples/MakerParts/_Bootscreen.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/config/examples/Malyan/M150/Configuration.h b/config/examples/Malyan/M150/Configuration.h similarity index 87% rename from Marlin/src/config/examples/Malyan/M150/Configuration.h rename to config/examples/Malyan/M150/Configuration.h index 0b4950205226..0efe5b988e51 100644 --- a/Marlin/src/config/examples/Malyan/M150/Configuration.h +++ b/config/examples/Malyan/M150/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -179,6 +179,16 @@ //#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) @@ -189,25 +199,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -217,13 +254,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -239,6 +290,10 @@ #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). @@ -310,7 +365,9 @@ * 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 * @@ -329,7 +386,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -352,37 +409,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -395,10 +449,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -424,7 +479,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -509,6 +564,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 ========================= @@ -588,8 +644,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -688,6 +745,14 @@ #define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration for retracts #define DEFAULT_TRAVEL_ACCELERATION 700 // 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 @@ -696,10 +761,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 8.0 -#define DEFAULT_YJERK 8.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 8.0 + #define DEFAULT_YJERK 8.0 + #define DEFAULT_ZJERK 0.3 +#endif + +#define DEFAULT_EJERK 5.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -728,11 +796,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -742,11 +810,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -781,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) @@ -875,6 +951,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -983,7 +1062,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 @@ -1001,6 +1080,9 @@ #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 @@ -1077,7 +1159,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 @@ -1096,13 +1178,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 @@ -1171,7 +1254,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 @@ -1197,6 +1280,8 @@ #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 @@ -1368,10 +1453,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 /** @@ -1738,11 +1823,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1841,6 +1933,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1889,6 +1987,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1934,6 +2041,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1947,10 +2055,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1963,6 +2067,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 * @@ -1988,11 +2096,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 @@ -2017,7 +2125,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(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 71% rename from Marlin/src/config/examples/Malyan/M150/Configuration_adv.h rename to config/examples/Malyan/M150/Configuration_adv.h index 80aa4504f3ff..2b0a0134b889 100644 --- a/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h +++ b/config/examples/Malyan/M150/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #define ENCODER_100X_STEPS_PER_SEC 300 // (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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ //#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. @@ -853,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1068,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 @@ -915,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1109,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 @@ -940,11 +1118,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 @@ -1124,6 +1308,7 @@ //#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 @@ -1174,6 +1359,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. @@ -1201,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1598,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1673,7 @@ #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. @@ -1399,7 +1695,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 @@ -1411,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2020,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2123,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2277,83 @@ #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/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 44c308de224d..3a5026a4bd15 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 99% rename from Marlin/src/config/examples/Malyan/M150/_Bootscreen.h rename to config/examples/Malyan/M150/_Bootscreen.h index 678a7a106f9b..5700d37a0fa7 100644 --- a/Marlin/src/config/examples/Malyan/M150/_Bootscreen.h +++ b/config/examples/Malyan/M150/_Bootscreen.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/config/examples/Malyan/M200/Configuration.h b/config/examples/Malyan/M200/Configuration.h similarity index 87% rename from Marlin/src/config/examples/Malyan/M200/Configuration.h rename to config/examples/Malyan/M200/Configuration.h index f6c587e7ae37..270dd7c6a513 100644 --- a/Marlin/src/config/examples/Malyan/M200/Configuration.h +++ b/config/examples/Malyan/M200/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 11 #define TEMP_SENSOR_1 0 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -415,7 +470,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -500,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 ========================= @@ -578,8 +634,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -667,6 +724,14 @@ #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 @@ -675,10 +740,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -707,11 +775,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -721,11 +789,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -760,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) @@ -850,6 +926,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -958,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 @@ -976,6 +1055,9 @@ #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 @@ -1048,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 @@ -1067,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 @@ -1142,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 @@ -1168,6 +1251,8 @@ #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 @@ -1339,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 /** @@ -1709,11 +1794,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1812,6 +1904,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1860,6 +1958,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1905,6 +2012,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1918,10 +2026,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1934,6 +2038,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 * @@ -1959,11 +2067,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 @@ -1988,7 +2096,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(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 71% rename from Marlin/src/config/examples/Malyan/M200/Configuration_adv.h rename to config/examples/Malyan/M200/Configuration_adv.h index df051d3f08ad..b4af89be784c 100644 --- a/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h +++ b/config/examples/Malyan/M200/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ //#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. @@ -853,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1068,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 @@ -915,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1109,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 @@ -940,11 +1118,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 @@ -1124,6 +1308,7 @@ //#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 @@ -1174,6 +1359,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. @@ -1201,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1598,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1673,7 @@ #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. @@ -1399,7 +1695,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 @@ -1411,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2020,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2123,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2277,83 @@ #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/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 87% rename from Marlin/src/config/examples/Micromake/C1/basic/Configuration.h rename to config/examples/Micromake/C1/basic/Configuration.h index 68f6430e20cf..90e2b17c4510 100644 --- a/Marlin/src/config/examples/Micromake/C1/basic/Configuration.h +++ b/config/examples/Micromake/C1/basic/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -416,7 +471,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -501,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 ========================= @@ -579,8 +635,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -672,6 +729,14 @@ #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 @@ -680,10 +745,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK DEFAULT_XJERK -#define DEFAULT_ZJERK DEFAULT_XJERK // Must be same as XY for delta -#define DEFAULT_EJERK 5.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 10.0 + #define DEFAULT_YJERK DEFAULT_XJERK + #define DEFAULT_ZJERK DEFAULT_XJERK // Must be same as XY for delta +#endif + +#define DEFAULT_EJERK 5.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -712,11 +780,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -726,11 +794,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -765,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) @@ -855,6 +931,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -963,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 @@ -981,6 +1060,9 @@ #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 @@ -1053,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 @@ -1072,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 3 @@ -1147,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 @@ -1173,6 +1256,8 @@ #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 @@ -1288,7 +1373,7 @@ // 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 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. @@ -1344,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 /** @@ -1714,11 +1799,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1817,6 +1909,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1865,6 +1963,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1910,6 +2017,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1923,10 +2031,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1939,6 +2043,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 * @@ -1964,11 +2072,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 @@ -1993,7 +2101,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(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 87% rename from Marlin/src/config/examples/Micromake/C1/enhanced/Configuration.h rename to config/examples/Micromake/C1/enhanced/Configuration.h index 0e8ee1e384fa..c39990614329 100644 --- a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration.h +++ b/config/examples/Micromake/C1/enhanced/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -416,7 +471,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -501,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 ========================= @@ -579,8 +635,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -672,6 +729,14 @@ #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 @@ -680,10 +745,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK DEFAULT_XJERK -#define DEFAULT_ZJERK DEFAULT_XJERK // Must be same as XY for delta -#define DEFAULT_EJERK 5.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 10.0 + #define DEFAULT_YJERK DEFAULT_XJERK + #define DEFAULT_ZJERK DEFAULT_XJERK // Must be same as XY for delta +#endif + +#define DEFAULT_EJERK 5.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -712,11 +780,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -726,11 +794,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -765,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) @@ -855,6 +931,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -963,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 @@ -981,6 +1060,9 @@ #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 @@ -1053,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 @@ -1072,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 3 @@ -1147,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 @@ -1173,6 +1256,8 @@ #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 @@ -1344,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 /** @@ -1714,11 +1799,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1817,6 +1909,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1865,6 +1963,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1910,6 +2017,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1923,10 +2031,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1939,6 +2043,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 * @@ -1964,11 +2072,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 @@ -1993,7 +2101,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(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/config/examples/Micromake/C1/enhanced/Configuration_adv.h b/config/examples/Micromake/C1/enhanced/Configuration_adv.h new file mode 100644 index 000000000000..a752503c1094 --- /dev/null +++ b/config/examples/Micromake/C1/enhanced/Configuration_adv.h @@ -0,0 +1,2359 @@ +/** + * 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 + +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#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) + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. + //#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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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 + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif + +#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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // 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/config/examples/Mks/Robin/Configuration.h b/config/examples/Mks/Robin/Configuration.h new file mode 100644 index 000000000000..ecfc05ead394 --- /dev/null +++ b/config/examples/Mks/Robin/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 "(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 3 + +/** + * 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 +#define NUM_SERIAL 2 + +/** + * 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_MKS_ROBIN +#endif + +// Optional custom name for your RepStrap or other custom machine +// Displayed in the LCD "Ready" message +#define CUSTOM_MACHINE_NAME "MKS Robin" + +// 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 + +// 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif +#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 0 + +// Dummy thermistor constant temperature readings, for use with 998 and 999 +#define DUMMY_THERMISTOR_998_VALUE 25 +#define DUMMY_THERMISTOR_999_VALUE 100 + +// Use temp sensor 1 as a redundant sensor with sensor 0. If the readings +// from the two sensors differ too much the print will be aborted. +//#define TEMP_SENSOR_1_AS_REDUNDANT +#define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 + +#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 + +// 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 + +// 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 + +//=========================================================================== +//============================= 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 +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif + +/** + * Enable one or more of the following if probing seems unreliable. + * Heaters and/or fans can be disabled during probing to minimize electrical + * noise. A delay can also be added to allow noise and vibration to settle. + * These options are most useful for the BLTouch probe, but may also improve + * readings with inductive probes and piezo sensors. + */ +//#define PROBING_HEATERS_OFF // Turn heaters off when probing +#if ENABLED(PROBING_HEATERS_OFF) + //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) +#endif +//#define PROBING_FANS_OFF // Turn fans off when probing +//#define 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 +#define SDIO_SUPPORT + +/** + * 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 + +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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. +// :[0,1,2,3,4,5,6,7] +#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 3 // Servo index starts with 0 for M280 command + +// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle. +// 300ms is a good value but you can try less delay. +// If the servo can't reach the requested position, increase it. +#define SERVO_DELAY { 300 } + +// Only power servos during movement, otherwise leave off to prevent jitter +//#define DEACTIVATE_SERVOS_AFTER_MOVE + +// Allow servo angle to be edited and saved to EEPROM +//#define EDITABLE_SERVO_ANGLES diff --git a/config/examples/Mks/Robin/Configuration_adv.h b/config/examples/Mks/Robin/Configuration_adv.h new file mode 100644 index 000000000000..0b804b988b54 --- /dev/null +++ b/config/examples/Mks/Robin/Configuration_adv.h @@ -0,0 +1,2359 @@ +/** + * 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 + +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#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) + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. + //#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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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 + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif + +#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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // 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/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 87% rename from Marlin/src/config/examples/Mks/Sbase/Configuration.h rename to config/examples/Mks/Sbase/Configuration.h index 89368941e86c..8883141cc61b 100644 --- a/Marlin/src/config/examples/Mks/Sbase/Configuration.h +++ b/config/examples/Mks/Sbase/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 5 #define TEMP_SENSOR_1 0 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -416,7 +471,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -501,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 ========================= @@ -579,22 +635,23 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] - */ -//#define X_DRIVER_TYPE A4988 -//#define Y_DRIVER_TYPE A4988 -//#define Z_DRIVER_TYPE A4988 -//#define X2_DRIVER_TYPE A4988 -//#define Y2_DRIVER_TYPE A4988 -//#define Z2_DRIVER_TYPE A4988 -//#define Z3_DRIVER_TYPE A4988 -//#define E0_DRIVER_TYPE A4988 -//#define E1_DRIVER_TYPE A4988 -//#define E2_DRIVER_TYPE A4988 -//#define E3_DRIVER_TYPE A4988 -//#define E4_DRIVER_TYPE A4988 -//#define E5_DRIVER_TYPE A4988 + * 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 DRV8825 +#define Y_DRIVER_TYPE DRV8825 +#define Z_DRIVER_TYPE DRV8825 +//#define X2_DRIVER_TYPE DRV8825 +//#define Y2_DRIVER_TYPE DRV8825 +//#define Z2_DRIVER_TYPE DRV8825 +//#define Z3_DRIVER_TYPE DRV8825 +#define E0_DRIVER_TYPE DRV8825 +#define E1_DRIVER_TYPE DRV8825 +//#define E2_DRIVER_TYPE DRV8825 +//#define E3_DRIVER_TYPE DRV8825 +//#define E4_DRIVER_TYPE DRV8825 +//#define E5_DRIVER_TYPE DRV8825 // Enable this feature if all enabled endstop pins are interrupt-capable. // This will remove the need to poll the interrupt pins, saving many CPU cycles. @@ -668,6 +725,14 @@ #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 @@ -676,10 +741,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -708,11 +776,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -722,11 +790,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -761,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) @@ -851,6 +927,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -959,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 @@ -977,6 +1056,9 @@ #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 @@ -1049,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 @@ -1068,13 +1150,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 @@ -1143,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 @@ -1169,6 +1252,8 @@ #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 @@ -1340,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 /** @@ -1710,11 +1795,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1813,6 +1905,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1861,6 +1959,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1906,6 +2013,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1919,10 +2027,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1935,6 +2039,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 * @@ -1960,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 @@ -1989,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(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 71% rename from Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h rename to config/examples/Mks/Sbase/Configuration_adv.h index 2f346fc05391..d64657e960fd 100644 --- a/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h +++ b/config/examples/Mks/Sbase/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #define THERMAL_PROTECTION_PERIOD 50 // Seconds #define THERMAL_PROTECTION_HYSTERESIS 6 // 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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -572,6 +722,13 @@ #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 @@ -596,7 +753,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -631,8 +788,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -746,7 +906,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -787,26 +958,19 @@ // 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. + * 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -824,8 +988,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -853,6 +1024,7 @@ */ //#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. @@ -861,12 +1033,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -894,13 +1069,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 @@ -923,13 +1099,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -940,7 +1110,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 @@ -948,11 +1119,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 @@ -1132,6 +1309,7 @@ //#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 @@ -1182,6 +1360,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. @@ -1209,127 +1388,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E1) + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + #define E1_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #if AXIS_IS_TMC(E2) + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + #define E2_RSENSE 0.11 + #endif - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1339,13 +1599,40 @@ //#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 + #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 TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1353,7 +1640,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1364,9 +1651,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1386,6 +1674,7 @@ #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. @@ -1407,7 +1696,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 @@ -1419,27 +1708,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1456,62 +1728,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1551,12 +1907,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1647,11 +2021,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1755,35 +2124,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1905,7 +2278,83 @@ #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/config/examples/Printrbot/PrintrboardG2/Configuration.h b/config/examples/Printrbot/PrintrboardG2/Configuration.h new file mode 100644 index 000000000000..b0dfb4c4c979 --- /dev/null +++ b/config/examples/Printrbot/PrintrboardG2/Configuration.h @@ -0,0 +1,2135 @@ +/** + * 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 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] + */ +// For programming port do NOT define +#define SERIAL_PORT_2 0 // For native port + +/** + * 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_PRINTRBOARD_G2 +#endif + +// Optional custom name for your RepStrap or other custom machine +// Displayed in the LCD "Ready" message +//#define CUSTOM_MACHINE_NAME "3D Printer" + +// Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines) +// You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4) +//#define MACHINE_UUID "00000000-0000-0000-0000-000000000000" + +// @section extruder + +// This defines the number of extruders +// :[1, 2, 3, 4, 5, 6] +#define EXTRUDERS 1 + +// Generally expected filament diameter (1.75, 2.85, 3.0, ...). Used for Volumetric, Filament Width Sensor, etc. +#define DEFAULT_NOMINAL_FILAMENT_DIA 3.0 + +// For Cyclops or any "multi-extruder" that shares a single nozzle. +//#define SINGLENOZZLE + +/** + * Průša MK2 Single Nozzle Multi-Material Multiplexer, and variants. + * + * This device allows one stepper driver on a control board to drive + * two to eight stepper motors, one at a time, in a manner suitable + * for extruders. + * + * This option only allows the multiplexer to switch on tool-change. + * Additional options to configure custom E moves are pending. + */ +//#define MK2_MULTIPLEXER +#if ENABLED(MK2_MULTIPLEXER) + // Override the default DIO selector pins here, if needed. + // Some pins files may provide defaults for these pins. + //#define E_MUX0_PIN 40 // Always Required + //#define E_MUX1_PIN 42 // Needed for 3 to 8 inputs + //#define E_MUX2_PIN 44 // Needed for 5 to 8 inputs +#endif + +/** + * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif +#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 + +// 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 + +// 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 + +// 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 + +//=========================================================================== +//============================= 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 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 true // set to true to invert the logic of the endstop. +#define Y_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. +#define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. +#define Z_MIN_PROBE_ENDSTOP_INVERTING true // set to true to invert the logic of the probe. + +/** + * Stepper Drivers + * + * These settings allow Marlin to tune stepper driver timing and enable advanced options for + * stepper drivers that support them. You may also override timing options in Configuration_adv.h. + * + * A4988 is assumed for unspecified drivers. + * + * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, + * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, + * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, + * 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 DRV8825 +//#define Y_DRIVER_TYPE DRV8825 +//#define Z_DRIVER_TYPE DRV8825 +//#define X2_DRIVER_TYPE A4988 +//#define Y2_DRIVER_TYPE A4988 +//#define Z2_DRIVER_TYPE A4988 +//#define Z3_DRIVER_TYPE A4988 +//#define E0_DRIVER_TYPE DRV8825 +//#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 } +#define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 80, 80 } + +/** + * 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 } +#define DEFAULT_MAX_FEEDRATE { 30, 30,30,30 } + +/** + * 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 } +#define DEFAULT_MAX_ACCELERATION { 100, 100, 100, 100 } + +/** + * 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 + +#define DEFAULT_ACCELERATION 100 // X, Y, Z and E acceleration for printing moves +#define DEFAULT_RETRACT_ACCELERATION 100 // E acceleration for retracts +#define DEFAULT_TRAVEL_ACCELERATION 100 // 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 1.0 + #define DEFAULT_YJERK 1.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 +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif + +/** + * Enable one or more of the following if probing seems unreliable. + * Heaters and/or fans can be disabled during probing to minimize electrical + * noise. A delay can also be added to allow noise and vibration to settle. + * These options are most useful for the BLTouch probe, but may also improve + * readings with inductive probes and piezo sensors. + */ +//#define PROBING_HEATERS_OFF // Turn heaters off when probing +#if ENABLED(PROBING_HEATERS_OFF) + //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) +#endif +//#define PROBING_FANS_OFF // Turn fans off when probing +//#define 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 + +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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. +// :[0,1,2,3,4,5,6,7] +#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 20 // LED driving pin on motherboard 4 => D4 (EXP2-5 on Printrboard) / 30 => PC7 (EXP3-13 on Rumba) + #define NEOPIXEL_PIXELS 3 // 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 3 // Servo index starts with 0 for M280 command + +// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle. +// 300ms is a good value but you can try less delay. +// If the servo can't reach the requested position, increase it. +#define SERVO_DELAY { 300 } + +// Only power servos during movement, otherwise leave off to prevent jitter +//#define DEACTIVATE_SERVOS_AFTER_MOVE + +// Allow servo angle to be edited and saved to EEPROM +//#define EDITABLE_SERVO_ANGLES diff --git a/config/examples/RapideLite/RL200/Configuration.h b/config/examples/RapideLite/RL200/Configuration.h new file mode 100644 index 000000000000..ff20725785b0 --- /dev/null +++ b/config/examples/RapideLite/RL200/Configuration.h @@ -0,0 +1,2127 @@ +/** + * 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 "(platon42)" // 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_RL200 +#endif + +// Optional custom name for your RepStrap or other custom machine +// Displayed in the LCD "Ready" message +#define CUSTOM_MACHINE_NAME "Rapide Lite 200" + +// Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines) +// You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4) +//#define MACHINE_UUID "00000000-0000-0000-0000-000000000000" + +// @section extruder + +// This defines the number of extruders +// :[1, 2, 3, 4, 5, 6] +#define EXTRUDERS 1 + +// Generally expected filament diameter (1.75, 2.85, 3.0, ...). Used for Volumetric, Filament Width Sensor, etc. +#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75 + +// For Cyclops or any "multi-extruder" that shares a single nozzle. +//#define SINGLENOZZLE + +/** + * Průša MK2 Single Nozzle Multi-Material Multiplexer, and variants. + * + * This device allows one stepper driver on a control board to drive + * two to eight stepper motors, one at a time, in a manner suitable + * for extruders. + * + * This option only allows the multiplexer to switch on tool-change. + * Additional options to configure custom E moves are pending. + */ +//#define MK2_MULTIPLEXER +#if ENABLED(MK2_MULTIPLEXER) + // Override the default DIO selector pins here, if needed. + // Some pins files may provide defaults for these pins. + //#define E_MUX0_PIN 40 // Always Required + //#define E_MUX1_PIN 42 // Needed for 3 to 8 inputs + //#define E_MUX2_PIN 44 // Needed for 5 to 8 inputs +#endif + +/** + * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif +#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 1 + +#if POWER_SUPPLY > 0 + // Enable this option to leave the PSU off at startup. + // Power to steppers and heaters will need to be turned on with M80. + //#define PS_DEFAULT_OFF + + //#define AUTO_POWER_CONTROL // Enable automatic control of the PS_ON pin + #if ENABLED(AUTO_POWER_CONTROL) + #define AUTO_POWER_FANS // Turn on PSU if fans need power + #define AUTO_POWER_E_FANS + #define AUTO_POWER_CONTROLLERFAN + #define POWER_TIMEOUT 30 + #endif + +#endif + +// @section temperature + +//=========================================================================== +//============================= Thermal Settings ============================ +//=========================================================================== + +/** + * --NORMAL IS 4.7kohm PULLUP!-- 1kohm pullup can be used on hotend sensor, using correct resistor and table + * + * Temperature sensors available: + * + * -4 : thermocouple with AD8495 + * -3 : thermocouple with MAX31855 (only for sensor 0) + * -2 : thermocouple with MAX6675 (only for sensor 0) + * -1 : thermocouple with AD595 + * 0 : not used + * 1 : 100k thermistor - best choice for EPCOS 100k (4.7k pullup) + * 2 : 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup) + * 3 : Mendel-parts thermistor (4.7k pullup) + * 4 : 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !! + * 5 : 100K thermistor - ATC Semitec 104GT-2/104NT-4-R025H42G (Used in ParCan & J-Head) (4.7k pullup) + * 501 : 100K Zonestar (Tronxy X3A) Thermistor + * 6 : 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup) + * 7 : 100k Honeywell thermistor 135-104LAG-J01 (4.7k pullup) + * 71 : 100k Honeywell thermistor 135-104LAF-J01 (4.7k pullup) + * 8 : 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) + * 9 : 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup) + * 10 : 100k RS thermistor 198-961 (4.7k pullup) + * 11 : 100k beta 3950 1% thermistor (4.7k pullup) + * 12 : 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) + * 13 : 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" + * 15 : 100k thermistor calibration for JGAurora A5 hotend + * 20 : the PT100 circuit found in the Ultimainboard V2.x + * 60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 + * 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 + +// 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 + +// 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 + +// 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 + +//=========================================================================== +//============================= 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 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 true // set to true to invert the logic of the endstop. +#define Y_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. +#define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. +#define Z_MIN_PROBE_ENDSTOP_INVERTING true // set to true to invert the logic of the probe. + +/** + * Stepper Drivers + * + * These settings allow Marlin to tune stepper driver timing and enable advanced options for + * stepper drivers that support them. You may also override timing options in Configuration_adv.h. + * + * A4988 is assumed for unspecified drivers. + * + * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, + * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, + * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, + * 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 DRV8825 +#define Y_DRIVER_TYPE DRV8825 +#define Z_DRIVER_TYPE DRV8825 +//#define X2_DRIVER_TYPE A4988 +//#define Y2_DRIVER_TYPE A4988 +#define Z2_DRIVER_TYPE DRV8825 +//#define Z3_DRIVER_TYPE A4988 +#define E0_DRIVER_TYPE DRV8825 +//#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 { 157, 157, 800, 195 } + +/** + * Default Max Feed Rate (mm/s) + * Override with M203 + * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] + */ +#define DEFAULT_MAX_FEEDRATE { 500, 500, 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 { 9000, 9000, 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 +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif + +/** + * Enable one or more of the following if probing seems unreliable. + * Heaters and/or fans can be disabled during probing to minimize electrical + * noise. A delay can also be added to allow noise and vibration to settle. + * These options are most useful for the BLTouch probe, but may also improve + * readings with inductive probes and piezo sensors. + */ +//#define PROBING_HEATERS_OFF // Turn heaters off when probing +#if ENABLED(PROBING_HEATERS_OFF) + //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) +#endif +//#define PROBING_FANS_OFF // Turn fans off when probing +//#define PROBING_STEPPERS_OFF // Turn steppers off (unless needed to hold position) when probing +//#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors + +// For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 +// :{ 0:'Low', 1:'High' } +#define X_ENABLE_ON 0 +#define Y_ENABLE_ON 0 +#define Z_ENABLE_ON 0 +#define E_ENABLE_ON 0 // For all extruders + +// Disables axis stepper immediately when it's not being used. +// WARNING: When motors turn off there is a chance of losing position accuracy! +#define DISABLE_X false +#define DISABLE_Y false +#define DISABLE_Z false + +// Warn on display about possibly reduced accuracy +//#define DISABLE_REDUCED_ACCURACY_WARNING + +// @section extruder + +#define DISABLE_E false // For all extruders +#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled + +// @section machine + +// Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way. +#define INVERT_X_DIR true +#define INVERT_Y_DIR true +#define INVERT_Z_DIR true + +// @section extruder + +// For direct drive extruder v9 set to true, for geared extruder set to false. +#define INVERT_E0_DIR true +#define INVERT_E1_DIR true +#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 190 + +/** + * 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 + +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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. +// :[0,1,2,3,4,5,6,7] +#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 3 // Servo index starts with 0 for M280 command + +// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle. +// 300ms is a good value but you can try less delay. +// If the servo can't reach the requested position, increase it. +#define SERVO_DELAY { 300 } + +// Only power servos during movement, otherwise leave off to prevent jitter +//#define DEACTIVATE_SERVOS_AFTER_MOVE + +// Allow servo angle to be edited and saved to EEPROM +//#define EDITABLE_SERVO_ANGLES diff --git a/config/examples/RapideLite/RL200/Configuration_adv.h b/config/examples/RapideLite/RL200/Configuration_adv.h new file mode 100644 index 000000000000..9191b838a07d --- /dev/null +++ b/config/examples/RapideLite/RL200/Configuration_adv.h @@ -0,0 +1,2359 @@ +/** + * 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 + +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#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) + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. + //#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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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 + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif + +#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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // 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/RepRapPro/Huxley/Configuration.h b/config/examples/RepRapPro/Huxley/Configuration.h similarity index 88% rename from Marlin/src/config/examples/RepRapPro/Huxley/Configuration.h rename to config/examples/RepRapPro/Huxley/Configuration.h index 121f9af6b744..d58be3ee4a6a 100644 --- a/Marlin/src/config/examples/RepRapPro/Huxley/Configuration.h +++ b/config/examples/RepRapPro/Huxley/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -416,7 +471,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -501,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 ========================= @@ -579,8 +635,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -708,6 +765,14 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley #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 @@ -716,10 +781,13 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -748,11 +816,11 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -762,11 +830,8 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -801,6 +866,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) @@ -891,6 +967,9 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -1008,7 +1087,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 @@ -1026,6 +1105,9 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley #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 @@ -1098,7 +1180,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 @@ -1117,13 +1199,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 @@ -1192,7 +1275,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 @@ -1218,6 +1301,8 @@ 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 @@ -1389,10 +1474,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 /** @@ -1759,11 +1844,18 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1862,6 +1954,12 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1910,6 +2008,15 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1955,6 +2062,7 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1968,10 +2076,6 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1984,6 +2088,10 @@ Black rubber belt(MXL), 18 - tooth aluminium pulley : 87.489 step per mm (Huxley // 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 * @@ -2009,11 +2117,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 @@ -2038,7 +2146,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(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 87% rename from Marlin/src/config/examples/RepRapWorld/Megatronics/Configuration.h rename to config/examples/RepRapWorld/Megatronics/Configuration.h index 0e54a291ef43..82a30f4549ca 100644 --- a/Marlin/src/config/examples/RepRapWorld/Megatronics/Configuration.h +++ b/config/examples/RepRapWorld/Megatronics/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -416,7 +471,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -501,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 ========================= @@ -579,8 +635,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -668,6 +725,14 @@ #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 @@ -676,10 +741,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -708,11 +776,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -722,11 +790,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -761,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) @@ -851,6 +927,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -959,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 @@ -977,6 +1056,9 @@ #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 @@ -1049,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 @@ -1068,13 +1150,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 @@ -1143,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 @@ -1169,6 +1252,8 @@ #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 @@ -1340,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 /** @@ -1710,11 +1795,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1813,6 +1905,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1861,6 +1959,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1906,6 +2013,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1919,10 +2027,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1935,6 +2039,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 * @@ -1960,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 @@ -1989,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(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 87% rename from Marlin/src/config/examples/RigidBot/Configuration.h rename to config/examples/RigidBot/Configuration.h index 0f09f1459b42..2add4143c611 100644 --- a/Marlin/src/config/examples/RigidBot/Configuration.h +++ b/config/examples/RigidBot/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -177,6 +177,16 @@ //#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) @@ -187,25 +197,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -215,13 +252,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -237,6 +288,10 @@ #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). @@ -308,7 +363,9 @@ * 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 * @@ -327,7 +384,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 // DGlass3D = 5; RigidBot = 1; 3DSv6 = 5 #define TEMP_SENSOR_1 0 @@ -347,37 +404,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT //#define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -390,10 +444,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -419,7 +474,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -497,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 ========================= @@ -575,8 +631,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -666,6 +723,14 @@ #define DEFAULT_RETRACT_ACCELERATION 1000 // 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 @@ -674,10 +739,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 8.0 -#define DEFAULT_YJERK 8.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 8.0 + #define DEFAULT_YJERK 8.0 + #define DEFAULT_ZJERK 0.3 +#endif + +#define DEFAULT_EJERK 5.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -706,11 +774,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -720,11 +788,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -759,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) @@ -849,6 +925,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -957,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 @@ -975,6 +1054,9 @@ #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 @@ -1047,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 @@ -1066,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 @@ -1141,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 @@ -1167,6 +1250,8 @@ #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 @@ -1338,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 /** @@ -1708,11 +1793,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1813,6 +1905,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1861,6 +1959,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1906,6 +2013,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1919,10 +2027,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1935,6 +2039,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 * @@ -1960,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 @@ -1989,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(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 71% rename from Marlin/src/config/examples/RigidBot/Configuration_adv.h rename to config/examples/RigidBot/Configuration_adv.h index c7548e796d94..896b2400fc4c 100644 --- a/Marlin/src/config/examples/RigidBot/Configuration_adv.h +++ b/config/examples/RigidBot/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ //#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. @@ -853,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1068,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 @@ -915,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1109,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 @@ -940,11 +1118,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 @@ -1124,6 +1308,7 @@ //#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 @@ -1174,6 +1359,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. @@ -1201,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1598,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1673,7 @@ #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. @@ -1399,7 +1695,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 @@ -1411,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2020,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2123,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2277,83 @@ #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/SCARA/Configuration.h b/config/examples/SCARA/Configuration.h similarity index 87% rename from Marlin/src/config/examples/SCARA/Configuration.h rename to config/examples/SCARA/Configuration.h index d7aa407d15a2..14c30d03622b 100644 --- a/Marlin/src/config/examples/SCARA/Configuration.h +++ b/config/examples/SCARA/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -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 @@ -205,6 +205,16 @@ //#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) @@ -215,25 +225,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -243,13 +280,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -265,6 +316,10 @@ #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). @@ -336,7 +391,9 @@ * 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 * @@ -355,7 +412,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -375,37 +432,34 @@ //#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. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +#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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -418,10 +472,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 20 // If the temperature difference between the target temperature and the actual temperature @@ -435,7 +490,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -514,6 +569,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,8 +648,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -681,6 +738,14 @@ #define DEFAULT_RETRACT_ACCELERATION 2000 // E acceleration for retracts #define DEFAULT_TRAVEL_ACCELERATION 400 // 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 @@ -689,10 +754,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 5.0 -#define DEFAULT_YJERK 5.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 3.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 5.0 + #define DEFAULT_YJERK 5.0 + #define DEFAULT_ZJERK 0.3 +#endif + +#define DEFAULT_EJERK 3.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -721,11 +789,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -735,11 +803,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -774,6 +839,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) @@ -864,6 +940,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -972,7 +1051,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 @@ -990,6 +1069,9 @@ #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 @@ -1062,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 @@ -1081,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 @@ -1156,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 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1182,6 +1265,8 @@ #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 @@ -1353,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 { (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 /** @@ -1723,11 +1808,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1826,6 +1918,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1874,6 +1972,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1919,6 +2026,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1932,10 +2040,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1948,6 +2052,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 * @@ -1973,11 +2081,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 @@ -2002,7 +2110,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(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 71% rename from Marlin/src/config/examples/SCARA/Configuration_adv.h rename to config/examples/SCARA/Configuration_adv.h index d03ae78bee17..3f42ee9d2857 100644 --- a/Marlin/src/config/examples/SCARA/Configuration_adv.h +++ b/config/examples/SCARA/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 3000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -483,11 +552,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +718,13 @@ #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 @@ -595,7 +749,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +784,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +902,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +954,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +984,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1020,7 @@ */ //#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. @@ -853,12 +1029,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1065,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 @@ -915,13 +1095,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1106,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 @@ -940,11 +1115,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 @@ -1124,6 +1305,7 @@ //#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 @@ -1174,6 +1356,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. @@ -1201,127 +1384,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #if AXIS_IS_TMC(E1) + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + #define E1_RSENSE 0.11 + #endif - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E2) + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + #define E2_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #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 - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1595,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1636,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1647,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1670,7 @@ #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. @@ -1399,7 +1692,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 @@ -1411,27 +1704,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1724,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define 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 - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1903,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2017,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2120,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2274,83 @@ #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/config/examples/STM32/Black_STM32F407VET6/Configuration.h b/config/examples/STM32/Black_STM32F407VET6/Configuration.h new file mode 100644 index 000000000000..978acbf91d3f --- /dev/null +++ b/config/examples/STM32/Black_STM32F407VET6/Configuration.h @@ -0,0 +1,2127 @@ +/** + * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif +#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 + +// 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 + +// 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 + +// 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 + +//=========================================================================== +//============================= 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 +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif + +/** + * Enable one or more of the following if probing seems unreliable. + * Heaters and/or fans can be disabled during probing to minimize electrical + * noise. A delay can also be added to allow noise and vibration to settle. + * These options are most useful for the BLTouch probe, but may also improve + * readings with inductive probes and piezo sensors. + */ +//#define PROBING_HEATERS_OFF // Turn heaters off when probing +#if ENABLED(PROBING_HEATERS_OFF) + //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) +#endif +//#define PROBING_FANS_OFF // Turn fans off when probing +//#define 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 + +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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. +// :[0,1,2,3,4,5,6,7] +#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/default/Configuration_adv.h b/config/examples/STM32/Black_STM32F407VET6/Configuration_adv.h old mode 100755 new mode 100644 similarity index 71% rename from Marlin/src/config/default/Configuration_adv.h rename to config/examples/STM32/Black_STM32F407VET6/Configuration_adv.h index e9ee032b714b..e1d82bca2b27 --- a/Marlin/src/config/default/Configuration_adv.h +++ b/config/examples/STM32/Black_STM32F407VET6/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -236,8 +295,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 @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -483,11 +552,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +718,13 @@ #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 @@ -595,7 +749,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +784,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +902,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +954,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +984,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1020,7 @@ */ //#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. @@ -853,11 +1029,11 @@ #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. // Note: Extra time may be added to mitigate controller latency. - #endif - - //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. + //#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 @@ -887,13 +1063,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 @@ -916,13 +1093,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -933,7 +1104,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 @@ -941,11 +1113,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 @@ -1125,6 +1303,7 @@ //#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 @@ -1175,6 +1354,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. @@ -1202,127 +1382,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #if AXIS_IS_TMC(E1) + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + #define E1_RSENSE 0.11 + #endif - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E2) + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + #define E2_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #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 - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1332,13 +1593,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1346,7 +1634,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1357,9 +1645,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1379,6 +1668,7 @@ #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. @@ -1400,7 +1690,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 @@ -1412,27 +1702,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1449,62 +1722,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define 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 - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1544,12 +1901,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1640,11 +2015,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1748,35 +2118,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1898,7 +2272,83 @@ #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/STM32F10/Configuration.h b/config/examples/STM32/STM32F10/Configuration.h similarity index 87% rename from Marlin/src/config/examples/STM32F10/Configuration.h rename to config/examples/STM32/STM32F10/Configuration.h index 0c4fadc32d59..abe8d54c4be5 100644 --- a/Marlin/src/config/examples/STM32F10/Configuration.h +++ b/config/examples/STM32/STM32F10/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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" } */ #warning temp_sensor set to 998/999 (fake) #define TEMP_SENSOR_0 999 @@ -345,37 +402,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -388,10 +442,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - #define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + #define PID_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 @@ -417,7 +472,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -503,6 +558,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 ========================= @@ -581,8 +637,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -670,6 +727,14 @@ #define DEFAULT_RETRACT_ACCELERATION 5000 // 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 @@ -678,10 +743,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 13.0 -#define DEFAULT_YJERK 13.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 13.0 + #define DEFAULT_YJERK 13.0 + #define DEFAULT_ZJERK 0.3 +#endif + +#define DEFAULT_EJERK 5.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -710,11 +778,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -724,11 +792,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -763,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) @@ -853,6 +929,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -961,7 +1040,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 @@ -979,6 +1058,9 @@ #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 @@ -1051,7 +1133,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 @@ -1070,13 +1152,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 @@ -1145,7 +1228,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 @@ -1171,6 +1254,8 @@ #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 @@ -1342,10 +1427,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 /** @@ -1712,11 +1797,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1815,6 +1907,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1863,6 +1961,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1908,6 +2015,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1921,10 +2029,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1937,6 +2041,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 * @@ -1962,11 +2070,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 @@ -1991,7 +2099,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(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 87% rename from Marlin/src/config/examples/STM32F4/Configuration.h rename to config/examples/STM32/STM32F4/Configuration.h index 9b2b35788c85..49b92aefd13c 100644 --- a/Marlin/src/config/examples/STM32F4/Configuration.h +++ b/config/examples/STM32/STM32F4/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -416,7 +471,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -501,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 ========================= @@ -579,8 +635,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -668,6 +725,14 @@ #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 @@ -676,10 +741,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -708,11 +776,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -722,11 +790,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -761,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) @@ -851,6 +927,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -959,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 @@ -977,6 +1056,9 @@ #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 @@ -1049,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 @@ -1068,13 +1150,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 @@ -1143,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 @@ -1169,6 +1252,8 @@ #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 @@ -1340,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 /** @@ -1710,11 +1795,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1813,6 +1905,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1861,6 +1959,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1906,6 +2013,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1919,10 +2027,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1935,6 +2039,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 * @@ -1960,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 @@ -1989,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(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 87% rename from Marlin/src/config/examples/stm32f103ret6/Configuration.h rename to config/examples/STM32/stm32f103ret6/Configuration.h index 16b2ffc4e49b..ba17e68c1492 100644 --- a/Marlin/src/config/examples/stm32f103ret6/Configuration.h +++ b/config/examples/STM32/stm32f103ret6/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #define MIXING_STEPPERS 3 // Number of steppers in your mixing extruder #define MIXING_VIRTUAL_TOOLS 16 // Use the Virtual Tool method with M163 and M164 //#define DIRECT_MIXING_IN_G1 // Allow ABCDHI mix factors in G1 movement commands + //#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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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" } */ #warning temp_sensor set to 998/999 (fake) #define TEMP_SENSOR_0 999 @@ -345,37 +402,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -388,10 +442,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - #define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + #define PID_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 @@ -417,7 +472,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -503,6 +558,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 ========================= @@ -581,8 +637,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -670,6 +727,14 @@ #define DEFAULT_RETRACT_ACCELERATION 5000 // 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 @@ -678,10 +743,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 13.0 -#define DEFAULT_YJERK 13.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 13.0 + #define DEFAULT_YJERK 13.0 + #define DEFAULT_ZJERK 0.3 +#endif + +#define DEFAULT_EJERK 5.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -710,11 +778,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -724,11 +792,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -763,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) @@ -853,6 +929,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -961,7 +1040,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 @@ -979,6 +1058,9 @@ #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 @@ -1051,7 +1133,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 @@ -1070,13 +1152,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 @@ -1145,7 +1228,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 @@ -1171,6 +1254,8 @@ #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 @@ -1342,10 +1427,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 /** @@ -1712,11 +1797,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1815,6 +1907,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1863,6 +1961,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1908,6 +2015,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1921,10 +2029,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1937,6 +2041,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 * @@ -1962,11 +2070,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 @@ -1991,7 +2099,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(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 88% rename from Marlin/src/config/examples/Sanguinololu/Configuration.h rename to config/examples/Sanguinololu/Configuration.h index e6295d115ce8..8fcfb0b6b4ec 100644 --- a/Marlin/src/config/examples/Sanguinololu/Configuration.h +++ b/config/examples/Sanguinololu/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -416,7 +471,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -501,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 ========================= @@ -579,8 +635,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -699,6 +756,14 @@ #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 @@ -707,10 +772,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -739,11 +807,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -753,11 +821,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -792,6 +857,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) @@ -882,6 +958,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -990,7 +1069,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 @@ -1008,6 +1087,9 @@ #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 @@ -1080,7 +1162,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 @@ -1099,13 +1181,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 @@ -1174,7 +1257,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 @@ -1200,6 +1283,8 @@ #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 @@ -1371,10 +1456,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 /** @@ -1741,11 +1826,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1844,6 +1936,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1892,6 +1990,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1937,6 +2044,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1950,10 +2058,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1966,6 +2070,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 * @@ -1991,7 +2099,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 @@ -2020,7 +2128,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(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 71% rename from Marlin/src/config/examples/Sanguinololu/Configuration_adv.h rename to config/examples/Sanguinololu/Configuration_adv.h index 93449d3dbeb2..31760b84cd01 100644 --- a/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h +++ b/config/examples/Sanguinololu/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ //#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. @@ -853,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1068,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 @@ -915,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1109,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 @@ -940,11 +1118,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 @@ -1124,6 +1308,7 @@ //#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 @@ -1174,6 +1359,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. @@ -1201,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1598,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1673,7 @@ #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. @@ -1399,7 +1695,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 @@ -1411,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2020,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2123,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2277,83 @@ #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/TheBorg/Configuration.h b/config/examples/TheBorg/Configuration.h similarity index 87% rename from Marlin/src/config/examples/TheBorg/Configuration.h rename to config/examples/TheBorg/Configuration.h index 33974b0b0e10..dd6e1d845aca 100644 --- a/Marlin/src/config/examples/TheBorg/Configuration.h +++ b/config/examples/TheBorg/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 5 #define TEMP_SENSOR_1 0 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -416,7 +471,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -501,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 ========================= @@ -579,8 +635,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -668,6 +725,14 @@ #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 @@ -676,10 +741,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -708,11 +776,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -722,11 +790,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -761,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) @@ -851,6 +927,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -959,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 @@ -977,6 +1056,9 @@ #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 @@ -1049,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 @@ -1068,13 +1150,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 @@ -1143,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 @@ -1169,6 +1252,8 @@ #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 @@ -1340,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 /** @@ -1710,11 +1795,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1813,6 +1905,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1861,6 +1959,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1906,6 +2013,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1919,10 +2027,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1935,6 +2039,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 * @@ -1960,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 @@ -1989,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(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 71% rename from Marlin/src/config/examples/TheBorg/Configuration_adv.h rename to config/examples/TheBorg/Configuration_adv.h index c3ac042b5122..fbb3b0cba1c6 100644 --- a/Marlin/src/config/examples/TheBorg/Configuration_adv.h +++ b/config/examples/TheBorg/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #define THERMAL_PROTECTION_PERIOD 50 // Seconds #define THERMAL_PROTECTION_HYSTERESIS 6 // 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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ //#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. @@ -853,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1068,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 @@ -915,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1109,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 @@ -940,11 +1118,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 @@ -1124,6 +1308,7 @@ //#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 @@ -1174,6 +1359,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. @@ -1201,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1598,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1673,7 @@ #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. @@ -1399,7 +1695,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 @@ -1411,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2020,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2123,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2277,83 @@ #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/TinyBoy2/Configuration.h b/config/examples/TinyBoy2/Configuration.h similarity index 88% rename from Marlin/src/config/examples/TinyBoy2/Configuration.h rename to config/examples/TinyBoy2/Configuration.h index ea0f352169a1..cd89ad5a93d3 100644 --- a/Marlin/src/config/examples/TinyBoy2/Configuration.h +++ b/config/examples/TinyBoy2/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -196,6 +196,16 @@ //#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) @@ -206,25 +216,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -234,13 +271,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -256,6 +307,10 @@ #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). @@ -327,7 +382,9 @@ * 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 * @@ -346,7 +403,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 5 #define TEMP_SENSOR_1 0 @@ -371,37 +428,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -414,10 +468,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -453,7 +508,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -551,6 +606,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 ========================= @@ -630,8 +686,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -719,6 +776,14 @@ #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 @@ -727,10 +792,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -759,11 +827,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -773,11 +841,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -812,6 +877,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) @@ -902,6 +978,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -1015,7 +1094,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 @@ -1033,6 +1112,9 @@ #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 @@ -1105,7 +1187,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 +1206,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 +1282,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 +1308,8 @@ #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 +1481,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 /** @@ -1766,11 +1851,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1869,6 +1961,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1917,6 +2015,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1962,6 +2069,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1975,10 +2083,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1991,6 +2095,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 * @@ -2016,11 +2124,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 @@ -2045,7 +2153,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(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 71% rename from Marlin/src/config/examples/TinyBoy2/Configuration_adv.h rename to config/examples/TinyBoy2/Configuration_adv.h index ddfa10b4f81f..229f2aa6a62b 100644 --- a/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h +++ b/config/examples/TinyBoy2/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ //#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. @@ -853,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1068,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 @@ -915,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1109,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 @@ -940,11 +1118,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 @@ -1124,6 +1308,7 @@ //#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 @@ -1174,6 +1359,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. @@ -1201,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1598,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1673,7 @@ #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. @@ -1399,7 +1695,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 @@ -1411,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2020,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2123,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2277,83 @@ #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/X1/Configuration.h b/config/examples/Tronxy/X1/Configuration.h similarity index 87% rename from Marlin/src/config/examples/Tronxy/X1/Configuration.h rename to config/examples/Tronxy/X1/Configuration.h index 9efc861d0bad..b13a74ed42c7 100644 --- a/Marlin/src/config/examples/Tronxy/X1/Configuration.h +++ b/config/examples/Tronxy/X1/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 11 #define TEMP_SENSOR_1 0 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -416,7 +471,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -501,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 ========================= @@ -579,8 +635,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -668,6 +725,14 @@ #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 @@ -676,10 +741,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 20.0 -#define DEFAULT_YJERK 20.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 20.0 + #define DEFAULT_YJERK 20.0 + #define DEFAULT_ZJERK 0.3 +#endif + +#define DEFAULT_EJERK 5.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -708,11 +776,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -722,11 +790,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -761,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) @@ -851,6 +927,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -959,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 @@ -977,6 +1056,9 @@ #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 @@ -1049,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 @@ -1066,15 +1148,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 @@ -1143,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 @@ -1169,6 +1252,8 @@ #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 @@ -1340,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 /** @@ -1710,11 +1795,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1813,6 +1905,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1861,6 +1959,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1906,6 +2013,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1919,10 +2027,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1935,6 +2039,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 * @@ -1960,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 @@ -1989,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(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 87% rename from Marlin/src/config/examples/Tronxy/X3A/Configuration.h rename to config/examples/Tronxy/X3A/Configuration.h index bb2f3a8fa937..9a582268618c 100644 --- a/Marlin/src/config/examples/Tronxy/X3A/Configuration.h +++ b/config/examples/Tronxy/X3A/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 6 #define TEMP_SENSOR_1 0 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -416,7 +471,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -501,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 ========================= @@ -579,8 +635,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -668,6 +725,14 @@ #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 @@ -676,10 +741,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 15.0 -#define DEFAULT_YJERK 15.0 -#define DEFAULT_ZJERK 0.4 -#define DEFAULT_EJERK 5.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 15.0 + #define DEFAULT_YJERK 15.0 + #define DEFAULT_ZJERK 0.4 +#endif + +#define DEFAULT_EJERK 5.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -708,11 +776,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -722,11 +790,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -761,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) @@ -851,6 +927,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -963,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 @@ -981,6 +1060,9 @@ #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 @@ -1053,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 @@ -1072,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 3 @@ -1147,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 @@ -1173,6 +1256,8 @@ #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 @@ -1344,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 /** @@ -1714,11 +1799,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1817,6 +1909,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1865,6 +1963,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1910,6 +2017,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1923,10 +2031,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1939,6 +2043,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 * @@ -1964,11 +2072,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 @@ -1993,7 +2101,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(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 71% rename from Marlin/src/config/examples/Tronxy/X3A/Configuration_adv.h rename to config/examples/Tronxy/X3A/Configuration_adv.h index cc2db6b9fcad..fa44910ac5af 100644 --- a/Marlin/src/config/examples/Tronxy/X3A/Configuration_adv.h +++ b/config/examples/Tronxy/X3A/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ //#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. @@ -853,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1068,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 @@ -915,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1109,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 @@ -940,11 +1118,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 @@ -1124,6 +1308,7 @@ //#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 @@ -1174,6 +1359,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. @@ -1201,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1598,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1673,7 @@ #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. @@ -1399,7 +1695,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 @@ -1411,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2020,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2123,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2277,83 @@ #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/config/examples/Tronxy/X5S-2E/Configuration.h b/config/examples/Tronxy/X5S-2E/Configuration.h new file mode 100644 index 000000000000..a91d1a0f9699 --- /dev/null +++ b/config/examples/Tronxy/X5S-2E/Configuration.h @@ -0,0 +1,2148 @@ +/** + * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif +#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 + +// 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 + +// 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 + +// 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 + +//=========================================================================== +//============================= 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 +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif + +/** + * Enable one or more of the following if probing seems unreliable. + * Heaters and/or fans can be disabled during probing to minimize electrical + * noise. A delay can also be added to allow noise and vibration to settle. + * These options are most useful for the BLTouch probe, but may also improve + * readings with inductive probes and piezo sensors. + */ +//#define PROBING_HEATERS_OFF // Turn heaters off when probing +#if ENABLED(PROBING_HEATERS_OFF) + //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) +#endif +//#define PROBING_FANS_OFF // Turn fans off when probing +//#define 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 + +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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. +// :[0,1,2,3,4,5,6,7] +#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 000000000000..25bdc243c927 --- /dev/null +++ b/config/examples/Tronxy/X5S-2E/Configuration_adv.h @@ -0,0 +1,2359 @@ +/** + * 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 + +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#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) + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. + //#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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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 + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif + +#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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // 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 88% rename from Marlin/src/config/examples/Tronxy/X5S/Configuration.h rename to config/examples/Tronxy/X5S/Configuration.h index 2bd0f9f111c6..381b760d9f13 100644 --- a/Marlin/src/config/examples/Tronxy/X5S/Configuration.h +++ b/config/examples/Tronxy/X5S/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -388,9 +442,9 @@ #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) #define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -416,7 +470,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -501,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 ========================= @@ -579,8 +634,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -668,6 +724,14 @@ #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 @@ -676,10 +740,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 18.0 -#define DEFAULT_YJERK 18.0 -#define DEFAULT_ZJERK 0.4 -#define DEFAULT_EJERK 5.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 18.0 + #define DEFAULT_YJERK 18.0 + #define DEFAULT_ZJERK 0.4 +#endif + +#define DEFAULT_EJERK 5.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -708,11 +775,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -722,11 +789,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -761,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) @@ -851,6 +926,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -959,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 @@ -977,6 +1055,9 @@ #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 @@ -1049,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 @@ -1068,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 @@ -1143,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 @@ -1169,6 +1251,8 @@ #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 @@ -1340,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 /** @@ -1710,11 +1794,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1813,6 +1904,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1861,6 +1958,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1906,6 +2012,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1919,10 +2026,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1935,6 +2038,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 * @@ -1960,11 +2067,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 @@ -1989,7 +2096,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(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 87% rename from Marlin/src/config/examples/Tronxy/XY100/Configuration.h rename to config/examples/Tronxy/XY100/Configuration.h index 023befcb05de..612942ead148 100644 --- a/Marlin/src/config/examples/Tronxy/XY100/Configuration.h +++ b/config/examples/Tronxy/XY100/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - #define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + #define PID_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 @@ -427,7 +482,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -512,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 ========================= @@ -590,8 +646,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -679,6 +736,14 @@ #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 @@ -687,10 +752,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 20.0 -#define DEFAULT_YJERK 20.0 -#define DEFAULT_ZJERK 0.4 -#define DEFAULT_EJERK 5.0 +#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 @@ -719,11 +787,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -733,11 +801,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -772,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) @@ -862,6 +938,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -970,7 +1049,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 @@ -988,6 +1067,9 @@ #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 @@ -1060,7 +1142,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 @@ -1079,13 +1161,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 @@ -1154,7 +1237,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 @@ -1180,6 +1263,8 @@ #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 @@ -1351,10 +1436,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 /** @@ -1721,11 +1806,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1824,6 +1916,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1872,6 +1970,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1917,6 +2024,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1930,10 +2038,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1946,6 +2050,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 * @@ -1971,11 +2079,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 @@ -2000,7 +2108,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(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 87% rename from Marlin/src/config/examples/UltiMachine/Archim1/Configuration.h rename to config/examples/UltiMachine/Archim1/Configuration.h index 1b8d9555f514..e95be76d2d2e 100644 --- a/Marlin/src/config/examples/UltiMachine/Archim1/Configuration.h +++ b/config/examples/UltiMachine/Archim1/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -416,7 +471,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -501,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 ========================= @@ -579,8 +635,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 DRV8825 #define Y_DRIVER_TYPE DRV8825 @@ -668,6 +725,14 @@ #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 @@ -676,10 +741,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -708,11 +776,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -722,11 +790,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -761,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) @@ -851,6 +927,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -959,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 @@ -977,6 +1056,9 @@ #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 @@ -1049,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 @@ -1068,13 +1150,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 @@ -1143,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 @@ -1169,6 +1252,8 @@ #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 @@ -1340,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 /** @@ -1710,11 +1795,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1813,6 +1905,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1861,6 +1959,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1906,6 +2013,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1919,10 +2027,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1935,6 +2039,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 * @@ -1960,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 @@ -1989,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(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 71% rename from Marlin/src/config/examples/UltiMachine/Archim1/Configuration_adv.h rename to config/examples/UltiMachine/Archim1/Configuration_adv.h index d24ee84baa53..1399b0272ba4 100644 --- a/Marlin/src/config/examples/UltiMachine/Archim1/Configuration_adv.h +++ b/config/examples/UltiMachine/Archim1/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ //#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. @@ -853,12 +1032,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 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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping #if ENABLED(BABYSTEP_ZPROBE_OFFSET) @@ -887,13 +1068,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 @@ -916,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -933,7 +1109,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 @@ -941,11 +1118,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 @@ -1125,6 +1308,7 @@ //#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 @@ -1175,6 +1359,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. @@ -1202,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #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 - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E1) + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + #define E1_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #if AXIS_IS_TMC(E2) + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + #define E2_RSENSE 0.11 + #endif - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1332,13 +1598,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1346,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1357,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1379,6 +1673,7 @@ #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. @@ -1400,7 +1695,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 @@ -1412,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1449,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1544,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1640,11 +2020,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1748,35 +2123,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1898,7 +2277,83 @@ #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/UltiMachine/Archim2/Configuration.h b/config/examples/UltiMachine/Archim2/Configuration.h similarity index 87% rename from Marlin/src/config/examples/UltiMachine/Archim2/Configuration.h rename to config/examples/UltiMachine/Archim2/Configuration.h index 26a93655a2ad..772f7e963ac6 100644 --- a/Marlin/src/config/examples/UltiMachine/Archim2/Configuration.h +++ b/config/examples/UltiMachine/Archim2/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -416,7 +471,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -501,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 ========================= @@ -579,8 +635,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 TMC2130 #define Y_DRIVER_TYPE TMC2130 @@ -668,6 +725,14 @@ #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 @@ -676,10 +741,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -708,11 +776,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -722,11 +790,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -761,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) @@ -851,6 +927,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -959,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 @@ -977,6 +1056,9 @@ #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 @@ -1049,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 @@ -1068,13 +1150,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 @@ -1143,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 @@ -1169,6 +1252,8 @@ #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 @@ -1340,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 /** @@ -1710,11 +1795,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1813,6 +1905,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1861,6 +1959,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1906,6 +2013,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1919,10 +2027,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1935,6 +2039,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 * @@ -1960,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 @@ -1989,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(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 71% rename from Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h rename to config/examples/UltiMachine/Archim2/Configuration_adv.h index 825a9216ef2d..dbc5eadfe12f 100644 --- a/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h +++ b/config/examples/UltiMachine/Archim2/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ //#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. @@ -853,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1068,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 @@ -915,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1109,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 @@ -940,11 +1118,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 @@ -1124,6 +1308,7 @@ //#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 @@ -1174,6 +1359,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. @@ -1201,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1598,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1673,7 @@ #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. @@ -1399,7 +1695,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 @@ -1411,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2020,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2123,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2277,83 @@ #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/config/examples/VORONDesign/Configuration.h b/config/examples/VORONDesign/Configuration.h new file mode 100644 index 000000000000..27be2081d82f --- /dev/null +++ b/config/examples/VORONDesign/Configuration.h @@ -0,0 +1,2136 @@ +/** + * 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 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_VORON +#endif + +// Optional custom name for your RepStrap or other custom machine +// Displayed in the LCD "Ready" message +#define CUSTOM_MACHINE_NAME "VORON 2.0" + +// 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 + +// 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif +#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, -18.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 5 +#define TEMP_SENSOR_1 5 +#define TEMP_SENSOR_2 0 +#define TEMP_SENSOR_3 0 +#define TEMP_SENSOR_4 0 +#define TEMP_SENSOR_5 0 +#define TEMP_SENSOR_BED 1 +#define TEMP_SENSOR_CHAMBER 0 + +// Dummy thermistor constant temperature readings, for use with 998 and 999 +#define DUMMY_THERMISTOR_998_VALUE 25 +#define DUMMY_THERMISTOR_999_VALUE 100 + +// Use temp sensor 1 as a redundant sensor with sensor 0. If the readings +// from the two sensors differ too much the print will be aborted. +//#define TEMP_SENSOR_1_AS_REDUNDANT +#define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 + +#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 + +// 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 + +// 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 + +//=========================================================================== +//============================= 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 + + // from VORON + #define DEFAULT_Kp 23.72 + #define DEFAULT_Ki 1.56 + #define DEFAULT_Kd 90.34 + +#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 205 // 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. + // Results from VORON + #define DEFAULT_bedKp 150.52 + #define DEFAULT_bedKi 12.25 + #define DEFAULT_bedKd 462.40 +#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 true // set to true to invert the logic of the endstop. +#define X_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. +#define Y_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. +#define Z_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. +#define Z_MIN_PROBE_ENDSTOP_INVERTING true // set to true to invert the logic of the probe. + +/** + * Stepper Drivers + * + * These settings allow Marlin to tune stepper driver timing and enable advanced options for + * stepper drivers that support them. You may also override timing options in Configuration_adv.h. + * + * A4988 is assumed for unspecified drivers. + * + * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, + * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, + * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, + * 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 DRV8825 +#define Y_DRIVER_TYPE DRV8825 +#define Z_DRIVER_TYPE DRV8825 +//#define X2_DRIVER_TYPE A4988 +//#define Y2_DRIVER_TYPE A4988 +//#define Z2_DRIVER_TYPE A4988 +//#define Z3_DRIVER_TYPE A4988 +#define E0_DRIVER_TYPE DRV8825 +#define E1_DRIVER_TYPE DRV8825 +//#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, 608, 608 } + +/** + * 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, 75, 75 } + +/** + * 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 , 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 20.0 + #define DEFAULT_YJERK 15.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 0 // 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 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 0 // Z Clearance for Deploy/Stow +#define Z_CLEARANCE_BETWEEN_PROBES 3 // 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 +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif + +/** + * Enable one or more of the following if probing seems unreliable. + * Heaters and/or fans can be disabled during probing to minimize electrical + * noise. A delay can also be added to allow noise and vibration to settle. + * These options are most useful for the BLTouch probe, but may also improve + * readings with inductive probes and piezo sensors. + */ +//#define PROBING_HEATERS_OFF // Turn heaters off when probing +#if ENABLED(PROBING_HEATERS_OFF) + //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) +#endif +//#define PROBING_FANS_OFF // Turn fans off when probing +//#define 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 false +#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 230 +#define Y_BED_SIZE 230 + +// 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 230 + +/** + * 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 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 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 15 + #define RIGHT_PROBE_BED_POSITION 200 + #define FRONT_PROBE_BED_POSITION 15 + #define BACK_PROBE_BED_POSITION 200 + + // 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 15 // Set Mesh bounds as an inset region of the bed + #define GRID_MAX_POINTS_X 12 // 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 2 + +// +// 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 + +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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. +// :[0,1,2,3,4,5,6,7] +#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 3 // Servo index starts with 0 for M280 command + +// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle. +// 300ms is a good value but you can try less delay. +// If the servo can't reach the requested position, increase it. +#define SERVO_DELAY { 300 } + +// Only power servos during movement, otherwise leave off to prevent jitter +//#define DEACTIVATE_SERVOS_AFTER_MOVE + +// Allow servo angle to be edited and saved to EEPROM +//#define EDITABLE_SERVO_ANGLES diff --git a/config/examples/VORONDesign/Configuration_adv.h b/config/examples/VORONDesign/Configuration_adv.h new file mode 100644 index 000000000000..dd44aed40dae --- /dev/null +++ b/config/examples/VORONDesign/Configuration_adv.h @@ -0,0 +1,2359 @@ +/** + * 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 + +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#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) + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. + //#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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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 + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif + +#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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // 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/config/examples/VORONDesign/_Bootscreen.h b/config/examples/VORONDesign/_Bootscreen.h new file mode 100644 index 000000000000..cb2bef631fec --- /dev/null +++ b/config/examples/VORONDesign/_Bootscreen.h @@ -0,0 +1,81 @@ +/** + * 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 . + * + */ + +/** + * Made with Marlin Bitmap Converter + * http://marlinfw.org/tools/u8glib/converter.html + */ + +#define CUSTOM_BOOTSCREEN_BMPWIDTH 128 + +const unsigned char custom_start_bmp[] PROGMEM = { + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000001,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00011111,B11111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00111111,B11111111,B11111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B11111111,B11111111,B11111110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000011,B11111111,B11111111,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00001111,B11111111,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00011111,B11111111,B11111111,B11111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00111111,B11111110,B00111111,B00011111,B11110011,B10000000,B00011100,B00111111,B11110000,B00111111,B11111000,B00000111,B11111110,B00000111,B10000000,B00110000, + B00111111,B11111100,B01111110,B00111111,B11110011,B10000000,B00011100,B01111111,B11111100,B00111111,B11111100,B00001111,B11111111,B10000111,B11000000,B00110000, + B00111111,B11111100,B11111100,B01111111,B11110001,B11000000,B00011100,B11110000,B00011100,B00111000,B00011110,B00011110,B00000011,B10000111,B11100000,B00110000, + B00111111,B11111000,B11111100,B01111111,B11110001,B11000000,B00111000,B11100000,B00001110,B00111000,B00001110,B00011100,B00000001,B11000111,B11100000,B00110000, + B00111111,B11110001,B11111000,B11111111,B11110001,B11000000,B00111000,B11100000,B00001110,B00111000,B00001110,B00011100,B00000001,B11000111,B01110000,B00110000, + B00111111,B11110011,B11111001,B11111111,B11110000,B11100000,B00110000,B11100000,B00001110,B00111000,B00001110,B00011100,B00000001,B11000111,B01111000,B00110000, + B00111111,B11100011,B11110001,B11111111,B11110000,B11100000,B01110000,B11100000,B00001110,B00111000,B00001110,B00011100,B00000001,B11000111,B00111000,B00110000, + B00111111,B11000111,B11100011,B11111111,B11110000,B01110000,B01110000,B11100000,B00001110,B00111000,B00011110,B00011100,B00000001,B11000111,B00011100,B00110000, + B00111111,B11001111,B11100111,B11111111,B11110000,B01110000,B11100000,B11100000,B00001110,B00111111,B11111100,B00011100,B00000001,B11000111,B00011110,B00110000, + B00111111,B11111111,B11000111,B11111111,B11110000,B01110000,B11100000,B11100000,B00001110,B00111111,B11110000,B00011100,B00000001,B11000111,B00001110,B00110000, + B00111111,B11111111,B10001111,B11111111,B11110000,B00111000,B11000000,B11100000,B00001110,B00111000,B11100000,B00011100,B00000001,B11000111,B00001111,B00110000, + B00111111,B11111111,B10011111,B11001111,B11110000,B00111001,B11000000,B11100000,B00001110,B00111000,B11110000,B00011100,B00000001,B11000111,B00000111,B00110000, + B00111111,B11111111,B00011111,B10001111,B11110000,B00111001,B11000000,B11100000,B00001110,B00111000,B01111000,B00011100,B00000001,B11000111,B00000011,B10110000, + B00111111,B11111110,B00111111,B00011111,B11110000,B00011101,B10000000,B11100000,B00001110,B00111000,B00111000,B00011100,B00000001,B11000111,B00000011,B11110000, + B00111111,B11111110,B01111111,B00111111,B11110000,B00011111,B10000000,B11110000,B00011110,B00111000,B00011100,B00011110,B00000011,B10000111,B00000001,B11110000, + B00111111,B11111100,B01111110,B00111111,B11110000,B00001111,B00000000,B01111110,B11111100,B00111000,B00011110,B00001111,B10011111,B10000111,B00000000,B11110000, + B00111111,B11111000,B11111100,B01111111,B11110000,B00001111,B00000000,B00111111,B11111000,B00111000,B00001110,B00000111,B11111111,B00000111,B00000000,B11110000, + B00111111,B11111001,B11111100,B11111111,B11110000,B00000000,B00000000,B00000111,B11000000,B00000000,B00000000,B00000000,B11111000,B00000000,B00000000,B00000000, + B00111111,B11110001,B11111000,B11111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00011111,B11111111,B11111111,B11111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00001111,B11111111,B11111111,B11111111,B11000011,B11110000,B00000001,B11110000,B00000000,B11110000,B00000000,B01100000,B00000001,B11110000,B00000011,B00010000, + B00000011,B11111111,B11111111,B11111111,B10000011,B00111000,B00000001,B10000000,B00000001,B10000000,B00000000,B01100000,B00000011,B00000000,B00000011,B00011000, + B00000000,B11111111,B11111111,B11111110,B00000011,B00011000,B00000001,B00000000,B00000001,B00000000,B00000000,B01100000,B00000010,B00000000,B00000011,B10011000, + B00000000,B01111111,B11111111,B11111000,B00000011,B00011000,B00000001,B11100000,B00000001,B11100000,B00000000,B01100000,B00000010,B01110000,B00000010,B11011000, + B00000000,B00011111,B11111111,B11110000,B00000011,B00011000,B00000001,B11100000,B00000000,B11110000,B00000000,B01100000,B00000010,B01110000,B00000010,B11011000, + B00000000,B00000111,B11111111,B11000000,B00000011,B00011000,B00000001,B00000000,B00000000,B00011000,B00000000,B01100000,B00000010,B00010000,B00000010,B01111000, + B00000000,B00000011,B11111111,B00000000,B00000011,B00011000,B00000001,B00000000,B00000000,B00010000,B00000000,B01100000,B00000010,B00010000,B00000010,B00111000, + B00000000,B00000000,B11111100,B00000000,B00000011,B11110000,B00000001,B11110000,B00000001,B11110000,B00000000,B01100000,B00000011,B11110000,B00000010,B00111000, + B00000000,B00000000,B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000 +}; diff --git a/Marlin/src/config/examples/Velleman/K8200/Configuration.h b/config/examples/Velleman/K8200/Configuration.h similarity index 88% rename from Marlin/src/config/examples/Velleman/K8200/Configuration.h rename to config/examples/Velleman/K8200/Configuration.h index a35a677668a6..2cf1d85c6bfb 100644 --- a/Marlin/src/config/examples/Velleman/K8200/Configuration.h +++ b/config/examples/Velleman/K8200/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -194,6 +194,16 @@ //#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) @@ -204,25 +214,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -232,13 +269,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -254,6 +305,10 @@ #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). @@ -325,7 +380,9 @@ * 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 * @@ -344,7 +401,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 5 #define TEMP_SENSOR_1 0 @@ -364,37 +421,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -407,10 +461,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -440,7 +495,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -531,6 +586,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 ========================= @@ -609,8 +665,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -697,6 +754,14 @@ #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 @@ -705,10 +770,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -737,11 +805,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -751,11 +819,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -790,6 +855,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) @@ -880,6 +956,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -989,7 +1068,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 @@ -1007,6 +1086,9 @@ #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 @@ -1079,7 +1161,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 @@ -1098,13 +1180,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 @@ -1173,7 +1256,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 @@ -1199,6 +1282,8 @@ #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 @@ -1370,10 +1455,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 /** @@ -1743,11 +1828,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1846,6 +1938,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1896,6 +1994,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1941,6 +2048,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1954,10 +2062,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1970,6 +2074,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 * @@ -1995,11 +2103,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 @@ -2024,7 +2132,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(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 71% rename from Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h rename to config/examples/Velleman/K8200/Configuration_adv.h index 3bd6011ebea7..b699e496eaef 100644 --- a/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h +++ b/config/examples/Velleman/K8200/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -59,6 +59,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -87,6 +100,11 @@ #define THERMAL_PROTECTION_PERIOD 60 // Seconds #define THERMAL_PROTECTION_HYSTERESIS 8 // 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 @@ -120,9 +138,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -235,6 +267,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 /** @@ -371,31 +430,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 @@ -414,6 +482,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 @@ -446,8 +515,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 @@ -471,8 +540,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 @@ -496,11 +568,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -584,6 +734,13 @@ #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 @@ -608,7 +765,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -643,8 +800,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -758,7 +918,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -799,19 +970,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -829,8 +1000,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -858,6 +1036,7 @@ */ #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. @@ -866,12 +1045,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -899,13 +1081,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 @@ -928,13 +1111,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -945,7 +1122,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 @@ -953,11 +1131,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 @@ -1137,6 +1321,7 @@ //#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 @@ -1187,6 +1372,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. @@ -1214,127 +1400,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1344,13 +1611,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1358,7 +1652,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1369,9 +1663,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1391,6 +1686,7 @@ #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. @@ -1412,7 +1708,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 @@ -1424,27 +1720,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1461,62 +1740,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1556,12 +1919,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1652,11 +2033,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1760,35 +2136,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1910,7 +2290,83 @@ #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/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 87% rename from Marlin/src/config/examples/Velleman/K8400/Configuration.h rename to config/examples/Velleman/K8400/Configuration.h index 82b9c3901e71..262dbfce16e9 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Configuration.h +++ b/config/examples/Velleman/K8400/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 5 #define TEMP_SENSOR_1 0 @@ -344,37 +401,34 @@ //#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. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +#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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -416,7 +471,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -501,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 ========================= @@ -579,8 +635,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -668,6 +725,14 @@ #define DEFAULT_RETRACT_ACCELERATION 6000 // 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 @@ -676,10 +741,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.5 -#define DEFAULT_EJERK 20.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 10.0 + #define DEFAULT_YJERK 10.0 + #define DEFAULT_ZJERK 0.5 +#endif + +#define DEFAULT_EJERK 20.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -708,11 +776,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -722,11 +790,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -761,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) @@ -851,6 +927,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -959,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 @@ -977,6 +1056,9 @@ #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 @@ -1049,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 @@ -1068,13 +1150,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 @@ -1143,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 @@ -1169,6 +1252,8 @@ #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 @@ -1340,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 /** @@ -1710,11 +1795,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1813,6 +1905,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1861,6 +1959,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1906,6 +2013,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1919,10 +2027,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1935,6 +2039,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 * @@ -1960,7 +2068,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 @@ -1990,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(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 71% rename from Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h rename to config/examples/Velleman/K8400/Configuration_adv.h index c2834f578581..7467f03691d5 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h +++ b/config/examples/Velleman/K8400/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 1000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ //#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. @@ -853,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1068,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 @@ -915,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1109,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 @@ -940,11 +1118,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 @@ -1124,6 +1308,7 @@ //#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 @@ -1174,6 +1359,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. @@ -1201,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1598,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1673,7 @@ #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. @@ -1399,7 +1695,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 @@ -1411,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2020,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2123,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2277,83 @@ #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/Velleman/K8400/Dual-head/Configuration.h b/config/examples/Velleman/K8400/Dual-head/Configuration.h similarity index 87% rename from Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h rename to config/examples/Velleman/K8400/Dual-head/Configuration.h index 1bfbb735a8fc..7cf031922af5 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h +++ b/config/examples/Velleman/K8400/Dual-head/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 5 #define TEMP_SENSOR_1 5 @@ -344,37 +401,34 @@ //#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. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +#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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -416,7 +471,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -501,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 ========================= @@ -579,8 +635,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -668,6 +725,14 @@ #define DEFAULT_RETRACT_ACCELERATION 6000 // 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 @@ -676,10 +741,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.4 -#define DEFAULT_EJERK 20.0 +#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 @@ -708,11 +776,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -722,11 +790,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -761,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) @@ -851,6 +927,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -959,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 @@ -977,6 +1056,9 @@ #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 @@ -1049,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 @@ -1068,13 +1150,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 @@ -1143,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 @@ -1169,6 +1252,8 @@ #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 @@ -1340,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 /** @@ -1710,11 +1795,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1813,6 +1905,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1861,6 +1959,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1906,6 +2013,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1919,10 +2027,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1935,6 +2039,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 * @@ -1960,7 +2068,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 @@ -1990,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(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/config/examples/WASP/PowerWASP/Configuration.h b/config/examples/WASP/PowerWASP/Configuration.h new file mode 100644 index 000000000000..c6d9db2f577a --- /dev/null +++ b/config/examples/WASP/PowerWASP/Configuration.h @@ -0,0 +1,2146 @@ +/** + * 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 "(Julian + Jason)" // 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 3 +/** Internal onboard port for WASP + + * (Top view) + + * .------------.---------------------. + + * | | Arduino Serial3 | + + * | Stepper | [O] 5V | Front + + * | drivers | [O] GND | panel + + * | & fan | [O] TX | side + + * | | [O] RX | + + * `------------´---------------------´ + + */ + +/** + * 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_ULTIMAKER +#endif + +// Optional custom name for your RepStrap or other custom machine +// Displayed in the LCD "Ready" message +#define CUSTOM_MACHINE_NAME " PowerWASP is " + +// Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines) +// You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4) +//#define MACHINE_UUID "00000000-0000-0000-0000-000000000000" + +// @section extruder + +// This defines the number of extruders +// :[1, 2, 3, 4, 5, 6] +#define EXTRUDERS 1 + +// Generally expected filament diameter (1.75, 2.85, 3.0, ...). Used for Volumetric, Filament Width Sensor, etc. +#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75 + +// For Cyclops or any "multi-extruder" that shares a single nozzle. +//#define SINGLENOZZLE + +/** + * Průša MK2 Single Nozzle Multi-Material Multiplexer, and variants. + * + * This device allows one stepper driver on a control board to drive + * two to eight stepper motors, one at a time, in a manner suitable + * for extruders. + * + * This option only allows the multiplexer to switch on tool-change. + * Additional options to configure custom E moves are pending. + */ +//#define MK2_MULTIPLEXER +#if ENABLED(MK2_MULTIPLEXER) + // Override the default DIO selector pins here, if needed. + // Some pins files may provide defaults for these pins. + //#define E_MUX0_PIN 40 // Always Required + //#define E_MUX1_PIN 42 // Needed for 3 to 8 inputs + //#define E_MUX2_PIN 44 // Needed for 5 to 8 inputs +#endif + +/** + * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif +#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 0 +#define TEMP_SENSOR_CHAMBER 0 + +// Dummy thermistor constant temperature readings, for use with 998 and 999 +#define DUMMY_THERMISTOR_998_VALUE 25 +#define DUMMY_THERMISTOR_999_VALUE 100 + +// Use temp sensor 1 as a redundant sensor with sensor 0. If the readings +// from the two sensors differ too much the print will be aborted. +//#define TEMP_SENSOR_1_AS_REDUNDANT +#define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 + +#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 + +#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 + +// 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 + +// 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 + +//=========================================================================== +//============================= 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 + + // POWERwasp + #define DEFAULT_Kp 27.56 + #define DEFAULT_Ki 5.34 + #define DEFAULT_Kd 35.56 + + // 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 500 + +//=========================================================================== +//======================== Thermal Runaway Protection ======================= +//=========================================================================== + +/** + * Thermal Protection provides additional protection to your printer from damage + * and fire. Marlin always includes safe min and max temperature ranges which + * protect against a broken or disconnected thermistor wire. + * + * The issue: If a thermistor falls out, it will report the much lower + * temperature of the air in the room, and the the firmware will keep + * the heater on. + * + * If you get "Thermal Runaway" or "Heating failed" errors the + * details can be tuned in Configuration_adv.h + */ + +#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders +#define THERMAL_PROTECTION_BED // Enable thermal protection for the heated bed +#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 true // set to true to invert the logic of the endstop. +#define Y_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. +#define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. +#define Z_MIN_PROBE_ENDSTOP_INVERTING true // set to true to invert the logic of the probe. + +/** + * Stepper Drivers + * + * These settings allow Marlin to tune stepper driver timing and enable advanced options for + * stepper drivers that support them. You may also override timing options in Configuration_adv.h. + * + * A4988 is assumed for unspecified drivers. + * + * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, + * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, + * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, + * 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 { 85.48,85.48,533.33,104.7 } + +/** + * Default Max Feed Rate (mm/s) + * Override with M203 + * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] + */ +#define DEFAULT_MAX_FEEDRATE { 150, 150, 15, 20 } + +/** + * 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 { 10000, 10000, 50, 500 } + +/** + * Default Acceleration (change/s) change = mm/s + * Override with M204 + * + * M204 P Acceleration + * M204 R Retract Acceleration + * M204 T Travel Acceleration + */ +#define DEFAULT_ACCELERATION 4000 // X, Y, Z and E acceleration for printing moves +#define DEFAULT_RETRACT_ACCELERATION 500 // 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 15.0 + #define DEFAULT_YJERK 15.0 + #define DEFAULT_ZJERK 0.5 +#endif + +#define DEFAULT_EJERK 1.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 1000 + +// 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 +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif + +/** + * Enable one or more of the following if probing seems unreliable. + * Heaters and/or fans can be disabled during probing to minimize electrical + * noise. A delay can also be added to allow noise and vibration to settle. + * These options are most useful for the BLTouch probe, but may also improve + * readings with inductive probes and piezo sensors. + */ +//#define PROBING_HEATERS_OFF // Turn heaters off when probing +#if ENABLED(PROBING_HEATERS_OFF) + //#define WAIT_FOR_BED_HEATER // Wait for bed to heat back up between probes (to improve accuracy) +#endif +//#define PROBING_FANS_OFF // Turn fans off when probing +//#define 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 false +#define INVERT_Z_DIR true + +// @section extruder + +// For direct drive extruder v9 set to true, for geared extruder set to false. +#define INVERT_E0_DIR false +#define INVERT_E1_DIR false +#define INVERT_E2_DIR false +#define INVERT_E3_DIR false +#define INVERT_E4_DIR false +#define INVERT_E5_DIR false + +// @section homing + +//#define NO_MOTION_BEFORE_HOMING // Inhibit movement until all axes have been homed + +//#define UNKNOWN_Z_NO_RAISE // Don't raise Z (lower the bed) if Z is "unknown." For beds that fall when Z is powered off. + +//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ... + // Be sure you have this distance over your Z_MAX_POS in case. + +// Direction of endstops when homing; 1=MAX, -1=MIN +// :[-1,1] +#define X_HOME_DIR -1 +#define Y_HOME_DIR -1 +#define Z_HOME_DIR 1 + +// @section machine + +// The size of the print bed +#define X_BED_SIZE 261 +#define Y_BED_SIZE 193 + +// 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 191.9 + +/** + * 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 (8*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 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), 190 } + #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 + +/** + * 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 WESTERN + +/** + * 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 20 +#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 + +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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. +// :[0,1,2,3,4,5,6,7] +#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 3 // Servo index starts with 0 for M280 command + +// Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle. +// 300ms is a good value but you can try less delay. +// If the servo can't reach the requested position, increase it. +#define SERVO_DELAY { 300 } + +// Only power servos during movement, otherwise leave off to prevent jitter +//#define DEACTIVATE_SERVOS_AFTER_MOVE + +// Allow servo angle to be edited and saved to EEPROM +//#define EDITABLE_SERVO_ANGLES diff --git a/config/examples/WASP/PowerWASP/Configuration_adv.h b/config/examples/WASP/PowerWASP/Configuration_adv.h new file mode 100644 index 000000000000..8bbce438c0ac --- /dev/null +++ b/config/examples/WASP/PowerWASP/Configuration_adv.h @@ -0,0 +1,2359 @@ +/** + * 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 + +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#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) + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. + //#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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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 + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif + +#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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // 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/config/examples/WASP/PowerWASP/README.md b/config/examples/WASP/PowerWASP/README.md new file mode 100644 index 000000000000..9ae7646d36ba --- /dev/null +++ b/config/examples/WASP/PowerWASP/README.md @@ -0,0 +1,72 @@ +# Modifications to PowerWASP firmware with a few extras +The later versions of the PowerWASP controller board have power loss detection on pin 65 (low on loss). this has been configured in POWER_LOSS_RECOVERY. Because of this there is no need to save each command line just in case of a power loss to the machine. The board will hold enough power to allow the print to be saved to the SD card. + +The retract position on finishing the print has been set at Z190 X0 Y0 + +There are provisions made here to use ESP3D wireless printer control. + +https://github.com/luc-github/ESP3D + +The original PowerWASP board has available a internal serial port connection with Arduino Serial3. +The connections are as follows: +``` +.------------.---------------------. +| | Serial3 | +| | [O] 5V | Front +| FAN | [O] GND | panel +| | [O] TX | side +| | [O] RX | +`------------´---------------------´ +``` + +With the option of wireless file upload to the SD card, the idea of updating the Firmware +from the SD can also be useful. This option has been selected, but requires a modified boot loader +that can be found here: + +https://github.com/rainerumrobotics/MicroBridge-Arduino-ATMega2560 + +USB and SDCARD Firmware flashing for the ARDUINO ATMEGA 2560 and ADK +--------------------------------------------------------------------- +The bootloader looks for byte in eeprom at address 0x3FF: + + -if it is set to 0xF0 bootloader will look for a bin file on the sdcard named + firmware.bin and use it to flash the firmware then reset the byte to 0xFF so it + does this only once + + -otherwise no action is taken and bootloader works as a arduino bootloader except + some of the debugging functions are missing + +Setup + + ADAFruit micro sdcard 5V ready: + + SDCARD on ATMEGA 2560 or ADK + + pin 50 - DO + + pin 51 - DI + + pin 52 - CLK + + pin 53 - CS + +Generate BIN file for firmware update: + +To generate a bin file you need issue the following command on you apps elf executable: + + avr-objcopy -I elf32-avr -O binary firmware.cpp.elf firmware.bin + +this generates firmware.bin which can be put on the sd for flashing your firmware. You can find the elf +file in you apps build directory. + +Using olimex usb to upload bootloader: + + avrdude -c stk500v2 -p m2560 -P /dev/tty.usbmodemfd131 -B 500 -e -u -U lock:w:0x3F:m -U efuse:w:0xFD:m -U hfuse:w:0xD8:m -U efuse:w:0xFF:m -F + + avrdude -p m2560 -c stk500v2 -P /dev/tty.usbmodemfa131 -F -U flash:w:stk500boot.hex -b 115200 -B1 -U lock:w:0x0F:m + + avrdude -p m168 -c usbtiny -e -u -U lock:w:0x3f:m -U efuse:w:0x00:m -U hfuse:w:0xDD:m -U lfuse:w:0xFF:m + + + avrdude -p m2560 -c stk500v2 -P /dev/tty.usbmodemfd131 -U flash:w:stk500boot_v2_mega2560.hex -U lock:w:0x0F:m -v + avrdude -c stk500v2 -p m2560 -P /dev/tty.usbmodemfd131 -U lock:w:0x3F:m -U efuse:w:0xFD:m -U hfuse:w:0xD8:m -U lfuse:w:0xFF:m -e -v diff --git a/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration.h b/config/examples/Wanhao/Duplicator 6/Configuration.h similarity index 87% rename from Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration.h rename to config/examples/Wanhao/Duplicator 6/Configuration.h index 545b7a26dc12..a52db9f8ada0 100644 --- a/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration.h +++ b/config/examples/Wanhao/Duplicator 6/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 20 #define TEMP_SENSOR_1 0 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - #define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + #define PID_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 @@ -421,7 +476,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -511,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 ========================= @@ -589,8 +645,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -678,6 +735,14 @@ #define DEFAULT_RETRACT_ACCELERATION 1500 // 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 @@ -686,10 +751,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 1.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 10.0 + #define DEFAULT_YJERK 10.0 + #define DEFAULT_ZJERK 0.3 +#endif + +#define DEFAULT_EJERK 1.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -718,11 +786,11 @@ //#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -732,11 +800,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -771,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) @@ -861,6 +937,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -969,7 +1048,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 @@ -987,6 +1066,9 @@ #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 @@ -1059,7 +1141,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 @@ -1078,13 +1160,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 @@ -1153,7 +1236,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 @@ -1179,6 +1262,8 @@ #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 @@ -1350,10 +1435,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 /** @@ -1720,11 +1805,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1826,6 +1918,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1874,6 +1972,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1919,6 +2026,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1932,10 +2040,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1948,6 +2052,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 * @@ -1973,11 +2081,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 @@ -2002,7 +2110,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(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 71% rename from Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h rename to config/examples/Wanhao/Duplicator 6/Configuration_adv.h index 828241938c11..038622d82b4c 100644 --- a/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h +++ b/config/examples/Wanhao/Duplicator 6/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #define THERMAL_PROTECTION_PERIOD 60 // 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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -483,11 +552,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -573,6 +720,13 @@ #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 @@ -597,7 +751,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -632,8 +786,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -747,7 +904,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -788,19 +956,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -818,8 +986,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -847,6 +1022,7 @@ */ #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. @@ -855,12 +1031,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -888,13 +1067,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 @@ -917,13 +1097,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -934,7 +1108,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 @@ -942,11 +1117,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 @@ -1126,6 +1307,7 @@ //#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 @@ -1176,6 +1358,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. @@ -1203,127 +1386,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #if AXIS_IS_TMC(E1) + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + #define E1_RSENSE 0.11 + #endif - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E2) + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + #define E2_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #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 - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1333,13 +1597,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1347,7 +1638,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1358,9 +1649,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1380,6 +1672,7 @@ #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. @@ -1401,7 +1694,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 @@ -1413,27 +1706,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1450,62 +1726,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define 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 - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1545,12 +1905,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1641,11 +2019,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1749,35 +2122,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1899,7 +2276,83 @@ #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/adafruit/ST7565/Configuration.h b/config/examples/adafruit/ST7565/Configuration.h similarity index 87% rename from Marlin/src/config/examples/adafruit/ST7565/Configuration.h rename to config/examples/adafruit/ST7565/Configuration.h index 0be2b56fc625..f7d21c20131c 100644 --- a/Marlin/src/config/examples/adafruit/ST7565/Configuration.h +++ b/config/examples/adafruit/ST7565/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -416,7 +471,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -501,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 ========================= @@ -579,8 +635,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -668,6 +725,14 @@ #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 @@ -676,10 +741,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -708,11 +776,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -722,11 +790,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -761,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) @@ -851,6 +927,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -959,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 @@ -977,6 +1056,9 @@ #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 @@ -1049,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 @@ -1068,13 +1150,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 @@ -1143,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 @@ -1169,6 +1252,8 @@ #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 @@ -1340,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 /** @@ -1710,11 +1795,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1813,6 +1905,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1861,6 +1959,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1906,6 +2013,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1919,10 +2027,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1935,6 +2039,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 * @@ -1960,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 @@ -1989,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(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 87% rename from Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration.h rename to config/examples/delta/Anycubic/Kossel/Configuration.h index 5a577ddcd5f0..7a97646ae524 100644 --- a/Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration.h +++ b/config/examples/delta/Anycubic/Kossel/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -189,6 +189,16 @@ //#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) @@ -199,25 +209,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -227,13 +264,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -249,6 +300,10 @@ #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). @@ -320,7 +375,9 @@ * 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 * @@ -339,7 +396,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 5 #define TEMP_SENSOR_1 0 @@ -365,37 +422,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -408,10 +462,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - #define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + #define PID_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 @@ -442,7 +497,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -542,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 ========================= @@ -591,46 +647,46 @@ #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 - #define PROBE_MANUALLY_STEP 0.05 // (mm) + #define PROBE_MANUALLY_STEP 0.05 // (mm) #endif #if ENABLED(ANYCUBIC_KOSSEL_PLUS) // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). - #define DELTA_PRINTABLE_RADIUS 116.0 // (mm) + #define DELTA_PRINTABLE_RADIUS 116.0 // (mm) // Center-to-center distance of the holes in the diagonal push rods. - #define DELTA_DIAGONAL_ROD 267 // (mm) + #define DELTA_DIAGONAL_ROD 267 // (mm) // Horizontal offset from middle of printer to smooth rod center. - #define DELTA_SMOOTH_ROD_OFFSET 186 // (mm) + #define DELTA_SMOOTH_ROD_OFFSET 186 // (mm) // Horizontal offset of the universal joints on the end effector. - #define DELTA_EFFECTOR_OFFSET 31 // (mm) + #define DELTA_EFFECTOR_OFFSET 31 // (mm) // Horizontal offset of the universal joints on the carriages. - #define DELTA_CARRIAGE_OFFSET 20.6 // (mm) + #define DELTA_CARRIAGE_OFFSET 20.6 // (mm) // Horizontal distance bridged by diagonal push rods when effector is centered. - #define DELTA_RADIUS (DELTA_SMOOTH_ROD_OFFSET-(DELTA_EFFECTOR_OFFSET)-(DELTA_CARRIAGE_OFFSET)) //mm Get this value from auto calibrate + #define DELTA_RADIUS (DELTA_SMOOTH_ROD_OFFSET-(DELTA_EFFECTOR_OFFSET)-(DELTA_CARRIAGE_OFFSET)) // (mm) Get this value from G33 auto calibrate #else // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). - #define DELTA_PRINTABLE_RADIUS 90.0 // (mm) + #define DELTA_PRINTABLE_RADIUS 90.0 // (mm) // Center-to-center distance of the holes in the diagonal push rods. - #define DELTA_DIAGONAL_ROD 218.0 // (mm) + #define DELTA_DIAGONAL_ROD 218.0 // (mm) // Horizontal distance bridged by diagonal push rods when effector is centered. - #define DELTA_RADIUS 97.0 //mm Get this value from auto calibrate + #define DELTA_RADIUS 97.0 // (mm) Get this value from G33 auto calibrate #endif - // height from z=0 to home position - #define DELTA_HEIGHT 320.00 // get this value from auto calibrate + // Distance between bed and nozzle Z home position + #define DELTA_HEIGHT 320.00 // (mm) Get this value from G33 auto calibrate - #define DELTA_ENDSTOP_ADJ { 0.0, 0.0, 0.0 } // get these from auto calibrate + #define DELTA_ENDSTOP_ADJ { 0.0, 0.0, 0.0 } // Get these values from G33 auto calibrate // Trim adjustments for individual towers // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // measured in degrees anticlockwise looking from above the printer - #define DELTA_TOWER_ANGLE_TRIM { 0.0, 0.0, 0.0 } // get these values from auto calibrate + #define DELTA_TOWER_ANGLE_TRIM { 0.0, 0.0, 0.0 } // Get these values from G33 auto calibrate - // delta radius and diaginal rod adjustments measured in mm + // Delta radius and diagonal rod adjustments (mm) //#define DELTA_RADIUS_TRIM_TOWER { 0.0, 0.0, 0.0 } //#define DELTA_DIAGONAL_ROD_TRIM_TOWER { 0.0, 0.0, 0.0 } @@ -700,8 +756,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -798,6 +855,14 @@ #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 @@ -806,10 +871,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 5.0 -#define DEFAULT_YJERK DEFAULT_XJERK -#define DEFAULT_ZJERK DEFAULT_XJERK // Must be same as XY for delta -#define DEFAULT_EJERK DEFAULT_XJERK +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 5.0 + #define DEFAULT_YJERK DEFAULT_XJERK + #define DEFAULT_ZJERK DEFAULT_XJERK // Must be same as XY for delta +#endif + +#define DEFAULT_EJERK 5.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -840,11 +908,11 @@ #endif /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -854,11 +922,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -897,6 +962,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) @@ -1147,7 +1223,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 @@ -1165,6 +1241,9 @@ #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 @@ -1239,7 +1318,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 @@ -1258,13 +1337,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. @@ -1334,7 +1414,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 @@ -1360,6 +1440,8 @@ #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 @@ -1530,10 +1612,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 /** @@ -1900,11 +1982,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -2003,6 +2092,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -2051,6 +2146,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2096,6 +2200,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -2109,10 +2214,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -2125,6 +2226,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 * @@ -2150,11 +2255,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 +2284,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(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 71% rename from Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration_adv.h rename to config/examples/delta/Anycubic/Kossel/Configuration_adv.h index e3d2db162e0e..b383fcb9dca9 100644 --- a/Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration_adv.h +++ b/config/examples/delta/Anycubic/Kossel/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -485,11 +554,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -573,6 +720,13 @@ #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 @@ -597,7 +751,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -632,8 +786,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -747,7 +904,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -788,19 +956,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -818,8 +986,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -847,6 +1022,7 @@ */ #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. @@ -855,12 +1031,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -888,13 +1067,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 @@ -917,13 +1097,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -934,7 +1108,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 @@ -942,11 +1117,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 @@ -1126,6 +1307,7 @@ //#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 @@ -1176,6 +1358,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. @@ -1203,127 +1386,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #if AXIS_IS_TMC(E1) + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + #define E1_RSENSE 0.11 + #endif - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E2) + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + #define E2_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #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 - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1333,13 +1597,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1347,7 +1638,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1358,9 +1649,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1380,6 +1672,7 @@ #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. @@ -1401,7 +1694,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 @@ -1413,27 +1706,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1450,62 +1726,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define 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 - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1545,12 +1905,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1641,11 +2019,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1749,35 +2122,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1899,7 +2276,83 @@ #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/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 87% rename from Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration.h rename to config/examples/delta/FLSUN/auto_calibrate/Configuration.h index f7ae89e47a9d..d1ba36e9a83a 100644 --- a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration.h +++ b/config/examples/delta/FLSUN/auto_calibrate/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 5 #define TEMP_SENSOR_1 0 @@ -344,37 +401,34 @@ //#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. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 1 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - #define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + #define PID_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 @@ -421,7 +476,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -511,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 ========================= @@ -558,33 +614,33 @@ #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 - #define PROBE_MANUALLY_STEP 0.05 // (mm) + #define PROBE_MANUALLY_STEP 0.05 // (mm) #endif // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). - #define DELTA_PRINTABLE_RADIUS 85.0 // (mm) + #define DELTA_PRINTABLE_RADIUS 85.0 // (mm) // Center-to-center distance of the holes in the diagonal push rods. - #define DELTA_DIAGONAL_ROD 218.0 // (mm) + #define DELTA_DIAGONAL_ROD 218.0 // (mm) - // height from z=0 to home position - #define DELTA_HEIGHT 295.00 // get this value from auto calibrate + // Distance between bed and nozzle Z home position + #define DELTA_HEIGHT 295.00 // (mm) Get this value from G33 auto calibrate - #define DELTA_ENDSTOP_ADJ { 0.0, 0.0, 0.0 } // get these from auto calibrate + #define DELTA_ENDSTOP_ADJ { 0.0, 0.0, 0.0 } // Get these values from G33 auto calibrate // Horizontal distance bridged by diagonal push rods when effector is centered. - #define DELTA_RADIUS 101.0 //mm Get this value from auto calibrate + #define DELTA_RADIUS 101.0 // (mm) Get this value from G33 auto calibrate // Trim adjustments for individual towers // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // measured in degrees anticlockwise looking from above the printer - #define DELTA_TOWER_ANGLE_TRIM { 0.0, 0.0, 0.0 } // get these values from auto calibrate + #define DELTA_TOWER_ANGLE_TRIM { 0.0, 0.0, 0.0 } // Get these values from G33 auto calibrate - // delta radius and diaginal rod adjustments measured in mm + // Delta radius and diagonal rod adjustments (mm) //#define DELTA_RADIUS_TRIM_TOWER { 0.0, 0.0, 0.0 } //#define DELTA_DIAGONAL_ROD_TRIM_TOWER { 0.0, 0.0, 0.0 } @@ -652,8 +708,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -750,6 +807,14 @@ #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 @@ -758,10 +823,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK DEFAULT_XJERK -#define DEFAULT_ZJERK DEFAULT_XJERK // Must be same as XY for delta -#define DEFAULT_EJERK 5.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 10.0 + #define DEFAULT_YJERK DEFAULT_XJERK + #define DEFAULT_ZJERK DEFAULT_XJERK // Must be same as XY for delta +#endif + +#define DEFAULT_EJERK 5.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -790,11 +858,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -804,11 +872,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP // A3K leave disabled! +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -843,6 +908,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) @@ -979,6 +1055,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -1087,7 +1166,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,6 +1184,9 @@ #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 @@ -1177,7 +1259,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 @@ -1196,13 +1278,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. @@ -1272,7 +1355,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 @@ -1298,6 +1381,8 @@ #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 @@ -1468,10 +1553,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 /** @@ -1838,11 +1923,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1941,6 +2033,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1989,6 +2087,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2034,6 +2141,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -2047,10 +2155,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -2063,6 +2167,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 * @@ -2088,11 +2196,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 @@ -2117,7 +2225,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(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/auto_calibrate/Configuration_adv.h similarity index 71% rename from Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h rename to config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h index 10b67acfcc73..25a7ddbcdcce 100644 --- a/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h +++ b/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -485,11 +554,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -573,6 +720,13 @@ #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 @@ -597,7 +751,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -632,8 +786,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -747,7 +904,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -788,19 +956,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -818,8 +986,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -847,6 +1022,7 @@ */ //#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. @@ -855,12 +1031,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -888,13 +1067,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 @@ -917,13 +1097,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -934,7 +1108,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 @@ -942,11 +1117,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 @@ -1126,6 +1307,7 @@ //#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 @@ -1176,6 +1358,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. @@ -1203,127 +1386,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #if AXIS_IS_TMC(E1) + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + #define E1_RSENSE 0.11 + #endif - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E2) + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + #define E2_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #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 - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1333,13 +1597,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1347,7 +1638,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1358,9 +1649,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1380,6 +1672,7 @@ #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. @@ -1401,7 +1694,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 @@ -1413,27 +1706,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1450,62 +1726,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define 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 - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1545,12 +1905,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1641,11 +2019,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1749,35 +2122,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1899,7 +2276,83 @@ #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/delta/FLSUN/kossel/Configuration.h b/config/examples/delta/FLSUN/kossel/Configuration.h similarity index 87% rename from Marlin/src/config/examples/delta/FLSUN/kossel/Configuration.h rename to config/examples/delta/FLSUN/kossel/Configuration.h index d29c31148adb..3b01bfed5966 100644 --- a/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration.h +++ b/config/examples/delta/FLSUN/kossel/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 5 #define TEMP_SENSOR_1 0 @@ -344,37 +401,34 @@ //#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. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 1 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - #define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + #define PID_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 @@ -421,7 +476,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -511,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 ========================= @@ -558,33 +614,33 @@ #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) + #define DELTA_CALIBRATION_RADIUS 63 // (mm) // Set the steprate for papertest probing - #define PROBE_MANUALLY_STEP 0.05 // (mm) + #define PROBE_MANUALLY_STEP 0.05 // (mm) #endif // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). - #define DELTA_PRINTABLE_RADIUS 70.0 // (mm) + #define DELTA_PRINTABLE_RADIUS 70.0 // (mm) // Center-to-center distance of the holes in the diagonal push rods. - #define DELTA_DIAGONAL_ROD 218.0 // (mm) + #define DELTA_DIAGONAL_ROD 218.0 // (mm) - // height from z=0 to home position - #define DELTA_HEIGHT 317.94 // get this value from auto calibrate + // Distance between bed and nozzle Z home position + #define DELTA_HEIGHT 317.94 // (mm) Get this value from G33 auto calibrate - #define DELTA_ENDSTOP_ADJ { 0.0, 0.0, 0.0 } // get these from auto calibrate + #define DELTA_ENDSTOP_ADJ { 0.0, 0.0, 0.0 } // Get these values from G33 auto calibrate // Horizontal distance bridged by diagonal push rods when effector is centered. - #define DELTA_RADIUS 110.0 //mm Get this value from auto calibrate + #define DELTA_RADIUS 110.0 // (mm) Get this value from G33 auto calibrate // Trim adjustments for individual towers // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // measured in degrees anticlockwise looking from above the printer - #define DELTA_TOWER_ANGLE_TRIM { 0.0, 0.0, 0.0 } // get these values from auto calibrate + #define DELTA_TOWER_ANGLE_TRIM { 0.0, 0.0, 0.0 } // Get these values from G33 auto calibrate - // delta radius and diaginal rod adjustments measured in mm + // Delta radius and diagonal rod adjustments (mm) //#define DELTA_RADIUS_TRIM_TOWER { 0.0, 0.0, 0.0 } //#define DELTA_DIAGONAL_ROD_TRIM_TOWER { 0.0, 0.0, 0.0 } @@ -652,8 +708,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -750,6 +807,14 @@ #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 @@ -758,10 +823,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK DEFAULT_XJERK -#define DEFAULT_ZJERK DEFAULT_XJERK // Must be same as XY for delta -#define DEFAULT_EJERK 5.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 10.0 + #define DEFAULT_YJERK DEFAULT_XJERK + #define DEFAULT_ZJERK DEFAULT_XJERK // Must be same as XY for delta +#endif + +#define DEFAULT_EJERK 5.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -790,11 +858,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -804,11 +872,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP // A3K leave disabled! +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -843,6 +908,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) @@ -978,6 +1054,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -1086,7 +1165,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,6 +1183,9 @@ #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 @@ -1176,7 +1258,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 @@ -1193,15 +1275,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. @@ -1271,7 +1354,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 @@ -1297,6 +1380,8 @@ #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 @@ -1467,10 +1552,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 /** @@ -1837,11 +1922,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1940,6 +2032,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1988,6 +2086,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2033,6 +2140,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -2046,10 +2154,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -2062,6 +2166,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 * @@ -2087,11 +2195,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 @@ -2116,7 +2224,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(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/kossel/Configuration_adv.h similarity index 71% rename from Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h rename to config/examples/delta/FLSUN/kossel/Configuration_adv.h index 10b67acfcc73..25a7ddbcdcce 100644 --- a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h +++ b/config/examples/delta/FLSUN/kossel/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -485,11 +554,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -573,6 +720,13 @@ #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 @@ -597,7 +751,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -632,8 +786,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -747,7 +904,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -788,19 +956,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -818,8 +986,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -847,6 +1022,7 @@ */ //#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. @@ -855,12 +1031,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -888,13 +1067,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 @@ -917,13 +1097,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -934,7 +1108,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 @@ -942,11 +1117,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 @@ -1126,6 +1307,7 @@ //#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 @@ -1176,6 +1358,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. @@ -1203,127 +1386,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #if AXIS_IS_TMC(E1) + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + #define E1_RSENSE 0.11 + #endif - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E2) + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + #define E2_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #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 - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1333,13 +1597,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1347,7 +1638,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1358,9 +1649,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1380,6 +1672,7 @@ #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. @@ -1401,7 +1694,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 @@ -1413,27 +1706,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1450,62 +1726,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define 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 - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1545,12 +1905,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1641,11 +2019,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1749,35 +2122,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1899,7 +2276,83 @@ #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/delta/FLSUN/kossel_mini/Configuration.h b/config/examples/delta/FLSUN/kossel_mini/Configuration.h similarity index 87% rename from Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration.h rename to config/examples/delta/FLSUN/kossel_mini/Configuration.h index 6801592a351b..8be2d2e29e00 100644 --- a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration.h +++ b/config/examples/delta/FLSUN/kossel_mini/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#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. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 1 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - #define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + #define PID_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 @@ -421,7 +476,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -511,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 ========================= @@ -558,33 +614,33 @@ #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 - #define PROBE_MANUALLY_STEP 0.05 // (mm) + #define PROBE_MANUALLY_STEP 0.05 // (mm) #endif // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). - #define DELTA_PRINTABLE_RADIUS 85.0 // (mm) + #define DELTA_PRINTABLE_RADIUS 85.0 // (mm) // Center-to-center distance of the holes in the diagonal push rods. - #define DELTA_DIAGONAL_ROD 218.0 // (mm) + #define DELTA_DIAGONAL_ROD 218.0 // (mm) - // height from z=0 to home position - #define DELTA_HEIGHT 280.00 // get this value from auto calibrate + // Distance between bed and nozzle Z home position + #define DELTA_HEIGHT 280.00 // (mm) Get this value from G33 auto calibrate - #define DELTA_ENDSTOP_ADJ { 0.0, 0.0, 0.0 } // get these from auto calibrate + #define DELTA_ENDSTOP_ADJ { 0.0, 0.0, 0.0 } // Get these values from G33 auto calibrate // Horizontal distance bridged by diagonal push rods when effector is centered. - #define DELTA_RADIUS 101.0 //mm Get this value from auto calibrate + #define DELTA_RADIUS 101.0 // (mm) Get this value from G33 auto calibrate // Trim adjustments for individual towers // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // measured in degrees anticlockwise looking from above the printer - #define DELTA_TOWER_ANGLE_TRIM { 0.0, 0.0, 0.0 } // get these values from auto calibrate + #define DELTA_TOWER_ANGLE_TRIM { 0.0, 0.0, 0.0 } // Get these values from G33 auto calibrate - // delta radius and diaginal rod adjustments measured in mm + // Delta radius and diagonal rod adjustments (mm) //#define DELTA_RADIUS_TRIM_TOWER { 0.0, 0.0, 0.0 } //#define DELTA_DIAGONAL_ROD_TRIM_TOWER { 0.0, 0.0, 0.0 } @@ -652,8 +708,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -750,6 +807,14 @@ #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 @@ -758,10 +823,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK DEFAULT_XJERK -#define DEFAULT_ZJERK DEFAULT_XJERK // Must be same as XY for delta -#define DEFAULT_EJERK 5.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 10.0 + #define DEFAULT_YJERK DEFAULT_XJERK + #define DEFAULT_ZJERK DEFAULT_XJERK // Must be same as XY for delta +#endif + +#define DEFAULT_EJERK 5.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -790,11 +858,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -804,11 +872,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP // A3K leave disabled! +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -843,6 +908,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) @@ -978,6 +1054,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -1086,7 +1165,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,6 +1183,9 @@ #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 @@ -1176,7 +1258,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 @@ -1195,13 +1277,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. @@ -1271,7 +1354,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 @@ -1297,6 +1380,8 @@ #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 @@ -1467,10 +1552,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 /** @@ -1837,11 +1922,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1940,6 +2032,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1988,6 +2086,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2033,6 +2140,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -2046,10 +2154,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -2062,6 +2166,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 * @@ -2087,11 +2195,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 @@ -2116,7 +2224,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(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/FLSUN/kossel_mini/Configuration_adv.h similarity index 71% rename from Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h rename to config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h index b92a6c85f6a5..5459388b0516 100644 --- a/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h +++ b/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -485,11 +554,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -573,6 +720,13 @@ #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 @@ -597,7 +751,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -632,8 +786,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -747,7 +904,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -788,19 +956,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -818,8 +986,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -847,6 +1022,7 @@ */ //#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. @@ -855,12 +1031,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -888,13 +1067,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 @@ -917,13 +1097,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -934,7 +1108,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 @@ -942,11 +1117,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 @@ -1126,6 +1307,7 @@ //#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 @@ -1176,6 +1358,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. @@ -1203,127 +1386,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #if AXIS_IS_TMC(E1) + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + #define E1_RSENSE 0.11 + #endif - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E2) + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + #define E2_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #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 - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1333,13 +1597,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1347,7 +1638,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1358,9 +1649,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1380,6 +1672,7 @@ #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. @@ -1401,7 +1694,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 @@ -1413,27 +1706,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1450,62 +1726,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define 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 - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1545,12 +1905,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1641,11 +2019,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1749,35 +2122,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1899,7 +2276,83 @@ #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/delta/Geeetech/Rostock 301/Configuration.h b/config/examples/delta/Geeetech/Rostock 301/Configuration.h similarity index 87% rename from Marlin/src/config/examples/delta/Geeetech/Rostock 301/Configuration.h rename to config/examples/delta/Geeetech/Rostock 301/Configuration.h index 42d6e991c9e1..090409f534dc 100644 --- a/Marlin/src/config/examples/delta/Geeetech/Rostock 301/Configuration.h +++ b/config/examples/delta/Geeetech/Rostock 301/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -154,17 +154,6 @@ // For Cyclops or any "multi-extruder" that shares a single nozzle. #define SINGLENOZZLE -#if ENABLED(SINGLENOZZLE) - // Parameters for filament retract / prime on toolchange - #define SINGLENOZZLE_SWAP_LENGTH 12 // (mm) - #define SINGLENOZZLE_SWAP_RETRACT_SPEED 3600 // (mm/m) - #define SINGLENOZZLE_SWAP_PRIME_SPEED 3600 // (mm/m) - //#define SINGLENOZZLE_SWAP_PARK - #if ENABLED(SINGLENOZZLE_SWAP_PARK) - #define SINGLENOZZLE_TOOLCHANGE_XY { X_MIN_POS + 10, Y_MIN_POS + 10 } - #define SINGLENOZZLE_PARK_XY_FEEDRATE 6000 // (mm/m) - #endif -#endif /** * Průša MK2 Single Nozzle Multi-Material Multiplexer, and variants. @@ -185,6 +174,16 @@ //#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) @@ -195,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -223,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -245,6 +285,10 @@ #define MIXING_STEPPERS 3 // Number of steppers in your mixing extruder #define MIXING_VIRTUAL_TOOLS 16 // Use the Virtual Tool method with M163 and M164 //#define DIRECT_MIXING_IN_G1 // Allow ABCDHI mix factors in G1 movement commands + //#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). @@ -316,7 +360,9 @@ * 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 * @@ -335,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -355,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -398,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -427,7 +471,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -512,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 ========================= @@ -559,33 +604,33 @@ #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 - #define PROBE_MANUALLY_STEP 0.05 // (mm) + #define PROBE_MANUALLY_STEP 0.05 // (mm) #endif // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). - #define DELTA_PRINTABLE_RADIUS 90.0 // (mm) + #define DELTA_PRINTABLE_RADIUS 90.0 // (mm) // Center-to-center distance of the holes in the diagonal push rods. - #define DELTA_DIAGONAL_ROD 196.0 // (mm) + #define DELTA_DIAGONAL_ROD 196.0 // (mm) - // height from z=0 to home position - #define DELTA_HEIGHT 228.00 // get this value from auto calibrate + // Distance between bed and nozzle Z home position + #define DELTA_HEIGHT 228.00 // (mm) Get this value from G33 auto calibrate - #define DELTA_ENDSTOP_ADJ { 0.0, 0.0, 0.0 } // get these from auto calibrate + #define DELTA_ENDSTOP_ADJ { 0.0, 0.0, 0.0 } // Get these values from G33 auto calibrate // Horizontal distance bridged by diagonal push rods when effector is centered. - #define DELTA_RADIUS 92 //124.0 //mm Get this value from auto calibrate + #define DELTA_RADIUS 92 //124.0 // (mm) Get this value from G33 auto calibrate // Trim adjustments for individual towers // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // measured in degrees anticlockwise looking from above the printer - #define DELTA_TOWER_ANGLE_TRIM { 0.0, 0.0, 0.0 } // get these values from auto calibrate + #define DELTA_TOWER_ANGLE_TRIM { 0.0, 0.0, 0.0 } // Get these values from G33 auto calibrate - // delta radius and diaginal rod adjustments measured in mm + // Delta radius and diagonal rod adjustments (mm) //#define DELTA_RADIUS_TRIM_TOWER { 0.0, 0.0, 0.0 } //#define DELTA_DIAGONAL_ROD_TRIM_TOWER { 0.0, 0.0, 0.0 } @@ -640,7 +685,7 @@ #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. +#define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the probe. /** * Stepper Drivers @@ -653,8 +698,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -751,6 +797,14 @@ #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 @@ -759,10 +813,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK DEFAULT_XJERK -#define DEFAULT_ZJERK DEFAULT_XJERK // Must be same as XY for delta -#define DEFAULT_EJERK 5.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 10.0 + #define DEFAULT_YJERK DEFAULT_XJERK + #define DEFAULT_ZJERK DEFAULT_XJERK // Must be same as XY for delta +#endif + +#define DEFAULT_EJERK 5.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -791,11 +848,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -805,11 +862,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -844,6 +898,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) @@ -977,6 +1042,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -1060,9 +1128,6 @@ #define Y_MAX_POS DELTA_PRINTABLE_RADIUS #define Z_MAX_POS MANUAL_Z_HOME_POS -// Z raise distance for tool-change, as needed for some extruders -#define TOOLCHANGE_ZRAISE 2 // (mm) - /** * Software Endstops * @@ -1088,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 @@ -1106,6 +1171,9 @@ #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 @@ -1178,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 @@ -1197,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. @@ -1273,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 @@ -1299,6 +1368,8 @@ #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 @@ -1469,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 /** @@ -1839,11 +1910,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1942,6 +2020,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1990,6 +2074,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2035,6 +2128,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -2048,10 +2142,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -2064,6 +2154,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 * @@ -2089,11 +2183,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 +2212,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(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 71% 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 b92a6c85f6a5..5459388b0516 100644 --- a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h +++ b/config/examples/delta/Geeetech/Rostock 301/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -485,11 +554,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -573,6 +720,13 @@ #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 @@ -597,7 +751,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -632,8 +786,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -747,7 +904,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -788,19 +956,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -818,8 +986,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -847,6 +1022,7 @@ */ //#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. @@ -855,12 +1031,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -888,13 +1067,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 @@ -917,13 +1097,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -934,7 +1108,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 @@ -942,11 +1117,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 @@ -1126,6 +1307,7 @@ //#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 @@ -1176,6 +1358,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. @@ -1203,127 +1386,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #if AXIS_IS_TMC(E1) + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + #define E1_RSENSE 0.11 + #endif - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E2) + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + #define E2_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #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 - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1333,13 +1597,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1347,7 +1638,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1358,9 +1649,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1380,6 +1672,7 @@ #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. @@ -1401,7 +1694,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 @@ -1413,27 +1706,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1450,62 +1726,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define 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 - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1545,12 +1905,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1641,11 +2019,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1749,35 +2122,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1899,7 +2276,83 @@ #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/delta/Hatchbox_Alpha/Configuration.h b/config/examples/delta/Hatchbox_Alpha/Configuration.h similarity index 87% rename from Marlin/src/config/examples/delta/Hatchbox_Alpha/Configuration.h rename to config/examples/delta/Hatchbox_Alpha/Configuration.h index 996bb58b088d..6f2292bb8040 100644 --- a/Marlin/src/config/examples/delta/Hatchbox_Alpha/Configuration.h +++ b/config/examples/delta/Hatchbox_Alpha/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -179,6 +179,16 @@ //#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) @@ -189,25 +199,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -217,13 +254,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -239,6 +290,10 @@ #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). @@ -310,7 +365,9 @@ * 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 * @@ -329,7 +386,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 5 #define TEMP_SENSOR_1 0 @@ -349,37 +406,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -392,10 +446,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -426,7 +481,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -516,6 +571,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 ========================= @@ -563,33 +619,33 @@ #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 - #define PROBE_MANUALLY_STEP 0.05 // (mm) + #define PROBE_MANUALLY_STEP 0.05 // (mm) #endif // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). - #define DELTA_PRINTABLE_RADIUS 151.0 // (mm) + #define DELTA_PRINTABLE_RADIUS 151.0 // (mm) // Center-to-center distance of the holes in the diagonal push rods. - #define DELTA_DIAGONAL_ROD 356.5 // (mm) + #define DELTA_DIAGONAL_ROD 356.5 // (mm) - // height from z=0 to home position - #define DELTA_HEIGHT 352.00 // get this value from auto calibrate + // Distance between bed and nozzle Z home position + #define DELTA_HEIGHT 352.00 // (mm) Get this value from G33 auto calibrate - #define DELTA_ENDSTOP_ADJ { 0.0, 0.0, 0.0 } // get these from auto calibrate + #define DELTA_ENDSTOP_ADJ { 0.0, 0.0, 0.0 } // Get these values from G33 auto calibrate // Horizontal distance bridged by diagonal push rods when effector is centered. - #define DELTA_RADIUS 176.5 //mm Get this value from auto calibrate + #define DELTA_RADIUS 176.5 // (mm) Get this value from G33 auto calibrate // Trim adjustments for individual towers // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // measured in degrees anticlockwise looking from above the printer - #define DELTA_TOWER_ANGLE_TRIM { 0.0, 0.0, 0.0 } // get these values from auto calibrate + #define DELTA_TOWER_ANGLE_TRIM { 0.0, 0.0, 0.0 } // Get these values from G33 auto calibrate - // delta radius and diaginal rod adjustments measured in mm + // Delta radius and diagonal rod adjustments (mm) //#define DELTA_RADIUS_TRIM_TOWER { 0.0, 0.0, 0.0 } //#define DELTA_DIAGONAL_ROD_TRIM_TOWER { 0.0, 0.0, 0.0 } @@ -657,8 +713,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -755,6 +812,14 @@ #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 @@ -763,10 +828,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 20.0 -#define DEFAULT_YJERK DEFAULT_XJERK -#define DEFAULT_ZJERK DEFAULT_XJERK // Must be same as XY for delta -#define DEFAULT_EJERK 5.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 20.0 + #define DEFAULT_YJERK DEFAULT_XJERK + #define DEFAULT_ZJERK DEFAULT_XJERK // Must be same as XY for delta +#endif + +#define DEFAULT_EJERK 5.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -795,11 +863,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -809,11 +877,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -848,6 +913,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) @@ -981,6 +1057,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -1089,7 +1168,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,6 +1186,9 @@ #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 @@ -1179,7 +1261,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 @@ -1198,13 +1280,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. @@ -1274,7 +1357,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 @@ -1300,6 +1383,8 @@ #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 @@ -1470,10 +1555,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 /** @@ -1840,11 +1925,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1943,6 +2035,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1991,6 +2089,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2036,6 +2143,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -2049,10 +2157,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -2065,6 +2169,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 * @@ -2090,11 +2198,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 @@ -2119,7 +2227,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(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 87% rename from Marlin/src/config/examples/delta/MKS/SBASE/Configuration.h rename to config/examples/delta/MKS/SBASE/Configuration.h index c66e9f744c6d..99696d452681 100644 --- a/Marlin/src/config/examples/delta/MKS/SBASE/Configuration.h +++ b/config/examples/delta/MKS/SBASE/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -416,7 +471,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -501,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 ========================= @@ -548,33 +604,33 @@ #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 - #define PROBE_MANUALLY_STEP 0.05 // (mm) + #define PROBE_MANUALLY_STEP 0.05 // (mm) #endif // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). - #define DELTA_PRINTABLE_RADIUS 140.0 // (mm) + #define DELTA_PRINTABLE_RADIUS 140.0 // (mm) // Center-to-center distance of the holes in the diagonal push rods. - #define DELTA_DIAGONAL_ROD 250.0 // (mm) + #define DELTA_DIAGONAL_ROD 250.0 // (mm) - // height from z=0 to home position - #define DELTA_HEIGHT 250.00 // get this value from auto calibrate + // Distance between bed and nozzle Z home position + #define DELTA_HEIGHT 250.00 // (mm) Get this value from G33 auto calibrate - #define DELTA_ENDSTOP_ADJ { 0.0, 0.0, 0.0 } // get these from auto calibrate + #define DELTA_ENDSTOP_ADJ { 0.0, 0.0, 0.0 } // Get these values from G33 auto calibrate // Horizontal distance bridged by diagonal push rods when effector is centered. - #define DELTA_RADIUS 124.0 //mm Get this value from auto calibrate + #define DELTA_RADIUS 124.0 // (mm) Get this value from G33 auto calibrate // Trim adjustments for individual towers // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // measured in degrees anticlockwise looking from above the printer - #define DELTA_TOWER_ANGLE_TRIM { 0.0, 0.0, 0.0 } // get these values from auto calibrate + #define DELTA_TOWER_ANGLE_TRIM { 0.0, 0.0, 0.0 } // Get these values from G33 auto calibrate - // delta radius and diaginal rod adjustments measured in mm + // Delta radius and diagonal rod adjustments (mm) //#define DELTA_RADIUS_TRIM_TOWER { 0.0, 0.0, 0.0 } //#define DELTA_DIAGONAL_ROD_TRIM_TOWER { 0.0, 0.0, 0.0 } @@ -642,8 +698,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -740,6 +797,14 @@ #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 @@ -748,10 +813,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK DEFAULT_XJERK -#define DEFAULT_ZJERK DEFAULT_XJERK // Must be same as XY for delta -#define DEFAULT_EJERK 5.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 10.0 + #define DEFAULT_YJERK DEFAULT_XJERK + #define DEFAULT_ZJERK DEFAULT_XJERK // Must be same as XY for delta +#endif + +#define DEFAULT_EJERK 5.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -780,11 +848,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -794,11 +862,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -833,6 +898,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) @@ -966,6 +1042,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -1074,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 @@ -1092,6 +1171,9 @@ #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 @@ -1164,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 @@ -1183,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. @@ -1259,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 @@ -1285,6 +1368,8 @@ #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 @@ -1455,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), (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 /** @@ -1825,11 +1910,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1928,6 +2020,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1976,6 +2074,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2021,6 +2128,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -2034,10 +2142,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -2050,6 +2154,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 * @@ -2075,11 +2183,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 @@ -2104,7 +2212,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(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 71% rename from Marlin/src/config/examples/delta/MKS/SBASE/Configuration_adv.h rename to config/examples/delta/MKS/SBASE/Configuration_adv.h index 2279bb433c82..78bc3fbcf72c 100644 --- a/Marlin/src/config/examples/delta/MKS/SBASE/Configuration_adv.h +++ b/config/examples/delta/MKS/SBASE/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #define THERMAL_PROTECTION_PERIOD 50 // Seconds #define THERMAL_PROTECTION_HYSTERESIS 6 // 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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -485,11 +554,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -573,6 +720,13 @@ #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 @@ -597,7 +751,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -632,8 +786,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -747,7 +904,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -788,19 +956,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -818,8 +986,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -847,6 +1022,7 @@ */ //#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. @@ -855,12 +1031,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -888,13 +1067,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 @@ -917,13 +1097,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -934,7 +1108,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 @@ -942,11 +1117,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 @@ -1126,6 +1307,7 @@ //#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 @@ -1176,6 +1358,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. @@ -1203,127 +1386,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #if AXIS_IS_TMC(E1) + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + #define E1_RSENSE 0.11 + #endif - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E2) + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + #define E2_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #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 - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1333,13 +1597,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1347,7 +1638,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1358,9 +1649,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1380,6 +1672,7 @@ #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. @@ -1401,7 +1694,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 @@ -1413,27 +1706,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1450,62 +1726,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define 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 - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1545,12 +1905,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1641,11 +2019,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1749,35 +2122,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1899,7 +2276,83 @@ #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/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 88% rename from Marlin/src/config/examples/delta/Tevo Little Monster/Configuration.h rename to config/examples/delta/Tevo Little Monster/Configuration.h index c65ededaa581..6eb82bc85b94 100644 --- a/Marlin/src/config/examples/delta/Tevo Little Monster/Configuration.h +++ b/config/examples/delta/Tevo Little Monster/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 1 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - #define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + #define PID_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 @@ -420,7 +475,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -505,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 ========================= @@ -552,33 +608,33 @@ #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) + #define DELTA_CALIBRATION_RADIUS 140 // (mm) // Set the steprate for papertest probing - #define PROBE_MANUALLY_STEP 0.05 // (mm) + #define PROBE_MANUALLY_STEP 0.05 // (mm) #endif // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). - #define DELTA_PRINTABLE_RADIUS 165.0 // (mm) + #define DELTA_PRINTABLE_RADIUS 165.0 // (mm) // Center-to-center distance of the holes in the diagonal push rods. - #define DELTA_DIAGONAL_ROD 397.19 // (mm) + #define DELTA_DIAGONAL_ROD 397.19 // (mm) - // height from z=0 to home position - #define DELTA_HEIGHT 522.27 // get this value from auto calibrate + // Distance between bed and nozzle Z home position + #define DELTA_HEIGHT 522.27 // (mm) Get this value from G33 auto calibrate - #define DELTA_ENDSTOP_ADJ { 0.0, -0.12, -0.78 } // get these from auto calibrate + #define DELTA_ENDSTOP_ADJ { 0.0, -0.12, -0.78 } // Get these values from G33 auto calibrate // Horizontal distance bridged by diagonal push rods when effector is centered. - #define DELTA_RADIUS 157.39 //mm Get this value from auto calibrate + #define DELTA_RADIUS 157.39 // (mm) Get this value from G33 auto calibrate // Trim adjustments for individual towers // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // measured in degrees anticlockwise looking from above the printer - #define DELTA_TOWER_ANGLE_TRIM { -0.18, 0.18, 0.0 } // get these values from auto calibrate + #define DELTA_TOWER_ANGLE_TRIM { -0.18, 0.18, 0.0 } // Get these values from G33 auto calibrate - // delta radius and diaginal rod adjustments measured in mm + // Delta radius and diagonal rod adjustments (mm) //#define DELTA_RADIUS_TRIM_TOWER { 0.0, 0.0, 0.0 } //#define DELTA_DIAGONAL_ROD_TRIM_TOWER { 0.0, 0.0, 0.0 } @@ -646,8 +702,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -744,6 +801,14 @@ #define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration for retracts #define DEFAULT_TRAVEL_ACCELERATION 5000 // 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 @@ -752,10 +817,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK DEFAULT_XJERK -#define DEFAULT_ZJERK DEFAULT_XJERK // Must be same as XY for delta -#define DEFAULT_EJERK 5.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 10.0 + #define DEFAULT_YJERK DEFAULT_XJERK + #define DEFAULT_ZJERK DEFAULT_XJERK // Must be same as XY for delta +#endif + +#define DEFAULT_EJERK 5.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -784,11 +852,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -798,11 +866,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -970,6 +1035,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -1078,7 +1146,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 @@ -1096,6 +1164,9 @@ #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 @@ -1168,7 +1239,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 @@ -1187,13 +1258,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. @@ -1263,7 +1335,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 @@ -1289,6 +1361,8 @@ #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 @@ -1459,10 +1533,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 /** @@ -1829,11 +1903,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1932,6 +2013,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1980,6 +2067,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2025,6 +2121,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -2038,10 +2135,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -2054,6 +2147,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 * @@ -2079,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 @@ -2108,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(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 71% 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 dfe94b19cb97..f45f30c857aa 100644 --- a/Marlin/src/config/examples/delta/Tevo Little Monster/Configuration_adv.h +++ b/config/examples/delta/Tevo Little Monster/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #define THERMAL_PROTECTION_PERIOD 60 // Seconds #define THERMAL_PROTECTION_HYSTERESIS 10 // 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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -485,11 +554,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -573,6 +720,13 @@ #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 @@ -597,7 +751,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -632,8 +786,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -747,7 +904,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -788,19 +956,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -818,8 +986,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -847,6 +1022,7 @@ */ //#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. @@ -855,12 +1031,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -888,13 +1067,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 @@ -917,13 +1097,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -934,7 +1108,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 @@ -942,11 +1117,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 @@ -1126,6 +1307,7 @@ //#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 @@ -1176,6 +1358,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. @@ -1203,127 +1386,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #if AXIS_IS_TMC(E1) + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + #define E1_RSENSE 0.11 + #endif - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E2) + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + #define E2_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #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 - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1333,13 +1597,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1347,7 +1638,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1358,9 +1649,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1380,6 +1672,7 @@ #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. @@ -1401,7 +1694,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 @@ -1413,27 +1706,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1450,62 +1726,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define 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 - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1545,12 +1905,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1641,11 +2019,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1737,35 +2110,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1887,7 +2264,83 @@ #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/delta/generic/Configuration.h b/config/examples/delta/generic/Configuration.h similarity index 87% rename from Marlin/src/config/examples/delta/generic/Configuration.h rename to config/examples/delta/generic/Configuration.h index 29bb6f54f30a..36cea0c6f26c 100644 --- a/Marlin/src/config/examples/delta/generic/Configuration.h +++ b/config/examples/delta/generic/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -416,7 +471,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -501,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 ========================= @@ -548,33 +604,33 @@ #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 - #define PROBE_MANUALLY_STEP 0.05 // (mm) + #define PROBE_MANUALLY_STEP 0.05 // (mm) #endif // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). - #define DELTA_PRINTABLE_RADIUS 140.0 // (mm) + #define DELTA_PRINTABLE_RADIUS 140.0 // (mm) // Center-to-center distance of the holes in the diagonal push rods. - #define DELTA_DIAGONAL_ROD 250.0 // (mm) + #define DELTA_DIAGONAL_ROD 250.0 // (mm) - // height from z=0 to home position - #define DELTA_HEIGHT 250.00 // get this value from auto calibrate + // Distance between bed and nozzle Z home position + #define DELTA_HEIGHT 250.00 // (mm) Get this value from G33 auto calibrate - #define DELTA_ENDSTOP_ADJ { 0.0, 0.0, 0.0 } // get these from auto calibrate + #define DELTA_ENDSTOP_ADJ { 0.0, 0.0, 0.0 } // Get these values from G33 auto calibrate // Horizontal distance bridged by diagonal push rods when effector is centered. - #define DELTA_RADIUS 124.0 //mm Get this value from auto calibrate + #define DELTA_RADIUS 124.0 // (mm) Get this value from G33 auto calibrate // Trim adjustments for individual towers // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // measured in degrees anticlockwise looking from above the printer - #define DELTA_TOWER_ANGLE_TRIM { 0.0, 0.0, 0.0 } // get these values from auto calibrate + #define DELTA_TOWER_ANGLE_TRIM { 0.0, 0.0, 0.0 } // Get these values from G33 auto calibrate - // delta radius and diaginal rod adjustments measured in mm + // Delta radius and diagonal rod adjustments (mm) //#define DELTA_RADIUS_TRIM_TOWER { 0.0, 0.0, 0.0 } //#define DELTA_DIAGONAL_ROD_TRIM_TOWER { 0.0, 0.0, 0.0 } @@ -642,8 +698,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -740,6 +797,14 @@ #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 @@ -748,10 +813,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK DEFAULT_XJERK -#define DEFAULT_ZJERK DEFAULT_XJERK // Must be same as XY for delta -#define DEFAULT_EJERK 5.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 10.0 + #define DEFAULT_YJERK DEFAULT_XJERK + #define DEFAULT_ZJERK DEFAULT_XJERK // Must be same as XY for delta +#endif + +#define DEFAULT_EJERK 5.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -780,11 +848,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -794,11 +862,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -833,6 +898,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) @@ -966,6 +1042,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -1074,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 @@ -1092,6 +1171,9 @@ #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 @@ -1164,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 @@ -1183,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. @@ -1259,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 @@ -1285,6 +1368,8 @@ #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 @@ -1455,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 /** @@ -1825,11 +1910,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1928,6 +2020,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1976,6 +2074,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2021,6 +2128,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -2034,10 +2142,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -2050,6 +2154,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 * @@ -2075,11 +2183,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 @@ -2104,7 +2212,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(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/generic/Configuration_adv.h similarity index 71% rename from Marlin/src/config/examples/delta/generic/Configuration_adv.h rename to config/examples/delta/generic/Configuration_adv.h index b92a6c85f6a5..5459388b0516 100644 --- a/Marlin/src/config/examples/delta/generic/Configuration_adv.h +++ b/config/examples/delta/generic/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -485,11 +554,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -573,6 +720,13 @@ #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 @@ -597,7 +751,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -632,8 +786,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -747,7 +904,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -788,19 +956,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -818,8 +986,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -847,6 +1022,7 @@ */ //#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. @@ -855,12 +1031,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -888,13 +1067,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 @@ -917,13 +1097,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -934,7 +1108,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 @@ -942,11 +1117,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 @@ -1126,6 +1307,7 @@ //#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 @@ -1176,6 +1358,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. @@ -1203,127 +1386,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #if AXIS_IS_TMC(E1) + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + #define E1_RSENSE 0.11 + #endif - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E2) + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + #define E2_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #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 - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1333,13 +1597,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1347,7 +1638,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1358,9 +1649,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1380,6 +1672,7 @@ #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. @@ -1401,7 +1694,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 @@ -1413,27 +1706,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1450,62 +1726,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define 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 - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1545,12 +1905,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1641,11 +2019,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1749,35 +2122,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1899,7 +2276,83 @@ #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/delta/kossel_mini/Configuration.h b/config/examples/delta/kossel_mini/Configuration.h similarity index 87% rename from Marlin/src/config/examples/delta/kossel_mini/Configuration.h rename to config/examples/delta/kossel_mini/Configuration.h index 8185306dc539..94131fd95227 100644 --- a/Marlin/src/config/examples/delta/kossel_mini/Configuration.h +++ b/config/examples/delta/kossel_mini/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 7 #define TEMP_SENSOR_1 0 @@ -344,37 +401,34 @@ //#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. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -416,7 +471,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -501,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 ========================= @@ -548,33 +604,33 @@ #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 - #define PROBE_MANUALLY_STEP 0.05 // (mm) + #define PROBE_MANUALLY_STEP 0.05 // (mm) #endif // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). - #define DELTA_PRINTABLE_RADIUS 90.0 // (mm) + #define DELTA_PRINTABLE_RADIUS 90.0 // (mm) // Center-to-center distance of the holes in the diagonal push rods. - #define DELTA_DIAGONAL_ROD 215.0 // (mm) + #define DELTA_DIAGONAL_ROD 215.0 // (mm) - // height from z=0 to home position - #define DELTA_HEIGHT 250.00 // get this value from auto calibrate + // Distance between bed and nozzle Z home position + #define DELTA_HEIGHT 250.00 // (mm) Get this value from G33 auto calibrate - #define DELTA_ENDSTOP_ADJ { 0.0, 0.0, 0.0 } // get these from auto calibrate + #define DELTA_ENDSTOP_ADJ { 0.0, 0.0, 0.0 } // Get these values from G33 auto calibrate // Horizontal distance bridged by diagonal push rods when effector is centered. - #define DELTA_RADIUS 105.2 //mm Get this value from auto calibrate + #define DELTA_RADIUS 105.2 // (mm) Get this value from G33 auto calibrate // Trim adjustments for individual towers // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // measured in degrees anticlockwise looking from above the printer - #define DELTA_TOWER_ANGLE_TRIM { 0.0, 0.0, 0.0 } // get these values from auto calibrate + #define DELTA_TOWER_ANGLE_TRIM { 0.0, 0.0, 0.0 } // Get these values from G33 auto calibrate - // delta radius and diaginal rod adjustments measured in mm + // Delta radius and diagonal rod adjustments (mm) //#define DELTA_RADIUS_TRIM_TOWER { 0.0, 0.0, 0.0 } //#define DELTA_DIAGONAL_ROD_TRIM_TOWER { 0.0, 0.0, 0.0 } @@ -642,8 +698,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -740,6 +797,14 @@ #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 @@ -748,10 +813,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK DEFAULT_XJERK -#define DEFAULT_ZJERK DEFAULT_XJERK // Must be same as XY for delta -#define DEFAULT_EJERK 5.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 10.0 + #define DEFAULT_YJERK DEFAULT_XJERK + #define DEFAULT_ZJERK DEFAULT_XJERK // Must be same as XY for delta +#endif + +#define DEFAULT_EJERK 5.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -780,11 +848,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -794,11 +862,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -833,6 +898,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) @@ -968,6 +1044,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -1076,7 +1155,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 @@ -1094,6 +1173,9 @@ #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 @@ -1166,7 +1248,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 @@ -1185,13 +1267,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. @@ -1261,7 +1344,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 @@ -1287,6 +1370,8 @@ #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 @@ -1457,10 +1542,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 /** @@ -1827,11 +1912,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1930,6 +2022,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1978,6 +2076,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2023,6 +2130,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -2036,10 +2144,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -2052,6 +2156,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 * @@ -2077,11 +2185,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 @@ -2106,7 +2214,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(NEOPIXEL_LED) +#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED) #define PRINTER_EVENT_LEDS #endif diff --git a/config/examples/delta/kossel_mini/Configuration_adv.h b/config/examples/delta/kossel_mini/Configuration_adv.h new file mode 100644 index 000000000000..f6f63b0712fd --- /dev/null +++ b/config/examples/delta/kossel_mini/Configuration_adv.h @@ -0,0 +1,2357 @@ +/** + * 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 + +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#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) + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. + //#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 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 + +// 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 60 +#define DISABLE_INACTIVE_X true +#define DISABLE_INACTIVE_Y true +#define DISABLE_INACTIVE_Z true // set to false if the nozzle will fall down on your printed part when print has finished. +#define DISABLE_INACTIVE_E true + +#define DEFAULT_MINIMUMFEEDRATE 0.0 // minimum feedrate +#define DEFAULT_MINTRAVELFEEDRATE 0.0 + +//#define HOME_AFTER_DEACTIVATE // Require rehoming after steppers are deactivated + +// @section lcd + +#if ENABLED(ULTIPANEL) + #define MANUAL_FEEDRATE_XYZ 50*60 + #define MANUAL_FEEDRATE { MANUAL_FEEDRATE_XYZ, MANUAL_FEEDRATE_XYZ, MANUAL_FEEDRATE_XYZ, 60 } // Feedrates for manual moves along X, Y, Z, E from panel + #define MANUAL_E_MOVES_RELATIVE // Show LCD extruder moves as relative rather than absolute positions + #define ULTIPANEL_FEEDMULTIPLY // Comment to disable setting feedrate multiplier via encoder +#endif + +// @section extras + +// minimum time in microseconds that a movement needs to take if the buffer is emptied. +#define DEFAULT_MINSEGMENTTIME 20000 + +// If defined the movements slow down when the look ahead buffer is only half full +// (don't use SLOWDOWN with DELTA because DELTA generates hundreds of segments per second) +//#define SLOWDOWN + +// Frequency limit +// See nophead's blog for more info +// Not working O +//#define XY_FREQUENCY_LIMIT 15 + +// Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end +// of the buffer and all stops. This should not be much greater than zero and should only be changed +// if unwanted behavior is observed on a user's machine when running at very slow speeds. +#define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) + +// +// 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) + * + * 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 + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif + +#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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // 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/delta/kossel_pro/Configuration.h b/config/examples/delta/kossel_pro/Configuration.h similarity index 87% rename from Marlin/src/config/examples/delta/kossel_pro/Configuration.h rename to config/examples/delta/kossel_pro/Configuration.h index 33f43cbeca09..5a12ddc97f27 100644 --- a/Marlin/src/config/examples/delta/kossel_pro/Configuration.h +++ b/config/examples/delta/kossel_pro/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -178,6 +178,16 @@ //#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) @@ -188,25 +198,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -216,13 +253,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -238,6 +289,10 @@ #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). @@ -309,7 +364,9 @@ * 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 * @@ -328,7 +385,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 5 #define TEMP_SENSOR_1 0 @@ -348,37 +405,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -391,10 +445,11 @@ #define PID_MAX 125 // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 50 // If the temperature difference between the target temperature and the actual temperature @@ -408,7 +463,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -487,6 +542,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 ========================= @@ -534,33 +590,33 @@ #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 - #define PROBE_MANUALLY_STEP 0.05 // (mm) + #define PROBE_MANUALLY_STEP 0.05 // (mm) #endif // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). - #define DELTA_PRINTABLE_RADIUS 127.0 // (mm) + #define DELTA_PRINTABLE_RADIUS 127.0 // (mm) // Center-to-center distance of the holes in the diagonal push rods. - #define DELTA_DIAGONAL_ROD 301.0 // (mm) + #define DELTA_DIAGONAL_ROD 301.0 // (mm) - // height from z=0 to home position - #define DELTA_HEIGHT 277.00 // get this value from auto calibrate + // Distance between bed and nozzle Z home position + #define DELTA_HEIGHT 277.00 // (mm) Get this value from G33 auto calibrate - #define DELTA_ENDSTOP_ADJ { 0.0, 0.0, 0.0 } // get these from auto calibrate + #define DELTA_ENDSTOP_ADJ { 0.0, 0.0, 0.0 } // Get these values from G33 auto calibrate // Horizontal distance bridged by diagonal push rods when effector is centered. - #define DELTA_RADIUS 152.357 //mm Get this value from auto calibrate + #define DELTA_RADIUS 152.357 // (mm) Get this value from G33 auto calibrate // Trim adjustments for individual towers // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // measured in degrees anticlockwise looking from above the printer - #define DELTA_TOWER_ANGLE_TRIM { 0.0, 0.0, 0.0 } // get these values from auto calibrate + #define DELTA_TOWER_ANGLE_TRIM { 0.0, 0.0, 0.0 } // Get these values from G33 auto calibrate - // delta radius and diaginal rod adjustments measured in mm + // Delta radius and diagonal rod adjustments (mm) //#define DELTA_RADIUS_TRIM_TOWER { 0.0, 0.0, 0.0 } //#define DELTA_DIAGONAL_ROD_TRIM_TOWER { 0.0, 0.0, 0.0 } @@ -628,8 +684,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -733,6 +790,14 @@ #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 @@ -741,10 +806,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK DEFAULT_XJERK -#define DEFAULT_ZJERK DEFAULT_XJERK // Must be same as XY for delta -#define DEFAULT_EJERK 5.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 10.0 + #define DEFAULT_YJERK DEFAULT_XJERK + #define DEFAULT_ZJERK DEFAULT_XJERK // Must be same as XY for delta +#endif + +#define DEFAULT_EJERK 5.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -773,11 +841,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -787,11 +855,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -826,6 +891,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) @@ -969,6 +1045,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -1077,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 @@ -1095,6 +1174,9 @@ #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 @@ -1167,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 @@ -1186,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. @@ -1262,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 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1288,6 +1371,8 @@ #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 @@ -1458,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 /** @@ -1828,11 +1913,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1931,6 +2023,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1979,6 +2077,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2024,6 +2131,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -2037,10 +2145,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -2053,6 +2157,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 * @@ -2078,11 +2186,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 @@ -2107,7 +2215,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(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 87% rename from Marlin/src/config/examples/delta/kossel_xl/Configuration.h rename to config/examples/delta/kossel_xl/Configuration.h index f5aa6b5935ba..5a92c6a13a0d 100644 --- a/Marlin/src/config/examples/delta/kossel_xl/Configuration.h +++ b/config/examples/delta/kossel_xl/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 5 #define TEMP_SENSOR_1 0 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -420,7 +475,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -505,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 ========================= @@ -552,33 +608,33 @@ #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 - #define PROBE_MANUALLY_STEP 0.05 // (mm) + #define PROBE_MANUALLY_STEP 0.05 // (mm) #endif // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers). - #define DELTA_PRINTABLE_RADIUS 140.0 // (mm) + #define DELTA_PRINTABLE_RADIUS 140.0 // (mm) // Center-to-center distance of the holes in the diagonal push rods. - #define DELTA_DIAGONAL_ROD 319.5 // (mm) + #define DELTA_DIAGONAL_ROD 319.5 // (mm) - // height from z=0 to home position - #define DELTA_HEIGHT 380.00 // get this value from auto calibrate + // Distance between bed and nozzle Z home position + #define DELTA_HEIGHT 380.00 // (mm) Get this value from G33 auto calibrate - #define DELTA_ENDSTOP_ADJ { 0.0, 0.0, 0.0 } // get these from auto calibrate + #define DELTA_ENDSTOP_ADJ { 0.0, 0.0, 0.0 } // Get these values from G33 auto calibrate // Horizontal distance bridged by diagonal push rods when effector is centered. - #define DELTA_RADIUS 174.1 //mm Get this value from auto calibrate + #define DELTA_RADIUS 174.1 // (mm) Get this value from G33 auto calibrate // Trim adjustments for individual towers // tower angle corrections for X and Y tower / rotate XYZ so Z tower angle = 0 // measured in degrees anticlockwise looking from above the printer - #define DELTA_TOWER_ANGLE_TRIM { 0.0, 0.0, 0.0 } // get these values from auto calibrate + #define DELTA_TOWER_ANGLE_TRIM { 0.0, 0.0, 0.0 } // Get these values from G33 auto calibrate - // delta radius and diaginal rod adjustments measured in mm + // Delta radius and diagonal rod adjustments (mm) //#define DELTA_RADIUS_TRIM_TOWER { 0.0, 0.0, 0.0 } //#define DELTA_DIAGONAL_ROD_TRIM_TOWER { 0.0, 0.0, 0.0 } @@ -646,8 +702,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -743,6 +800,14 @@ #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 @@ -751,10 +816,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK DEFAULT_XJERK -#define DEFAULT_ZJERK DEFAULT_XJERK // Must be same as XY for delta -#define DEFAULT_EJERK 20.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 10.0 + #define DEFAULT_YJERK DEFAULT_XJERK + #define DEFAULT_ZJERK DEFAULT_XJERK // Must be same as XY for delta +#endif + +#define DEFAULT_EJERK 20.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -783,11 +851,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -797,11 +865,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -836,6 +901,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) @@ -969,6 +1045,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -1077,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 @@ -1095,6 +1174,9 @@ #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 @@ -1167,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 @@ -1186,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. @@ -1262,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 15 //#define PROBE_PT_1_Y 180 //#define PROBE_PT_2_X 15 @@ -1288,6 +1371,8 @@ #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 @@ -1458,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 /** @@ -1828,11 +1913,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1931,6 +2023,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1979,6 +2077,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -2024,6 +2131,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -2037,10 +2145,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -2053,6 +2157,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 * @@ -2078,11 +2186,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 @@ -2107,7 +2215,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(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 71% rename from Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h rename to config/examples/delta/kossel_xl/Configuration_adv.h index 4f5367b72f73..87ccbe3ea557 100644 --- a/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h +++ b/config/examples/delta/kossel_xl/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -485,11 +554,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -573,6 +720,13 @@ #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 @@ -597,7 +751,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -632,8 +786,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -747,7 +904,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -788,19 +956,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -818,8 +986,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -847,6 +1022,7 @@ */ //#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. @@ -855,12 +1031,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -888,13 +1067,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 @@ -917,13 +1097,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -934,7 +1108,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 @@ -942,11 +1117,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 @@ -1126,6 +1307,7 @@ //#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 @@ -1176,6 +1358,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. @@ -1203,127 +1386,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #if AXIS_IS_TMC(E1) + #define E1_CURRENT 800 + #define E1_MICROSTEPS 16 + #define E1_RSENSE 0.11 + #endif - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E2) + #define E2_CURRENT 800 + #define E2_MICROSTEPS 16 + #define E2_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #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 - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1333,13 +1597,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1347,7 +1638,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1358,9 +1649,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1380,6 +1672,7 @@ #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. @@ -1401,7 +1694,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 @@ -1413,27 +1706,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1450,62 +1726,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define 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 - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1545,12 +1905,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1641,11 +2019,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1749,35 +2122,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1899,7 +2276,83 @@ #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/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 88% rename from Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h rename to config/examples/gCreate/gMax1.5+/Configuration.h index a4d41f0191c2..95d584477801 100644 --- a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h +++ b/config/examples/gCreate/gMax1.5+/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -179,6 +179,16 @@ //#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) @@ -189,25 +199,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -217,13 +254,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -239,6 +290,10 @@ #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). @@ -310,7 +365,9 @@ * 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 * @@ -329,7 +386,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 5 #define TEMP_SENSOR_1 0 @@ -352,37 +409,34 @@ //#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. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +#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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -395,10 +449,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -429,7 +484,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -514,6 +569,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,8 +648,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -681,6 +738,14 @@ #define DEFAULT_RETRACT_ACCELERATION 400 // E acceleration for retracts #define DEFAULT_TRAVEL_ACCELERATION 400 // 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 @@ -689,10 +754,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 8.5 -#define DEFAULT_YJERK 8.5 -#define DEFAULT_ZJERK 0.7 -#define DEFAULT_EJERK 4.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 8.5 + #define DEFAULT_YJERK 8.5 + #define DEFAULT_ZJERK 0.7 +#endif + +#define DEFAULT_EJERK 4.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -721,11 +789,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -735,11 +803,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -864,6 +929,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -973,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 @@ -991,6 +1059,9 @@ #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 @@ -1063,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 @@ -1082,13 +1153,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 @@ -1157,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 53 #define PROBE_PT_1_Y 323 #define PROBE_PT_2_X 53 @@ -1183,6 +1255,8 @@ #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 @@ -1354,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 /** @@ -1724,11 +1798,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1827,6 +1908,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1875,6 +1962,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1920,6 +2016,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1933,10 +2030,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1949,6 +2042,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 * @@ -1974,11 +2071,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 @@ -2003,7 +2100,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(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 71% rename from Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h rename to config/examples/gCreate/gMax1.5+/Configuration_adv.h index 7d67bb14b1e8..6704570da0bf 100644 --- a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h +++ b/config/examples/gCreate/gMax1.5+/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #define THERMAL_PROTECTION_PERIOD 50 // Seconds #define THERMAL_PROTECTION_HYSTERESIS 3 // 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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ #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 3 // Babysteps are very small. Increase for faster motion. @@ -853,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1068,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 @@ -915,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1109,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 @@ -940,11 +1118,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 @@ -1124,6 +1308,7 @@ //#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 @@ -1174,6 +1359,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. @@ -1201,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1598,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1673,7 @@ #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. @@ -1399,7 +1695,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 @@ -1411,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2020,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2123,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2277,83 @@ #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/gCreate/gMax1.5+/_Bootscreen.h b/config/examples/gCreate/gMax1.5+/_Bootscreen.h similarity index 99% rename from Marlin/src/config/examples/gCreate/gMax1.5+/_Bootscreen.h rename to config/examples/gCreate/gMax1.5+/_Bootscreen.h index 9fa6b953afb2..003a7978be84 100644 --- a/Marlin/src/config/examples/gCreate/gMax1.5+/_Bootscreen.h +++ b/config/examples/gCreate/gMax1.5+/_Bootscreen.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/config/examples/makibox/Configuration.h b/config/examples/makibox/Configuration.h similarity index 87% rename from Marlin/src/config/examples/makibox/Configuration.h rename to config/examples/makibox/Configuration.h index 98d83e367d7b..791b3afcb9b7 100644 --- a/Marlin/src/config/examples/makibox/Configuration.h +++ b/config/examples/makibox/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -416,7 +471,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -504,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 ========================= @@ -582,8 +638,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -671,6 +728,14 @@ #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 @@ -679,10 +744,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -711,11 +779,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -725,11 +793,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -764,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) @@ -854,6 +930,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -962,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 @@ -980,6 +1059,9 @@ #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 @@ -1052,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 @@ -1071,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 @@ -1146,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 @@ -1172,6 +1255,8 @@ #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 @@ -1343,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 /** @@ -1713,11 +1798,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1816,6 +1908,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1864,6 +1962,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1909,6 +2016,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1922,10 +2030,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1938,6 +2042,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 * @@ -1963,11 +2071,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 @@ -1992,7 +2100,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(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 71% rename from Marlin/src/config/examples/makibox/Configuration_adv.h rename to config/examples/makibox/Configuration_adv.h index 4ad3635fc208..ed75fd3165d8 100644 --- a/Marlin/src/config/examples/makibox/Configuration_adv.h +++ b/config/examples/makibox/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ //#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. @@ -853,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1068,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 @@ -915,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1109,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 @@ -940,11 +1118,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 @@ -1124,6 +1308,7 @@ //#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 @@ -1174,6 +1359,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. @@ -1201,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1598,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1673,7 @@ #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. @@ -1399,7 +1695,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 @@ -1411,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2020,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2123,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2277,83 @@ #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/tvrrug/Round2/Configuration.h b/config/examples/tvrrug/Round2/Configuration.h similarity index 87% rename from Marlin/src/config/examples/tvrrug/Round2/Configuration.h rename to config/examples/tvrrug/Round2/Configuration.h index 47b16f0a30a7..82eef350cfd6 100644 --- a/Marlin/src/config/examples/tvrrug/Round2/Configuration.h +++ b/config/examples/tvrrug/Round2/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 5 #define TEMP_SENSOR_1 0 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 0 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -405,7 +460,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -490,6 +545,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 ========================= @@ -568,8 +624,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -663,6 +720,14 @@ #define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration for retracts #define DEFAULT_TRAVEL_ACCELERATION 500 // 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 @@ -671,10 +736,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 10.0 -#define DEFAULT_YJERK 10.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#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 @@ -703,11 +771,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -717,11 +785,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -756,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) @@ -846,6 +922,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -954,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 @@ -972,6 +1051,9 @@ #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 @@ -1044,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 @@ -1063,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 @@ -1138,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 @@ -1164,6 +1247,8 @@ #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 @@ -1335,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 /** @@ -1705,11 +1790,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1808,6 +1900,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1856,6 +1954,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1901,6 +2008,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1914,10 +2022,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1930,6 +2034,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 * @@ -1955,11 +2063,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 @@ -1984,7 +2092,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(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 71% rename from Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h rename to config/examples/tvrrug/Round2/Configuration_adv.h index 338be6d88078..27236504a803 100644 --- a/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h +++ b/config/examples/tvrrug/Round2/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -571,6 +721,13 @@ #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 @@ -595,7 +752,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -630,8 +787,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -745,7 +905,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -786,19 +957,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -816,8 +987,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -845,6 +1023,7 @@ */ //#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. @@ -853,12 +1032,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -886,13 +1068,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 @@ -915,13 +1098,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -932,7 +1109,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 @@ -940,11 +1118,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 @@ -1124,6 +1308,7 @@ //#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 @@ -1174,6 +1359,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. @@ -1201,127 +1387,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1331,13 +1598,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1345,7 +1639,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1356,9 +1650,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1378,6 +1673,7 @@ #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. @@ -1399,7 +1695,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 @@ -1411,27 +1707,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1448,62 +1727,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1543,12 +1906,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1639,11 +2020,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1747,35 +2123,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1897,7 +2277,83 @@ #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/wt150/Configuration.h b/config/examples/wt150/Configuration.h similarity index 87% rename from Marlin/src/config/examples/wt150/Configuration.h rename to config/examples/wt150/Configuration.h index 0f7296fba371..1e009ff19adf 100644 --- a/Marlin/src/config/examples/wt150/Configuration.h +++ b/config/examples/wt150/Configuration.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -174,6 +174,16 @@ //#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) @@ -184,25 +194,52 @@ #endif #endif -// A dual-nozzle that uses a servomotor to raise/lower one of the nozzles +// 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_SERVO_ANGLES { 0, 90 } // Angles for E0, E1 + //#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 magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + * via a solenoid docking mechanism. Requires SOL1_PIN and SOL2_PIN. */ //#define PARKING_EXTRUDER -#if ENABLED(PARKING_EXTRUDER) - #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage - #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil - #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + +/** + * 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 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) + + #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 /** @@ -212,13 +249,27 @@ * 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 + +/** + * Magnetic Switching Toolhead + * + * Support swappable and dockable toolheads with a magnetic + * docking mechanism using movement and no servo. + */ +//#define MAGNETIC_SWITCHING_TOOLHEAD + +#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD) + #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 + #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 + #elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD) + #define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis + #define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis + #endif #endif /** @@ -234,6 +285,10 @@ #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). @@ -305,7 +360,9 @@ * 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 * @@ -324,7 +381,7 @@ * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * - * :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '66':"Dyze Design 4.7M High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" } + * :{ '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 -2 #define TEMP_SENSOR_1 0 @@ -344,37 +401,34 @@ //#define TEMP_SENSOR_1_AS_REDUNDANT #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 -// Extruder temperature must be close to target for this long before M109 returns success -#define TEMP_RESIDENCY_TIME 10 // (seconds) -#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// Bed temperature must be close to target for this long before M190 returns success -#define TEMP_BED_RESIDENCY_TIME 10 // (seconds) -#define TEMP_BED_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one -#define TEMP_BED_WINDOW 1 // (degC) Window around target to start the residency timer x degC early. - -// The minimal temperature defines the temperature below which the heater will not be enabled It is used -// to check that the wiring to the thermistor is not broken. -// Otherwise this would lead to the heater being powered on all the time. -#define HEATER_0_MINTEMP 5 -#define HEATER_1_MINTEMP 5 -#define HEATER_2_MINTEMP 5 -#define HEATER_3_MINTEMP 5 -#define HEATER_4_MINTEMP 5 -#define HEATER_5_MINTEMP 5 -#define BED_MINTEMP 5 - -// When temperature exceeds max temp, your heater will be switched off. -// This feature exists to protect your hotend from overheating accidentally, but *NOT* from thermistor short/failure! -// You should use MINTEMP for thermistor short/failure protection. +#define 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 + +// 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 + +// 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 //=========================================================================== //============================= PID Settings ================================ @@ -387,10 +441,11 @@ #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_K1 0.95 // Smoothing factor within any PID loop #if ENABLED(PIDTEMP) - //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result. - //#define PID_DEBUG // Sends debug data to the serial port. - //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX - //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay + //#define PID_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 @@ -421,7 +476,7 @@ #endif // PIDTEMP //=========================================================================== -//============================= PID > Bed Temperature Control =============== +//====================== PID > Bed Temperature Control ====================== //=========================================================================== /** @@ -506,6 +561,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 ========================= @@ -584,8 +640,9 @@ * Options: A4988, A5984, DRV8825, LV8729, L6470, TB6560, TB6600, TMC2100, * TMC2130, TMC2130_STANDALONE, TMC2208, TMC2208_STANDALONE, * TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE, - * TMC5130, TMC5130_STANDALONE - * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE'] + * 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 @@ -673,6 +730,14 @@ #define DEFAULT_RETRACT_ACCELERATION 1200 // E acceleration for retracts #define DEFAULT_TRAVEL_ACCELERATION 1200 // 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 @@ -681,10 +746,13 @@ * When changing speed and direction, if the difference is less than the * value set here, it may happen instantaneously. */ -#define DEFAULT_XJERK 8.0 -#define DEFAULT_YJERK 8.0 -#define DEFAULT_ZJERK 0.3 -#define DEFAULT_EJERK 5.0 +#if DISABLED(JUNCTION_DEVIATION) + #define DEFAULT_XJERK 8.0 + #define DEFAULT_YJERK 8.0 + #define DEFAULT_ZJERK 0.3 +#endif + +#define DEFAULT_EJERK 5.0 // May be used by Linear Advance /** * S-Curve Acceleration @@ -713,11 +781,11 @@ #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN /** - * Z_MIN_PROBE_ENDSTOP + * Z_MIN_PROBE_PIN * - * Enable this option for a probe connected to any pin except Z-Min. - * (By default Marlin assumes the Z-Max endstop pin.) - * To use a custom Z Probe pin, set Z_MIN_PROBE_PIN below. + * 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. @@ -727,11 +795,8 @@ * - normally-closed switches to GND and D32. * - normally-open switches to 5V and D32. * - * WARNING: Setting the wrong pin may have unexpected and potentially - * disastrous consequences. Use with caution and do your homework. - * */ -//#define Z_MIN_PROBE_ENDSTOP +//#define Z_MIN_PROBE_PIN 32 // Pin 32 is the RAMPS default /** * Probe Type @@ -766,6 +831,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) @@ -856,6 +932,9 @@ // Before deploy/stow pause for user confirmation //#define PAUSE_BEFORE_DEPLOY_STOW +#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + //#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe +#endif /** * Enable one or more of the following if probing seems unreliable. @@ -964,7 +1043,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 @@ -982,6 +1061,9 @@ #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 @@ -1054,7 +1136,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 @@ -1073,13 +1155,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 @@ -1148,7 +1231,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 @@ -1174,6 +1257,8 @@ #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 @@ -1345,10 +1430,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 /** @@ -1715,11 +1800,18 @@ // // -// 2 wire Non-latching LCD SR from https://goo.gl/aJJ4sH +// 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) ======================== @@ -1818,6 +1910,12 @@ // //#define MKS_MINI_12864 +// +// FYSETC variant of the MINI12864 graphic controller with SD support +// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 +// +//#define FYSETC_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 @@ -1866,6 +1964,15 @@ // //#define EXTENSIBLE_UI +//============================================================================= +//=============================== Graphical TFTs ============================== +//============================================================================= + +// +// MKS Robin 320x240 color display +// +//#define MKS_ROBIN_TFT + //============================================================================= //============================ Other Controllers ============================ //============================================================================= @@ -1911,6 +2018,7 @@ // 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. +// :[0,1,2,3,4,5,6,7] #define SOFT_PWM_SCALE 0 // If SOFT_PWM_SCALE is set to a value higher than 0, dithering can @@ -1924,10 +2032,6 @@ // then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis) //#define TEMP_STAT_LEDS -// M240 Triggers a camera by emulating a Canon RC-1 Remote -// Data from: http://www.doc-diy.net/photo/rc-1_hacked/ -//#define PHOTOGRAPH_PIN 23 - // SkeinForge sends the wrong arc g-codes when using Arc Point as fillet procedure //#define SF_ARC_FIX @@ -1940,6 +2044,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 * @@ -1965,11 +2073,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 @@ -1994,7 +2102,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(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 71% rename from Marlin/src/config/examples/wt150/Configuration_adv.h rename to config/examples/wt150/Configuration_adv.h index eb241a95a8c4..b46bfc929a90 100644 --- a/Marlin/src/config/examples/wt150/Configuration_adv.h +++ b/config/examples/wt150/Configuration_adv.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -50,6 +50,19 @@ #define HEATER_BED_INVERTING true #endif +/** + * Heated Chamber settings + */ +#if TEMP_SENSOR_CHAMBER + #define CHAMBER_MINTEMP 5 + #define CHAMBER_MAXTEMP 60 + #define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target + #define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber + //#define CHAMBER_LIMIT_SWITCHING + //#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin + //#define HEATER_CHAMBER_INVERTING false +#endif + #if DISABLED(PIDTEMPBED) #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control #if ENABLED(BED_LIMIT_SWITCHING) @@ -77,6 +90,11 @@ #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 @@ -107,9 +125,23 @@ #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. + // Add an experimental additional term to the heater power, proportional to the extrusion speed. + // A well-chosen Kc value should add just enough power to melt the increased material volume. //#define PID_EXTRUSION_SCALING #if ENABLED(PID_EXTRUSION_SCALING) #define DEFAULT_Kc (100) //heating power=Kc*(e_speed) @@ -222,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 /** @@ -358,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 @@ -401,6 +469,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 @@ -433,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 @@ -458,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 @@ -483,11 +555,89 @@ #define MINIMUM_PLANNER_SPEED 0.05 // (mm/s) // -// Use Junction Deviation instead of traditional Jerk Limiting +// Backlash Compensation +// Adds extra movement to axes on direction-changes to account for backlash. // -//#define JUNCTION_DEVIATION -#if ENABLED(JUNCTION_DEVIATION) - #define JUNCTION_DEVIATION_MM 0.02 // (mm) Distance from real junction edge +//#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 /** @@ -572,6 +722,13 @@ #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 @@ -596,7 +753,7 @@ //#define PROGRESS_MSG_ONCE // Show the message for MSG_TIME then clear it //#define LCD_PROGRESS_BAR_TEST // Add a menu item to test the progress bar #endif -#endif // HAS_PRINT_PROGRESS +#endif /** * LED Control Menu @@ -631,8 +788,11 @@ // 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 SD_MENU_CONFIRM_START // Confirm the selected SD file before printing + + //#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) @@ -746,7 +906,18 @@ #endif // Add an optimized binary file transfer mode, initiated with 'M28 B1' - //#define FAST_FILE_TRANSFER + //#define BINARY_FILE_TRANSFER + + // LPC-based boards have on-board SD Card options. Override here or defaults apply. + #ifdef TARGET_LPC1768 + //#define LPC_SD_LCD // Use the SD drive in the external LCD controller. + //#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.) + //#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file). + //#define USB_SD_DISABLED // Disable SD Card access over USB (for security). + #if ENABLED(LPC_SD_ONBOARD) + //#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device. + #endif + #endif #endif // SDSUPPORT @@ -787,19 +958,19 @@ // 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) - /** - * ST7920-based LCDs can emulate a 16 x 4 character display using - * the ST7920 character-generator for very fast screen updates. - * Enable LIGHTWEIGHT_UI to use this special display mode. - * - * Since LIGHTWEIGHT_UI has limited space, the position and status - * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the - * length of time to display the status message before clearing. - * - * Set STATUS_EXPIRE_SECONDS to zero to never clear the status. - * This will prevent position updates from being displayed. - */ //#define LIGHTWEIGHT_UI #if ENABLED(LIGHTWEIGHT_UI) #define STATUS_EXPIRE_SECONDS 20 @@ -817,8 +988,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 + //#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash) + + // Frivolous Game Options + //#define MARLIN_BRICKOUT + //#define MARLIN_INVADERS + //#define MARLIN_SNAKE #endif // HAS_GRAPHICAL_LCD @@ -846,6 +1024,7 @@ */ //#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. @@ -854,12 +1033,15 @@ #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 MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. - #if ENABLED(MOVE_Z_WHEN_IDLE) - #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. - #endif + //#define BABYSTEP_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 @@ -887,13 +1069,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 @@ -916,13 +1099,7 @@ #define G29_SUCCESS_COMMANDS "M117 Bed leveling done." #define G29_RECOVER_COMMANDS "M117 Probe failed. Rewiping.\nG28\nG12 P0 S12 T0" #define G29_FAILURE_COMMANDS "M117 Bed leveling failed.\nG0 Z10\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nM300 P25 S880\nM300 P50 S0\nG4 S1" - /** - * Specify an action command to send to the host on a recovery attempt or failure. - * Will be sent in the form '//action:ACTION_ON_G29_FAILURE', e.g. '//action:probe_failed'. - * The host must be configured to handle the action command. - */ - #define G29_ACTION_ON_RECOVER "probe_rewipe" - #define G29_ACTION_ON_FAILURE "probe_failed" + #endif // @section extras @@ -933,7 +1110,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 @@ -941,11 +1119,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 @@ -1125,6 +1309,7 @@ //#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 @@ -1175,6 +1360,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. @@ -1202,127 +1388,208 @@ */ #if HAS_DRIVER(TMC26X) - #define X_MAX_CURRENT 1000 // in mA - #define X_SENSE_RESISTOR 91 // in mOhms - #define X_MICROSTEPS 16 // number of microsteps + #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 - #define X2_MAX_CURRENT 1000 - #define X2_SENSE_RESISTOR 91 - #define X2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_X2(TMC26X) + #define X2_MAX_CURRENT 1000 + #define X2_SENSE_RESISTOR 91 + #define X2_MICROSTEPS 16 + #endif - #define Y_MAX_CURRENT 1000 - #define Y_SENSE_RESISTOR 91 - #define Y_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y(TMC26X) + #define Y_MAX_CURRENT 1000 + #define Y_SENSE_RESISTOR 91 + #define Y_MICROSTEPS 16 + #endif - #define Y2_MAX_CURRENT 1000 - #define Y2_SENSE_RESISTOR 91 - #define Y2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Y2(TMC26X) + #define Y2_MAX_CURRENT 1000 + #define Y2_SENSE_RESISTOR 91 + #define Y2_MICROSTEPS 16 + #endif - #define Z_MAX_CURRENT 1000 - #define Z_SENSE_RESISTOR 91 - #define Z_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z(TMC26X) + #define Z_MAX_CURRENT 1000 + #define Z_SENSE_RESISTOR 91 + #define Z_MICROSTEPS 16 + #endif - #define Z2_MAX_CURRENT 1000 - #define Z2_SENSE_RESISTOR 91 - #define Z2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z2(TMC26X) + #define Z2_MAX_CURRENT 1000 + #define Z2_SENSE_RESISTOR 91 + #define Z2_MICROSTEPS 16 + #endif - #define Z3_MAX_CURRENT 1000 - #define Z3_SENSE_RESISTOR 91 - #define Z3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_Z3(TMC26X) + #define Z3_MAX_CURRENT 1000 + #define Z3_SENSE_RESISTOR 91 + #define Z3_MICROSTEPS 16 + #endif - #define E0_MAX_CURRENT 1000 - #define E0_SENSE_RESISTOR 91 - #define E0_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E0(TMC26X) + #define E0_MAX_CURRENT 1000 + #define E0_SENSE_RESISTOR 91 + #define E0_MICROSTEPS 16 + #endif - #define E1_MAX_CURRENT 1000 - #define E1_SENSE_RESISTOR 91 - #define E1_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E1(TMC26X) + #define E1_MAX_CURRENT 1000 + #define E1_SENSE_RESISTOR 91 + #define E1_MICROSTEPS 16 + #endif - #define E2_MAX_CURRENT 1000 - #define E2_SENSE_RESISTOR 91 - #define E2_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E2(TMC26X) + #define E2_MAX_CURRENT 1000 + #define E2_SENSE_RESISTOR 91 + #define E2_MICROSTEPS 16 + #endif - #define E3_MAX_CURRENT 1000 - #define E3_SENSE_RESISTOR 91 - #define E3_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E3(TMC26X) + #define E3_MAX_CURRENT 1000 + #define E3_SENSE_RESISTOR 91 + #define E3_MICROSTEPS 16 + #endif - #define E4_MAX_CURRENT 1000 - #define E4_SENSE_RESISTOR 91 - #define E4_MICROSTEPS 16 + #if AXIS_DRIVER_TYPE_E4(TMC26X) + #define E4_MAX_CURRENT 1000 + #define E4_SENSE_RESISTOR 91 + #define E4_MICROSTEPS 16 + #endif - #define E5_MAX_CURRENT 1000 - #define E5_SENSE_RESISTOR 91 - #define E5_MICROSTEPS 16 + #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 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.). + * 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. * - * The TMC2130Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2130Stepper - * - * To use TMC2208 stepper UART-configurable stepper drivers - * connect #_SERIAL_TX_PIN to the driver side PDN_UART pin with a 1K resistor. - * To use the reading capabilities, also connect #_SERIAL_RX_PIN - * to PDN_UART without a resistor. + * To use TMC2208 stepper UART-configurable stepper drivers connect #_SERIAL_TX_PIN + * to the driver side PDN_UART pin with a 1K resistor. + * To use the reading capabilities, also connect #_SERIAL_RX_PIN to PDN_UART without + * a resistor. * The drivers can also be used with hardware serial. * - * The TMC2208Stepper library is required for this stepper driver. - * https://github.com/teemuatlut/TMC2208Stepper + * TMCStepper library is required to use TMC stepper drivers. + * https://github.com/teemuatlut/TMCStepper */ #if HAS_TRINAMIC - #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #define X_CURRENT 800 // rms current in mA. Multiply by 1.41 for peak current. - #define X_MICROSTEPS 16 // 0..256 + #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 - #define Y_CURRENT 800 - #define Y_MICROSTEPS 16 + #if AXIS_IS_TMC(X2) + #define X2_CURRENT 800 + #define X2_MICROSTEPS 16 + #define X2_RSENSE 0.11 + #endif - #define Z_CURRENT 800 - #define Z_MICROSTEPS 16 + #if AXIS_IS_TMC(Y) + #define Y_CURRENT 800 + #define Y_MICROSTEPS 16 + #define Y_RSENSE 0.11 + #endif - #define X2_CURRENT 800 - #define X2_MICROSTEPS 16 + #if AXIS_IS_TMC(Y2) + #define Y2_CURRENT 800 + #define Y2_MICROSTEPS 16 + #define Y2_RSENSE 0.11 + #endif - #define Y2_CURRENT 800 - #define Y2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z) + #define Z_CURRENT 800 + #define Z_MICROSTEPS 16 + #define Z_RSENSE 0.11 + #endif - #define Z2_CURRENT 800 - #define Z2_MICROSTEPS 16 + #if AXIS_IS_TMC(Z2) + #define Z2_CURRENT 800 + #define Z2_MICROSTEPS 16 + #define Z2_RSENSE 0.11 + #endif - #define Z3_CURRENT 800 - #define Z3_MICROSTEPS 16 + #if AXIS_IS_TMC(Z3) + #define Z3_CURRENT 800 + #define Z3_MICROSTEPS 16 + #define Z3_RSENSE 0.11 + #endif - #define E0_CURRENT 800 - #define E0_MICROSTEPS 16 + #if AXIS_IS_TMC(E0) + #define E0_CURRENT 800 + #define E0_MICROSTEPS 16 + #define E0_RSENSE 0.11 + #endif - #define E1_CURRENT 800 - #define E1_MICROSTEPS 16 + #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 - #define E2_CURRENT 800 - #define E2_MICROSTEPS 16 + #if AXIS_IS_TMC(E3) + #define E3_CURRENT 800 + #define E3_MICROSTEPS 16 + #define E3_RSENSE 0.11 + #endif - #define E3_CURRENT 800 - #define E3_MICROSTEPS 16 + #if AXIS_IS_TMC(E4) + #define E4_CURRENT 800 + #define E4_MICROSTEPS 16 + #define E4_RSENSE 0.11 + #endif - #define E4_CURRENT 800 - #define E4_MICROSTEPS 16 + #if AXIS_IS_TMC(E5) + #define E5_CURRENT 800 + #define E5_MICROSTEPS 16 + #define E5_RSENSE 0.11 + #endif - #define E5_CURRENT 800 - #define E5_MICROSTEPS 16 + /** + * 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. */ @@ -1332,13 +1599,40 @@ //#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 + #define STEALTHCHOP_XY + #define STEALTHCHOP_Z + #define STEALTHCHOP_E /** - * Monitor Trinamic TMC2130 and TMC2208 drivers for error conditions, + * 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. @@ -1346,7 +1640,7 @@ * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. * M911 - Report stepper driver overtemperature pre-warn condition. * M912 - Clear stepper driver overtemperature pre-warn condition flag. - * M122 S0/1 - Report driver parameters (Requires TMC_DEBUG) + * M122 - Report driver parameters (Requires TMC_DEBUG) */ //#define MONITOR_DRIVER_STATUS @@ -1357,9 +1651,10 @@ #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 needs to be enabled. + * STEALTHCHOP_(XY|Z|E) must be enabled to use HYBRID_THRESHOLD. * M913 X/Y/Z/E to live tune the setting */ //#define HYBRID_THRESHOLD @@ -1379,6 +1674,7 @@ #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. @@ -1400,7 +1696,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 @@ -1412,27 +1708,10 @@ */ //#define TMC_DEBUG - /** - * M915 Z Axis Calibration - * - * - Adjust Z stepper current, - * - Drive the Z axis to its physical maximum, and - * - Home Z to account for the lost steps. - * - * Use M915 Snn to specify the current. - * Use M925 Znn to add extra Z height to Z_MAX_POS. - */ - //#define TMC_Z_CALIBRATION - #if ENABLED(TMC_Z_CALIBRATION) - #define CALIBRATION_CURRENT 250 - #define CALIBRATION_EXTRA_HEIGHT 10 - #endif - /** * You can set your own advanced settings by filling in predefined functions. * A list of available functions can be found on the library github page - * https://github.com/teemuatlut/TMC2130Stepper - * https://github.com/teemuatlut/TMC2208Stepper + * https://github.com/teemuatlut/TMCStepper * * Example: * #define TMC_ADV() { \ @@ -1449,62 +1728,146 @@ /** * L6470 Stepper Driver options * - * The Arduino-L6470 library is required for this stepper driver. + * 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 X_MICROSTEPS 16 // number of microsteps - #define X_OVERCURRENT 2000 // maxc current in mA. If the current goes over this value, the driver will switch off - #define X_STALLCURRENT 1500 // current in mA where the driver will detect a stall + //#define L6470_CHITCHAT // Display additional status info - #define X2_MICROSTEPS 16 - #define X2_OVERCURRENT 2000 - #define X2_STALLCURRENT 1500 + #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 - #define Y_MICROSTEPS 16 - #define Y_OVERCURRENT 2000 - #define Y_STALLCURRENT 1500 + #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 - #define Y2_MICROSTEPS 16 - #define Y2_OVERCURRENT 2000 - #define Y2_STALLCURRENT 1500 + #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 - #define Z_MICROSTEPS 16 - #define Z_OVERCURRENT 2000 - #define Z_STALLCURRENT 1500 + #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 - #define Z2_MICROSTEPS 16 - #define Z2_OVERCURRENT 2000 - #define Z2_STALLCURRENT 1500 + #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 - #define Z3_MICROSTEPS 16 - #define Z3_OVERCURRENT 2000 - #define Z3_STALLCURRENT 1500 + #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 - #define E0_MICROSTEPS 16 - #define E0_OVERCURRENT 2000 - #define E0_STALLCURRENT 1500 + #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 - #define E1_MICROSTEPS 16 - #define E1_OVERCURRENT 2000 - #define E1_STALLCURRENT 1500 + #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 - #define E2_MICROSTEPS 16 - #define E2_OVERCURRENT 2000 - #define E2_STALLCURRENT 1500 + #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 - #define E3_MICROSTEPS 16 - #define E3_OVERCURRENT 2000 - #define E3_STALLCURRENT 1500 + #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 - #define E4_MICROSTEPS 16 - #define E4_OVERCURRENT 2000 - #define E4_STALLCURRENT 1500 + /** + * 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 - #define E5_MICROSTEPS 16 - #define E5_OVERCURRENT 2000 - #define E5_STALLCURRENT 1500 + #if ENABLED(MONITOR_L6470_DRIVER_STATUS) + #define KVAL_HOLD_STEP_DOWN 1 + //#define L6470_STOP_ON_ERROR + #endif #endif // L6470 @@ -1544,12 +1907,30 @@ // @section extras /** - * Canon Hack Development Kit - * http://captain-slow.dk/2014/03/09/3d-printing-timelapses/ + * 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 CHDK_PIN 4 // Set and enable a pin for triggering CHDK to take a picture -#if PIN_EXISTS(CHDK) - #define CHDK_DELAY 50 // (ms) How long the pin should remain HIGH +//#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 /** @@ -1640,11 +2021,6 @@ */ //#define CNC_COORDINATE_SYSTEMS -/** - * M43 - display pin status, watch pins for changes, watch endstops & toggle LED, Z servo probe test, toggle pins - */ -//#define PINS_DEBUGGING - /** * Auto-report temperatures with M155 S */ @@ -1748,35 +2124,39 @@ #endif /** - * Specify an action command to send to the host when the printer is killed. - * Will be sent in the form '//action:ACTION_ON_KILL', e.g. '//action:poweroff'. - * The host must be configured to handle the action command. - */ -//#define ACTION_ON_KILL "poweroff" - -/** - * Specify an action command to send to the host on pause and resume. - * Will be sent in the form '//action:ACTION_ON_PAUSE', e.g. '//action:pause'. - * The host must be configured to handle the action command. + * 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 ACTION_ON_PAUSE "pause" -//#define ACTION_ON_RESUME "resume" +//#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. + * 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 + * 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/ + * Supplier: http://aus3d.com.au/magnetic-encoder-module + * Alternative Supplier: http://reliabuild3d.com/ * - * Reilabuild encoders have been modified to improve reliability. + * Reliabuild encoders have been modified to improve reliability. */ //#define I2C_POSITION_ENCODERS @@ -1898,7 +2278,83 @@ #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/data/www/index.html b/data/www/index.html new file mode 100644 index 000000000000..d3291de8def7 --- /dev/null +++ b/data/www/index.html @@ -0,0 +1,37 @@ + + + + + Marlin + + + + + + +
+ + + +
+
+
    + +
    +
    + + +
    +
    +
    +
    + + +
    +
    + #controls +
    +
    +
    + + diff --git a/data/www/marlin-logo.png b/data/www/marlin-logo.png new file mode 100644 index 000000000000..d0ce790141c7 Binary files /dev/null and b/data/www/marlin-logo.png differ diff --git a/data/www/marlin.css b/data/www/marlin.css new file mode 100644 index 000000000000..b29ec2e24c13 --- /dev/null +++ b/data/www/marlin.css @@ -0,0 +1,166 @@ +/* CSS reset */ + +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td, +article, aside, canvas, details, embed, +figure, figcaption, footer, header, hgroup, +menu, nav, output, ruby, section, summary, +time, mark, audio, video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; + font-family: Impact, Charcoal, sans-serif; + } +article, aside, details, figcaption, figure, +footer, header, hgroup, menu, nav, section { + display: block; + } +body { line-height: 1; } +ol, ul { list-style: none; } +blockquote, q { quotes: none; } +blockquote:before, blockquote:after, +q:before, q:after { content: ''; content: none; } +table { + border-collapse: collapse; + border-spacing: 0; + } + +/* Custom */ + +/* Tabs */ +* { box-sizing: border-box; } +body { + display: flex; + justify-content: center; + padding: 0px; + background: #1e1e1e; + color: #efefef; + } +h1 { + margin: 0; + font-size: 2em; + } +.tabs { + display: flex; + width: 100%; + flex-wrap: wrap; + background: #e5e5e5; + } +.input { + position: absolute; + opacity: 0; + } +.label { + width: 100%; + padding: 18px 28px; + background: #e5e5e5; + cursor: pointer; + font-weight: bold; + font-size: 18px; + color: #7f7f7f; + transition: background 0.1s, color 0.1s; + border-style: solid; + border-width: 0 0 4px 0; + border-color: #acacac; + } +.label:hover { + background: #d8d8d8; + } +.label:active { + background: #ccc; + } +.input:focus + .label { + z-index: 1; + } +.input:checked + .label { + background: #1e1e1e; + color: #efefef; + border-width: 4px 0 0 0; + border-color: #65a57d; + } +.panel { + display: none; + width: 100%; + padding: 20px 30px 30px; + background: #1e1e1e; + color: #e5e5e5; + } +.panel .panel-content { + width: 100%; + max-width: 800px; + } + +@media (min-width: 600px) { + .label { width: auto; } + .panel { order: 99; } +} + +.input:checked + .label + .panel { display: block; } + +#logo { + width: 130px; + height: 58px; + margin-right: 20px; + background: url(marlin-logo.png) no-repeat center center; + } + +input[type="text"], textarea { + background-color: #2c2c2c; + border: solid 2px #314b3b; + color: #e5e5e5; + outline: none; + } + +input[type="text"]:focus, textarea:focus { + border-color: #4d7a5e; + } + +ul#serial-output { + width: 100%; + height: 300px; + overflow-y: scroll; + background-color: #2c2c2c; + border: solid 2px #314b3b; + } + +ul#serial-output li { + padding: 4px; + font-family: "Lucida Console", Monaco, monospace; + font-size: 0.8em; + } + +ul#serial-output li:nth-child(odd) { + background-color: #3c3c3c; + } + +div.form-wrapper { + display: flex; + width: 100%; + margin: 6px 0; + } + +div.form-wrapper input { + font-size: 1.2em; + padding: 4px 6px; + } + +div.form-wrapper input[type="text"] { + flex: 1 1 auto; + } + +div.form-wrapper input[type="submit"], +div.form-wrapper button { + border: solid 2px #314b3b; + background-color: #4d7a5e; + color: #e5e5e5; + } diff --git a/data/www/marlin.js b/data/www/marlin.js new file mode 100644 index 000000000000..0a95045affaf --- /dev/null +++ b/data/www/marlin.js @@ -0,0 +1,24 @@ +document.addEventListener('DOMContentLoaded', () => { + const ws = new WebSocket(`ws://${location.host}/ws`); + + ws.onmessage = (e) => { + if (typeof e.data === 'string') { + let node = document.createElement('li'); + let text = document.createTextNode(e.data); + node.appendChild(text); + document.getElementById('serial-output').appendChild(node); + } + }; + + document.getElementById('serial-command-form').addEventListener('submit', (e) => { + e.preventDefault(); + + let value = document.getElementById('serial-command').value.trim(); + + if (!value) return; + + ws.send(`${value}\n`); + + document.getElementById('serial-command').value = ''; + }); +}); diff --git a/platformio.ini b/platformio.ini index cb2b10a37e5b..c9327f299a3d 100644 --- a/platformio.ini +++ b/platformio.ini @@ -31,11 +31,14 @@ build_flags = -fmax-errors=5 lib_deps = https://github.com/MarlinFirmware/U8glib-HAL/archive/dev.zip LiquidCrystal@1.3.4 - https://github.com/teemuatlut/TMCStepper.git + TMCStepper@<1.0.0 Adafruit NeoPixel@1.1.3 https://github.com/lincomatic/LiquidTWI2/archive/30aa480.zip - https://github.com/ameyer/Arduino-L6470/archive/master.zip + https://github.com/ameyer/Arduino-L6470/archive/dev.zip https://github.com/trinamic/TMC26XStepper/archive/c1921b4.zip + https://github.com/mikeshub/SailfishLCD.git + https://github.com/mikeshub/SailfishRGB_LED.git + https://github.com/mikeshub/SlowSoftI2CMaster.git ################################# # # @@ -86,7 +89,6 @@ framework = arduino board = at90usb1286 build_flags = ${common.build_flags} lib_deps = ${common.lib_deps} -lib_ldf_mode = deep+ src_filter = ${common.default_src_filter} + extra_scripts = pre:buildroot/share/atom/create_custom_upload_command_CDC.py monitor_speed = 250000 @@ -103,7 +105,6 @@ framework = arduino board = at90usb1286 build_flags = ${common.build_flags} lib_deps = ${common.lib_deps} -lib_ldf_mode = deep+ src_filter = ${common.default_src_filter} + extra_scripts = pre:buildroot/share/atom/create_custom_upload_command_DFU.py monitor_speed = 250000 @@ -163,14 +164,15 @@ src_filter = ${common.default_src_filter} + monitor_speed = 250000 lib_deps = Servo LiquidCrystal - https://github.com/MarlinFirmware/U8glib-HAL/archive/dev.zip - https://github.com/teemuatlut/TMCStepper.git + U8glib-HAL=https://github.com/MarlinFirmware/U8glib-HAL/archive/dev.zip + TMCStepper@<1.0.0 + Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/master.zip [env:LPC1769] platform = https://github.com/p3p/pio-nxplpc-arduino-lpc176x/archive/master.zip framework = arduino board = nxp_lpc1769 -build_flags = -DTARGET_LPC1768 -DU8G_HAL_LINKS -IMarlin/src/HAL/HAL_LPC1768/include -IMarlin/src/HAL/HAL_LPC1768/u8g ${common.build_flags} +build_flags = -DTARGET_LPC1768 -DLPC1769 -DU8G_HAL_LINKS -IMarlin/src/HAL/HAL_LPC1768/include -IMarlin/src/HAL/HAL_LPC1768/u8g ${common.build_flags} # debug options for backtrace # -funwind-tables # -mpoke-function-name @@ -181,8 +183,9 @@ src_filter = ${common.default_src_filter} + monitor_speed = 250000 lib_deps = Servo LiquidCrystal - https://github.com/MarlinFirmware/U8glib-HAL/archive/dev.zip - https://github.com/teemuatlut/TMCStepper.git + U8glib-HAL=https://github.com/MarlinFirmware/U8glib-HAL/archive/dev.zip + TMCStepper@<1.0.0 + Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/master.zip # # Melzi and clones (ATmega1284p) @@ -254,7 +257,7 @@ monitor_speed = 250000 platform = ststm32@<4.4.0 framework = arduino board = genericSTM32F103RE -build_flags = !python Marlin/src/HAL/HAL_STM32F1/stm32f1_flag_script.py +build_flags = !python Marlin/src/HAL/HAL_STM32F1/STM32F1_flag_script.py ${common.build_flags} lib_deps = ${common.lib_deps} lib_ignore = U8glib-HAL @@ -283,16 +286,55 @@ src_filter = ${common.default_src_filter} + monitor_speed = 250000 # -# ARMED +# ARMED (STM32) # [env:ARMED] -platform = ststm32 +platform = ststm32 +framework = arduino +board = armed_v1 +build_flags = ${common.build_flags} -DUSBCON -DUSBD_VID=0x0483 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="ARMED_V1"' -DHAL_PCD_MODULE_ENABLED -DUSBD_USE_CDC -O2 -ffreestanding -fsigned-char -fno-move-loop-invariants -fno-strict-aliasing -std=gnu11 -std=gnu++11 +lib_deps = ${common.lib_deps} +lib_ignore = Adafruit NeoPixel, c1921b4 +src_filter = ${common.default_src_filter} + +monitor_speed = 250000 + +# +# MKS Robin (STM32F103ZET6) +# +[env:mks_robin] +platform = ststm32@5.3.0 framework = arduino -board = ARMED -build_flags = ${common.build_flags} -DUSE_STM32GENERIC -DSTM32GENERIC -DMENU_USB_SERIAL -DMENU_SERIAL=SerialUSB -O2 -ffreestanding -fsigned-char -fno-move-loop-invariants -fno-strict-aliasing -std=gnu11 -std=gnu++11 +board = genericSTM32F103ZE +extra_scripts = buildroot/share/PlatformIO/scripts/mks_robin.py +build_flags = !python Marlin/src/HAL/HAL_STM32F1/STM32F1_flag_script.py + ${common.build_flags} + -DSTM32_XL_DENSITY +src_filter = ${common.default_src_filter} + lib_deps = ${common.lib_deps} -lib_ignore = Adafruit NeoPixel, c1921b4 -src_filter = ${common.default_src_filter} + +lib_ignore = c1921b4 + libf3c + lib066 + Adafruit NeoPixel_ID28 + Adafruit NeoPixel + libf3e + TMC26XStepper + U8glib-HAL + +# +# STM32F407VET6 with RAMPS-like shield +# 'Black' STM32F407VET6 board - http://wiki.stm32duino.com/index.php?title=STM32F407 +# Shield - https://github.com/jmz52/Hardware +# +[env:black_stm32f407ve] +platform = ststm32 +framework = arduino +board = blackSTM32F407VET6 +extra_scripts = pre:buildroot/share/PlatformIO/scripts/black_stm32f407vet6.py +build_flags = ${common.build_flags} + -DUSBCON -DUSBD_USE_CDC -DUSBD_VID=0x0483 -DUSB_PRODUCT=\"BLACK_F407VE\" +lib_deps = ${common.lib_deps} +lib_ignore = Adafruit NeoPixel, c1921b4, TMCStepper, TMC26XStepper, SailfishLCD, SailfishRGB_LED, SlowSoftI2CMaster +src_filter = ${common.default_src_filter} + monitor_speed = 250000 # @@ -308,11 +350,14 @@ lib_ignore = Adafruit NeoPixel src_filter = ${common.default_src_filter} + monitor_speed = 250000 +# +# Malyan M200 (STM32F1) +# [env:malyanm200] platform = ststm32 framework = arduino board = malyanM200 -build_flags = !python Marlin/src/HAL/HAL_STM32F1/stm32f1_flag_script.py -DMCU_STM32F103CB -D __STM32F1__=1 -std=c++1y -D MOTHERBOARD="BOARD_MALYAN_M200" -DSERIAL_USB -ffunction-sections -fdata-sections -Wl,--gc-sections +build_flags = !python Marlin/src/HAL/HAL_STM32F1/STM32F1_flag_script.py -DMCU_STM32F103CB -D __STM32F1__=1 -std=c++1y -D MOTHERBOARD="BOARD_MALYAN_M200" -DSERIAL_USB -ffunction-sections -fdata-sections -Wl,--gc-sections src_filter = ${common.default_src_filter} + #- lib_ignore = @@ -332,10 +377,15 @@ lib_ignore = # Espressif ESP32 # [env:esp32] -platform = https://github.com/platformio/platform-espressif32.git#feature/stage +platform = https://github.com/platformio/platform-espressif32.git ; #feature/stage board = esp32dev framework = arduino -upload_port = COM3 +upload_speed = 115200 +monitor_speed = 115200 +upload_port = /dev/ttyUSB0 +lib_deps = + https://github.com/me-no-dev/AsyncTCP.git + https://github.com/me-no-dev/ESPAsyncWebServer.git lib_ignore = LiquidCrystal_I2C LiquidCrystal @@ -343,6 +393,8 @@ lib_ignore = LiquidTWI2 TMC26XStepper c1921b4 + SailfishLCD + SailfishRGB_LED src_filter = ${common.default_src_filter} + # @@ -357,3 +409,17 @@ board_build.f_cpu = 16000000L lib_deps = ${common.lib_deps} src_filter = ${common.default_src_filter} + monitor_speed = 250000 + +# +# Native +# No supported Arduino libraries, base Marlin only +# +[env:linux_native] +platform = native +build_flags = -D__PLAT_LINUX__ -std=gnu++17 -ggdb -g -lrt -lpthread +src_build_flags = -Wall -IMarlin/src/HAL/HAL_LINUX/include +build_unflags = -Wall +lib_ldf_mode = off +lib_deps = +extra_scripts = +src_filter = ${common.default_src_filter} +